internal AvailableAppPlatformSku(ResourceType?resourceType, string name, string tier, SkuCapacity capacity, IReadOnlyList <AzureLocation> locations, IReadOnlyList <ResourceSkuLocationInfo> locationInfo, IReadOnlyList <ResourceSkuRestrictions> restrictions) { ResourceType = resourceType; Name = name; Tier = tier; Capacity = capacity; Locations = locations; LocationInfo = locationInfo; Restrictions = restrictions; }
internal static AvailableAppPlatformSku DeserializeAvailableAppPlatformSku(JsonElement element) { Optional <ResourceType> resourceType = default; Optional <string> name = default; Optional <string> tier = default; Optional <SkuCapacity> capacity = default; Optional <IReadOnlyList <AzureLocation> > locations = default; Optional <IReadOnlyList <ResourceSkuLocationInfo> > locationInfo = default; Optional <IReadOnlyList <ResourceSkuRestrictions> > restrictions = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } resourceType = new ResourceType(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("tier")) { tier = property.Value.GetString(); continue; } if (property.NameEquals("capacity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } capacity = SkuCapacity.DeserializeSkuCapacity(property.Value); 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 <ResourceSkuLocationInfo> array = new List <ResourceSkuLocationInfo>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ResourceSkuLocationInfo.DeserializeResourceSkuLocationInfo(item)); } locationInfo = array; continue; } if (property.NameEquals("restrictions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ResourceSkuRestrictions> array = new List <ResourceSkuRestrictions>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ResourceSkuRestrictions.DeserializeResourceSkuRestrictions(item)); } restrictions = array; continue; } } return(new AvailableAppPlatformSku(Optional.ToNullable(resourceType), name.Value, tier.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(restrictions))); }