Beispiel #1
0
 private Amazon.Personalize.Model.CreateBatchInferenceJobResponse CallAWSServiceOperation(IAmazonPersonalize client, Amazon.Personalize.Model.CreateBatchInferenceJobRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Personalize", "CreateBatchInferenceJob");
     try
     {
         #if DESKTOP
         return(client.CreateBatchInferenceJob(request));
         #elif CORECLR
         return(client.CreateBatchInferenceJobAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Personalize.Model.CreateBatchInferenceJobRequest();

            if (cmdletContext.FilterArn != null)
            {
                request.FilterArn = cmdletContext.FilterArn;
            }

            // populate JobInput
            var requestJobInputIsNull = true;

            request.JobInput = new Amazon.Personalize.Model.BatchInferenceJobInput();
            Amazon.Personalize.Model.S3DataConfig requestJobInput_jobInput_S3DataSource = null;

            // populate S3DataSource
            var requestJobInput_jobInput_S3DataSourceIsNull = true;

            requestJobInput_jobInput_S3DataSource = new Amazon.Personalize.Model.S3DataConfig();
            System.String requestJobInput_jobInput_S3DataSource_s3DataSource_KmsKeyArn = null;
            if (cmdletContext.S3DataSource_KmsKeyArn != null)
            {
                requestJobInput_jobInput_S3DataSource_s3DataSource_KmsKeyArn = cmdletContext.S3DataSource_KmsKeyArn;
            }
            if (requestJobInput_jobInput_S3DataSource_s3DataSource_KmsKeyArn != null)
            {
                requestJobInput_jobInput_S3DataSource.KmsKeyArn = requestJobInput_jobInput_S3DataSource_s3DataSource_KmsKeyArn;
                requestJobInput_jobInput_S3DataSourceIsNull     = false;
            }
            System.String requestJobInput_jobInput_S3DataSource_s3DataSource_Path = null;
            if (cmdletContext.S3DataSource_Path != null)
            {
                requestJobInput_jobInput_S3DataSource_s3DataSource_Path = cmdletContext.S3DataSource_Path;
            }
            if (requestJobInput_jobInput_S3DataSource_s3DataSource_Path != null)
            {
                requestJobInput_jobInput_S3DataSource.Path  = requestJobInput_jobInput_S3DataSource_s3DataSource_Path;
                requestJobInput_jobInput_S3DataSourceIsNull = false;
            }
            // determine if requestJobInput_jobInput_S3DataSource should be set to null
            if (requestJobInput_jobInput_S3DataSourceIsNull)
            {
                requestJobInput_jobInput_S3DataSource = null;
            }
            if (requestJobInput_jobInput_S3DataSource != null)
            {
                request.JobInput.S3DataSource = requestJobInput_jobInput_S3DataSource;
                requestJobInputIsNull         = false;
            }
            // determine if request.JobInput should be set to null
            if (requestJobInputIsNull)
            {
                request.JobInput = null;
            }
            if (cmdletContext.JobName != null)
            {
                request.JobName = cmdletContext.JobName;
            }

            // populate JobOutput
            var requestJobOutputIsNull = true;

            request.JobOutput = new Amazon.Personalize.Model.BatchInferenceJobOutput();
            Amazon.Personalize.Model.S3DataConfig requestJobOutput_jobOutput_S3DataDestination = null;

            // populate S3DataDestination
            var requestJobOutput_jobOutput_S3DataDestinationIsNull = true;

            requestJobOutput_jobOutput_S3DataDestination = new Amazon.Personalize.Model.S3DataConfig();
            System.String requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_KmsKeyArn = null;
            if (cmdletContext.S3DataDestination_KmsKeyArn != null)
            {
                requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_KmsKeyArn = cmdletContext.S3DataDestination_KmsKeyArn;
            }
            if (requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_KmsKeyArn != null)
            {
                requestJobOutput_jobOutput_S3DataDestination.KmsKeyArn = requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_KmsKeyArn;
                requestJobOutput_jobOutput_S3DataDestinationIsNull     = false;
            }
            System.String requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_Path = null;
            if (cmdletContext.S3DataDestination_Path != null)
            {
                requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_Path = cmdletContext.S3DataDestination_Path;
            }
            if (requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_Path != null)
            {
                requestJobOutput_jobOutput_S3DataDestination.Path  = requestJobOutput_jobOutput_S3DataDestination_s3DataDestination_Path;
                requestJobOutput_jobOutput_S3DataDestinationIsNull = false;
            }
            // determine if requestJobOutput_jobOutput_S3DataDestination should be set to null
            if (requestJobOutput_jobOutput_S3DataDestinationIsNull)
            {
                requestJobOutput_jobOutput_S3DataDestination = null;
            }
            if (requestJobOutput_jobOutput_S3DataDestination != null)
            {
                request.JobOutput.S3DataDestination = requestJobOutput_jobOutput_S3DataDestination;
                requestJobOutputIsNull = false;
            }
            // determine if request.JobOutput should be set to null
            if (requestJobOutputIsNull)
            {
                request.JobOutput = null;
            }
            if (cmdletContext.NumResult != null)
            {
                request.NumResults = cmdletContext.NumResult.Value;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }
            if (cmdletContext.SolutionVersionArn != null)
            {
                request.SolutionVersionArn = cmdletContext.SolutionVersionArn;
            }

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