#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 verify connectivity with a specified database ensemble. By default it uses the ensemble for the cluster the node is associated with. Alternatively you can provide a different ensemble to test connectivity with.
///
[Cmdlet(VerbsDiagnostic.Test, "SFConnectEnsemble")]
public class TestSFConnectEnsemble : SFCmdlet
{
#region CmdLet Parameters
[Parameter(HelpMessage = "An array of ensemble node CIPs for connectivity testing")]
public string[] Ensemble { 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 TestConnectEnsembleRequest();
if (Ensemble != null)
{
request.Ensemble = string.Join(",", Ensemble);
}
var objsFromAPI = SendRequest("TestConnectEnsemble", request);
WriteObject(objsFromAPI.Select(o => o.Result), true);
}
#endregion
}
}