internal static VpnClientConfiguration DeserializeVpnClientConfiguration(JsonElement element) { Optional <AddressSpace> vpnClientAddressPool = default; Optional <IList <VpnClientRootCertificate> > vpnClientRootCertificates = default; Optional <IList <VpnClientRevokedCertificate> > vpnClientRevokedCertificates = default; Optional <IList <VpnClientProtocol> > vpnClientProtocols = default; Optional <IList <IpsecPolicy> > vpnClientIpsecPolicies = default; Optional <string> radiusServerAddress = default; Optional <string> radiusServerSecret = default; Optional <IList <RadiusServer> > radiusServers = default; Optional <string> aadTenant = default; Optional <string> aadAudience = default; Optional <string> aadIssuer = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vpnClientAddressPool")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } vpnClientAddressPool = AddressSpace.DeserializeAddressSpace(property.Value); continue; } if (property.NameEquals("vpnClientRootCertificates")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VpnClientRootCertificate> array = new List <VpnClientRootCertificate>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VpnClientRootCertificate.DeserializeVpnClientRootCertificate(item)); } vpnClientRootCertificates = array; continue; } if (property.NameEquals("vpnClientRevokedCertificates")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VpnClientRevokedCertificate> array = new List <VpnClientRevokedCertificate>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VpnClientRevokedCertificate.DeserializeVpnClientRevokedCertificate(item)); } vpnClientRevokedCertificates = array; continue; } if (property.NameEquals("vpnClientProtocols")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VpnClientProtocol> array = new List <VpnClientProtocol>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new VpnClientProtocol(item.GetString())); } vpnClientProtocols = array; continue; } if (property.NameEquals("vpnClientIpsecPolicies")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <IpsecPolicy> array = new List <IpsecPolicy>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(IpsecPolicy.DeserializeIpsecPolicy(item)); } vpnClientIpsecPolicies = array; continue; } if (property.NameEquals("radiusServerAddress")) { radiusServerAddress = property.Value.GetString(); continue; } if (property.NameEquals("radiusServerSecret")) { radiusServerSecret = property.Value.GetString(); continue; } if (property.NameEquals("radiusServers")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <RadiusServer> array = new List <RadiusServer>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(RadiusServer.DeserializeRadiusServer(item)); } radiusServers = array; continue; } if (property.NameEquals("aadTenant")) { aadTenant = property.Value.GetString(); continue; } if (property.NameEquals("aadAudience")) { aadAudience = property.Value.GetString(); continue; } if (property.NameEquals("aadIssuer")) { aadIssuer = property.Value.GetString(); continue; } } return(new VpnClientConfiguration(vpnClientAddressPool.Value, Optional.ToList(vpnClientRootCertificates), Optional.ToList(vpnClientRevokedCertificates), Optional.ToList(vpnClientProtocols), Optional.ToList(vpnClientIpsecPolicies), radiusServerAddress.Value, radiusServerSecret.Value, Optional.ToList(radiusServers), aadTenant.Value, aadAudience.Value, aadIssuer.Value)); }
internal static VpnClientConfiguration DeserializeVpnClientConfiguration(JsonElement element) { AddressSpace vpnClientAddressPool = default; IList <VpnClientRootCertificate> vpnClientRootCertificates = default; IList <VpnClientRevokedCertificate> vpnClientRevokedCertificates = default; IList <VpnClientProtocol> vpnClientProtocols = default; IList <IpsecPolicy> vpnClientIpsecPolicies = default; string radiusServerAddress = default; string radiusServerSecret = default; IList <RadiusServer> radiusServers = default; string aadTenant = default; string aadAudience = default; string aadIssuer = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vpnClientAddressPool")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } vpnClientAddressPool = AddressSpace.DeserializeAddressSpace(property.Value); continue; } if (property.NameEquals("vpnClientRootCertificates")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <VpnClientRootCertificate> array = new List <VpnClientRootCertificate>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(VpnClientRootCertificate.DeserializeVpnClientRootCertificate(item)); } } vpnClientRootCertificates = array; continue; } if (property.NameEquals("vpnClientRevokedCertificates")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <VpnClientRevokedCertificate> array = new List <VpnClientRevokedCertificate>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(VpnClientRevokedCertificate.DeserializeVpnClientRevokedCertificate(item)); } } vpnClientRevokedCertificates = array; continue; } if (property.NameEquals("vpnClientProtocols")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <VpnClientProtocol> array = new List <VpnClientProtocol>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(new VpnClientProtocol(item.GetString())); } vpnClientProtocols = array; continue; } if (property.NameEquals("vpnClientIpsecPolicies")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <IpsecPolicy> array = new List <IpsecPolicy>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(IpsecPolicy.DeserializeIpsecPolicy(item)); } } vpnClientIpsecPolicies = array; continue; } if (property.NameEquals("radiusServerAddress")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } radiusServerAddress = property.Value.GetString(); continue; } if (property.NameEquals("radiusServerSecret")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } radiusServerSecret = property.Value.GetString(); continue; } if (property.NameEquals("radiusServers")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <RadiusServer> array = new List <RadiusServer>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(RadiusServer.DeserializeRadiusServer(item)); } } radiusServers = array; continue; } if (property.NameEquals("aadTenant")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } aadTenant = property.Value.GetString(); continue; } if (property.NameEquals("aadAudience")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } aadAudience = property.Value.GetString(); continue; } if (property.NameEquals("aadIssuer")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } aadIssuer = property.Value.GetString(); continue; } } return(new VpnClientConfiguration(vpnClientAddressPool, vpnClientRootCertificates, vpnClientRevokedCertificates, vpnClientProtocols, vpnClientIpsecPolicies, radiusServerAddress, radiusServerSecret, radiusServers, aadTenant, aadAudience, aadIssuer)); }