public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ForecastService.Model.CreatePredictorBacktestExportJobRequest();


            // populate Destination
            var requestDestinationIsNull = true;

            request.Destination = new Amazon.ForecastService.Model.DataDestination();
            Amazon.ForecastService.Model.S3Config requestDestination_destination_S3Config = null;

            // populate S3Config
            var requestDestination_destination_S3ConfigIsNull = true;

            requestDestination_destination_S3Config = new Amazon.ForecastService.Model.S3Config();
            System.String requestDestination_destination_S3Config_s3Config_KMSKeyArn = null;
            if (cmdletContext.S3Config_KMSKeyArn != null)
            {
                requestDestination_destination_S3Config_s3Config_KMSKeyArn = cmdletContext.S3Config_KMSKeyArn;
            }
            if (requestDestination_destination_S3Config_s3Config_KMSKeyArn != null)
            {
                requestDestination_destination_S3Config.KMSKeyArn = requestDestination_destination_S3Config_s3Config_KMSKeyArn;
                requestDestination_destination_S3ConfigIsNull     = false;
            }
            System.String requestDestination_destination_S3Config_s3Config_Path = null;
            if (cmdletContext.S3Config_Path != null)
            {
                requestDestination_destination_S3Config_s3Config_Path = cmdletContext.S3Config_Path;
            }
            if (requestDestination_destination_S3Config_s3Config_Path != null)
            {
                requestDestination_destination_S3Config.Path  = requestDestination_destination_S3Config_s3Config_Path;
                requestDestination_destination_S3ConfigIsNull = false;
            }
            System.String requestDestination_destination_S3Config_s3Config_RoleArn = null;
            if (cmdletContext.S3Config_RoleArn != null)
            {
                requestDestination_destination_S3Config_s3Config_RoleArn = cmdletContext.S3Config_RoleArn;
            }
            if (requestDestination_destination_S3Config_s3Config_RoleArn != null)
            {
                requestDestination_destination_S3Config.RoleArn = requestDestination_destination_S3Config_s3Config_RoleArn;
                requestDestination_destination_S3ConfigIsNull   = false;
            }
            // determine if requestDestination_destination_S3Config should be set to null
            if (requestDestination_destination_S3ConfigIsNull)
            {
                requestDestination_destination_S3Config = null;
            }
            if (requestDestination_destination_S3Config != null)
            {
                request.Destination.S3Config = requestDestination_destination_S3Config;
                requestDestinationIsNull     = false;
            }
            // determine if request.Destination should be set to null
            if (requestDestinationIsNull)
            {
                request.Destination = null;
            }
            if (cmdletContext.PredictorArn != null)
            {
                request.PredictorArn = cmdletContext.PredictorArn;
            }
            if (cmdletContext.PredictorBacktestExportJobName != null)
            {
                request.PredictorBacktestExportJobName = cmdletContext.PredictorBacktestExportJobName;
            }
            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);
        }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ForecastService.Model.CreateExplainabilityRequest();


            // populate DataSource
            var requestDataSourceIsNull = true;

            request.DataSource = new Amazon.ForecastService.Model.DataSource();
            Amazon.ForecastService.Model.S3Config requestDataSource_dataSource_S3Config = null;

            // populate S3Config
            var requestDataSource_dataSource_S3ConfigIsNull = true;

            requestDataSource_dataSource_S3Config = new Amazon.ForecastService.Model.S3Config();
            System.String requestDataSource_dataSource_S3Config_s3Config_KMSKeyArn = null;
            if (cmdletContext.S3Config_KMSKeyArn != null)
            {
                requestDataSource_dataSource_S3Config_s3Config_KMSKeyArn = cmdletContext.S3Config_KMSKeyArn;
            }
            if (requestDataSource_dataSource_S3Config_s3Config_KMSKeyArn != null)
            {
                requestDataSource_dataSource_S3Config.KMSKeyArn = requestDataSource_dataSource_S3Config_s3Config_KMSKeyArn;
                requestDataSource_dataSource_S3ConfigIsNull     = false;
            }
            System.String requestDataSource_dataSource_S3Config_s3Config_Path = null;
            if (cmdletContext.S3Config_Path != null)
            {
                requestDataSource_dataSource_S3Config_s3Config_Path = cmdletContext.S3Config_Path;
            }
            if (requestDataSource_dataSource_S3Config_s3Config_Path != null)
            {
                requestDataSource_dataSource_S3Config.Path  = requestDataSource_dataSource_S3Config_s3Config_Path;
                requestDataSource_dataSource_S3ConfigIsNull = false;
            }
            System.String requestDataSource_dataSource_S3Config_s3Config_RoleArn = null;
            if (cmdletContext.S3Config_RoleArn != null)
            {
                requestDataSource_dataSource_S3Config_s3Config_RoleArn = cmdletContext.S3Config_RoleArn;
            }
            if (requestDataSource_dataSource_S3Config_s3Config_RoleArn != null)
            {
                requestDataSource_dataSource_S3Config.RoleArn = requestDataSource_dataSource_S3Config_s3Config_RoleArn;
                requestDataSource_dataSource_S3ConfigIsNull   = false;
            }
            // determine if requestDataSource_dataSource_S3Config should be set to null
            if (requestDataSource_dataSource_S3ConfigIsNull)
            {
                requestDataSource_dataSource_S3Config = null;
            }
            if (requestDataSource_dataSource_S3Config != null)
            {
                request.DataSource.S3Config = requestDataSource_dataSource_S3Config;
                requestDataSourceIsNull     = false;
            }
            // determine if request.DataSource should be set to null
            if (requestDataSourceIsNull)
            {
                request.DataSource = null;
            }
            if (cmdletContext.EnableVisualization != null)
            {
                request.EnableVisualization = cmdletContext.EnableVisualization.Value;
            }
            if (cmdletContext.EndDateTime != null)
            {
                request.EndDateTime = cmdletContext.EndDateTime;
            }

            // populate ExplainabilityConfig
            var requestExplainabilityConfigIsNull = true;

            request.ExplainabilityConfig = new Amazon.ForecastService.Model.ExplainabilityConfig();
            Amazon.ForecastService.TimePointGranularity requestExplainabilityConfig_explainabilityConfig_TimePointGranularity = null;
            if (cmdletContext.ExplainabilityConfig_TimePointGranularity != null)
            {
                requestExplainabilityConfig_explainabilityConfig_TimePointGranularity = cmdletContext.ExplainabilityConfig_TimePointGranularity;
            }
            if (requestExplainabilityConfig_explainabilityConfig_TimePointGranularity != null)
            {
                request.ExplainabilityConfig.TimePointGranularity = requestExplainabilityConfig_explainabilityConfig_TimePointGranularity;
                requestExplainabilityConfigIsNull = false;
            }
            Amazon.ForecastService.TimeSeriesGranularity requestExplainabilityConfig_explainabilityConfig_TimeSeriesGranularity = null;
            if (cmdletContext.ExplainabilityConfig_TimeSeriesGranularity != null)
            {
                requestExplainabilityConfig_explainabilityConfig_TimeSeriesGranularity = cmdletContext.ExplainabilityConfig_TimeSeriesGranularity;
            }
            if (requestExplainabilityConfig_explainabilityConfig_TimeSeriesGranularity != null)
            {
                request.ExplainabilityConfig.TimeSeriesGranularity = requestExplainabilityConfig_explainabilityConfig_TimeSeriesGranularity;
                requestExplainabilityConfigIsNull = false;
            }
            // determine if request.ExplainabilityConfig should be set to null
            if (requestExplainabilityConfigIsNull)
            {
                request.ExplainabilityConfig = null;
            }
            if (cmdletContext.ExplainabilityName != null)
            {
                request.ExplainabilityName = cmdletContext.ExplainabilityName;
            }
            if (cmdletContext.ResourceArn != null)
            {
                request.ResourceArn = cmdletContext.ResourceArn;
            }

            // populate Schema
            var requestSchemaIsNull = true;

            request.Schema = new Amazon.ForecastService.Model.Schema();
            List <Amazon.ForecastService.Model.SchemaAttribute> requestSchema_schema_Attribute = null;

            if (cmdletContext.Schema_Attribute != null)
            {
                requestSchema_schema_Attribute = cmdletContext.Schema_Attribute;
            }
            if (requestSchema_schema_Attribute != null)
            {
                request.Schema.Attributes = requestSchema_schema_Attribute;
                requestSchemaIsNull       = false;
            }
            // determine if request.Schema should be set to null
            if (requestSchemaIsNull)
            {
                request.Schema = null;
            }
            if (cmdletContext.StartDateTime != null)
            {
                request.StartDateTime = cmdletContext.StartDateTime;
            }
            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);
        }