#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; using System.Management.Automation.Runspaces; #endregion namespace SolidFire.Cluster.Set { /// /// Set-SFLoginSessionInfo is used to set the period of time a log in authentication is valid. /// After the log in period elapses without activity on the system the authentication will expire. /// New log in credentials will be required for continued access to the cluster once the timeout period has elapsed. /// [Cmdlet(VerbsCommon.Set, "SFLoginSessionInfo", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] public class SetSFLoginSessionInfo : SFCmdlet { #region Private Data private Pipeline _pipeline; #endregion #region Parameters [Parameter(Position = 0, Mandatory = true, HelpMessage = "Cluster authentication expiration period. Formatted in HH:mm:ss.")] [SFValidatePattern(SolidFireValidations.HoursMinutesSeconds, "The argument is not in the format of HH:mm:ss.")] public string Timeout { get; set; } #endregion #region Cmdlet Overrides protected override void BeginProcessing() { base.BeginProcessing(); CheckConnection(minVersionNumber: 7f); _pipeline = Runspace.DefaultRunspace.CreateNestedPipeline(); } protected override void ProcessRecord() { base.ProcessRecord(); var request = new SetLoginSessionInfoRequest() { Timeout = Timeout }; SendRequest("SetLoginSessionInfo", request); } protected override void EndProcessing() { var command = new Command("Get-SFLoginSessionInfo"); 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 } }