Beispiel #1
0
 protected void SerializeCommonProperties(Utf8JsonWriter writer)
 {
     writer.WritePropertyName("dataSourceCredentialType");
     writer.WriteStringValue(DataSourceCredentialType.ToString());
     writer.WriteNullStringValue("dataSourceCredentialName", DataSourceCredentialName);
     writer.WriteNullStringValue("dataSourceCredentialDescription", DataSourceCredentialDescription);
 }
Beispiel #2
0
 internal DatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     Id          = id;
     Name        = name;
     Description = description;
 }
Beispiel #3
0
 internal DataSourceCredential(DataSourceCredentialType dataSourceCredentialType, Guid?dataSourceCredentialId, string dataSourceCredentialName, string dataSourceCredentialDescription)
 {
     DataSourceCredentialType        = dataSourceCredentialType;
     DataSourceCredentialId          = dataSourceCredentialId;
     DataSourceCredentialName        = dataSourceCredentialName;
     DataSourceCredentialDescription = dataSourceCredentialDescription;
 }
 internal ServicePrincipalDatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description, ServicePrincipalParam parameters)
     : base(dataSourceCredentialType, id, name, description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     ClientId     = parameters.ClientId;
     ClientSecret = parameters.ClientSecret;
     TenantId     = parameters.TenantId;
 }
 internal ServicePrincipalInKeyVaultDatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description, ServicePrincipalInKVParam parameters)
     : base(dataSourceCredentialType, id, name, description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     Endpoint                  = new Uri(parameters.KeyVaultEndpoint);
     KeyVaultClientId          = parameters.KeyVaultClientId;
     KeyVaultClientSecret      = parameters.KeyVaultClientSecret;
     TenantId                  = parameters.TenantId;
     SecretNameForClientId     = parameters.ServicePrincipalIdNameInKV;
     SecretNameForClientSecret = parameters.ServicePrincipalSecretNameInKV;
 }
Beispiel #6
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("dataSourceCredentialType");
     writer.WriteStringValue(DataSourceCredentialType.ToString());
     writer.WritePropertyName("dataSourceCredentialName");
     writer.WriteStringValue(Name);
     if (Optional.IsDefined(Description))
     {
         writer.WritePropertyName("dataSourceCredentialDescription");
         writer.WriteStringValue(Description);
     }
     writer.WriteEndObject();
 }
Beispiel #7
0
        internal static DataSourceCredential DeserializeDataSourceCredential(JsonElement element)
        {
            if (element.TryGetProperty("dataSourceCredentialType", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "AzureSQLConnectionString": return(AzureSQLConnectionStringCredential.DeserializeAzureSQLConnectionStringCredential(element));

                case "DataLakeGen2SharedKey": return(DataLakeGen2SharedKeyCredential.DeserializeDataLakeGen2SharedKeyCredential(element));

                case "ServicePrincipal": return(ServicePrincipalCredential.DeserializeServicePrincipalCredential(element));

                case "ServicePrincipalInKV": return(ServicePrincipalInKVCredential.DeserializeServicePrincipalInKVCredential(element));
                }
            }
            DataSourceCredentialType dataSourceCredentialType = default;
            Optional <Guid>          dataSourceCredentialId   = default;
            string            dataSourceCredentialName        = default;
            Optional <string> dataSourceCredentialDescription = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dataSourceCredentialId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new DataSourceCredential(dataSourceCredentialType, Optional.ToNullable(dataSourceCredentialId), dataSourceCredentialName, dataSourceCredentialDescription.Value));
        }
Beispiel #8
0
        internal static DatasourceCredential DeserializeDatasourceCredential(JsonElement element)
        {
            if (element.TryGetProperty("dataSourceCredentialType", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "AzureSQLConnectionString": return(SqlConnectionStringDatasourceCredential.DeserializeSqlConnectionStringDatasourceCredential(element));

                case "DataLakeGen2SharedKey": return(DataLakeGen2SharedKeyDatasourceCredential.DeserializeDataLakeGen2SharedKeyDatasourceCredential(element));

                case "ServicePrincipal": return(ServicePrincipalDatasourceCredential.DeserializeServicePrincipalDatasourceCredential(element));

                case "ServicePrincipalInKV": return(ServicePrincipalInKeyVaultDatasourceCredential.DeserializeServicePrincipalInKeyVaultDatasourceCredential(element));
                }
            }
            DataSourceCredentialType dataSourceCredentialType = default;
            Optional <string>        dataSourceCredentialId   = default;
            string            dataSourceCredentialName        = default;
            Optional <string> dataSourceCredentialDescription = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    dataSourceCredentialId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new DatasourceCredential(dataSourceCredentialType, dataSourceCredentialId.Value, dataSourceCredentialName, dataSourceCredentialDescription.Value));
        }
Beispiel #9
0
        internal static ServicePrincipalCredential DeserializeServicePrincipalCredential(JsonElement element)
        {
            ServicePrincipalParam    parameters = default;
            DataSourceCredentialType dataSourceCredentialType = default;
            Optional <Guid>          dataSourceCredentialId   = default;
            string            dataSourceCredentialName        = default;
            Optional <string> dataSourceCredentialDescription = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    parameters = ServicePrincipalParam.DeserializeServicePrincipalParam(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dataSourceCredentialId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new ServicePrincipalCredential(dataSourceCredentialType, Optional.ToNullable(dataSourceCredentialId), dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters));
        }
        internal static ServicePrincipalInKeyVaultDatasourceCredential DeserializeServicePrincipalInKeyVaultDatasourceCredential(JsonElement element)
        {
            ServicePrincipalInKVParam parameters = default;
            DataSourceCredentialType  dataSourceCredentialType = default;
            Optional <string>         dataSourceCredentialId   = default;
            string            dataSourceCredentialName         = default;
            Optional <string> dataSourceCredentialDescription  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("parameters"))
                {
                    parameters = ServicePrincipalInKVParam.DeserializeServicePrincipalInKVParam(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialType"))
                {
                    dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialId"))
                {
                    dataSourceCredentialId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialName"))
                {
                    dataSourceCredentialName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataSourceCredentialDescription"))
                {
                    dataSourceCredentialDescription = property.Value.GetString();
                    continue;
                }
            }
            return(new ServicePrincipalInKeyVaultDatasourceCredential(dataSourceCredentialType, dataSourceCredentialId.Value, dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters));
        }
Beispiel #11
0
 internal DataLakeGen2SharedKeyCredential(DataSourceCredentialType dataSourceCredentialType, Guid?dataSourceCredentialId, string dataSourceCredentialName, string dataSourceCredentialDescription, DataLakeGen2SharedKeyParam parameters) : base(dataSourceCredentialType, dataSourceCredentialId, dataSourceCredentialName, dataSourceCredentialDescription)
 {
     Parameters = parameters;
     DataSourceCredentialType = dataSourceCredentialType;
 }
 internal SqlConnectionStringDatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description, AzureSQLConnectionStringParam parameters)
     : base(dataSourceCredentialType, id, name, description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     ConnectionString         = parameters.ConnectionString;
 }
Beispiel #13
0
 internal DataLakeGen2SharedKeyDatasourceCredential(DataSourceCredentialType dataSourceCredentialType, string id, string name, string description, DataLakeGen2SharedKeyParam parameters)
     : base(dataSourceCredentialType, id, name, description)
 {
     DataSourceCredentialType = dataSourceCredentialType;
     AccountKey = parameters.AccountKey;
 }
Beispiel #14
0
 internal ServicePrincipalCredential(DataSourceCredentialType dataSourceCredentialType, Guid?dataSourceCredentialId, string dataSourceCredentialName, string dataSourceCredentialDescription, ServicePrincipalParam parameters) : base(dataSourceCredentialType, dataSourceCredentialId, dataSourceCredentialName, dataSourceCredentialDescription)
 {
     Parameters = parameters;
     DataSourceCredentialType = dataSourceCredentialType;
 }
Beispiel #15
0
 internal AzureSQLConnectionStringCredential(DataSourceCredentialType dataSourceCredentialType, Guid?dataSourceCredentialId, string dataSourceCredentialName, string dataSourceCredentialDescription, AzureSQLConnectionStringParam parameters) : base(dataSourceCredentialType, dataSourceCredentialId, dataSourceCredentialName, dataSourceCredentialDescription)
 {
     Parameters = parameters;
     DataSourceCredentialType = dataSourceCredentialType;
 }