private Amazon.ForecastService.Model.CreateAutoPredictorResponse CallAWSServiceOperation(IAmazonForecastService client, Amazon.ForecastService.Model.CreateAutoPredictorRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Forecast Service", "CreateAutoPredictor");
     try
     {
         #if DESKTOP
         return(client.CreateAutoPredictor(request));
         #elif CORECLR
         return(client.CreateAutoPredictorAsync(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.ForecastService.Model.CreateAutoPredictorRequest();


            // populate DataConfig
            var requestDataConfigIsNull = true;

            request.DataConfig = new Amazon.ForecastService.Model.DataConfig();
            List <Amazon.ForecastService.Model.AdditionalDataset> requestDataConfig_dataConfig_AdditionalDataset = null;

            if (cmdletContext.DataConfig_AdditionalDataset != null)
            {
                requestDataConfig_dataConfig_AdditionalDataset = cmdletContext.DataConfig_AdditionalDataset;
            }
            if (requestDataConfig_dataConfig_AdditionalDataset != null)
            {
                request.DataConfig.AdditionalDatasets = requestDataConfig_dataConfig_AdditionalDataset;
                requestDataConfigIsNull = false;
            }
            List <Amazon.ForecastService.Model.AttributeConfig> requestDataConfig_dataConfig_AttributeConfig = null;

            if (cmdletContext.DataConfig_AttributeConfig != null)
            {
                requestDataConfig_dataConfig_AttributeConfig = cmdletContext.DataConfig_AttributeConfig;
            }
            if (requestDataConfig_dataConfig_AttributeConfig != null)
            {
                request.DataConfig.AttributeConfigs = requestDataConfig_dataConfig_AttributeConfig;
                requestDataConfigIsNull             = false;
            }
            System.String requestDataConfig_dataConfig_DatasetGroupArn = null;
            if (cmdletContext.DataConfig_DatasetGroupArn != null)
            {
                requestDataConfig_dataConfig_DatasetGroupArn = cmdletContext.DataConfig_DatasetGroupArn;
            }
            if (requestDataConfig_dataConfig_DatasetGroupArn != null)
            {
                request.DataConfig.DatasetGroupArn = requestDataConfig_dataConfig_DatasetGroupArn;
                requestDataConfigIsNull            = false;
            }
            // determine if request.DataConfig should be set to null
            if (requestDataConfigIsNull)
            {
                request.DataConfig = null;
            }

            // populate EncryptionConfig
            var requestEncryptionConfigIsNull = true;

            request.EncryptionConfig = new Amazon.ForecastService.Model.EncryptionConfig();
            System.String requestEncryptionConfig_encryptionConfig_KMSKeyArn = null;
            if (cmdletContext.EncryptionConfig_KMSKeyArn != null)
            {
                requestEncryptionConfig_encryptionConfig_KMSKeyArn = cmdletContext.EncryptionConfig_KMSKeyArn;
            }
            if (requestEncryptionConfig_encryptionConfig_KMSKeyArn != null)
            {
                request.EncryptionConfig.KMSKeyArn = requestEncryptionConfig_encryptionConfig_KMSKeyArn;
                requestEncryptionConfigIsNull      = false;
            }
            System.String requestEncryptionConfig_encryptionConfig_RoleArn = null;
            if (cmdletContext.EncryptionConfig_RoleArn != null)
            {
                requestEncryptionConfig_encryptionConfig_RoleArn = cmdletContext.EncryptionConfig_RoleArn;
            }
            if (requestEncryptionConfig_encryptionConfig_RoleArn != null)
            {
                request.EncryptionConfig.RoleArn = requestEncryptionConfig_encryptionConfig_RoleArn;
                requestEncryptionConfigIsNull    = false;
            }
            // determine if request.EncryptionConfig should be set to null
            if (requestEncryptionConfigIsNull)
            {
                request.EncryptionConfig = null;
            }
            if (cmdletContext.ExplainPredictor != null)
            {
                request.ExplainPredictor = cmdletContext.ExplainPredictor.Value;
            }
            if (cmdletContext.ForecastDimension != null)
            {
                request.ForecastDimensions = cmdletContext.ForecastDimension;
            }
            if (cmdletContext.ForecastFrequency != null)
            {
                request.ForecastFrequency = cmdletContext.ForecastFrequency;
            }
            if (cmdletContext.ForecastHorizon != null)
            {
                request.ForecastHorizon = cmdletContext.ForecastHorizon.Value;
            }
            if (cmdletContext.ForecastType != null)
            {
                request.ForecastTypes = cmdletContext.ForecastType;
            }
            if (cmdletContext.OptimizationMetric != null)
            {
                request.OptimizationMetric = cmdletContext.OptimizationMetric;
            }
            if (cmdletContext.PredictorName != null)
            {
                request.PredictorName = cmdletContext.PredictorName;
            }
            if (cmdletContext.ReferencePredictorArn != null)
            {
                request.ReferencePredictorArn = cmdletContext.ReferencePredictorArn;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }