#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;
using System.ComponentModel;
using System.Management.Automation;
using SolidFire.Core;
using SolidFire.Element.Api;
using System.Linq;
using SolidFire.Core.Helpers;
#endregion
namespace SolidFire.Test
{
///
/// Used to test the storage connection to the cluster. The test pings the SVIP and executes a simple API method to verify connectivity.
///
[Cmdlet(VerbsDiagnostic.Test, "SFConnectSvip")]
public class TestSFConnectSvip : SFCmdlet
{
#region CmdLet Parameters
[Parameter(HelpMessage = "Use this to test the storage connection of a different SVIP. This is not needed to test the connection to the target cluster.")]
public string Svip { get; set; }
#endregion
#region Cmdlet Overrides
protected override void BeginProcessing()
{
base.BeginProcessing();
CheckConnection(endPoint: SolidFireUtilities.SFEndPoint.Node);
}
protected override void ProcessRecord()
{
base.ProcessRecord();
var request = new TestConnectSvipRequest()
{
Svip = Svip
};
var objsFromAPI = SendRequest("TestConnectSvip", request);
WriteObject(objsFromAPI.Select(o => o.Result), true);
}
#endregion
}
}