public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var frontendPort = this.ApplicationGateway.FrontendPorts.SingleOrDefault(resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase));

            if (frontendPort != null)
            {
                throw new ArgumentException("Frontend port with the specified name already exists");
            }

            frontendPort      = new PSApplicationGatewayFrontendPort();
            frontendPort.Name = this.Name;
            frontendPort.Port = this.Port;

            frontendPort.Id =
                ChildResourceHelper.GetResourceId(
                    this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
                    this.ApplicationGateway.ResourceGroupName,
                    this.ApplicationGateway.Name,
                    Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendPortName,
                    this.Name);

            this.ApplicationGateway.FrontendPorts.Add(frontendPort);

            WriteObject(this.ApplicationGateway);
        }
Пример #2
0
        public PSApplicationGatewayFrontendPort NewObject()
        {
            var frontendPort = new PSApplicationGatewayFrontendPort();

            frontendPort.Name = this.Name;
            frontendPort.Port = this.Port;

            frontendPort.Id =
                ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                    this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
                    Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendPortName,
                    this.Name);

            return(frontendPort);
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var frontendPort = new PSApplicationGatewayFrontendPort();

            frontendPort.Name = this.Name;
            frontendPort.Port = this.Port;

            frontendPort.Id =
                ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                    this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
                    Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayFrontendPortName,
                    this.Name);

            WriteObject(frontendPort);
        }