internal ApplicationGatewayIPConfiguration(string id, string name, string etag, string type, SubResource subnet, ProvisioningState?provisioningState) : base(id)
 {
     Name              = name;
     Etag              = etag;
     Type              = type;
     Subnet            = subnet;
     ProvisioningState = provisioningState;
 }
Exemple #2
0
 internal VirtualNetworkGatewayConnectionData(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, string authorizationKey, VirtualNetworkGatewayData virtualNetworkGateway1, VirtualNetworkGatewayData virtualNetworkGateway2, LocalNetworkGatewayData localNetworkGateway2, IList <SubResource> ingressNatRules, IList <SubResource> egressNatRules, VirtualNetworkGatewayConnectionType connectionType, VirtualNetworkGatewayConnectionProtocol?connectionProtocol, int?routingWeight, int?dpdTimeoutSeconds, VirtualNetworkGatewayConnectionMode?connectionMode, string sharedKey, VirtualNetworkGatewayConnectionStatus?connectionStatus, IReadOnlyList <TunnelConnectionHealth> tunnelConnectionStatus, long?egressBytesTransferred, long?ingressBytesTransferred, SubResource peer, bool?enableBgp, bool?useLocalAzureIpAddress, bool?usePolicyBasedTrafficSelectors, IList <IpsecPolicy> ipsecPolicies, IList <TrafficSelectorPolicy> trafficSelectorPolicies, string resourceGuid, ProvisioningState?provisioningState, bool?expressRouteGatewayBypass) : base(id, name, type, location, tags)
 {
     Etag                           = etag;
     AuthorizationKey               = authorizationKey;
     VirtualNetworkGateway1         = virtualNetworkGateway1;
     VirtualNetworkGateway2         = virtualNetworkGateway2;
     LocalNetworkGateway2           = localNetworkGateway2;
     IngressNatRules                = ingressNatRules;
     EgressNatRules                 = egressNatRules;
     ConnectionType                 = connectionType;
     ConnectionProtocol             = connectionProtocol;
     RoutingWeight                  = routingWeight;
     DpdTimeoutSeconds              = dpdTimeoutSeconds;
     ConnectionMode                 = connectionMode;
     SharedKey                      = sharedKey;
     ConnectionStatus               = connectionStatus;
     TunnelConnectionStatus         = tunnelConnectionStatus;
     EgressBytesTransferred         = egressBytesTransferred;
     IngressBytesTransferred        = ingressBytesTransferred;
     Peer                           = peer;
     EnableBgp                      = enableBgp;
     UseLocalAzureIpAddress         = useLocalAzureIpAddress;
     UsePolicyBasedTrafficSelectors = usePolicyBasedTrafficSelectors;
     IpsecPolicies                  = ipsecPolicies;
     TrafficSelectorPolicies        = trafficSelectorPolicies;
     ResourceGuid                   = resourceGuid;
     ProvisioningState              = provisioningState;
     ExpressRouteGatewayBypass      = expressRouteGatewayBypass;
 }
        internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement element)
        {
            Optional <ExtendedLocation>              extendedLocation = default;
            Optional <PublicIPPrefixSku>             sku      = default;
            Optional <string>                        etag     = default;
            Optional <IList <string> >               zones    = default;
            Optional <string>                        name     = default;
            Optional <string>                        type     = default;
            Optional <string>                        location = default;
            Optional <IDictionary <string, string> > tags     = default;
            ResourceIdentifier                       id       = default;
            Optional <IPVersion>                     publicIPAddressVersion = default;
            Optional <IList <IpTag> >                ipTags = default;
            Optional <int>    prefixLength = default;
            Optional <string> ipPrefix     = default;
            Optional <IReadOnlyList <ReferencedPublicIpAddress> > publicIPAddresses = default;
            Optional <SubResource>       loadBalancerFrontendIpConfiguration        = default;
            Optional <SubResource>       customIPPrefix    = default;
            Optional <string>            resourceGuid      = default;
            Optional <ProvisioningState> provisioningState = default;
            Optional <NatGatewayData>    natGateway        = 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("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = PublicIPPrefixSku.DeserializePublicIPPrefixSku(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    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("publicIPAddressVersion"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicIPAddressVersion = new IPVersion(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("ipTags"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IpTag> array = new List <IpTag>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IpTag.DeserializeIpTag(item));
                            }
                            ipTags = array;
                            continue;
                        }
                        if (property0.NameEquals("prefixLength"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            prefixLength = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("ipPrefix"))
                        {
                            ipPrefix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("publicIPAddresses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ReferencedPublicIpAddress> array = new List <ReferencedPublicIpAddress>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ReferencedPublicIpAddress.DeserializeReferencedPublicIpAddress(item));
                            }
                            publicIPAddresses = array;
                            continue;
                        }
                        if (property0.NameEquals("loadBalancerFrontendIpConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            loadBalancerFrontendIpConfiguration = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("customIPPrefix"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customIPPrefix = SubResource.DeserializeSubResource(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("natGateway"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            natGateway = NatGatewayData.DeserializeNatGatewayData(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PublicIPPrefixData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(zones), Optional.ToNullable(publicIPAddressVersion), Optional.ToList(ipTags), Optional.ToNullable(prefixLength), ipPrefix.Value, Optional.ToList(publicIPAddresses), loadBalancerFrontendIpConfiguration.Value, customIPPrefix.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), natGateway.Value));
        }
Exemple #4
0
 internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string location, IReadOnlyDictionary <string, string> tags, string etag, SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState?provisioningState) : base(id, name, type, systemData, location, tags)
 {
     Etag            = etag;
     PrivateEndpoint = privateEndpoint;
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
     ProvisioningState = provisioningState;
 }
Exemple #5
0
 internal TopologyParameters(string targetResourceGroupName, SubResource targetVirtualNetwork, SubResource targetSubnet)
 {
     TargetResourceGroupName = targetResourceGroupName;
     TargetVirtualNetwork    = targetVirtualNetwork;
     TargetSubnet            = targetSubnet;
 }
        internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonElement element)
        {
            Optional <string>  name     = default;
            Optional <string>  etag     = default;
            Optional <string>  type     = default;
            ResourceIdentifier id       = default;
            Optional <string>  location = default;
            Optional <IList <GatewayLoadBalancerTunnelInterface> >      tunnelInterfaces             = default;
            Optional <IList <LoadBalancerBackendAddress> >              loadBalancerBackendAddresses = default;
            Optional <IReadOnlyList <NetworkInterfaceIPConfiguration> > backendIPConfigurations      = default;
            Optional <IReadOnlyList <SubResource> > loadBalancingRules = default;
            Optional <SubResource> outboundRule = default;
            Optional <IReadOnlyList <SubResource> > outboundRules     = default;
            Optional <ProvisioningState>            provisioningState = 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("location"))
                        {
                            location = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("tunnelInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <GatewayLoadBalancerTunnelInterface> array = new List <GatewayLoadBalancerTunnelInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(GatewayLoadBalancerTunnelInterface.DeserializeGatewayLoadBalancerTunnelInterface(item));
                            }
                            tunnelInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("loadBalancerBackendAddresses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <LoadBalancerBackendAddress> array = new List <LoadBalancerBackendAddress>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LoadBalancerBackendAddress.DeserializeLoadBalancerBackendAddress(item));
                            }
                            loadBalancerBackendAddresses = array;
                            continue;
                        }
                        if (property0.NameEquals("backendIPConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkInterfaceIPConfiguration> array = new List <NetworkInterfaceIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(item));
                            }
                            backendIPConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("loadBalancingRules"))
                        {
                            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));
                            }
                            loadBalancingRules = array;
                            continue;
                        }
                        if (property0.NameEquals("outboundRule"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            outboundRule = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("outboundRules"))
                        {
                            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));
                            }
                            outboundRules = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new BackendAddressPoolData(id, name.Value, etag.Value, type.Value, location.Value, Optional.ToList(tunnelInterfaces), Optional.ToList(loadBalancerBackendAddresses), Optional.ToList(backendIPConfigurations), Optional.ToList(loadBalancingRules), outboundRule.Value, Optional.ToList(outboundRules), Optional.ToNullable(provisioningState)));
        }
Exemple #7
0
 internal Ipv6ExpressRouteCircuitPeeringConfig(string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, SubResource routeFilter, ExpressRouteCircuitPeeringState?state)
 {
     PrimaryPeerAddressPrefix   = primaryPeerAddressPrefix;
     SecondaryPeerAddressPrefix = secondaryPeerAddressPrefix;
     MicrosoftPeeringConfig     = microsoftPeeringConfig;
     RouteFilter = routeFilter;
     State       = state;
 }
 internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState?provisioningState) : base(id, name, type, systemData)
 {
     PrivateEndpoint = privateEndpoint;
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
     ProvisioningState = provisioningState;
 }
        internal static InboundNatRuleData DeserializeInboundNatRuleData(JsonElement element)
        {
            Optional <string>      name = default;
            Optional <string>      etag = default;
            Optional <string>      type = default;
            ResourceIdentifier     id   = default;
            Optional <SubResource> frontendIPConfiguration = default;
            Optional <NetworkInterfaceIPConfiguration> backendIPConfiguration = default;
            Optional <TransportProtocol> protocol          = default;
            Optional <int>  frontendPort                   = default;
            Optional <int>  backendPort                    = default;
            Optional <int>  idleTimeoutInMinutes           = default;
            Optional <bool> enableFloatingIP               = default;
            Optional <bool> enableTcpReset                 = default;
            Optional <ProvisioningState> provisioningState = 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("frontendIPConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("backendIPConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendIPConfiguration = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("protocol"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            protocol = new TransportProtocol(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("frontendPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontendPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("backendPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("idleTimeoutInMinutes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            idleTimeoutInMinutes = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("enableFloatingIP"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableFloatingIP = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableTcpReset"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableTcpReset = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new InboundNatRuleData(id, name.Value, etag.Value, type.Value, frontendIPConfiguration.Value, backendIPConfiguration.Value, Optional.ToNullable(protocol), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(provisioningState)));
        }
 internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes?storageAccountType, SubResource diskEncryptionSet)
 {
     StorageAccountType = storageAccountType;
     DiskEncryptionSet  = diskEncryptionSet;
 }
        internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(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 <SubResource> virtualHub = default;
            Optional <IList <P2SConnectionConfiguration> > p2SConnectionConfigurations = default;
            Optional <ProvisioningState> provisioningState = default;
            Optional <int>         vpnGatewayScaleUnit     = default;
            Optional <SubResource> vpnServerConfiguration  = default;
            Optional <VpnClientConnectionHealth> vpnClientConnectionHealth = default;
            Optional <IList <string> >           customDnsServers          = default;
            Optional <bool> isRoutingPreferenceInternet = 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("virtualHub"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualHub = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("p2SConnectionConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <P2SConnectionConfiguration> array = new List <P2SConnectionConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(P2SConnectionConfiguration.DeserializeP2SConnectionConfiguration(item));
                            }
                            p2SConnectionConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(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("vpnServerConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnServerConfiguration = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("vpnClientConnectionHealth"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnClientConnectionHealth = VpnClientConnectionHealth.DeserializeVpnClientConnectionHealth(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("customDnsServers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            customDnsServers = array;
                            continue;
                        }
                        if (property0.NameEquals("isRoutingPreferenceInternet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isRoutingPreferenceInternet = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new P2SVpnGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualHub.Value, Optional.ToList(p2SConnectionConfigurations), Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), vpnServerConfiguration.Value, vpnClientConnectionHealth.Value, Optional.ToList(customDnsServers), Optional.ToNullable(isRoutingPreferenceInternet)));
        }
Exemple #12
0
        internal static IpAllocationData DeserializeIpAllocationData(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 <SubResource>      subnet                      = default;
            Optional <SubResource>      virtualNetwork              = default;
            Optional <IpAllocationType> type0                       = default;
            Optional <string>           prefix                      = default;
            Optional <int?>             prefixLength                = default;
            Optional <IPVersion>        prefixType                  = default;
            Optional <string>           ipamAllocationId            = default;
            Optional <IDictionary <string, string> > allocationTags = 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("subnet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            subnet = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("virtualNetwork"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualNetwork = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("type"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            type0 = new IpAllocationType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("prefix"))
                        {
                            prefix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("prefixLength"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                prefixLength = null;
                                continue;
                            }
                            prefixLength = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("prefixType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            prefixType = new IPVersion(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("ipamAllocationId"))
                        {
                            ipamAllocationId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("allocationTags"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, property1.Value.GetString());
                            }
                            allocationTags = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new IpAllocationData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, subnet.Value, virtualNetwork.Value, Optional.ToNullable(type0), prefix.Value, Optional.ToNullable(prefixLength), Optional.ToNullable(prefixType), ipamAllocationId.Value, Optional.ToDictionary(allocationTags)));
        }
        internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPeeringData(JsonElement element)
        {
            Optional <string>  name = default;
            Optional <string>  etag = default;
            Optional <string>  type = default;
            ResourceIdentifier id   = default;
            Optional <ExpressRoutePeeringType>  peeringType = default;
            Optional <ExpressRoutePeeringState> state       = default;
            Optional <int>    azureASN = default;
            Optional <long>   peerASN  = default;
            Optional <string> primaryPeerAddressPrefix   = default;
            Optional <string> secondaryPeerAddressPrefix = default;
            Optional <string> primaryAzurePort           = default;
            Optional <string> secondaryAzurePort         = default;
            Optional <string> sharedKey = default;
            Optional <int>    vlanId    = default;
            Optional <ExpressRouteCircuitPeeringConfig> microsoftPeeringConfig = default;
            Optional <ExpressRouteCircuitStats>         stats = default;
            Optional <ProvisioningState> provisioningState    = default;
            Optional <string>            gatewayManagerEtag   = default;
            Optional <string>            lastModifiedBy       = default;
            Optional <SubResource>       routeFilter          = default;
            Optional <Ipv6ExpressRouteCircuitPeeringConfig>               ipv6PeeringConfig      = default;
            Optional <ExpressRouteConnectionId>                           expressRouteConnection = default;
            Optional <IList <ExpressRouteCircuitConnectionData> >         connections            = default;
            Optional <IReadOnlyList <PeerExpressRouteCircuitConnection> > peeredConnections      = 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("peeringType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peeringType = new ExpressRoutePeeringType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("state"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            state = new ExpressRoutePeeringState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("azureASN"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            azureASN = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("peerASN"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peerASN = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("primaryPeerAddressPrefix"))
                        {
                            primaryPeerAddressPrefix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("secondaryPeerAddressPrefix"))
                        {
                            secondaryPeerAddressPrefix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("primaryAzurePort"))
                        {
                            primaryAzurePort = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("secondaryAzurePort"))
                        {
                            secondaryAzurePort = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("sharedKey"))
                        {
                            sharedKey = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vlanId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vlanId = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("microsoftPeeringConfig"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            microsoftPeeringConfig = ExpressRouteCircuitPeeringConfig.DeserializeExpressRouteCircuitPeeringConfig(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("stats"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            stats = ExpressRouteCircuitStats.DeserializeExpressRouteCircuitStats(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("gatewayManagerEtag"))
                        {
                            gatewayManagerEtag = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("lastModifiedBy"))
                        {
                            lastModifiedBy = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("routeFilter"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            routeFilter = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipv6PeeringConfig"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            ipv6PeeringConfig = Ipv6ExpressRouteCircuitPeeringConfig.DeserializeIpv6ExpressRouteCircuitPeeringConfig(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("expressRouteConnection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            expressRouteConnection = ExpressRouteConnectionId.DeserializeExpressRouteConnectionId(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("connections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ExpressRouteCircuitConnectionData> array = new List <ExpressRouteCircuitConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ExpressRouteCircuitConnectionData.DeserializeExpressRouteCircuitConnectionData(item));
                            }
                            connections = array;
                            continue;
                        }
                        if (property0.NameEquals("peeredConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PeerExpressRouteCircuitConnection> array = new List <PeerExpressRouteCircuitConnection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnection(item));
                            }
                            peeredConnections = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRouteCircuitPeeringData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, stats.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, routeFilter.Value, ipv6PeeringConfig.Value, expressRouteConnection.Value, Optional.ToList(connections), Optional.ToList(peeredConnections)));
        }
Exemple #14
0
        internal static SecurityPartnerProviderData DeserializeSecurityPartnerProviderData(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 <ProvisioningState>    provisioningState    = default;
            Optional <SecurityProviderName> securityProviderName = default;
            Optional <SecurityPartnerProviderConnectionStatus> connectionStatus = default;
            Optional <SubResource> virtualHub = 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("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("securityProviderName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            securityProviderName = new SecurityProviderName(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("connectionStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectionStatus = new SecurityPartnerProviderConnectionStatus(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualHub"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualHub = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SecurityPartnerProviderData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(securityProviderName), Optional.ToNullable(connectionStatus), virtualHub.Value));
        }
Exemple #15
0
        public override void ExecuteCmdlet()
        {
            if (this.VM.OSProfile == null)
            {
                this.VM.OSProfile = new OSProfile();
            }

            if (this.VM.OSProfile.Secrets == null)
            {
                this.VM.OSProfile.Secrets = new List <VaultSecretGroup>();
            }

            int i = 0;

            for (; i <= this.VM.OSProfile.Secrets.Count; i++)
            {
                if (i == this.VM.OSProfile.Secrets.Count)
                {
                    var sourceVault = new SubResource
                    {
                        Id = this.SourceVaultId
                    };

                    var vaultCertificates = new List <VaultCertificate> {
                        new VaultCertificate()
                        {
                            CertificateStore = this.CertificateStore,
                            CertificateUrl   = this.CertificateUrl,
                        }
                    };

                    this.VM.OSProfile.Secrets.Add(
                        new VaultSecretGroup()
                    {
                        SourceVault       = sourceVault,
                        VaultCertificates = vaultCertificates,
                    });

                    break;
                }

                if (this.VM.OSProfile.Secrets[i].SourceVault != null && this.VM.OSProfile.Secrets[i].SourceVault.Id.Equals(this.SourceVaultId))
                {
                    if (this.VM.OSProfile.Secrets[i].VaultCertificates == null)
                    {
                        this.VM.OSProfile.Secrets[i].VaultCertificates = new List <VaultCertificate>();
                    }

                    this.VM.OSProfile.Secrets[i].VaultCertificates.Add(
                        new VaultCertificate()
                    {
                        CertificateStore = this.CertificateStore,
                        CertificateUrl   = this.CertificateUrl,
                    });

                    break;
                }
            }

            WriteObject(this.VM);
        }
Exemple #16
0
 internal ExpressRouteCircuitPeeringData(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, ExpressRoutePeeringType?peeringType, ExpressRoutePeeringState?state, int?azureASN, long?peerASN, string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, string primaryAzurePort, string secondaryAzurePort, string sharedKey, int?vlanId, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, ExpressRouteCircuitStats stats, NetworkProvisioningState?provisioningState, string gatewayManagerEtag, string lastModifiedBy, WritableSubResource routeFilter, IPv6ExpressRouteCircuitPeeringConfig iPv6PeeringConfig, SubResource expressRouteConnection, IList <ExpressRouteCircuitConnectionData> connections, IReadOnlyList <PeerExpressRouteCircuitConnectionData> peeredConnections) : base(id, name, resourceType)
 {
     Etag        = etag;
     PeeringType = peeringType;
     State       = state;
     AzureASN    = azureASN;
     PeerASN     = peerASN;
     PrimaryPeerAddressPrefix   = primaryPeerAddressPrefix;
     SecondaryPeerAddressPrefix = secondaryPeerAddressPrefix;
     PrimaryAzurePort           = primaryAzurePort;
     SecondaryAzurePort         = secondaryAzurePort;
     SharedKey = sharedKey;
     VlanId    = vlanId;
     MicrosoftPeeringConfig = microsoftPeeringConfig;
     Stats                  = stats;
     ProvisioningState      = provisioningState;
     GatewayManagerEtag     = gatewayManagerEtag;
     LastModifiedBy         = lastModifiedBy;
     RouteFilter            = routeFilter;
     IPv6PeeringConfig      = iPv6PeeringConfig;
     ExpressRouteConnection = expressRouteConnection;
     Connections            = connections;
     PeeredConnections      = peeredConnections;
 }
Exemple #17
0
 internal EffectiveNetworkSecurityGroupAssociation(SubResource networkManager, SubResource subnet, SubResource networkInterface)
 {
     NetworkManager   = networkManager;
     Subnet           = subnet;
     NetworkInterface = networkInterface;
 }
        ///GENMHASH:B2EB74D988CD2A7EFC551E57BE9B48BB:4FFCDCB491AE20C1268464BD73D55EF2
        protected override async Task <INetworkPeering> CreateChildResourceAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            NetworkPeeringImpl localPeering = this;
            string             networkName  = ResourceUtils.NameFromResourceId(NetworkId());
            var inner = await Manager.Inner.VirtualNetworkPeerings.CreateOrUpdateAsync(
                parent.ResourceGroupName, networkName, Name, Inner);

            if (inner == null)
            {
                return(null);
            }

            // After successful creation, update the inner
            SetInner(inner);

            // Then get the remote network to update it if needed and in the same subscription
            SubResource networkRef    = inner.RemoteVirtualNetwork;
            INetwork    remoteNetwork = null;

            if (localPeering.IsSameSubscription())
            {
                // Update the remote network only if it is in the same subscription
                remoteNetwork = await localPeering.Manager.Networks.GetByIdAsync(networkRef.Id);
            }

            // Then update the existing remote network if needed
            INetworkPeering remotePeering = null;

            if (remoteNetwork != null)
            {
                // Check if any peering is already pointing at this network
                var remotePeerings = await remoteNetwork.Peerings.ListAsync();

                remotePeering = remotePeerings.FirstOrDefault(p => p.RemoteNetworkId != null && p.RemoteNetworkId.Equals(localPeering.parent.Id, StringComparison.OrdinalIgnoreCase));
            }

            // Depending on the existence of a matching remote peering, create one or update existing
            if (remotePeering != null)
            {
                // Matching peering exists, so update as needed
                var  remotePeeringUpdate = remotePeering.Update();
                bool isUpdateNeeded      = false;

                // Update traffic forwarding on the remote peering if needed
                if (localPeering.remoteForwarding == null)
                {
                    // No traffic forwarding change, so ignore
                }
                else if (localPeering.remoteForwarding.Value && !remotePeering.IsTrafficForwardingFromRemoteNetworkAllowed)
                {
                    isUpdateNeeded      = true;
                    remotePeeringUpdate = remotePeeringUpdate.WithTrafficForwardingFromRemoteNetwork();
                }
                else if (!localPeering.remoteForwarding.Value && remotePeering.IsTrafficForwardingFromRemoteNetworkAllowed)
                {
                    isUpdateNeeded      = true;
                    remotePeeringUpdate = remotePeeringUpdate.WithoutTrafficForwardingFromRemoteNetwork();
                }

                // Update network access on the remote peering if needed
                if (localPeering.remoteAccess == null)
                {
                    // No access change, so ignore
                }
                else if (localPeering.remoteAccess.Value && !((NetworkPeeringImpl)remotePeering).IsAccessFromRemoteNetworkAllowed())
                {
                    isUpdateNeeded      = true;
                    remotePeeringUpdate = ((NetworkPeeringImpl)remotePeeringUpdate).WithAccessFromRemoteNetwork();
                }
                else if (!localPeering.remoteAccess.Value && ((NetworkPeeringImpl)remotePeering).IsAccessFromRemoteNetworkAllowed())
                {
                    isUpdateNeeded      = true;
                    remotePeeringUpdate = ((NetworkPeeringImpl)remotePeeringUpdate).WithoutAccessFromRemoteNetwork();
                }

                // Update gateway use permission on the remote peering if needed
                if (localPeering.allowGatewayUseOnRemoteNetwork == null)
                {
                    // No change, so ignore
                }
                else if (localPeering.allowGatewayUseOnRemoteNetwork.Value && remotePeering.GatewayUse != NetworkPeeringGatewayUse.ByRemoteNetwork)
                {
                    // Allow gateway use on remote network
                    isUpdateNeeded = true;
                    remotePeeringUpdate.WithGatewayUseByRemoteNetworkAllowed();
                }
                else if (!localPeering.allowGatewayUseOnRemoteNetwork.Value && remotePeering.GatewayUse == NetworkPeeringGatewayUse.ByRemoteNetwork)
                {
                    // Disallow gateway use on remote network
                    isUpdateNeeded = true;
                    remotePeeringUpdate.WithoutGatewayUseByRemoteNetwork();
                }

                // Update gateway use start on the remote peering if needed
                if (localPeering.startGatewayUseByRemoteNetwork == null)
                {
                    // No change, so ignore
                }
                else if (localPeering.startGatewayUseByRemoteNetwork.Value && remotePeering.GatewayUse != NetworkPeeringGatewayUse.OnRemoteNetwork)
                {
                    remotePeeringUpdate.WithGatewayUseOnRemoteNetworkStarted();
                    isUpdateNeeded = true;
                }
                else if (!localPeering.startGatewayUseByRemoteNetwork.Value && remotePeering.GatewayUse == NetworkPeeringGatewayUse.OnRemoteNetwork)
                {
                    remotePeeringUpdate.WithoutGatewayUseOnRemoteNetwork();
                    isUpdateNeeded = true;
                }

                if (isUpdateNeeded)
                {
                    localPeering.remoteForwarding = null;
                    localPeering.remoteAccess     = null;
                    localPeering.startGatewayUseByRemoteNetwork = null;
                    localPeering.allowGatewayUseOnRemoteNetwork = null;
                    await remotePeeringUpdate.ApplyAsync();
                }
            }

            else
            {
                // No matching remote peering, so create one on the remote network
                string peeringName             = SdkContext.RandomResourceName("peer", 15);
                var    remotePeeringDefinition = remoteNetwork.Peerings.Define(peeringName)
                                                 .WithRemoteNetwork(localPeering.parent.Id);

                // Process remote network's UseRemoteGateways setting
                if (localPeering.startGatewayUseByRemoteNetwork == null)
                {
                    // Do nothing
                }
                else if (localPeering.startGatewayUseByRemoteNetwork.Value)
                {
                    // Start gateway use on this network by the remote network
                    remotePeeringDefinition.WithGatewayUseOnRemoteNetworkStarted();
                }

                // Process remote network's AllowGatewayTransit setting
                if (localPeering.allowGatewayUseOnRemoteNetwork == null)
                {
                    // Do nothing
                }
                else if (localPeering.allowGatewayUseOnRemoteNetwork.Value)
                {
                    // Allow gateway use on remote network
                    remotePeeringDefinition.WithGatewayUseByRemoteNetworkAllowed();
                }

                if (localPeering.remoteAccess != null && !localPeering.remoteAccess.Value)
                {
                    ((NetworkPeeringImpl)remotePeeringDefinition).WithoutAccessFromRemoteNetwork(); // Assumes by default access is on for new peerings
                }

                if (localPeering.remoteForwarding != null && localPeering.remoteForwarding.Value)
                {
                    remotePeeringDefinition.WithTrafficForwardingFromRemoteNetwork(); // Assumes by default forwarding is off for new peerings
                }

                localPeering.remoteAccess     = null;
                localPeering.remoteForwarding = null;
                localPeering.startGatewayUseByRemoteNetwork = null;
                localPeering.allowGatewayUseOnRemoteNetwork = null;
                return(await remotePeeringDefinition.CreateAsync());
            }

            // Then refresh the parent local network, if available
            if (localPeering.parent != null)
            {
                await localPeering.parent.RefreshAsync();
            }

            // Then refresh the remote network, if available and in the same subscription
            if (localPeering.remoteNetwork != null && localPeering.IsSameSubscription())
            {
                await localPeering.remoteNetwork.RefreshAsync();
            }

            // Then return the created local peering
            return(localPeering);
        }
Exemple #19
0
 internal MhsmPrivateEndpointConnectionItem(SubResource privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState?provisioningState)
 {
     PrivateEndpoint = privateEndpoint;
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
     ProvisioningState = provisioningState;
 }
 internal ImageOSDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes?caching, int?diskSizeGB, StorageAccountTypes?storageAccountType, SubResource diskEncryptionSet, OperatingSystemTypes osType, OperatingSystemStateTypes osState) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet)
 {
     OsType  = osType;
     OsState = osState;
 }
Exemple #21
0
        public override void ExecuteCmdlet()
        {
            WriteWarning("Add-AzureRmVMSecret: A property of the output of this cmdlet will change in an upcoming breaking change release. " +
                         "The StorageAccountType property for a DataDisk will return Standard_LRS and Premium_LRS");

            if (this.VM.OSProfile == null)
            {
                this.VM.OSProfile = new OSProfile();
            }

            if (this.VM.OSProfile.Secrets == null)
            {
                this.VM.OSProfile.Secrets = new List <VaultSecretGroup>();
            }

            int i = 0;

            for (; i <= this.VM.OSProfile.Secrets.Count; i++)
            {
                if (i == this.VM.OSProfile.Secrets.Count)
                {
                    var sourceVault = new SubResource
                    {
                        Id = this.SourceVaultId
                    };

                    var vaultCertificates = new List <VaultCertificate> {
                        new VaultCertificate()
                        {
                            CertificateStore = this.CertificateStore,
                            CertificateUrl   = this.CertificateUrl,
                        }
                    };

                    this.VM.OSProfile.Secrets.Add(
                        new VaultSecretGroup()
                    {
                        SourceVault       = sourceVault,
                        VaultCertificates = vaultCertificates,
                    });

                    break;
                }

                if (this.VM.OSProfile.Secrets[i].SourceVault != null && this.VM.OSProfile.Secrets[i].SourceVault.Id.Equals(this.SourceVaultId))
                {
                    if (this.VM.OSProfile.Secrets[i].VaultCertificates == null)
                    {
                        this.VM.OSProfile.Secrets[i].VaultCertificates = new List <VaultCertificate>();
                    }

                    this.VM.OSProfile.Secrets[i].VaultCertificates.Add(
                        new VaultCertificate()
                    {
                        CertificateStore = this.CertificateStore,
                        CertificateUrl   = this.CertificateUrl,
                    });

                    break;
                }
            }

            WriteObject(this.VM);
        }
 internal IpAllocationData(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, SubResource subnet, SubResource virtualNetwork, IpAllocationType?typePropertiesType, string prefix, int?prefixLength, IPVersion?prefixType, string ipamAllocationId, IDictionary <string, string> allocationTags) : base(id, name, type, location, tags)
 {
     Etag               = etag;
     Subnet             = subnet;
     VirtualNetwork     = virtualNetwork;
     TypePropertiesType = typePropertiesType;
     Prefix             = prefix;
     PrefixLength       = prefixLength;
     PrefixType         = prefixType;
     IpamAllocationId   = ipamAllocationId;
     AllocationTags     = allocationTags;
 }
 /// <summary>
 /// Initializes a new instance of the
 /// VirtualNetworkGatewayConnectionInner class.
 /// </summary>
 /// <param name="virtualNetworkGateway1">The reference to virtual
 /// network gateway resource.</param>
 /// <param name="connectionType">Gateway connection type. Possible
 /// values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient.
 /// Possible values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute',
 /// 'VPNClient'</param>
 /// <param name="authorizationKey">The authorizationKey.</param>
 /// <param name="virtualNetworkGateway2">The reference to virtual
 /// network gateway resource.</param>
 /// <param name="localNetworkGateway2">The reference to local network
 /// gateway resource.</param>
 /// <param name="routingWeight">The routing weight.</param>
 /// <param name="sharedKey">The IPSec shared key.</param>
 /// <param name="connectionStatus">Virtual network Gateway connection
 /// status. Possible values are 'Unknown', 'Connecting', 'Connected'
 /// and 'NotConnected'. Possible values include: 'Unknown',
 /// 'Connecting', 'Connected', 'NotConnected'</param>
 /// <param name="tunnelConnectionStatus">Collection of all tunnels'
 /// connection health status.</param>
 /// <param name="egressBytesTransferred">The egress bytes transferred
 /// in this connection.</param>
 /// <param name="ingressBytesTransferred">The ingress bytes transferred
 /// in this connection.</param>
 /// <param name="peer">The reference to peerings resource.</param>
 /// <param name="enableBgp">EnableBgp flag</param>
 /// <param name="usePolicyBasedTrafficSelectors">Enable policy-based
 /// traffic selectors.</param>
 /// <param name="ipsecPolicies">The IPSec Policies to be considered by
 /// this connection.</param>
 /// <param name="resourceGuid">The resource GUID property of the
 /// VirtualNetworkGatewayConnection resource.</param>
 /// <param name="provisioningState">The provisioning state of the
 /// VirtualNetworkGatewayConnection resource. Possible values are:
 /// 'Updating', 'Deleting', and 'Failed'.</param>
 /// <param name="etag">Gets a unique read-only string that changes
 /// whenever the resource is updated.</param>
 public VirtualNetworkGatewayConnectionInner(SubResource virtualNetworkGateway1, string connectionType, string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string authorizationKey = default(string), SubResource virtualNetworkGateway2 = default(SubResource), SubResource localNetworkGateway2 = default(SubResource), int?routingWeight = default(int?), string sharedKey = default(string), string connectionStatus = default(string), IList <TunnelConnectionHealth> tunnelConnectionStatus = default(IList <TunnelConnectionHealth>), long?egressBytesTransferred = default(long?), long?ingressBytesTransferred = default(long?), Microsoft.Azure.Management.ResourceManager.Fluent.SubResource peer = default(Microsoft.Azure.Management.ResourceManager.Fluent.SubResource), bool?enableBgp = default(bool?), bool?usePolicyBasedTrafficSelectors = default(bool?), IList <IpsecPolicy> ipsecPolicies = default(IList <IpsecPolicy>), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string))
     : base(location, id, name, type, tags)
 {
     AuthorizationKey       = authorizationKey;
     VirtualNetworkGateway1 = virtualNetworkGateway1;
     VirtualNetworkGateway2 = virtualNetworkGateway2;
     LocalNetworkGateway2   = localNetworkGateway2;
     ConnectionType         = connectionType;
     RoutingWeight          = routingWeight;
     SharedKey               = sharedKey;
     ConnectionStatus        = connectionStatus;
     TunnelConnectionStatus  = tunnelConnectionStatus;
     EgressBytesTransferred  = egressBytesTransferred;
     IngressBytesTransferred = ingressBytesTransferred;
     Peer      = peer;
     EnableBgp = enableBgp;
     UsePolicyBasedTrafficSelectors = usePolicyBasedTrafficSelectors;
     IpsecPolicies     = ipsecPolicies;
     ResourceGuid      = resourceGuid;
     ProvisioningState = provisioningState;
     Etag = etag;
     CustomInit();
 }
Exemple #24
0
        private void Run()
        {
            // Sku
            Sku vSku = null;

            // Plan
            Plan vPlan = null;

            // UpgradePolicy
            UpgradePolicy vUpgradePolicy = null;

            // VirtualMachineProfile
            VirtualMachineScaleSetVMProfile vVirtualMachineProfile = null;

            // ProximityPlacementGroup
            SubResource vProximityPlacementGroup = null;

            // AdditionalCapabilities
            AdditionalCapabilities vAdditionalCapabilities = null;

            // Identity
            VirtualMachineScaleSetIdentity vIdentity = null;

            if (this.IsParameterBound(c => c.SkuName))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Name = this.SkuName;
            }

            if (this.IsParameterBound(c => c.SkuTier))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Tier = this.SkuTier;
            }

            if (this.IsParameterBound(c => c.SkuCapacity))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Capacity = this.SkuCapacity;
            }

            if (this.IsParameterBound(c => c.PlanName))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Name = this.PlanName;
            }

            if (this.IsParameterBound(c => c.PlanPublisher))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Publisher = this.PlanPublisher;
            }

            if (this.IsParameterBound(c => c.PlanProduct))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Product = this.PlanProduct;
            }

            if (this.IsParameterBound(c => c.PlanPromotionCode))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.PromotionCode = this.PlanPromotionCode;
            }

            if (this.IsParameterBound(c => c.UpgradePolicyMode))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                vUpgradePolicy.Mode = this.UpgradePolicyMode;
            }

            if (this.IsParameterBound(c => c.RollingUpgradePolicy))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                vUpgradePolicy.RollingUpgradePolicy = this.RollingUpgradePolicy;
            }

            if (vUpgradePolicy == null)
            {
                vUpgradePolicy = new UpgradePolicy();
            }
            if (vUpgradePolicy.AutomaticOSUpgradePolicy == null)
            {
                vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy();
            }
            vUpgradePolicy.AutomaticOSUpgradePolicy.EnableAutomaticOSUpgrade = this.AutoOSUpgrade.IsPresent;

            if (this.IsParameterBound(c => c.DisableAutoRollback))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                if (vUpgradePolicy.AutomaticOSUpgradePolicy == null)
                {
                    vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy();
                }
                vUpgradePolicy.AutomaticOSUpgradePolicy.DisableAutomaticRollback = this.DisableAutoRollback;
            }

            if (this.IsParameterBound(c => c.OsProfile))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.OsProfile = this.OsProfile;
            }

            if (this.IsParameterBound(c => c.StorageProfile))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.StorageProfile = this.StorageProfile;
            }

            if (this.IsParameterBound(c => c.HealthProbeId))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile == null)
                {
                    vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile.HealthProbe == null)
                {
                    vVirtualMachineProfile.NetworkProfile.HealthProbe = new ApiEntityReference();
                }
                vVirtualMachineProfile.NetworkProfile.HealthProbe.Id = this.HealthProbeId;
            }

            if (this.IsParameterBound(c => c.NetworkInterfaceConfiguration))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile == null)
                {
                    vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile();
                }
                vVirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = this.NetworkInterfaceConfiguration;
            }

            if (this.IsParameterBound(c => c.BootDiagnostic))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.DiagnosticsProfile == null)
                {
                    vVirtualMachineProfile.DiagnosticsProfile = new DiagnosticsProfile();
                }
                vVirtualMachineProfile.DiagnosticsProfile.BootDiagnostics = this.BootDiagnostic;
            }

            if (this.IsParameterBound(c => c.Extension))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ExtensionProfile == null)
                {
                    vVirtualMachineProfile.ExtensionProfile = new VirtualMachineScaleSetExtensionProfile();
                }
                vVirtualMachineProfile.ExtensionProfile.Extensions = this.Extension;
            }

            if (this.IsParameterBound(c => c.LicenseType))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.LicenseType = this.LicenseType;
            }

            if (this.IsParameterBound(c => c.Priority))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.Priority = this.Priority;
            }

            if (this.IsParameterBound(c => c.EvictionPolicy))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.EvictionPolicy = this.EvictionPolicy;
            }

            if (this.TerminateScheduledEvents.IsPresent)
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile();
                }
                vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.Enable = this.TerminateScheduledEvents.IsPresent;
            }

            if (this.IsParameterBound(c => c.TerminateScheduledEventNotBeforeTimeoutInMinutes))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new VirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile();
                }
                vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.NotBeforeTimeout = XmlConvert.ToString(new TimeSpan(0, this.TerminateScheduledEventNotBeforeTimeoutInMinutes, 0));
            }

            if (this.IsParameterBound(c => c.ProximityPlacementGroupId))
            {
                if (vProximityPlacementGroup == null)
                {
                    vProximityPlacementGroup = new SubResource();
                }
                vProximityPlacementGroup.Id = this.ProximityPlacementGroupId;
            }

            if (this.EnableUltraSSD.IsPresent)
            {
                if (vAdditionalCapabilities == null)
                {
                    vAdditionalCapabilities = new AdditionalCapabilities(true);
                }
            }

            if (this.AssignIdentity.IsPresent)
            {
                if (vIdentity == null)
                {
                    vIdentity = new VirtualMachineScaleSetIdentity();
                }
                vIdentity.Type = ResourceIdentityType.SystemAssigned;
            }

            if (this.IsParameterBound(c => c.IdentityType))
            {
                if (vIdentity == null)
                {
                    vIdentity = new VirtualMachineScaleSetIdentity();
                }
                vIdentity.Type = this.IdentityType;
            }

            if (this.IsParameterBound(c => c.IdentityId))
            {
                if (vIdentity == null)
                {
                    vIdentity = new VirtualMachineScaleSetIdentity();
                }

                vIdentity.UserAssignedIdentities = new Dictionary <string, VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue>();

                foreach (var id in this.IdentityId)
                {
                    vIdentity.UserAssignedIdentities.Add(id, new VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue());
                }
            }

            var vVirtualMachineScaleSet = new PSVirtualMachineScaleSet
            {
                Overprovision            = this.IsParameterBound(c => c.Overprovision) ? this.Overprovision : (bool?)null,
                SinglePlacementGroup     = this.IsParameterBound(c => c.SinglePlacementGroup) ? this.SinglePlacementGroup : (bool?)null,
                ZoneBalance              = this.ZoneBalance.IsPresent ? true : (bool?)null,
                PlatformFaultDomainCount = this.IsParameterBound(c => c.PlatformFaultDomainCount) ? this.PlatformFaultDomainCount : (int?)null,
                Zones                   = this.IsParameterBound(c => c.Zone) ? this.Zone : null,
                Location                = this.IsParameterBound(c => c.Location) ? this.Location : null,
                Tags                    = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                Sku                     = vSku,
                Plan                    = vPlan,
                UpgradePolicy           = vUpgradePolicy,
                VirtualMachineProfile   = vVirtualMachineProfile,
                ProximityPlacementGroup = vProximityPlacementGroup,
                AdditionalCapabilities  = vAdditionalCapabilities,
                Identity                = vIdentity,
            };

            WriteObject(vVirtualMachineScaleSet);
        }
Exemple #25
0
 internal AppBuildProperties(string relativePath, string builder, string agentPool, AppBuildProvisioningState?provisioningState, IDictionary <string, string> env, SubResource triggeredBuildResult)
 {
     RelativePath      = relativePath;
     Builder           = builder;
     AgentPool         = agentPool;
     ProvisioningState = provisioningState;
     Env = env;
     TriggeredBuildResult = triggeredBuildResult;
 }
 internal MhsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ManagedHsmSku sku, string etag, SubResource privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState?provisioningState) : base(id, name, resourceType, systemData, tags, location, sku)
 {
     Etag            = etag;
     PrivateEndpoint = privateEndpoint;
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
     ProvisioningState = provisioningState;
 }
Exemple #27
0
        private void Run()
        {
            var vIpConfigurations = new VirtualMachineScaleSetIPConfiguration();

            vIpConfigurations.Name    = this.IsParameterBound(c => c.Name) ? this.Name : null;
            vIpConfigurations.Primary = this.Primary.IsPresent;
            vIpConfigurations.PrivateIPAddressVersion = this.IsParameterBound(c => c.PrivateIPAddressVersion) ? this.PrivateIPAddressVersion : null;
            vIpConfigurations.Id = this.IsParameterBound(c => c.Id) ? this.Id : null;

            // SubnetId
            if (this.IsParameterBound(c => c.SubnetId))
            {
                if (vIpConfigurations.Subnet == null)
                {
                    vIpConfigurations.Subnet = new ApiEntityReference();
                }

                vIpConfigurations.Subnet.Id = this.SubnetId;
            }

            // PublicIPAddressConfigurationName
            if (this.IsParameterBound(c => c.PublicIPAddressConfigurationName))
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }

                vIpConfigurations.PublicIPAddressConfiguration.Name = this.PublicIPAddressConfigurationName;
            }

            // PublicIPAddressConfigurationIdleTimeoutInMinutes
            if (this.IsParameterBound(c => c.PublicIPAddressConfigurationIdleTimeoutInMinutes))
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }

                vIpConfigurations.PublicIPAddressConfiguration.IdleTimeoutInMinutes = this.PublicIPAddressConfigurationIdleTimeoutInMinutes;
            }

            // DnsSetting
            if (this.IsParameterBound(c => c.DnsSetting))
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }
                if (vIpConfigurations.PublicIPAddressConfiguration.DnsSettings == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration.DnsSettings = new VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings();
                }

                vIpConfigurations.PublicIPAddressConfiguration.DnsSettings.DomainNameLabel = this.DnsSetting;
            }

            // IpTag
            if (this.IpTag != null)
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }
                if (vIpConfigurations.PublicIPAddressConfiguration.IpTags == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration.IpTags = new List <VirtualMachineScaleSetIpTag>();
                }
                foreach (var element in this.IpTag)
                {
                    vIpConfigurations.PublicIPAddressConfiguration.IpTags.Add(element);
                }
            }

            // PublicIPPrefix
            if (this.IsParameterBound(c => c.PublicIPPrefix))
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }
                if (vIpConfigurations.PublicIPAddressConfiguration.PublicIPPrefix == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration.PublicIPPrefix = new SubResource();
                }

                vIpConfigurations.PublicIPAddressConfiguration.PublicIPPrefix.Id = this.PublicIPPrefix;
            }

            // PublicIPAddressVersion
            if (this.IsParameterBound(c => c.PublicIPAddressVersion))
            {
                if (vIpConfigurations.PublicIPAddressConfiguration == null)
                {
                    vIpConfigurations.PublicIPAddressConfiguration = new VirtualMachineScaleSetPublicIPAddressConfiguration();
                }

                vIpConfigurations.PublicIPAddressConfiguration.PublicIPAddressVersion = this.PublicIPAddressVersion;
            }

            // ApplicationGatewayBackendAddressPoolsId
            if (this.ApplicationGatewayBackendAddressPoolsId != null)
            {
                if (vIpConfigurations.ApplicationGatewayBackendAddressPools == null)
                {
                    vIpConfigurations.ApplicationGatewayBackendAddressPools = new List <SubResource>();
                }
                foreach (var element in this.ApplicationGatewayBackendAddressPoolsId)
                {
                    var vApplicationGatewayBackendAddressPools = new SubResource();
                    vApplicationGatewayBackendAddressPools.Id = element;
                    vIpConfigurations.ApplicationGatewayBackendAddressPools.Add(vApplicationGatewayBackendAddressPools);
                }
            }

            // LoadBalancerBackendAddressPoolsId
            if (this.LoadBalancerBackendAddressPoolsId != null)
            {
                if (vIpConfigurations.LoadBalancerBackendAddressPools == null)
                {
                    vIpConfigurations.LoadBalancerBackendAddressPools = new List <SubResource>();
                }
                foreach (var element in this.LoadBalancerBackendAddressPoolsId)
                {
                    var vLoadBalancerBackendAddressPools = new SubResource();
                    vLoadBalancerBackendAddressPools.Id = element;
                    vIpConfigurations.LoadBalancerBackendAddressPools.Add(vLoadBalancerBackendAddressPools);
                }
            }

            // LoadBalancerInboundNatPoolsId
            if (this.LoadBalancerInboundNatPoolsId != null)
            {
                if (vIpConfigurations.LoadBalancerInboundNatPools == null)
                {
                    vIpConfigurations.LoadBalancerInboundNatPools = new List <SubResource>();
                }
                foreach (var element in this.LoadBalancerInboundNatPoolsId)
                {
                    var vLoadBalancerInboundNatPools = new SubResource();
                    vLoadBalancerInboundNatPools.Id = element;
                    vIpConfigurations.LoadBalancerInboundNatPools.Add(vLoadBalancerInboundNatPools);
                }
            }

            WriteObject(vIpConfigurations);
        }
Exemple #28
0
 internal AzureFirewallData(string id, string name, string type, string location, IDictionary <string, string> tags, IList <string> zones, string etag, IList <AzureFirewallApplicationRuleCollection> applicationRuleCollections, IList <AzureFirewallNatRuleCollection> natRuleCollections, IList <AzureFirewallNetworkRuleCollection> networkRuleCollections, IList <AzureFirewallIPConfiguration> ipConfigurations, AzureFirewallIPConfiguration managementIpConfiguration, ProvisioningState?provisioningState, AzureFirewallThreatIntelMode?threatIntelMode, SubResource virtualHub, SubResource firewallPolicy, HubIPAddresses hubIPAddresses, IReadOnlyList <AzureFirewallIpGroups> ipGroups, AzureFirewallSku sku, IDictionary <string, string> additionalProperties) : base(id, name, type, location, tags)
 {
     Zones = zones;
     Etag  = etag;
     ApplicationRuleCollections = applicationRuleCollections;
     NatRuleCollections         = natRuleCollections;
     NetworkRuleCollections     = networkRuleCollections;
     IpConfigurations           = ipConfigurations;
     ManagementIpConfiguration  = managementIpConfiguration;
     ProvisioningState          = provisioningState;
     ThreatIntelMode            = threatIntelMode;
     VirtualHub           = virtualHub;
     FirewallPolicy       = firewallPolicy;
     HubIPAddresses       = hubIPAddresses;
     IpGroups             = ipGroups;
     Sku                  = sku;
     AdditionalProperties = additionalProperties;
 }
Exemple #29
0
 internal ApplicationGatewayOnDemandProbe(ApplicationGatewayProtocol?protocol, string host, string path, int?timeout, bool?pickHostNameFromBackendHttpSettings, ApplicationGatewayProbeHealthResponseMatch match, SubResource backendAddressPool, SubResource backendHttpSettings)
 {
     Protocol = protocol;
     Host     = host;
     Path     = path;
     Timeout  = timeout;
     PickHostNameFromBackendHttpSettings = pickHostNameFromBackendHttpSettings;
     Match = match;
     BackendAddressPool  = backendAddressPool;
     BackendHttpSettings = backendHttpSettings;
 }
        public override void ExecuteCmdlet()
        {
            if (this.VM.OSProfile == null)
            {
                this.VM.OSProfile = new OSProfile();
            }

            if (this.VM.OSProfile.Secrets == null)
            {
                this.VM.OSProfile.Secrets = new List<VaultSecretGroup>();
            }

            int i = 0;

            for(; i <= this.VM.OSProfile.Secrets.Count; i++)
            {
                if (i == this.VM.OSProfile.Secrets.Count)
                {
                    var sourceVault = new SubResource {
                        Id = this.SourceVaultId
                    };

                    var vaultCertificates = new List<VaultCertificate>{
                        new VaultCertificate()
                        {
                            CertificateStore = this.CertificateStore,
                            CertificateUrl = this.CertificateUrl,
                        }
                    };

                    this.VM.OSProfile.Secrets.Add(
                        new VaultSecretGroup()
                        {
                            SourceVault = sourceVault,
                            VaultCertificates = vaultCertificates,
                        });

                    break;
                }

                if (this.VM.OSProfile.Secrets[i].SourceVault != null && this.VM.OSProfile.Secrets[i].SourceVault.Id.Equals(this.SourceVaultId))
                {
                    if (this.VM.OSProfile.Secrets[i].VaultCertificates == null)
                    {
                        this.VM.OSProfile.Secrets[i].VaultCertificates = new List<VaultCertificate>();
                    }

                    this.VM.OSProfile.Secrets[i].VaultCertificates.Add(
                        new VaultCertificate()
                        {
                            CertificateStore = this.CertificateStore,
                            CertificateUrl = this.CertificateUrl,
                        });

                    break;
                }
            }

            WriteObject(this.VM);
        }
 internal RemotePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, string kind, string provisioningState, SubResource privateEndpoint, PrivateLinkConnectionState privateLinkServiceConnectionState, IList <string> ipAddresses) : base(id, name, type, systemData, kind)
 {
     ProvisioningState = provisioningState;
     PrivateEndpoint   = privateEndpoint;
     PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
     IpAddresses = ipAddresses;
 }