private Amazon.CostAndUsageReport.Model.PutReportDefinitionResponse CallAWSServiceOperation(IAmazonCostAndUsageReport client, Amazon.CostAndUsageReport.Model.PutReportDefinitionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Cost and Usage Report", "PutReportDefinition");
     try
     {
         #if DESKTOP
         return(client.PutReportDefinition(request));
         #elif CORECLR
         return(client.PutReportDefinitionAsync(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;
            // create request
            var request = new Amazon.CostAndUsageReport.Model.PutReportDefinitionRequest();


            // populate ReportDefinition
            var requestReportDefinitionIsNull = true;

            request.ReportDefinition = new Amazon.CostAndUsageReport.Model.ReportDefinition();
            List <System.String> requestReportDefinition_reportDefinition_AdditionalArtifact = null;

            if (cmdletContext.ReportDefinition_AdditionalArtifact != null)
            {
                requestReportDefinition_reportDefinition_AdditionalArtifact = cmdletContext.ReportDefinition_AdditionalArtifact;
            }
            if (requestReportDefinition_reportDefinition_AdditionalArtifact != null)
            {
                request.ReportDefinition.AdditionalArtifacts = requestReportDefinition_reportDefinition_AdditionalArtifact;
                requestReportDefinitionIsNull = false;
            }
            List <System.String> requestReportDefinition_reportDefinition_AdditionalSchemaElement = null;

            if (cmdletContext.ReportDefinition_AdditionalSchemaElement != null)
            {
                requestReportDefinition_reportDefinition_AdditionalSchemaElement = cmdletContext.ReportDefinition_AdditionalSchemaElement;
            }
            if (requestReportDefinition_reportDefinition_AdditionalSchemaElement != null)
            {
                request.ReportDefinition.AdditionalSchemaElements = requestReportDefinition_reportDefinition_AdditionalSchemaElement;
                requestReportDefinitionIsNull = false;
            }
            System.String requestReportDefinition_reportDefinition_BillingViewArn = null;
            if (cmdletContext.ReportDefinition_BillingViewArn != null)
            {
                requestReportDefinition_reportDefinition_BillingViewArn = cmdletContext.ReportDefinition_BillingViewArn;
            }
            if (requestReportDefinition_reportDefinition_BillingViewArn != null)
            {
                request.ReportDefinition.BillingViewArn = requestReportDefinition_reportDefinition_BillingViewArn;
                requestReportDefinitionIsNull           = false;
            }
            Amazon.CostAndUsageReport.CompressionFormat requestReportDefinition_reportDefinition_Compression = null;
            if (cmdletContext.ReportDefinition_Compression != null)
            {
                requestReportDefinition_reportDefinition_Compression = cmdletContext.ReportDefinition_Compression;
            }
            if (requestReportDefinition_reportDefinition_Compression != null)
            {
                request.ReportDefinition.Compression = requestReportDefinition_reportDefinition_Compression;
                requestReportDefinitionIsNull        = false;
            }
            Amazon.CostAndUsageReport.ReportFormat requestReportDefinition_reportDefinition_Format = null;
            if (cmdletContext.ReportDefinition_Format != null)
            {
                requestReportDefinition_reportDefinition_Format = cmdletContext.ReportDefinition_Format;
            }
            if (requestReportDefinition_reportDefinition_Format != null)
            {
                request.ReportDefinition.Format = requestReportDefinition_reportDefinition_Format;
                requestReportDefinitionIsNull   = false;
            }
            System.Boolean?requestReportDefinition_reportDefinition_RefreshClosedReport = null;
            if (cmdletContext.ReportDefinition_RefreshClosedReport != null)
            {
                requestReportDefinition_reportDefinition_RefreshClosedReport = cmdletContext.ReportDefinition_RefreshClosedReport.Value;
            }
            if (requestReportDefinition_reportDefinition_RefreshClosedReport != null)
            {
                request.ReportDefinition.RefreshClosedReports = requestReportDefinition_reportDefinition_RefreshClosedReport.Value;
                requestReportDefinitionIsNull = false;
            }
            System.String requestReportDefinition_reportDefinition_ReportName = null;
            if (cmdletContext.ReportDefinition_ReportName != null)
            {
                requestReportDefinition_reportDefinition_ReportName = cmdletContext.ReportDefinition_ReportName;
            }
            if (requestReportDefinition_reportDefinition_ReportName != null)
            {
                request.ReportDefinition.ReportName = requestReportDefinition_reportDefinition_ReportName;
                requestReportDefinitionIsNull       = false;
            }
            Amazon.CostAndUsageReport.ReportVersioning requestReportDefinition_reportDefinition_ReportVersioning = null;
            if (cmdletContext.ReportDefinition_ReportVersioning != null)
            {
                requestReportDefinition_reportDefinition_ReportVersioning = cmdletContext.ReportDefinition_ReportVersioning;
            }
            if (requestReportDefinition_reportDefinition_ReportVersioning != null)
            {
                request.ReportDefinition.ReportVersioning = requestReportDefinition_reportDefinition_ReportVersioning;
                requestReportDefinitionIsNull             = false;
            }
            System.String requestReportDefinition_reportDefinition_S3Bucket = null;
            if (cmdletContext.ReportDefinition_S3Bucket != null)
            {
                requestReportDefinition_reportDefinition_S3Bucket = cmdletContext.ReportDefinition_S3Bucket;
            }
            if (requestReportDefinition_reportDefinition_S3Bucket != null)
            {
                request.ReportDefinition.S3Bucket = requestReportDefinition_reportDefinition_S3Bucket;
                requestReportDefinitionIsNull     = false;
            }
            System.String requestReportDefinition_reportDefinition_S3Prefix = null;
            if (cmdletContext.ReportDefinition_S3Prefix != null)
            {
                requestReportDefinition_reportDefinition_S3Prefix = cmdletContext.ReportDefinition_S3Prefix;
            }
            if (requestReportDefinition_reportDefinition_S3Prefix != null)
            {
                request.ReportDefinition.S3Prefix = requestReportDefinition_reportDefinition_S3Prefix;
                requestReportDefinitionIsNull     = false;
            }
            Amazon.CostAndUsageReport.AWSRegion requestReportDefinition_reportDefinition_S3Region = null;
            if (cmdletContext.ReportDefinition_S3Region != null)
            {
                requestReportDefinition_reportDefinition_S3Region = cmdletContext.ReportDefinition_S3Region;
            }
            if (requestReportDefinition_reportDefinition_S3Region != null)
            {
                request.ReportDefinition.S3Region = requestReportDefinition_reportDefinition_S3Region;
                requestReportDefinitionIsNull     = false;
            }
            Amazon.CostAndUsageReport.TimeUnit requestReportDefinition_reportDefinition_TimeUnit = null;
            if (cmdletContext.ReportDefinition_TimeUnit != null)
            {
                requestReportDefinition_reportDefinition_TimeUnit = cmdletContext.ReportDefinition_TimeUnit;
            }
            if (requestReportDefinition_reportDefinition_TimeUnit != null)
            {
                request.ReportDefinition.TimeUnit = requestReportDefinition_reportDefinition_TimeUnit;
                requestReportDefinitionIsNull     = false;
            }
            // determine if request.ReportDefinition should be set to null
            if (requestReportDefinitionIsNull)
            {
                request.ReportDefinition = null;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }