#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 System.Management.Automation.Runspaces;
using SolidFire.Core;
using SolidFire.Element.Api;
#endregion
namespace SolidFire.Cluster.Disable
{
///
/// EnableSnmp is used to enable SNMP on the cluster nodes. The values set with this interface apply to all nodes in the cluster,
/// and the values that are passed replace, in whole, all values set in any previous call to EnableSnmp.
///
[Cmdlet(VerbsLifecycle.Disable, "SFSnmp", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
public class DisableSFSnmp : SFCmdlet
{
#region Private Data
///
/// Member used to host a nested Pipeline for calling other CmdLets
///
private Pipeline pipeline = null;
#endregion
#region Parameters
#endregion
#region Cmdlet Overrides
///
/// Verify the connection is Oxygen or less.
/// Create a nested pipeline that can be written to after processing
///
protected override void BeginProcessing()
{
base.BeginProcessing();
CheckConnection(minVersionNumber: 8.0f);
pipeline = Runspace.DefaultRunspace.CreateNestedPipeline();
}
///
/// After processing, invoke the Get-SFSnmpState CmdLet to pass the new SNMPState into the pipeline.
///
protected override void EndProcessing()
{
base.EndProcessing();
var command = new Command("Get-SFSnmpState");
pipeline.Commands.Add(command);
// Send it to the pipline
WriteObject(pipeline.Invoke(), true);
pipeline = null;
}
///
/// Implementation for processing the execution of the cmdlet.
///
protected override void ProcessRecord()
{
base.ProcessRecord();
SendRequest("DisableSnmp");
}
#endregion
}
}