#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 SolidFire.Core.Validation; #endregion namespace SolidFire.Volume.Start { /// /// Used to create an encoded key from a volume that is used to pair with another volume. /// The key created from this API method is used in the CompleteVolumePairing API method to establish a volume pairing. /// [Cmdlet(VerbsLifecycle.Start, "SFVolumePairing")] public class StartSFVolumePairing : SFCmdlet { #region Private Data #endregion #region Parameters /// /// The ID of the volume on which to start the pairing process. /// [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The ID of the volume on which to start the pairing process.")] [ValidatePattern(SolidFireValidations.Numeric)] public long VolumeID { get; set; } /// /// The mode of the volume on which to start the pairing process. /// Possible values: /// Async: Waits for system to acknowledge that data is stored on source before writing to the target. /// Sync: Does not wait for data transmission acknowledgment from source to begin writing data to the target. /// SnapshotsOnly: Only snapshots created on the source cluster /// will be replicated. Active writes from the source volume will not be replicated. /// [Parameter(Position = 1, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The mode of the volume on which to start the pairing process.")] [ValidateSet("Async", "Sync", "SnapshotsOnly", IgnoreCase =false)] public string Mode { get; set; } #endregion #region Cmdlet Overrides protected override void BeginProcessing() { base.BeginProcessing(); CheckConnection(); } protected override void ProcessRecord() { base.ProcessRecord(); var request = new StartVolumePairingRequest(); request.VolumeID = VolumeID; request.Mode = Mode; var objsFromAPI = SendRequest("StartVolumePairing", request); foreach (var obj in objsFromAPI) { WriteObject(obj.Result); } } #endregion } }