internal static SkuZoneDetail DeserializeSkuZoneDetail(JsonElement element) { Optional <IReadOnlyList <string> > zones = default; Optional <IReadOnlyList <SkuCapability> > capabilities = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } zones = array; continue; } if (property.NameEquals("capabilities")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SkuCapability> array = new List <SkuCapability>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SkuCapability.DeserializeSkuCapability(item)); } capabilities = array; continue; } } return(new SkuZoneDetail(Optional.ToList(zones), Optional.ToList(capabilities))); }
internal static SkuDefinition DeserializeSkuDefinition(JsonElement element) { string name = default; Optional <string> resourceType = default; Optional <string> tier = default; Optional <string> size = default; Optional <string> family = default; Optional <string> kind = default; Optional <IReadOnlyList <AzureLocation> > locations = default; Optional <IReadOnlyList <SkuLocationAndZones> > locationInfo = default; Optional <BinaryData> capacity = default; Optional <IReadOnlyList <SkuCost> > costs = default; Optional <IReadOnlyList <SkuCapability> > capabilities = default; Optional <IReadOnlyList <SkuRestriction> > restrictions = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("resourceType")) { resourceType = property.Value.GetString(); continue; } if (property.NameEquals("tier")) { tier = property.Value.GetString(); continue; } if (property.NameEquals("size")) { size = property.Value.GetString(); continue; } if (property.NameEquals("family")) { family = property.Value.GetString(); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("locations")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <AzureLocation> array = new List <AzureLocation>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new AzureLocation(item.GetString())); } locations = array; continue; } if (property.NameEquals("locationInfo")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SkuLocationAndZones> array = new List <SkuLocationAndZones>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SkuLocationAndZones.DeserializeSkuLocationAndZones(item)); } locationInfo = array; continue; } if (property.NameEquals("capacity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } capacity = BinaryData.FromString(property.Value.GetRawText()); continue; } if (property.NameEquals("costs")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SkuCost> array = new List <SkuCost>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SkuCost.DeserializeSkuCost(item)); } costs = array; continue; } if (property.NameEquals("capabilities")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SkuCapability> array = new List <SkuCapability>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SkuCapability.DeserializeSkuCapability(item)); } capabilities = array; continue; } if (property.NameEquals("restrictions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SkuRestriction> array = new List <SkuRestriction>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SkuRestriction.DeserializeSkuRestriction(item)); } restrictions = array; continue; } } return(new SkuDefinition(name, resourceType.Value, tier.Value, size.Value, family.Value, kind.Value, Optional.ToList(locations), Optional.ToList(locationInfo), capacity.Value, Optional.ToList(costs), Optional.ToList(capabilities), Optional.ToList(restrictions))); }