예제 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreatePipelineRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.PipelineDefinition != null)
            {
                request.PipelineDefinition = cmdletContext.PipelineDefinition;
            }
            if (cmdletContext.PipelineDescription != null)
            {
                request.PipelineDescription = cmdletContext.PipelineDescription;
            }
            if (cmdletContext.PipelineDisplayName != null)
            {
                request.PipelineDisplayName = cmdletContext.PipelineDisplayName;
            }
            if (cmdletContext.PipelineName != null)
            {
                request.PipelineName = cmdletContext.PipelineName;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }
            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);
        }
 private Amazon.SageMaker.Model.CreatePipelineResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreatePipelineRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreatePipeline");
     try
     {
         #if DESKTOP
         return(client.CreatePipeline(request));
         #elif CORECLR
         return(client.CreatePipelineAsync(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.SageMaker.Model.CreatePipelineRequest();

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

            // populate ParallelismConfiguration
            var requestParallelismConfigurationIsNull = true;

            request.ParallelismConfiguration = new Amazon.SageMaker.Model.ParallelismConfiguration();
            System.Int32?requestParallelismConfiguration_parallelismConfiguration_MaxParallelExecutionStep = null;
            if (cmdletContext.ParallelismConfiguration_MaxParallelExecutionStep != null)
            {
                requestParallelismConfiguration_parallelismConfiguration_MaxParallelExecutionStep = cmdletContext.ParallelismConfiguration_MaxParallelExecutionStep.Value;
            }
            if (requestParallelismConfiguration_parallelismConfiguration_MaxParallelExecutionStep != null)
            {
                request.ParallelismConfiguration.MaxParallelExecutionSteps = requestParallelismConfiguration_parallelismConfiguration_MaxParallelExecutionStep.Value;
                requestParallelismConfigurationIsNull = false;
            }
            // determine if request.ParallelismConfiguration should be set to null
            if (requestParallelismConfigurationIsNull)
            {
                request.ParallelismConfiguration = null;
            }
            if (cmdletContext.PipelineDefinition != null)
            {
                request.PipelineDefinition = cmdletContext.PipelineDefinition;
            }

            // populate PipelineDefinitionS3Location
            var requestPipelineDefinitionS3LocationIsNull = true;

            request.PipelineDefinitionS3Location = new Amazon.SageMaker.Model.PipelineDefinitionS3Location();
            System.String requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_Bucket = null;
            if (cmdletContext.PipelineDefinitionS3Location_Bucket != null)
            {
                requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_Bucket = cmdletContext.PipelineDefinitionS3Location_Bucket;
            }
            if (requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_Bucket != null)
            {
                request.PipelineDefinitionS3Location.Bucket = requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_Bucket;
                requestPipelineDefinitionS3LocationIsNull   = false;
            }
            System.String requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_ObjectKey = null;
            if (cmdletContext.PipelineDefinitionS3Location_ObjectKey != null)
            {
                requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_ObjectKey = cmdletContext.PipelineDefinitionS3Location_ObjectKey;
            }
            if (requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_ObjectKey != null)
            {
                request.PipelineDefinitionS3Location.ObjectKey = requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_ObjectKey;
                requestPipelineDefinitionS3LocationIsNull      = false;
            }
            System.String requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_VersionId = null;
            if (cmdletContext.PipelineDefinitionS3Location_VersionId != null)
            {
                requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_VersionId = cmdletContext.PipelineDefinitionS3Location_VersionId;
            }
            if (requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_VersionId != null)
            {
                request.PipelineDefinitionS3Location.VersionId = requestPipelineDefinitionS3Location_pipelineDefinitionS3Location_VersionId;
                requestPipelineDefinitionS3LocationIsNull      = false;
            }
            // determine if request.PipelineDefinitionS3Location should be set to null
            if (requestPipelineDefinitionS3LocationIsNull)
            {
                request.PipelineDefinitionS3Location = null;
            }
            if (cmdletContext.PipelineDescription != null)
            {
                request.PipelineDescription = cmdletContext.PipelineDescription;
            }
            if (cmdletContext.PipelineDisplayName != null)
            {
                request.PipelineDisplayName = cmdletContext.PipelineDisplayName;
            }
            if (cmdletContext.PipelineName != null)
            {
                request.PipelineName = cmdletContext.PipelineName;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }
            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);
        }