private Amazon.CostExplorer.Model.GetAnomaliesResponse CallAWSServiceOperation(IAmazonCostExplorer client, Amazon.CostExplorer.Model.GetAnomaliesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Cost Explorer", "GetAnomalies");
     try
     {
         #if DESKTOP
         return(client.GetAnomalies(request));
         #elif CORECLR
         return(client.GetAnomaliesAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;

            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute

            // create request and set iteration invariants
            var request = new Amazon.CostExplorer.Model.GetAnomaliesRequest();


            // populate DateInterval
            var requestDateIntervalIsNull = true;
            request.DateInterval = new Amazon.CostExplorer.Model.AnomalyDateInterval();
            System.String requestDateInterval_dateInterval_EndDate = null;
            if (cmdletContext.DateInterval_EndDate != null)
            {
                requestDateInterval_dateInterval_EndDate = cmdletContext.DateInterval_EndDate;
            }
            if (requestDateInterval_dateInterval_EndDate != null)
            {
                request.DateInterval.EndDate = requestDateInterval_dateInterval_EndDate;
                requestDateIntervalIsNull    = false;
            }
            System.String requestDateInterval_dateInterval_StartDate = null;
            if (cmdletContext.DateInterval_StartDate != null)
            {
                requestDateInterval_dateInterval_StartDate = cmdletContext.DateInterval_StartDate;
            }
            if (requestDateInterval_dateInterval_StartDate != null)
            {
                request.DateInterval.StartDate = requestDateInterval_dateInterval_StartDate;
                requestDateIntervalIsNull      = false;
            }
            // determine if request.DateInterval should be set to null
            if (requestDateIntervalIsNull)
            {
                request.DateInterval = null;
            }
            if (cmdletContext.Feedback != null)
            {
                request.Feedback = cmdletContext.Feedback;
            }
            if (cmdletContext.MaxResult != null)
            {
                request.MaxResults = cmdletContext.MaxResult.Value;
            }
            if (cmdletContext.MonitorArn != null)
            {
                request.MonitorArn = cmdletContext.MonitorArn;
            }

            // populate TotalImpact
            var requestTotalImpactIsNull = true;
            request.TotalImpact = new Amazon.CostExplorer.Model.TotalImpactFilter();
            System.Double?requestTotalImpact_totalImpact_EndValue = null;
            if (cmdletContext.TotalImpact_EndValue != null)
            {
                requestTotalImpact_totalImpact_EndValue = cmdletContext.TotalImpact_EndValue.Value;
            }
            if (requestTotalImpact_totalImpact_EndValue != null)
            {
                request.TotalImpact.EndValue = requestTotalImpact_totalImpact_EndValue.Value;
                requestTotalImpactIsNull     = false;
            }
            Amazon.CostExplorer.NumericOperator requestTotalImpact_totalImpact_NumericOperator = null;
            if (cmdletContext.TotalImpact_NumericOperator != null)
            {
                requestTotalImpact_totalImpact_NumericOperator = cmdletContext.TotalImpact_NumericOperator;
            }
            if (requestTotalImpact_totalImpact_NumericOperator != null)
            {
                request.TotalImpact.NumericOperator = requestTotalImpact_totalImpact_NumericOperator;
                requestTotalImpactIsNull            = false;
            }
            System.Double?requestTotalImpact_totalImpact_StartValue = null;
            if (cmdletContext.TotalImpact_StartValue != null)
            {
                requestTotalImpact_totalImpact_StartValue = cmdletContext.TotalImpact_StartValue.Value;
            }
            if (requestTotalImpact_totalImpact_StartValue != null)
            {
                request.TotalImpact.StartValue = requestTotalImpact_totalImpact_StartValue.Value;
                requestTotalImpactIsNull       = false;
            }
            // determine if request.TotalImpact should be set to null
            if (requestTotalImpactIsNull)
            {
                request.TotalImpact = null;
            }

            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.NextPageToken;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextPageToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
            do
            {
                request.NextPageToken = _nextToken;

                CmdletOutput output;

                try
                {
                    var response = CallAWSServiceOperation(client, request);

                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };

                    _nextToken = response.NextPageToken;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }