internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement element) { Optional <ImageOSDisk> osDisk = default; Optional <IList <ImageDataDisk> > dataDisks = default; Optional <bool> zoneResilient = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDisk")) { osDisk = ImageOSDisk.DeserializeImageOSDisk(property.Value); continue; } if (property.NameEquals("dataDisks")) { List <ImageDataDisk> array = new List <ImageDataDisk>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ImageDataDisk.DeserializeImageDataDisk(item)); } dataDisks = array; continue; } if (property.NameEquals("zoneResilient")) { zoneResilient = property.Value.GetBoolean(); continue; } } return(new ImageStorageProfile(osDisk.Value, Optional.ToList(dataDisks), Optional.ToNullable(zoneResilient))); }
internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement element) { ImageOSDisk osDisk = default; IList <ImageDataDisk> dataDisks = default; bool?zoneResilient = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDisk")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } osDisk = ImageOSDisk.DeserializeImageOSDisk(property.Value); continue; } if (property.NameEquals("dataDisks")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <ImageDataDisk> array = new List <ImageDataDisk>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ImageDataDisk.DeserializeImageDataDisk(item)); } } dataDisks = array; continue; } if (property.NameEquals("zoneResilient")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } zoneResilient = property.Value.GetBoolean(); continue; } } return(new ImageStorageProfile(osDisk, dataDisks, zoneResilient)); }