internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement element) { Optional <GalleryArtifactVersionSource> source = default; Optional <GalleryDiskImage> osDiskImage = default; Optional <IList <GalleryDataDiskImage> > dataDiskImages = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source")) { source = GalleryArtifactVersionSource.DeserializeGalleryArtifactVersionSource(property.Value); continue; } if (property.NameEquals("osDiskImage")) { osDiskImage = GalleryDiskImage.DeserializeGalleryDiskImage(property.Value); continue; } if (property.NameEquals("dataDiskImages")) { List <GalleryDataDiskImage> array = new List <GalleryDataDiskImage>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(GalleryDataDiskImage.DeserializeGalleryDataDiskImage(item)); } dataDiskImages = array; continue; } } return(new GalleryImageVersionStorageProfile(source.Value, osDiskImage.Value, Optional.ToList(dataDiskImages))); }
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)); }