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

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

            if (backendHttpSettings == null)
            {
                throw new ArgumentException("Backend http settings with the specified name does not exist");
            }

            backendHttpSettings                     = new PSApplicationGatewayBackendHttpSettings();
            backendHttpSettings.Name                = this.Name;
            backendHttpSettings.Port                = this.Port;
            backendHttpSettings.Protocol            = this.Protocol;
            backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity;
            backendHttpSettings.Id                  = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
                Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName,
                this.Name);

            this.ApplicationGateway.BackendHttpSettingsCollection.Add(backendHttpSettings);

            WriteObject(this.ApplicationGateway);
        }
        public PSApplicationGatewayBackendHttpSettings NewObject()
        {
            var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings();

            backendHttpSettings.Name                = this.Name;
            backendHttpSettings.Port                = this.Port;
            backendHttpSettings.Protocol            = this.Protocol;
            backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity;
            if (0 == this.RequestTimeout)
            {
                backendHttpSettings.RequestTimeout = 30;
            }
            else
            {
                backendHttpSettings.RequestTimeout = this.RequestTimeout;
            }
            if (!string.IsNullOrEmpty(this.ProbeId))
            {
                backendHttpSettings.Probe    = new PSResourceId();
                backendHttpSettings.Probe.Id = this.ProbeId;
            }
            backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                this.NetworkClient.NetworkManagementClient.SubscriptionId,
                Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName,
                this.Name);
            return(backendHttpSettings);
        }
        public PSApplicationGatewayBackendHttpSettings NewObject()
        {
            var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings();

            backendHttpSettings.Name                = this.Name;
            backendHttpSettings.Port                = this.Port;
            backendHttpSettings.Protocol            = this.Protocol;
            backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity;
            backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
                Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName,
                this.Name);
            return(backendHttpSettings);
        }
        public PSApplicationGatewayBackendHttpSettings NewObject()
        {
            var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings();

            backendHttpSettings.Name                = this.Name;
            backendHttpSettings.Port                = this.Port;
            backendHttpSettings.Protocol            = this.Protocol;
            backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity;
            if (0 == this.RequestTimeout)
            {
                backendHttpSettings.RequestTimeout = 30;
            }
            else
            {
                backendHttpSettings.RequestTimeout = this.RequestTimeout;
            }
            if (this.ConnectionDraining != null)
            {
                backendHttpSettings.ConnectionDraining = this.ConnectionDraining;
            }
            if (!string.IsNullOrEmpty(this.ProbeId))
            {
                backendHttpSettings.Probe    = new PSResourceId();
                backendHttpSettings.Probe.Id = this.ProbeId;
            }
            if (this.AuthenticationCertificates != null && this.AuthenticationCertificates.Count > 0)
            {
                backendHttpSettings.AuthenticationCertificates = new List <PSResourceId>();
                foreach (var authcert in this.AuthenticationCertificates)
                {
                    backendHttpSettings.AuthenticationCertificates.Add(
                        new PSResourceId()
                    {
                        Id = authcert.Id
                    });
                }
            }

            backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
                this.NetworkClient.NetworkManagementClient.SubscriptionId,
                Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName,
                this.Name);
            return(backendHttpSettings);
        }