internal VirtualMachineImage(string id, string name, string location, IDictionary <string, string> tags, PurchasePlan plan, OSDiskImage osDiskImage, IList <DataDiskImage> dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties, HyperVGenerationTypes?hyperVGeneration) : base(id, name, location, tags) { Plan = plan; OsDiskImage = osDiskImage; DataDiskImages = dataDiskImages; AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; HyperVGeneration = hyperVGeneration; }
internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement element) { string name = default; string location = default; IDictionary <string, string> tags = default; string id = default; PurchasePlan plan = default; OSDiskImage osDiskImage = default; IList <DataDiskImage> dataDiskImages = default; AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default; HyperVGenerationTypes? hyperVGeneration = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property0.Name, null); } else { dictionary.Add(property0.Name, property0.Value.GetString()); } } tags = dictionary; continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("plan")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } plan = PurchasePlan.DeserializePurchasePlan(property0.Value); continue; } if (property0.NameEquals("osDiskImage")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } osDiskImage = OSDiskImage.DeserializeOSDiskImage(property0.Value); continue; } if (property0.NameEquals("dataDiskImages")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <DataDiskImage> array = new List <DataDiskImage>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(DataDiskImage.DeserializeDataDiskImage(item)); } } dataDiskImages = array; continue; } if (property0.NameEquals("automaticOSUpgradeProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } automaticOSUpgradeProperties = AutomaticOSUpgradeProperties.DeserializeAutomaticOSUpgradeProperties(property0.Value); continue; } if (property0.NameEquals("hyperVGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hyperVGeneration = new HyperVGenerationTypes(property0.Value.GetString()); continue; } } continue; } } return(new VirtualMachineImage(id, name, location, tags, plan, osDiskImage, dataDiskImages, automaticOSUpgradeProperties, hyperVGeneration)); }
internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement element) { string name = default; string location = default; Optional <IDictionary <string, string> > tags = default; Optional <string> id = default; Optional <PurchasePlan> plan = default; Optional <OSDiskImage> osDiskImage = default; Optional <IList <DataDiskImage> > dataDiskImages = default; Optional <AutomaticOSUpgradeProperties> automaticOSUpgradeProperties = default; Optional <HyperVGenerationTypes> hyperVGeneration = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("plan")) { plan = PurchasePlan.DeserializePurchasePlan(property0.Value); continue; } if (property0.NameEquals("osDiskImage")) { osDiskImage = OSDiskImage.DeserializeOSDiskImage(property0.Value); continue; } if (property0.NameEquals("dataDiskImages")) { List <DataDiskImage> array = new List <DataDiskImage>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(DataDiskImage.DeserializeDataDiskImage(item)); } dataDiskImages = array; continue; } if (property0.NameEquals("automaticOSUpgradeProperties")) { automaticOSUpgradeProperties = AutomaticOSUpgradeProperties.DeserializeAutomaticOSUpgradeProperties(property0.Value); continue; } if (property0.NameEquals("hyperVGeneration")) { hyperVGeneration = new HyperVGenerationTypes(property0.Value.GetString()); continue; } } continue; } } return(new VirtualMachineImage(id.Value, name, location, Optional.ToDictionary(tags), plan.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), automaticOSUpgradeProperties.Value, Optional.ToNullable(hyperVGeneration))); }