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 already exists");
            }

            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;
 }