Exemple #1
0
        private PSPrivateEndpoint CreatePSPrivateEndpoint()
        {
            var psPrivateEndpoint = new PSPrivateEndpoint
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                Location          = Location,
                Subnet            = Subnet
            };

            if (this.ByManualRequest.IsPresent)
            {
                psPrivateEndpoint.ManualPrivateLinkServiceConnections = this.PrivateLinkServiceConnection.ToList();
            }
            else
            {
                psPrivateEndpoint.PrivateLinkServiceConnections = this.PrivateLinkServiceConnection.ToList();
            }

            var peModel = NetworkResourceManagerProfile.Mapper.Map <MNM.PrivateEndpoint>(psPrivateEndpoint);

            peModel.Tags = TagsConversionHelper.CreateTagDictionary(Tag, validate: true);

            this.PrivateEndpointClient.CreateOrUpdate(ResourceGroupName, Name, peModel);
            var getPrivateEndpoint = GetPrivateEndpoint(ResourceGroupName, Name);

            return(getPrivateEndpoint);
        }
Exemple #2
0
        private PSPrivateEndpoint CreatePSPrivateEndpoint()
        {
            var psPrivateEndpoint = new PSPrivateEndpoint
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                Location          = Location,
                Subnet            = Subnet
            };

            if (this.ByManualRequest.IsPresent)
            {
                psPrivateEndpoint.ManualPrivateLinkServiceConnections = this.PrivateLinkServiceConnection.ToList();
            }
            else
            {
                psPrivateEndpoint.PrivateLinkServiceConnections = this.PrivateLinkServiceConnection.ToList();
            }

            if (!string.IsNullOrEmpty(this.EdgeZone))
            {
                psPrivateEndpoint.ExtendedLocation = new PSExtendedLocation(this.EdgeZone);
            }

            // Add support for new properties ApplicationSecurityGroup, IpConfiguration, CustomNetworkInterfaceName
            if (this.ApplicationSecurityGroup != null && this.ApplicationSecurityGroup.Length > 0)
            {
                psPrivateEndpoint._psApplicationSecurityGroups = ApplicationSecurityGroup.ToList();
            }
            if (this.IpConfiguration != null && this.IpConfiguration.Length > 0)
            {
                psPrivateEndpoint._psIpConfigurations = this.IpConfiguration.ToList();
            }
            if (this.CustomNetworkInterfaceName != null)
            {
                psPrivateEndpoint.CustomNetworkInterfaceName = this.CustomNetworkInterfaceName;
            }


            var peModel = NetworkResourceManagerProfile.Mapper.Map <MNM.PrivateEndpoint>(psPrivateEndpoint);

            peModel.Tags = TagsConversionHelper.CreateTagDictionary(Tag, validate: true);

            this.PrivateEndpointClient.CreateOrUpdate(ResourceGroupName, Name, peModel);
            var getPrivateEndpoint = GetPrivateEndpoint(ResourceGroupName, Name);

            return(getPrivateEndpoint);
        }