Exemple #1
0
 internal VirtualNetworkData(ResourceIdentifier id, string name, ResourceType?resourceType, AzureLocation?location, IDictionary <string, string> tags, Models.ExtendedLocation extendedLocation, ETag?etag, AddressSpace addressSpace, DhcpOptions dhcpOptions, int?flowTimeoutInMinutes, IList <SubnetData> subnets, IList <VirtualNetworkPeeringData> virtualNetworkPeerings, Guid?resourceGuid, NetworkProvisioningState?provisioningState, bool?enableDdosProtection, bool?enableVmProtection, WritableSubResource ddosProtectionPlan, VirtualNetworkBgpCommunities bgpCommunities, IList <WritableSubResource> ipAllocations) : base(id, name, resourceType, location, tags)
 {
     ExtendedLocation       = extendedLocation;
     Etag                   = etag;
     AddressSpace           = addressSpace;
     DhcpOptions            = dhcpOptions;
     FlowTimeoutInMinutes   = flowTimeoutInMinutes;
     Subnets                = subnets;
     VirtualNetworkPeerings = virtualNetworkPeerings;
     ResourceGuid           = resourceGuid;
     ProvisioningState      = provisioningState;
     EnableDdosProtection   = enableDdosProtection;
     EnableVmProtection     = enableVmProtection;
     DdosProtectionPlan     = ddosProtectionPlan;
     BgpCommunities         = bgpCommunities;
     IPAllocations          = ipAllocations;
 }
        internal static VirtualNetworkData DeserializeVirtualNetworkData(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 <AddressSpace>        addressSpace         = default;
            Optional <DhcpOptions>         dhcpOptions          = default;
            Optional <int>                 flowTimeoutInMinutes = default;
            Optional <IList <SubnetData> > subnets              = default;
            Optional <IList <VirtualNetworkPeeringData> > virtualNetworkPeerings = default;
            Optional <string>            resourceGuid              = default;
            Optional <ProvisioningState> provisioningState         = default;
            Optional <bool>        enableDdosProtection            = default;
            Optional <bool>        enableVmProtection              = default;
            Optional <SubResource> ddosProtectionPlan              = default;
            Optional <VirtualNetworkBgpCommunities> bgpCommunities = default;
            Optional <IList <SubResource> >         ipAllocations  = 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("addressSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            addressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("dhcpOptions"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dhcpOptions = DhcpOptions.DeserializeDhcpOptions(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("flowTimeoutInMinutes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            flowTimeoutInMinutes = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("subnets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SubnetData> array = new List <SubnetData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubnetData.DeserializeSubnetData(item));
                            }
                            subnets = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkPeerings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkPeeringData> array = new List <VirtualNetworkPeeringData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkPeeringData.DeserializeVirtualNetworkPeeringData(item));
                            }
                            virtualNetworkPeerings = array;
                            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("enableDdosProtection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableDdosProtection = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableVmProtection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableVmProtection = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("ddosProtectionPlan"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            ddosProtectionPlan = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("bgpCommunities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bgpCommunities = VirtualNetworkBgpCommunities.DeserializeVirtualNetworkBgpCommunities(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipAllocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SubResource> array = new List <SubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResource.DeserializeSubResource(item));
                            }
                            ipAllocations = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualNetworkData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, addressSpace.Value, dhcpOptions.Value, Optional.ToNullable(flowTimeoutInMinutes), Optional.ToList(subnets), Optional.ToList(virtualNetworkPeerings), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDdosProtection), Optional.ToNullable(enableVmProtection), ddosProtectionPlan.Value, bgpCommunities.Value, Optional.ToList(ipAllocations)));
        }
Exemple #3
0
 internal VirtualNetworkPeeringData(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, bool?allowVirtualNetworkAccess, bool?allowForwardedTraffic, bool?allowGatewayTransit, bool?useRemoteGateways, WritableSubResource remoteVirtualNetwork, AddressSpace remoteAddressSpace, AddressSpace remoteVirtualNetworkAddressSpace, VirtualNetworkBgpCommunities remoteBgpCommunities, VirtualNetworkPeeringState?peeringState, VirtualNetworkPeeringLevel?peeringSyncLevel, NetworkProvisioningState?provisioningState, bool?doNotVerifyRemoteGateways, Guid?resourceGuid) : base(id, name, resourceType)
 {
     Etag = etag;
     AllowVirtualNetworkAccess        = allowVirtualNetworkAccess;
     AllowForwardedTraffic            = allowForwardedTraffic;
     AllowGatewayTransit              = allowGatewayTransit;
     UseRemoteGateways                = useRemoteGateways;
     RemoteVirtualNetwork             = remoteVirtualNetwork;
     RemoteAddressSpace               = remoteAddressSpace;
     RemoteVirtualNetworkAddressSpace = remoteVirtualNetworkAddressSpace;
     RemoteBgpCommunities             = remoteBgpCommunities;
     PeeringState              = peeringState;
     PeeringSyncLevel          = peeringSyncLevel;
     ProvisioningState         = provisioningState;
     DoNotVerifyRemoteGateways = doNotVerifyRemoteGateways;
     ResourceGuid              = resourceGuid;
 }
Exemple #4
0
        internal static VirtualNetworkPeeringData DeserializeVirtualNetworkPeeringData(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> etag = default;
            Optional <string> type = default;
            Optional <string> id   = default;
            Optional <bool>   allowVirtualNetworkAccess = default;
            Optional <bool>   allowForwardedTraffic     = default;
            Optional <bool>   allowGatewayTransit       = default;
            Optional <bool>   useRemoteGateways         = default;
            Optional <WritableSubResource>          remoteVirtualNetwork             = default;
            Optional <AddressSpace>                 remoteAddressSpace               = default;
            Optional <AddressSpace>                 remoteVirtualNetworkAddressSpace = default;
            Optional <VirtualNetworkBgpCommunities> remoteBgpCommunities             = default;
            Optional <VirtualNetworkPeeringState>   peeringState      = default;
            Optional <VirtualNetworkPeeringLevel>   peeringSyncLevel  = default;
            Optional <ProvisioningState>            provisioningState = default;
            Optional <bool>   doNotVerifyRemoteGateways = default;
            Optional <string> resourceGuid = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    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("allowVirtualNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowVirtualNetworkAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("allowForwardedTraffic"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowForwardedTraffic = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("allowGatewayTransit"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowGatewayTransit = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("useRemoteGateways"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            useRemoteGateways = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("remoteVirtualNetwork"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            remoteVirtualNetwork = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("remoteAddressSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            remoteAddressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("remoteVirtualNetworkAddressSpace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            remoteVirtualNetworkAddressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("remoteBgpCommunities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            remoteBgpCommunities = VirtualNetworkBgpCommunities.DeserializeVirtualNetworkBgpCommunities(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("peeringState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peeringState = new VirtualNetworkPeeringState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("peeringSyncLevel"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peeringSyncLevel = new VirtualNetworkPeeringLevel(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("doNotVerifyRemoteGateways"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            doNotVerifyRemoteGateways = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualNetworkPeeringData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(allowVirtualNetworkAccess), Optional.ToNullable(allowForwardedTraffic), Optional.ToNullable(allowGatewayTransit), Optional.ToNullable(useRemoteGateways), remoteVirtualNetwork, remoteAddressSpace.Value, remoteVirtualNetworkAddressSpace.Value, remoteBgpCommunities.Value, Optional.ToNullable(peeringState), Optional.ToNullable(peeringSyncLevel), Optional.ToNullable(provisioningState), Optional.ToNullable(doNotVerifyRemoteGateways), resourceGuid.Value));
        }
Exemple #5
0
 internal VirtualNetworkPeeringData(string id, string name, string etag, string type, bool?allowVirtualNetworkAccess, bool?allowForwardedTraffic, bool?allowGatewayTransit, bool?useRemoteGateways, WritableSubResource remoteVirtualNetwork, AddressSpace remoteAddressSpace, AddressSpace remoteVirtualNetworkAddressSpace, VirtualNetworkBgpCommunities remoteBgpCommunities, VirtualNetworkPeeringState?peeringState, VirtualNetworkPeeringLevel?peeringSyncLevel, ProvisioningState?provisioningState, bool?doNotVerifyRemoteGateways, string resourceGuid) : base(id)
 {
     Name = name;
     Etag = etag;
     Type = type;
     AllowVirtualNetworkAccess        = allowVirtualNetworkAccess;
     AllowForwardedTraffic            = allowForwardedTraffic;
     AllowGatewayTransit              = allowGatewayTransit;
     UseRemoteGateways                = useRemoteGateways;
     RemoteVirtualNetwork             = remoteVirtualNetwork;
     RemoteAddressSpace               = remoteAddressSpace;
     RemoteVirtualNetworkAddressSpace = remoteVirtualNetworkAddressSpace;
     RemoteBgpCommunities             = remoteBgpCommunities;
     PeeringState              = peeringState;
     PeeringSyncLevel          = peeringSyncLevel;
     ProvisioningState         = provisioningState;
     DoNotVerifyRemoteGateways = doNotVerifyRemoteGateways;
     ResourceGuid              = resourceGuid;
 }