MSGraph.Autorest/custom/CSharp/Get-AzADServicePrincipal_List.cs

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
 
namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
{
    using System.Management.Automation;
 
    public partial class GetAzADServicePrincipal_List
    {
        private bool _isPolling = false;
        // <summary>Backing field for <see cref="CountVariable" /> property.</summary>
        private string _countVariable;
 
        /// <summary>Specifies a count of the total number of items in a collection. </summary>
        [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.")]
        [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
        Required = false,
        ReadOnly = false,
        Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
        PossibleTypes = new[] { typeof(string) })]
        [global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
        public string CountVariable { get => this._countVariable; set => this._countVariable = value; }
 
        partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.ICollectionOfServicePrincipal> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
        {
            if (_isPolling || global::System.String.IsNullOrEmpty(this.ConsistencyLevel) || !global::System.String.Equals(this.ConsistencyLevel, "eventual", System.StringComparison.InvariantCultureIgnoreCase) || !this.Count || global::System.String.IsNullOrEmpty(this.CountVariable))
            {
                return;
            }
            SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
            _isPolling = true;
        }
    }
}