internal static VirtualNetworkGateway DeserializeVirtualNetworkGateway(JsonElement element) { string etag = default; string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; IList <VirtualNetworkGatewayIPConfiguration> ipConfigurations = default; VirtualNetworkGatewayType?gatewayType = default; VpnType?vpnType = default; VpnGatewayGeneration?vpnGatewayGeneration = default; bool? enableBgp = default; bool? enablePrivateIpAddress = default; bool? activeActive = default; SubResource gatewayDefaultSite = default; VirtualNetworkGatewaySku sku = default; VpnClientConfiguration vpnClientConfiguration = default; BgpSettings bgpSettings = default; AddressSpace customRoutes = default; string resourceGuid = default; ProvisioningState?provisioningState = default; bool? enableDnsForwarding = default; string inboundDnsForwardingEndpoint = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } etag = property.Value.GetString(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } 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("ipConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <VirtualNetworkGatewayIPConfiguration> array = new List <VirtualNetworkGatewayIPConfiguration>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(VirtualNetworkGatewayIPConfiguration.DeserializeVirtualNetworkGatewayIPConfiguration(item)); } } ipConfigurations = array; continue; } if (property0.NameEquals("gatewayType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } gatewayType = new VirtualNetworkGatewayType(property0.Value.GetString()); continue; } if (property0.NameEquals("vpnType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } vpnType = new VpnType(property0.Value.GetString()); continue; } if (property0.NameEquals("vpnGatewayGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } vpnGatewayGeneration = new VpnGatewayGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("enableBgp")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } enableBgp = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("enablePrivateIpAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } enablePrivateIpAddress = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("activeActive")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } activeActive = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("gatewayDefaultSite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } gatewayDefaultSite = SubResource.DeserializeSubResource(property0.Value); continue; } if (property0.NameEquals("sku")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } sku = VirtualNetworkGatewaySku.DeserializeVirtualNetworkGatewaySku(property0.Value); continue; } if (property0.NameEquals("vpnClientConfiguration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } vpnClientConfiguration = VpnClientConfiguration.DeserializeVpnClientConfiguration(property0.Value); continue; } if (property0.NameEquals("bgpSettings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value); continue; } if (property0.NameEquals("customRoutes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } customRoutes = AddressSpace.DeserializeAddressSpace(property0.Value); continue; } if (property0.NameEquals("resourceGuid")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } resourceGuid = property0.Value.GetString(); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("enableDnsForwarding")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } enableDnsForwarding = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("inboundDnsForwardingEndpoint")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } inboundDnsForwardingEndpoint = property0.Value.GetString(); continue; } } continue; } } return(new VirtualNetworkGateway(id, name, type, location, tags, etag, ipConfigurations, gatewayType, vpnType, vpnGatewayGeneration, enableBgp, enablePrivateIpAddress, activeActive, gatewayDefaultSite, sku, vpnClientConfiguration, bgpSettings, customRoutes, resourceGuid, provisioningState, enableDnsForwarding, inboundDnsForwardingEndpoint)); }
internal static VirtualNetworkGateway DeserializeVirtualNetworkGateway(JsonElement element) { Optional <string> etag = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; Optional <IList <VirtualNetworkGatewayIPConfiguration> > ipConfigurations = default; Optional <VirtualNetworkGatewayType> gatewayType = default; Optional <VpnType> vpnType = default; Optional <VpnGatewayGeneration> vpnGatewayGeneration = default; Optional <bool> enableBgp = default; Optional <bool> enablePrivateIpAddress = default; Optional <bool> activeActive = default; Optional <SubResource> gatewayDefaultSite = default; Optional <VirtualNetworkGatewaySku> sku = default; Optional <VpnClientConfiguration> vpnClientConfiguration = default; Optional <BgpSettings> bgpSettings = default; Optional <AddressSpace> customRoutes = default; Optional <string> resourceGuid = default; Optional <ProvisioningState> provisioningState = default; Optional <bool> enableDnsForwarding = default; Optional <string> inboundDnsForwardingEndpoint = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("ipConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualNetworkGatewayIPConfiguration> array = new List <VirtualNetworkGatewayIPConfiguration>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualNetworkGatewayIPConfiguration.DeserializeVirtualNetworkGatewayIPConfiguration(item)); } ipConfigurations = array; continue; } if (property0.NameEquals("gatewayType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } gatewayType = new VirtualNetworkGatewayType(property0.Value.GetString()); continue; } if (property0.NameEquals("vpnType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vpnType = new VpnType(property0.Value.GetString()); continue; } if (property0.NameEquals("vpnGatewayGeneration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vpnGatewayGeneration = new VpnGatewayGeneration(property0.Value.GetString()); continue; } if (property0.NameEquals("enableBgp")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enableBgp = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("enablePrivateIpAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enablePrivateIpAddress = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("activeActive")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } activeActive = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("gatewayDefaultSite")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } gatewayDefaultSite = SubResource.DeserializeSubResource(property0.Value); continue; } if (property0.NameEquals("sku")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } sku = VirtualNetworkGatewaySku.DeserializeVirtualNetworkGatewaySku(property0.Value); continue; } if (property0.NameEquals("vpnClientConfiguration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } vpnClientConfiguration = VpnClientConfiguration.DeserializeVpnClientConfiguration(property0.Value); continue; } if (property0.NameEquals("bgpSettings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value); continue; } if (property0.NameEquals("customRoutes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } customRoutes = AddressSpace.DeserializeAddressSpace(property0.Value); continue; } if (property0.NameEquals("resourceGuid")) { resourceGuid = property0.Value.GetString(); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("enableDnsForwarding")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enableDnsForwarding = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("inboundDnsForwardingEndpoint")) { inboundDnsForwardingEndpoint = property0.Value.GetString(); continue; } } continue; } } return(new VirtualNetworkGateway(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(gatewayType), Optional.ToNullable(vpnType), Optional.ToNullable(vpnGatewayGeneration), Optional.ToNullable(enableBgp), Optional.ToNullable(enablePrivateIpAddress), Optional.ToNullable(activeActive), gatewayDefaultSite.Value, sku.Value, vpnClientConfiguration.Value, bgpSettings.Value, customRoutes.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDnsForwarding), inboundDnsForwardingEndpoint.Value)); }