Exemple #1
0
 internal DatabaseAccountCreateUpdateOptions(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, DatabaseAccountKind?kind, ManagedServiceIdentity identity, ConsistencyPolicy consistencyPolicy, IList <DatabaseAccountLocation> locations, string databaseAccountOfferType, IList <IpAddressOrRange> ipRules, bool?isVirtualNetworkFilterEnabled, bool?enableAutomaticFailover, IList <DatabaseAccountCapability> capabilities, IList <VirtualNetworkRule> virtualNetworkRules, bool?enableMultipleWriteLocations, bool?enableCassandraConnector, ConnectorOffer?connectorOffer, bool?disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, string defaultIdentity, PublicNetworkAccess?publicNetworkAccess, bool?enableFreeTier, ApiProperties apiProperties, bool?enableAnalyticalStorage, AnalyticalStorageConfiguration analyticalStorageConfiguration, CreateMode?createMode, BackupPolicy backupPolicy, IList <CorsPolicy> cors, NetworkAclBypass?networkAclBypass, IList <string> networkAclBypassResourceIds, bool?disableLocalAuth, RestoreParameters restoreParameters) : base(id, name, type, systemData, tags, location)
 {
     Kind                               = kind;
     Identity                           = identity;
     ConsistencyPolicy                  = consistencyPolicy;
     Locations                          = locations;
     DatabaseAccountOfferType           = databaseAccountOfferType;
     IpRules                            = ipRules;
     IsVirtualNetworkFilterEnabled      = isVirtualNetworkFilterEnabled;
     EnableAutomaticFailover            = enableAutomaticFailover;
     Capabilities                       = capabilities;
     VirtualNetworkRules                = virtualNetworkRules;
     EnableMultipleWriteLocations       = enableMultipleWriteLocations;
     EnableCassandraConnector           = enableCassandraConnector;
     ConnectorOffer                     = connectorOffer;
     DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess;
     KeyVaultKeyUri                     = keyVaultKeyUri;
     DefaultIdentity                    = defaultIdentity;
     PublicNetworkAccess                = publicNetworkAccess;
     EnableFreeTier                     = enableFreeTier;
     ApiProperties                      = apiProperties;
     EnableAnalyticalStorage            = enableAnalyticalStorage;
     AnalyticalStorageConfiguration     = analyticalStorageConfiguration;
     CreateMode                         = createMode;
     BackupPolicy                       = backupPolicy;
     Cors                               = cors;
     NetworkAclBypass                   = networkAclBypass;
     NetworkAclBypassResourceIds        = networkAclBypassResourceIds;
     DisableLocalAuth                   = disableLocalAuth;
     RestoreParameters                  = restoreParameters;
 }
Exemple #2
0
        internal static DatabaseAccountCreateUpdateData DeserializeDatabaseAccountCreateUpdateData(JsonElement element)
        {
            Optional <DatabaseAccountKind>    kind                                           = default;
            Optional <ManagedServiceIdentity> identity                                       = default;
            IDictionary <string, string>      tags                                           = default;
            AzureLocation                                 location                           = default;
            ResourceIdentifier                            id                                 = default;
            string                                        name                               = default;
            ResourceType                                  type                               = default;
            SystemData                                    systemData                         = default;
            Optional <ConsistencyPolicy>                  consistencyPolicy                  = default;
            IList <DatabaseAccountLocation>               locations                          = default;
            string                                        databaseAccountOfferType           = default;
            Optional <IList <IPAddressOrRange> >          ipRules                            = default;
            Optional <bool>                               isVirtualNetworkFilterEnabled      = default;
            Optional <bool>                               enableAutomaticFailover            = default;
            Optional <IList <DatabaseAccountCapability> > capabilities                       = default;
            Optional <IList <VirtualNetworkRule> >        virtualNetworkRules                = default;
            Optional <bool>                               enableMultipleWriteLocations       = default;
            Optional <bool>                               enableCassandraConnector           = default;
            Optional <ConnectorOffer>                     connectorOffer                     = default;
            Optional <bool>                               disableKeyBasedMetadataWriteAccess = default;
            Optional <Uri>                                keyVaultKeyUri                     = default;
            Optional <string>                             defaultIdentity                    = default;
            Optional <PublicNetworkAccess>                publicNetworkAccess                = default;
            Optional <bool>                               enableFreeTier                     = default;
            Optional <ApiProperties>                      apiProperties                      = default;
            Optional <bool>                               enableAnalyticalStorage            = default;
            Optional <AnalyticalStorageConfiguration>     analyticalStorageConfiguration     = default;
            Optional <CreateMode>                         createMode                         = default;
            Optional <BackupPolicy>                       backupPolicy                       = default;
            Optional <IList <CorsPolicy> >                cors                               = default;
            Optional <NetworkAclBypass>                   networkAclBypass                   = default;
            Optional <IList <string> >                    networkAclBypassResourceIds        = default;
            Optional <bool>                               disableLocalAuth                   = default;
            Optional <RestoreParameters>                  restoreParameters                  = default;
            Optional <Capacity>                           capacity                           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new DatabaseAccountKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    var serializeOptions = new JsonSerializerOptions {
                        Converters = { new ManagedServiceIdentityTypeV3Converter() }
                    };
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString(), serializeOptions);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("consistencyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("locations"))
                        {
                            List <DatabaseAccountLocation> array = new List <DatabaseAccountLocation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountLocation.DeserializeDatabaseAccountLocation(item));
                            }
                            locations = array;
                            continue;
                        }
                        if (property0.NameEquals("databaseAccountOfferType"))
                        {
                            databaseAccountOfferType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IPAddressOrRange> array = new List <IPAddressOrRange>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IPAddressOrRange.DeserializeIPAddressOrRange(item));
                            }
                            ipRules = array;
                            continue;
                        }
                        if (property0.NameEquals("isVirtualNetworkFilterEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isVirtualNetworkFilterEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableAutomaticFailover"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAutomaticFailover = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("capabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DatabaseAccountCapability> array = new List <DatabaseAccountCapability>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountCapability.DeserializeDatabaseAccountCapability(item));
                            }
                            capabilities = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkRule> array = new List <VirtualNetworkRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("enableMultipleWriteLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableMultipleWriteLocations = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableCassandraConnector"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableCassandraConnector = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("connectorOffer"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectorOffer = new ConnectorOffer(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disableKeyBasedMetadataWriteAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("keyVaultKeyUri"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                keyVaultKeyUri = null;
                                continue;
                            }
                            keyVaultKeyUri = new Uri(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("defaultIdentity"))
                        {
                            defaultIdentity = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableFreeTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableFreeTier = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("apiProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            apiProperties = ApiProperties.DeserializeApiProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enableAnalyticalStorage"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAnalyticalStorage = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("analyticalStorageConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            analyticalStorageConfiguration = AnalyticalStorageConfiguration.DeserializeAnalyticalStorageConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("createMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            createMode = new CreateMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("backupPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backupPolicy = BackupPolicy.DeserializeBackupPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("cors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <CorsPolicy> array = new List <CorsPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CorsPolicy.DeserializeCorsPolicy(item));
                            }
                            cors = array;
                            continue;
                        }
                        if (property0.NameEquals("networkAclBypass"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAclBypass = property0.Value.GetString().ToNetworkAclBypass();
                            continue;
                        }
                        if (property0.NameEquals("networkAclBypassResourceIds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            networkAclBypassResourceIds = array;
                            continue;
                        }
                        if (property0.NameEquals("disableLocalAuth"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableLocalAuth = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("restoreParameters"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            restoreParameters = RestoreParameters.DeserializeRestoreParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("capacity"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            capacity = Capacity.DeserializeCapacity(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DatabaseAccountCreateUpdateData(id, name, type, systemData, tags, location, Optional.ToNullable(kind), identity, consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value));
        }
 internal DatabaseAccountCreateUpdateParameters(string id, string name, string type, string location, IDictionary <string, string> tags, DatabaseAccountKind?kind, ConsistencyPolicy consistencyPolicy, IList <Location> locations, string databaseAccountOfferType, IList <IpAddressOrRange> ipRules, bool?isVirtualNetworkFilterEnabled, bool?enableAutomaticFailover, IList <Capability> capabilities, IList <VirtualNetworkRule> virtualNetworkRules, bool?enableMultipleWriteLocations, bool?enableCassandraConnector, ConnectorOffer?connectorOffer, bool?disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess?publicNetworkAccess, bool?enableFreeTier, ApiProperties apiProperties, bool?enableAnalyticalStorage, IList <CorsPolicy> cors) : base(id, name, type, location, tags)
 {
     Kind = kind;
     ConsistencyPolicy        = consistencyPolicy;
     Locations                = locations;
     DatabaseAccountOfferType = databaseAccountOfferType;
     IpRules = ipRules;
     IsVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled;
     EnableAutomaticFailover       = enableAutomaticFailover;
     Capabilities                       = capabilities;
     VirtualNetworkRules                = virtualNetworkRules;
     EnableMultipleWriteLocations       = enableMultipleWriteLocations;
     EnableCassandraConnector           = enableCassandraConnector;
     ConnectorOffer                     = connectorOffer;
     DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess;
     KeyVaultKeyUri                     = keyVaultKeyUri;
     PublicNetworkAccess                = publicNetworkAccess;
     EnableFreeTier                     = enableFreeTier;
     ApiProperties                      = apiProperties;
     EnableAnalyticalStorage            = enableAnalyticalStorage;
     Cors = cors;
 }
Exemple #4
0
        internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccountCreateUpdateParameters(JsonElement element)
        {
            Optional <DatabaseAccountKind> kind = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <ConsistencyPolicy>             consistencyPolicy = default;
            IList <Location> locations = default;
            string           databaseAccountOfferType                         = default;
            Optional <IList <IpAddressOrRange> > ipRules                      = default;
            Optional <bool> isVirtualNetworkFilterEnabled                     = default;
            Optional <bool> enableAutomaticFailover                           = default;
            Optional <IList <Capability> >         capabilities               = default;
            Optional <IList <VirtualNetworkRule> > virtualNetworkRules        = default;
            Optional <bool>                enableMultipleWriteLocations       = default;
            Optional <bool>                enableCassandraConnector           = default;
            Optional <ConnectorOffer>      connectorOffer                     = default;
            Optional <bool>                disableKeyBasedMetadataWriteAccess = default;
            Optional <string>              keyVaultKeyUri                     = default;
            Optional <PublicNetworkAccess> publicNetworkAccess                = default;
            Optional <bool>                enableFreeTier                     = default;
            Optional <ApiProperties>       apiProperties                      = default;
            Optional <bool>                enableAnalyticalStorage            = default;
            Optional <IList <CorsPolicy> > cors = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = new DatabaseAccountKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("consistencyPolicy"))
                        {
                            consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("locations"))
                        {
                            List <Location> array = new List <Location>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.Location.DeserializeLocation(item));
                            }
                            locations = array;
                            continue;
                        }
                        if (property0.NameEquals("databaseAccountOfferType"))
                        {
                            databaseAccountOfferType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            List <IpAddressOrRange> array = new List <IpAddressOrRange>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IpAddressOrRange.DeserializeIpAddressOrRange(item));
                            }
                            ipRules = array;
                            continue;
                        }
                        if (property0.NameEquals("isVirtualNetworkFilterEnabled"))
                        {
                            isVirtualNetworkFilterEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableAutomaticFailover"))
                        {
                            enableAutomaticFailover = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("capabilities"))
                        {
                            List <Capability> array = new List <Capability>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Capability.DeserializeCapability(item));
                            }
                            capabilities = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            List <VirtualNetworkRule> array = new List <VirtualNetworkRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("enableMultipleWriteLocations"))
                        {
                            enableMultipleWriteLocations = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableCassandraConnector"))
                        {
                            enableCassandraConnector = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("connectorOffer"))
                        {
                            connectorOffer = new ConnectorOffer(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disableKeyBasedMetadataWriteAccess"))
                        {
                            disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("keyVaultKeyUri"))
                        {
                            keyVaultKeyUri = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableFreeTier"))
                        {
                            enableFreeTier = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("apiProperties"))
                        {
                            apiProperties = ApiProperties.DeserializeApiProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enableAnalyticalStorage"))
                        {
                            enableAnalyticalStorage = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("cors"))
                        {
                            List <CorsPolicy> array = new List <CorsPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CorsPolicy.DeserializeCorsPolicy(item));
                            }
                            cors = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DatabaseAccountCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)));
        }
        internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(JsonElement element)
        {
            Optional <DatabaseAccountKind> kind = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string> provisioningState           = default;
            Optional <string> documentEndpoint            = default;
            Optional <string> databaseAccountOfferType    = default;
            Optional <IList <IpAddressOrRange> > ipRules  = default;
            Optional <bool> isVirtualNetworkFilterEnabled = default;
            Optional <bool> enableAutomaticFailover       = default;
            Optional <ConsistencyPolicy>                          consistencyPolicy          = default;
            Optional <IList <Capability> >                        capabilities               = default;
            Optional <IReadOnlyList <Location> >                  writeLocations             = default;
            Optional <IReadOnlyList <Location> >                  readLocations              = default;
            Optional <IReadOnlyList <Location> >                  locations                  = default;
            Optional <IReadOnlyList <FailoverPolicy> >            failoverPolicies           = default;
            Optional <IList <VirtualNetworkRule> >                virtualNetworkRules        = default;
            Optional <IReadOnlyList <PrivateEndpointConnection> > privateEndpointConnections = default;
            Optional <bool>                enableMultipleWriteLocations = default;
            Optional <bool>                enableCassandraConnector     = default;
            Optional <ConnectorOffer>      connectorOffer = default;
            Optional <bool>                disableKeyBasedMetadataWriteAccess = default;
            Optional <string>              keyVaultKeyUri          = default;
            Optional <PublicNetworkAccess> publicNetworkAccess     = default;
            Optional <bool>                enableFreeTier          = default;
            Optional <ApiProperties>       apiProperties           = default;
            Optional <bool>                enableAnalyticalStorage = default;
            Optional <IList <CorsPolicy> > cors = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new DatabaseAccountKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("documentEndpoint"))
                        {
                            documentEndpoint = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("databaseAccountOfferType"))
                        {
                            databaseAccountOfferType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IpAddressOrRange> array = new List <IpAddressOrRange>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IpAddressOrRange.DeserializeIpAddressOrRange(item));
                            }
                            ipRules = array;
                            continue;
                        }
                        if (property0.NameEquals("isVirtualNetworkFilterEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isVirtualNetworkFilterEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableAutomaticFailover"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAutomaticFailover = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("consistencyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("capabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Capability> array = new List <Capability>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Capability.DeserializeCapability(item));
                            }
                            capabilities = array;
                            continue;
                        }
                        if (property0.NameEquals("writeLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Location> array = new List <Location>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.Location.DeserializeLocation(item));
                            }
                            writeLocations = array;
                            continue;
                        }
                        if (property0.NameEquals("readLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Location> array = new List <Location>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.Location.DeserializeLocation(item));
                            }
                            readLocations = array;
                            continue;
                        }
                        if (property0.NameEquals("locations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Location> array = new List <Location>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.Location.DeserializeLocation(item));
                            }
                            locations = array;
                            continue;
                        }
                        if (property0.NameEquals("failoverPolicies"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FailoverPolicy> array = new List <FailoverPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FailoverPolicy.DeserializeFailoverPolicy(item));
                            }
                            failoverPolicies = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkRule> array = new List <VirtualNetworkRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnection> array = new List <PrivateEndpointConnection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("enableMultipleWriteLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableMultipleWriteLocations = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableCassandraConnector"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableCassandraConnector = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("connectorOffer"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectorOffer = new ConnectorOffer(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disableKeyBasedMetadataWriteAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("keyVaultKeyUri"))
                        {
                            keyVaultKeyUri = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableFreeTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableFreeTier = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("apiProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            apiProperties = ApiProperties.DeserializeApiProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enableAnalyticalStorage"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAnalyticalStorage = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("cors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <CorsPolicy> array = new List <CorsPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CorsPolicy.DeserializeCorsPolicy(item));
                            }
                            cors = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DatabaseAccountGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, databaseAccountOfferType.Value, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)));
        }
Exemple #6
0
 internal DatabaseAccountGetResults(string id, string name, string type, string location, IDictionary <string, string> tags, DatabaseAccountKind?kind, string provisioningState, string documentEndpoint, string databaseAccountOfferType, IList <IpAddressOrRange> ipRules, bool?isVirtualNetworkFilterEnabled, bool?enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList <Capability> capabilities, IReadOnlyList <Location> writeLocations, IReadOnlyList <Location> readLocations, IReadOnlyList <Location> locations, IReadOnlyList <FailoverPolicy> failoverPolicies, IList <VirtualNetworkRule> virtualNetworkRules, IReadOnlyList <PrivateEndpointConnection> privateEndpointConnections, bool?enableMultipleWriteLocations, bool?enableCassandraConnector, ConnectorOffer?connectorOffer, bool?disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess?publicNetworkAccess, bool?enableFreeTier, ApiProperties apiProperties, bool?enableAnalyticalStorage, IList <CorsPolicy> cors) : base(id, name, type, location, tags)
 {
     Kind = kind;
     ProvisioningState        = provisioningState;
     DocumentEndpoint         = documentEndpoint;
     DatabaseAccountOfferType = databaseAccountOfferType;
     IpRules = ipRules;
     IsVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled;
     EnableAutomaticFailover       = enableAutomaticFailover;
     ConsistencyPolicy             = consistencyPolicy;
     Capabilities                       = capabilities;
     WriteLocations                     = writeLocations;
     ReadLocations                      = readLocations;
     Locations                          = locations;
     FailoverPolicies                   = failoverPolicies;
     VirtualNetworkRules                = virtualNetworkRules;
     PrivateEndpointConnections         = privateEndpointConnections;
     EnableMultipleWriteLocations       = enableMultipleWriteLocations;
     EnableCassandraConnector           = enableCassandraConnector;
     ConnectorOffer                     = connectorOffer;
     DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess;
     KeyVaultKeyUri                     = keyVaultKeyUri;
     PublicNetworkAccess                = publicNetworkAccess;
     EnableFreeTier                     = enableFreeTier;
     ApiProperties                      = apiProperties;
     EnableAnalyticalStorage            = enableAnalyticalStorage;
     Cors = cors;
 }