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

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

            if (gatewayIPConfiguration != null)
            {
                throw new ArgumentException("Application gateway IP configuration with the specified name already exists");
            }

            gatewayIPConfiguration = new PSApplicationGatewayIPConfiguration();

            gatewayIPConfiguration.Name = this.Name;

            if (!string.IsNullOrEmpty(this.SubnetId))
            {
                var gatewayIPConfig = new PSResourceId();
                gatewayIPConfig.Id = this.SubnetId;
                gatewayIPConfiguration.Subnet = gatewayIPConfig;
            }    

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

            this.ApplicationGateway.GatewayIPConfigurations.Add(gatewayIPConfiguration);

            WriteObject(this.ApplicationGateway);
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

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

            if (backendAddressPool == null)
            {
                throw new ArgumentException("Backend address pool with the specified name does not exist");
            }

            backendAddressPool = new PSApplicationGatewayBackendAddressPool();

            backendAddressPool.Name = this.Name;

            if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId))
            {
                backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List<PSResourceId>();
                foreach (string id in this.BackendIPConfigurationIds)
                {
                    var backendIpConfig = new PSResourceId();
                    backendIpConfig.Id = id;
                    backendAddressPool.BackendIpConfigurations.Add(backendIpConfig);
                }
            }
            else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP))
            {
                backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
                foreach (string ip in this.BackendIPAddresses)
                {
                    var backendAddress = new PSApplicationGatewayBackendAddress();
                    backendAddress.IpAddress = ip;
                    backendAddressPool.BackendAddresses.Add(backendAddress);
                }
            }
            else
            {
                backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
                foreach (string fqdn in this.BackendFqdns)
                {
                    var backendAddress = new PSApplicationGatewayBackendAddress();
                    backendAddress.Fqdn = fqdn;
                    backendAddressPool.BackendAddresses.Add(backendAddress);
                }
            }

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

            this.ApplicationGateway.BackendAddressPools.Add(backendAddressPool);

            WriteObject(this.ApplicationGateway);
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var backendAddressPool = new PSApplicationGatewayBackendAddressPool();

            backendAddressPool.Name = this.Name;

            if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId))
            {
                backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List<PSResourceId>();
                foreach (string id in this.BackendIPConfigurationIds)
                {
                    var backendIpConfig = new PSResourceId();
                    backendIpConfig.Id = id;
                    backendAddressPool.BackendIpConfigurations.Add(backendIpConfig);
                }
            }
            else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP))
            {
                backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
                foreach (string ip in this.BackendIPAddresses)
                {
                    var backendAddress = new PSApplicationGatewayBackendAddress();
                    backendAddress.IpAddress = ip;
                    backendAddressPool.BackendAddresses.Add(backendAddress);
                }
            }
            else 
            {
                backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
                foreach (string fqdn in this.BackendFqdns)
                {
                    var backendAddress = new PSApplicationGatewayBackendAddress();
                    backendAddress.Fqdn = fqdn;
                    backendAddressPool.BackendAddresses.Add(backendAddress);
                }
            }

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

            WriteObject(backendAddressPool);
        }
        public PSApplicationGatewayIPConfiguration NewObject()
        {
            var gatewayIPConfiguration = new PSApplicationGatewayIPConfiguration();

            gatewayIPConfiguration.Name = this.Name;

            if (!string.IsNullOrEmpty(this.SubnetId))
            {
                var gatewayIPConfig = new PSResourceId();
                gatewayIPConfig.Id = this.SubnetId;
                gatewayIPConfiguration.Subnet = gatewayIPConfig;
            }

            gatewayIPConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                                this.NetworkClient.NetworkManagementClient.SubscriptionId,
                                Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayIPConfigurationName,
                                this.Name);

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

            var gatewayIPConfiguration = new PSApplicationGatewayIPConfiguration();

            gatewayIPConfiguration.Name = this.Name;

            if (!string.IsNullOrEmpty(this.SubnetId))
            {
                var gatewayIPConfig = new PSResourceId();
                gatewayIPConfig.Id = this.SubnetId;
                gatewayIPConfiguration.Subnet = gatewayIPConfig;
            }            

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

            WriteObject(gatewayIPConfiguration);
        }