internal static ProximityPlacementGroup DeserializeProximityPlacementGroup(JsonElement element) { Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; string location = default; Optional <IDictionary <string, string> > tags = default; Optional <ProximityPlacementGroupType> proximityPlacementGroupType = default; Optional <IReadOnlyList <SubResourceWithColocationStatus> > virtualMachines = default; Optional <IReadOnlyList <SubResourceWithColocationStatus> > virtualMachineScaleSets = default; Optional <IReadOnlyList <SubResourceWithColocationStatus> > availabilitySets = default; Optional <InstanceViewStatus> colocationStatus = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = 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("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("proximityPlacementGroupType")) { proximityPlacementGroupType = new ProximityPlacementGroupType(property0.Value.GetString()); continue; } if (property0.NameEquals("virtualMachines")) { List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } virtualMachines = array; continue; } if (property0.NameEquals("virtualMachineScaleSets")) { List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } virtualMachineScaleSets = array; continue; } if (property0.NameEquals("availabilitySets")) { List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } availabilitySets = array; continue; } if (property0.NameEquals("colocationStatus")) { colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property0.Value); continue; } } continue; } } return(new ProximityPlacementGroup(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), Optional.ToNullable(proximityPlacementGroupType), Optional.ToList(virtualMachines), Optional.ToList(virtualMachineScaleSets), Optional.ToList(availabilitySets), colocationStatus.Value)); }
internal static ProximityPlacementGroup DeserializeProximityPlacementGroup(JsonElement element) { string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; ProximityPlacementGroupType? proximityPlacementGroupType = default; IList <SubResourceWithColocationStatus> virtualMachines = default; IList <SubResourceWithColocationStatus> virtualMachineScaleSets = default; IList <SubResourceWithColocationStatus> availabilitySets = default; InstanceViewStatus colocationStatus = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = 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("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("proximityPlacementGroupType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } proximityPlacementGroupType = new ProximityPlacementGroupType(property0.Value.GetString()); continue; } if (property0.NameEquals("virtualMachines")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } } virtualMachines = array; continue; } if (property0.NameEquals("virtualMachineScaleSets")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } } virtualMachineScaleSets = array; continue; } if (property0.NameEquals("availabilitySets")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item)); } } availabilitySets = array; continue; } if (property0.NameEquals("colocationStatus")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property0.Value); continue; } } continue; } } return(new ProximityPlacementGroup(id, name, type, location, tags, proximityPlacementGroupType, virtualMachines, virtualMachineScaleSets, availabilitySets, colocationStatus)); }