Пример #1
0
 internal ResourceTypeSku(ElasticSanSku sku, IReadOnlyList <SkuLocationInfo> locationInfo, SanTierInfo san, ElasticSanVolumeGroupTierInfo elasticSanVolumeGroup, ElasticSanVolumeTierInfo elasticSanVolume)
 {
     Sku                   = sku;
     LocationInfo          = locationInfo;
     San                   = san;
     ElasticSanVolumeGroup = elasticSanVolumeGroup;
     ElasticSanVolume      = elasticSanVolume;
 }
        internal static ResourceTypeSku DeserializeResourceTypeSku(JsonElement element)
        {
            Optional <ElasticSanSku> sku = default;
            Optional <IReadOnlyList <SkuLocationInfo> > locationInfo = default;
            Optional <SanTierInfo> san = default;
            Optional <ElasticSanVolumeGroupTierInfo> volumeGroup = default;
            Optional <ElasticSanVolumeTierInfo>      volume      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = ElasticSanSku.DeserializeElasticSanSku(property.Value);
                    continue;
                }
                if (property.NameEquals("locationInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <SkuLocationInfo> array = new List <SkuLocationInfo>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SkuLocationInfo.DeserializeSkuLocationInfo(item));
                    }
                    locationInfo = array;
                    continue;
                }
                if (property.NameEquals("san"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    san = SanTierInfo.DeserializeSanTierInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("volumeGroup"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    volumeGroup = ElasticSanVolumeGroupTierInfo.DeserializeElasticSanVolumeGroupTierInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("volume"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    volume = ElasticSanVolumeTierInfo.DeserializeElasticSanVolumeTierInfo(property.Value);
                    continue;
                }
            }
            return(new ResourceTypeSku(sku.Value, Optional.ToList(locationInfo), san.Value, volumeGroup.Value, volume.Value));
        }