public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters = new ThrottledRequestsInput();
                    parameters.GroupByOperationName = this.GroupByOperationName;
                    parameters.BlobContainerSasUri  = this.BlobContainerSasUri;
                    parameters.FromTime             = this.FromTime;
                    parameters.ToTime = this.ToTime;
                    parameters.GroupByResourceName   = this.GroupByResourceName;
                    parameters.GroupByThrottlePolicy = this.GroupByThrottlePolicy;
                    string location = this.Location.Canonicalize();

                    if (NoWait.IsPresent)
                    {
                        var result   = LogAnalyticsClient.BeginExportThrottledRequests(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    else
                    {
                        var result   = LogAnalyticsClient.ExportThrottledRequests(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                }
            });
        }
Exemple #2
0
        public override void ExecuteCmdlet()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters                   = new RequestRateByIntervalInput();
                    parameters.FromTime              = this.FromTime;
                    parameters.GroupByOperationName  = this.GroupByOperationName;
                    parameters.IntervalLength        = this.IntervalLength;
                    parameters.GroupByThrottlePolicy = this.GroupByThrottlePolicy;
                    parameters.BlobContainerSasUri   = this.BlobContainerSasUri;
                    parameters.GroupByResourceName   = this.GroupByResourceName;
                    parameters.ToTime                = this.ToTime;
                    string location                  = this.Location.Canonicalize();

                    var result   = LogAnalyticsClient.ExportRequestRateByInterval(parameters, location);
                    var psObject = new PSLogAnalyticsOperationResult();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                    WriteObject(psObject);
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters = new RequestRateByIntervalInput();
                    parameters.GroupByOperationName = this.GroupByOperationName;
                    parameters.BlobContainerSasUri  = this.BlobContainerSasUri;
                    parameters.IntervalLength       = this.IntervalLength;
                    parameters.FromTime             = this.FromTime;
                    parameters.ToTime = this.ToTime;
                    parameters.GroupByResourceName        = this.GroupByResourceName;
                    parameters.GroupByThrottlePolicy      = this.GroupByThrottlePolicy;
                    parameters.GroupByClientApplicationId = this.GroupByApplicationId;
                    parameters.GroupByUserAgent           = this.GroupByUserAgent;
                    string location = this.Location.Canonicalize();

                    if (NoWait.IsPresent)
                    {
                        var result   = LogAnalyticsClient.BeginExportRequestRateByInterval(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    else
                    {
                        var result   = LogAnalyticsClient.ExportRequestRateByInterval(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    WriteWarning("Please go to https://aka.ms/throttledRequest to learn more about this cmdlet.");
                }
            });
        }