Ejemplo n.º 1
0
        ///GENMHASH:EE424593047EC034E4F687A7D891306B:FB90A8FA59771F5D7A9F2D0152458B21
        public VirtualNetworkGatewayImpl WithBgp(long asn, string bgpPeeringAddress)
        {
            Inner.EnableBgp = true;
            BgpSettings bgpSettings = EnsureBgpSettings();

            bgpSettings.Asn = asn;
            bgpSettings.BgpPeeringAddress = bgpPeeringAddress;
            return(this);
        }
Ejemplo n.º 2
0
 internal LocalNetworkGatewayData(ResourceIdentifier id, string name, ResourceType?resourceType, AzureLocation?location, IDictionary <string, string> tags, ETag?etag, AddressSpace localNetworkAddressSpace, string gatewayIPAddress, string fqdn, BgpSettings bgpSettings, Guid?resourceGuid, NetworkProvisioningState?provisioningState) : base(id, name, resourceType, location, tags)
 {
     Etag = etag;
     LocalNetworkAddressSpace = localNetworkAddressSpace;
     GatewayIPAddress         = gatewayIPAddress;
     Fqdn              = fqdn;
     BgpSettings       = bgpSettings;
     ResourceGuid      = resourceGuid;
     ProvisioningState = provisioningState;
 }
 internal LocalNetworkGatewayData(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, AddressSpace localNetworkAddressSpace, string gatewayIPAddress, string fqdn, BgpSettings bgpSettings, string resourceGuid, ProvisioningState?provisioningState) : base(id, name, type, location, tags)
 {
     Etag = etag;
     LocalNetworkAddressSpace = localNetworkAddressSpace;
     GatewayIPAddress         = gatewayIPAddress;
     Fqdn              = fqdn;
     BgpSettings       = bgpSettings;
     ResourceGuid      = resourceGuid;
     ProvisioningState = provisioningState;
 }
Ejemplo n.º 4
0
 internal VpnGatewayData(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, SubResource virtualHub, IList <VpnConnectionData> connections, BgpSettings bgpSettings, ProvisioningState?provisioningState, int?vpnGatewayScaleUnit, IReadOnlyList <VpnGatewayIpConfiguration> ipConfigurations, bool?isRoutingPreferenceInternet, IList <VpnGatewayNatRuleData> natRules) : base(id, name, type, location, tags)
 {
     Etag                        = etag;
     VirtualHub                  = virtualHub;
     Connections                 = connections;
     BgpSettings                 = bgpSettings;
     ProvisioningState           = provisioningState;
     VpnGatewayScaleUnit         = vpnGatewayScaleUnit;
     IpConfigurations            = ipConfigurations;
     IsRoutingPreferenceInternet = isRoutingPreferenceInternet;
     NatRules                    = natRules;
 }
Ejemplo n.º 5
0
 internal VpnGatewayData(ResourceIdentifier id, string name, ResourceType?resourceType, AzureLocation?location, IDictionary <string, string> tags, ETag?etag, WritableSubResource virtualHub, IList <VpnConnectionData> connections, BgpSettings bgpSettings, NetworkProvisioningState?provisioningState, int?vpnGatewayScaleUnit, IReadOnlyList <VpnGatewayIPConfiguration> ipConfigurations, bool?isRoutingPreferenceInternet, IList <VpnGatewayNatRuleData> natRules) : base(id, name, resourceType, location, tags)
 {
     Etag                        = etag;
     VirtualHub                  = virtualHub;
     Connections                 = connections;
     BgpSettings                 = bgpSettings;
     ProvisioningState           = provisioningState;
     VpnGatewayScaleUnit         = vpnGatewayScaleUnit;
     IPConfigurations            = ipConfigurations;
     IsRoutingPreferenceInternet = isRoutingPreferenceInternet;
     NatRules                    = natRules;
 }
Ejemplo n.º 6
0
 internal VpnSiteData(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, WritableSubResource virtualWan, DeviceProperties deviceProperties, string ipAddress, string siteKey, AddressSpace addressSpace, BgpSettings bgpProperties, ProvisioningState?provisioningState, bool?isSecuritySite, IList <VpnSiteLinkData> vpnSiteLinks, O365PolicyProperties o365Policy) : base(id, name, type, location, tags)
 {
     Etag              = etag;
     VirtualWan        = virtualWan;
     DeviceProperties  = deviceProperties;
     IPAddress         = ipAddress;
     SiteKey           = siteKey;
     AddressSpace      = addressSpace;
     BgpProperties     = bgpProperties;
     ProvisioningState = provisioningState;
     IsSecuritySite    = isSecuritySite;
     VpnSiteLinks      = vpnSiteLinks;
     O365Policy        = o365Policy;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
        internal static VpnSiteData DeserializeVpnSiteData(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 <WritableSubResource>           virtualWan = default;
            Optional <DeviceProperties>  deviceProperties       = default;
            Optional <string>            ipAddress         = default;
            Optional <string>            siteKey           = default;
            Optional <AddressSpace>      addressSpace      = default;
            Optional <BgpSettings>       bgpProperties     = default;
            Optional <ProvisioningState> provisioningState = default;
            Optional <bool> isSecuritySite = default;
            Optional <IList <VpnSiteLinkData> > vpnSiteLinks = default;
            Optional <O365PolicyProperties>     o365Policy   = 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("virtualWan"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualWan = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("deviceProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            deviceProperties = DeviceProperties.DeserializeDeviceProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipAddress"))
                        {
                            ipAddress = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("siteKey"))
                        {
                            siteKey = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("addressSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            addressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("bgpProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bgpProperties = BgpSettings.DeserializeBgpSettings(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("isSecuritySite"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isSecuritySite = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("vpnSiteLinks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VpnSiteLinkData> array = new List <VpnSiteLinkData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VpnSiteLinkData.DeserializeVpnSiteLinkData(item));
                            }
                            vpnSiteLinks = array;
                            continue;
                        }
                        if (property0.NameEquals("o365Policy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            o365Policy = O365PolicyProperties.DeserializeO365PolicyProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VpnSiteData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan, deviceProperties.Value, ipAddress.Value, siteKey.Value, addressSpace.Value, bgpProperties.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(isSecuritySite), Optional.ToList(vpnSiteLinks), o365Policy.Value));
        }
Ejemplo n.º 9
0
        internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element)
        {
            Optional <ETag> etag = default;
            Optional <ResourceIdentifier>            id                = default;
            Optional <string>                        name              = default;
            Optional <ResourceType>                  type              = default;
            Optional <AzureLocation>                 location          = default;
            Optional <IDictionary <string, string> > tags              = default;
            Optional <WritableSubResource>           virtualHub        = default;
            Optional <IList <VpnConnectionData> >    connections       = default;
            Optional <BgpSettings>                   bgpSettings       = default;
            Optional <NetworkProvisioningState>      provisioningState = default;
            Optional <int> vpnGatewayScaleUnit = default;
            Optional <IReadOnlyList <VpnGatewayIPConfiguration> > ipConfigurations = default;
            Optional <bool> isRoutingPreferenceInternet        = default;
            Optional <IList <VpnGatewayNatRuleData> > natRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    etag = new ETag(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(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("virtualHub"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualHub = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("connections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VpnConnectionData> array = new List <VpnConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VpnConnectionData.DeserializeVpnConnectionData(item));
                            }
                            connections = array;
                            continue;
                        }
                        if (property0.NameEquals("bgpSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new NetworkProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("vpnGatewayScaleUnit"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnGatewayScaleUnit = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VpnGatewayIPConfiguration> array = new List <VpnGatewayIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VpnGatewayIPConfiguration.DeserializeVpnGatewayIPConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("isRoutingPreferenceInternet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isRoutingPreferenceInternet = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("natRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VpnGatewayNatRuleData> array = new List <VpnGatewayNatRuleData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VpnGatewayNatRuleData.DeserializeVpnGatewayNatRuleData(item));
                            }
                            natRules = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VpnGatewayData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToNullable(etag), virtualHub, Optional.ToList(connections), bgpSettings.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), Optional.ToList(ipConfigurations), Optional.ToNullable(isRoutingPreferenceInternet), Optional.ToList(natRules)));
        }
        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)));
        }
Ejemplo n.º 11
0
        internal static LocalNetworkGatewayData DeserializeLocalNetworkGatewayData(JsonElement element)
        {
            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 <AddressSpace>      localNetworkAddressSpace = default;
            Optional <string>            gatewayIpAddress         = default;
            Optional <string>            fqdn              = default;
            Optional <BgpSettings>       bgpSettings       = default;
            Optional <string>            resourceGuid      = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                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("localNetworkAddressSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            localNetworkAddressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("gatewayIpAddress"))
                        {
                            gatewayIpAddress = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("fqdn"))
                        {
                            fqdn = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("bgpSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bgpSettings = BgpSettings.DeserializeBgpSettings(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;
                        }
                    }
                    continue;
                }
            }
            return(new LocalNetworkGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, localNetworkAddressSpace.Value, gatewayIpAddress.Value, fqdn.Value, bgpSettings.Value, resourceGuid.Value, Optional.ToNullable(provisioningState)));
        }