#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.Linq; using System.Management.Automation; using SolidFire.Core.Helpers; using SolidFire.Core.Validation; using SolidFire.Core; using SolidFire.Element.Api; using ElementAccount = SolidFire.Element.Api.Account; #endregion namespace SolidFire.Account.Get { /// /// GetAccountEfficiency is used to retrieve information about a volume account. Only the account given as a parameter in this API /// method is used to compute the capacity. /// [Cmdlet(VerbsCommon.Get, "SFAccountEfficiency", DefaultParameterSetName = "AccountId")] public class GetSFAccountEfficiency : SFCmdlet { #region Private Data /// /// /// private Int64[] accountId; #endregion #region Parameters [Parameter(Position = 0, ParameterSetName = "AccountId", Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ValueFromRemainingArguments = false, HelpMessage = "Please enter an account ID")] [ValidateNotNullOrEmpty] [ValidatePattern(SolidFireValidations.Numeric)] public Int64[] AccountID { get { return accountId; } set { accountId = value; } } #endregion #region Cmdlet Overrides protected override void BeginProcessing() { base.BeginProcessing(); CheckConnection(); } /// /// /// protected override void ProcessRecord() { base.ProcessRecord(); ProcessByAccountId(accountId); } private void ProcessByAccountId(Int64[] accountIDs) { foreach (var id in accountIDs) { var request = new GetAccountEfficiencyRequest(); request.AccountID = id; var objsFromAPI = SendRequest("GetAccountEfficiency", request, false); WriteObject(objsFromAPI.Select(obj => obj.Result), true); } } #endregion } }