internal DatabaseAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, 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, Uri 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, Capacity capacity) : base(id, name, resourceType, 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;
     Capacity                           = capacity;
 }
Beispiel #2
0
        internal static DatabaseAccountCreateUpdateOptions DeserializeDatabaseAccountCreateUpdateOptions(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)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                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 DatabaseAccountCreateUpdateOptions(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));
        }