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

            if (cmdletContext.DisplayName != null)
            {
                request.DisplayName = cmdletContext.DisplayName;
            }
            if (cmdletContext.ExperimentName != null)
            {
                request.ExperimentName = cmdletContext.ExperimentName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TrialName != null)
            {
                request.TrialName = cmdletContext.TrialName;
            }

            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);
        }
Beispiel #2
0
 private Amazon.SageMaker.Model.CreateTrialResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateTrialRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateTrial");
     try
     {
         #if DESKTOP
         return(client.CreateTrial(request));
         #elif CORECLR
         return(client.CreateTrialAsync(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.CreateTrialRequest();

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

            // populate MetadataProperties
            var requestMetadataPropertiesIsNull = true;

            request.MetadataProperties = new Amazon.SageMaker.Model.MetadataProperties();
            System.String requestMetadataProperties_metadataProperties_CommitId = null;
            if (cmdletContext.MetadataProperties_CommitId != null)
            {
                requestMetadataProperties_metadataProperties_CommitId = cmdletContext.MetadataProperties_CommitId;
            }
            if (requestMetadataProperties_metadataProperties_CommitId != null)
            {
                request.MetadataProperties.CommitId = requestMetadataProperties_metadataProperties_CommitId;
                requestMetadataPropertiesIsNull     = false;
            }
            System.String requestMetadataProperties_metadataProperties_GeneratedBy = null;
            if (cmdletContext.MetadataProperties_GeneratedBy != null)
            {
                requestMetadataProperties_metadataProperties_GeneratedBy = cmdletContext.MetadataProperties_GeneratedBy;
            }
            if (requestMetadataProperties_metadataProperties_GeneratedBy != null)
            {
                request.MetadataProperties.GeneratedBy = requestMetadataProperties_metadataProperties_GeneratedBy;
                requestMetadataPropertiesIsNull        = false;
            }
            System.String requestMetadataProperties_metadataProperties_ProjectId = null;
            if (cmdletContext.MetadataProperties_ProjectId != null)
            {
                requestMetadataProperties_metadataProperties_ProjectId = cmdletContext.MetadataProperties_ProjectId;
            }
            if (requestMetadataProperties_metadataProperties_ProjectId != null)
            {
                request.MetadataProperties.ProjectId = requestMetadataProperties_metadataProperties_ProjectId;
                requestMetadataPropertiesIsNull      = false;
            }
            System.String requestMetadataProperties_metadataProperties_Repository = null;
            if (cmdletContext.MetadataProperties_Repository != null)
            {
                requestMetadataProperties_metadataProperties_Repository = cmdletContext.MetadataProperties_Repository;
            }
            if (requestMetadataProperties_metadataProperties_Repository != null)
            {
                request.MetadataProperties.Repository = requestMetadataProperties_metadataProperties_Repository;
                requestMetadataPropertiesIsNull       = false;
            }
            // determine if request.MetadataProperties should be set to null
            if (requestMetadataPropertiesIsNull)
            {
                request.MetadataProperties = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.TrialName != null)
            {
                request.TrialName = cmdletContext.TrialName;
            }

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