#region Copyright /* * Copyright © 2014-2016 NetApp, Inc. All Rights Reserved. * * CONFIDENTIALITY NOTICE: THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION OF * NETAPP, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR * EXPRESS WRITTEN PERMISSION OF NETAPP, INC. */ #endregion #region Using Directives using System.ComponentModel; using System.Management.Automation; using SolidFire.Core; using SolidFire.Element.Api; using System.Management.Automation.Runspaces; #endregion namespace SolidFire.Cluster.Set { /// /// Set-SFRemoteLogginHost is used to configure remote logging from the nodes in the storage cluster to a centralized log server or servers. /// Remote logging is performed over TCP using the default port 514. This API does not add to the existing logging hosts. /// Rather, it replaces what currently exists with new values specified by this API method. /// You can use the Get-SFRemoteLoggingHost to determine what the current logging hosts are and then use the Set-SFRemoteLogginHost to set the desired list of current and new logging hosts. /// [Cmdlet(VerbsCommon.Set, "SFRemoteLoggingHost", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] public class SetSFRemoteLoggingHost : SFCmdlet { #region Private Data private Pipeline _pipeline; #endregion #region Parameters [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "List of LoggingServer hosts to send log messages to.")] public LoggingServer[] RemoteHosts { get; set; } #endregion #region Cmdlet Overrides protected override void BeginProcessing() { base.BeginProcessing(); CheckConnection(); _pipeline = Runspace.DefaultRunspace.CreateNestedPipeline(); } protected override void ProcessRecord() { base.ProcessRecord(); var request = new SetRemoteLoggingHostsRequest() { RemoteHosts = RemoteHosts }; SendRequest("SetRemoteLoggingHosts", request); } protected override void EndProcessing() { var command = new Command("Get-SFRemoteLoggingHost"); if (SFConnection != null) { command.Parameters.Add("SFConnection", SFConnection); } else if (Target != null) { command.Parameters.Add("Target", Target); } _pipeline.Commands.Add(command); WriteObject(_pipeline.Invoke(), true); base.EndProcessing(); _pipeline = null; } #endregion } }