internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) { IList <NetworkInterfaceReference> networkInterfaces = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <NetworkInterfaceReference> array = new List <NetworkInterfaceReference>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(NetworkInterfaceReference.DeserializeNetworkInterfaceReference(item)); } } networkInterfaces = array; continue; } } return(new NetworkProfile(networkInterfaces)); }
internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) { Optional <IList <NetworkInterfaceReference> > networkInterfaces = default; Optional <NetworkApiVersion> networkApiVersion = default; Optional <IList <VirtualMachineNetworkInterfaceConfiguration> > networkInterfaceConfigurations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterfaceReference> array = new List <NetworkInterfaceReference>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(NetworkInterfaceReference.DeserializeNetworkInterfaceReference(item)); } networkInterfaces = array; continue; } if (property.NameEquals("networkApiVersion")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } networkApiVersion = new NetworkApiVersion(property.Value.GetString()); continue; } if (property.NameEquals("networkInterfaceConfigurations")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualMachineNetworkInterfaceConfiguration> array = new List <VirtualMachineNetworkInterfaceConfiguration>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VirtualMachineNetworkInterfaceConfiguration.DeserializeVirtualMachineNetworkInterfaceConfiguration(item)); } networkInterfaceConfigurations = array; continue; } } return(new NetworkProfile(Optional.ToList(networkInterfaces), Optional.ToNullable(networkApiVersion), Optional.ToList(networkInterfaceConfigurations))); }
internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) { Optional <IList <NetworkInterfaceReference> > networkInterfaces = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces")) { List <NetworkInterfaceReference> array = new List <NetworkInterfaceReference>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(NetworkInterfaceReference.DeserializeNetworkInterfaceReference(item)); } networkInterfaces = array; continue; } } return(new NetworkProfile(Optional.ToList(networkInterfaces))); }