コード例 #1
0
        internal static Sku DeserializeSku(JsonElement element)
        {
            SkuName            name = default;
            Optional <SkuTier> tier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new SkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tier = property.Value.GetString().ToSkuTier();
                    continue;
                }
            }
            return(new Sku(name, Optional.ToNullable(tier)));
        }
コード例 #2
0
 internal SkuInformation(SkuName name)
 {
     Name         = name;
     Locations    = new ChangeTrackingList <string>();
     Capabilities = new ChangeTrackingList <SKUCapability>();
     Restrictions = new ChangeTrackingList <Restriction>();
 }
コード例 #3
0
 internal SkuInformation(SkuName name, SkuTier?tier, string resourceType, Kind?kind, IReadOnlyList <string> locations, IReadOnlyList <SKUCapability> capabilities, IReadOnlyList <Restriction> restrictions)
 {
     Name         = name;
     Tier         = tier;
     ResourceType = resourceType;
     Kind         = kind;
     Locations    = locations;
     Capabilities = capabilities;
     Restrictions = restrictions;
 }
コード例 #4
0
        internal static Sku DeserializeSku(JsonElement element)
        {
            SkuName name = default;
            SkuTier?tier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new SkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    tier = property.Value.GetString().ToSkuTier();
                    continue;
                }
            }
            return(new Sku(name, tier));
        }
コード例 #5
0
        internal static SkuInformation DeserializeSkuInformation(JsonElement element)
        {
            SkuName name         = default;
            SkuTier?tier         = default;
            string  resourceType = default;
            Kind?   kind         = default;
            IReadOnlyList <string>        locations    = default;
            IReadOnlyList <SKUCapability> capabilities = default;
            IReadOnlyList <Restriction>   restrictions = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new SkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    tier = property.Value.GetString().ToSkuTier();
                    continue;
                }
                if (property.NameEquals("resourceType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    resourceType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    kind = new Kind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("locations"))
                {
                    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());
                        }
                    }
                    locations = array;
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <SKUCapability> array = new List <SKUCapability>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(SKUCapability.DeserializeSKUCapability(item));
                        }
                    }
                    capabilities = array;
                    continue;
                }
                if (property.NameEquals("restrictions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <Restriction> array = new List <Restriction>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(Restriction.DeserializeRestriction(item));
                        }
                    }
                    restrictions = array;
                    continue;
                }
            }
            return(new SkuInformation(name, tier, resourceType, kind, locations, capabilities, restrictions));
        }
コード例 #6
0
 internal SkuInformation(SkuName name)
 {
     Name = name;
 }
コード例 #7
0
        internal static SkuInformation DeserializeSkuInformation(JsonElement element)
        {
            SkuName            name         = default;
            Optional <SkuTier> tier         = default;
            Optional <string>  resourceType = default;
            Optional <Kind>    kind         = default;
            Optional <IReadOnlyList <string> >        locations    = default;
            Optional <IReadOnlyList <SKUCapability> > capabilities = default;
            Optional <IReadOnlyList <Restriction> >   restrictions = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new SkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    tier = property.Value.GetString().ToSkuTier();
                    continue;
                }
                if (property.NameEquals("resourceType"))
                {
                    resourceType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = new Kind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("locations"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    locations = array;
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    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"))
                {
                    List <Restriction> array = new List <Restriction>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(Restriction.DeserializeRestriction(item));
                    }
                    restrictions = array;
                    continue;
                }
            }
            return(new SkuInformation(name, Optional.ToNullable(tier), resourceType.Value, Optional.ToNullable(kind), Optional.ToList(locations), Optional.ToList(capabilities), Optional.ToList(restrictions)));
        }