internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement element)
        {
            GalleryArtifactVersionSource source         = default;
            GalleryDiskImage             osDiskImage    = default;
            IList <GalleryDataDiskImage> dataDiskImages = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("source"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    source = GalleryArtifactVersionSource.DeserializeGalleryArtifactVersionSource(property.Value);
                    continue;
                }
                if (property.NameEquals("osDiskImage"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osDiskImage = GalleryDiskImage.DeserializeGalleryDiskImage(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDiskImages"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <GalleryDataDiskImage> array = new List <GalleryDataDiskImage>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(GalleryDataDiskImage.DeserializeGalleryDataDiskImage(item));
                        }
                    }
                    dataDiskImages = array;
                    continue;
                }
            }
            return(new GalleryImageVersionStorageProfile(source, osDiskImage, dataDiskImages));
        }
Exemplo n.º 2
0
 internal GalleryImageVersionStorageProfile(GalleryArtifactVersionSource source, GalleryDiskImage osDiskImage, IList <GalleryDataDiskImage> dataDiskImages)
 {
     Source         = source;
     OsDiskImage    = osDiskImage;
     DataDiskImages = dataDiskImages;
 }