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)); }
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")) { 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("consistencyPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } 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")) { 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 <Capability> array = new List <Capability>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(Capability.DeserializeCapability(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")) { 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 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))); }