internal VirtualNetworkGatewayData(ResourceIdentifier id, string name, ResourceType?resourceType, AzureLocation?location, IDictionary <string, string> tags, Models.ExtendedLocation extendedLocation, ETag?etag, IList <VirtualNetworkGatewayIPConfiguration> ipConfigurations, VirtualNetworkGatewayType?gatewayType, VpnType?vpnType, VpnGatewayGeneration?vpnGatewayGeneration, bool?enableBgp, bool?enablePrivateIPAddress, bool?active, WritableSubResource gatewayDefaultSite, VirtualNetworkGatewaySku sku, VpnClientConfiguration vpnClientConfiguration, BgpSettings bgpSettings, AddressSpace customRoutes, Guid?resourceGuid, NetworkProvisioningState?provisioningState, bool?enableDnsForwarding, string inboundDnsForwardingEndpoint, ResourceIdentifier vNetExtendedLocationResourceId, IList <VirtualNetworkGatewayNatRuleData> natRules, bool?enableBgpRouteTranslationForNat) : base(id, name, resourceType, location, tags) { ExtendedLocation = extendedLocation; Etag = etag; IPConfigurations = ipConfigurations; GatewayType = gatewayType; VpnType = vpnType; VpnGatewayGeneration = vpnGatewayGeneration; EnableBgp = enableBgp; EnablePrivateIPAddress = enablePrivateIPAddress; Active = active; GatewayDefaultSite = gatewayDefaultSite; Sku = sku; VpnClientConfiguration = vpnClientConfiguration; BgpSettings = bgpSettings; CustomRoutes = customRoutes; ResourceGuid = resourceGuid; ProvisioningState = provisioningState; EnableDnsForwarding = enableDnsForwarding; InboundDnsForwardingEndpoint = inboundDnsForwardingEndpoint; VNetExtendedLocationResourceId = vNetExtendedLocationResourceId; NatRules = natRules; EnableBgpRouteTranslationForNat = enableBgpRouteTranslationForNat; }
internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(JsonElement element) { Optional <ExtendedLocation> extendedLocation = default; Optional <string> etag = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; ResourceIdentifier id = 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; Optional <string> vNetExtendedLocationResourceId = default; Optional <IList <VirtualNetworkGatewayNatRuleData> > natRules = default; Optional <bool> enableBgpRouteTranslationForNat = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } if (property.NameEquals("etag")) { etag = 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("id")) { id = property.Value.GetString(); 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; } if (property0.NameEquals("vNetExtendedLocationResourceId")) { vNetExtendedLocationResourceId = property0.Value.GetString(); continue; } if (property0.NameEquals("natRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualNetworkGatewayNatRuleData> array = new List <VirtualNetworkGatewayNatRuleData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualNetworkGatewayNatRuleData.DeserializeVirtualNetworkGatewayNatRuleData(item)); } natRules = array; continue; } if (property0.NameEquals("enableBgpRouteTranslationForNat")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enableBgpRouteTranslationForNat = property0.Value.GetBoolean(); continue; } } continue; } } return(new VirtualNetworkGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, 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, vNetExtendedLocationResourceId.Value, Optional.ToList(natRules), Optional.ToNullable(enableBgpRouteTranslationForNat))); }