internal static ResourceSkuLocationInfo DeserializeResourceSkuLocationInfo(JsonElement element)
        {
            Optional <string> location = default;
            Optional <IReadOnlyList <string> > zones = default;
            Optional <IReadOnlyList <ResourceSkuZoneDetails> > zoneDetails = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("zoneDetails"))
                {
                    List <ResourceSkuZoneDetails> array = new List <ResourceSkuZoneDetails>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceSkuZoneDetails.DeserializeResourceSkuZoneDetails(item));
                    }
                    zoneDetails = array;
                    continue;
                }
            }
            return(new ResourceSkuLocationInfo(location.Value, Optional.ToList(zones), Optional.ToList(zoneDetails)));
        }
示例#2
0
        internal static ResourceSkuLocationInfo DeserializeResourceSkuLocationInfo(JsonElement element)
        {
            string location = default;
            IReadOnlyList <string> zones = default;
            IReadOnlyList <ResourceSkuZoneDetails> zoneDetails = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetString());
                        }
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("zoneDetails"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceSkuZoneDetails> array = new List <ResourceSkuZoneDetails>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(ResourceSkuZoneDetails.DeserializeResourceSkuZoneDetails(item));
                        }
                    }
                    zoneDetails = array;
                    continue;
                }
            }
            return(new ResourceSkuLocationInfo(location, zones, zoneDetails));
        }