Microsoft.Azure.Commands.Network.SetAzureApplicationGatewayBackendHttpSettingsCommand.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

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

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

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

            var newBackendHttpSettings = base.NewObject();

            this.ApplicationGateway.BackendHttpSettingsCollection.Remove(oldBackendHttpSettings);
            this.ApplicationGateway.BackendHttpSettingsCollection.Add(newBackendHttpSettings);

            WriteObject(this.ApplicationGateway);
        }
    }
SetAzureApplicationGatewayBackendHttpSettingsCommand