Microsoft.Azure.Commands.Insights.Metrics.GetAzureRmMetricDefinitionCommand.ProcessRecordInternal C# (CSharp) Méthode

ProcessRecordInternal() protected méthode

Execute the cmdlet
protected ProcessRecordInternal ( ) : void
Résultat void
        protected override void ProcessRecordInternal()
        {
            string queryFilter = this.ProcessParameters();
            bool fullDetails = this.DetailedOutput.IsPresent;

            WriteWarning("API deprecation: The use of the legacy metrics API will be discontinued in the next release. This implies a change in the output of this cmdlet.");
            using (var clientTemp = AzureSession.ClientFactory.CreateClient<InsightsClient>(DefaultProfile.Context, Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment.Endpoint .ResourceManager))
            {
                // Call the proper API methods to return a list of raw records.
                MetricDefinitionListResponse response = clientTemp.MetricDefinitionOperations.GetMetricDefinitionsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result;

                // If fullDetails is present full details of the records are displayed, otherwise only a summary of the records is displayed
                var records = response.MetricDefinitionCollection.Value.Select(e => fullDetails ? (MetricDefinition)new PSMetricDefinition(e) : new PSMetricDefinitionNoDetails(e)).ToArray();

                WriteObject(sendToPipeline: records);
            }
        }
    }
GetAzureRmMetricDefinitionCommand