示例#1
0
 private Amazon.SageMaker.Model.CreateFlowDefinitionResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateFlowDefinitionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateFlowDefinition");
     try
     {
         #if DESKTOP
         return(client.CreateFlowDefinition(request));
         #elif CORECLR
         return(client.CreateFlowDefinitionAsync(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;
     }
 }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreateFlowDefinitionRequest();

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

            // populate HumanLoopActivationConfig
            var requestHumanLoopActivationConfigIsNull = true;

            request.HumanLoopActivationConfig = new Amazon.SageMaker.Model.HumanLoopActivationConfig();
            Amazon.SageMaker.Model.HumanLoopActivationConditionsConfig requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig = null;

            // populate HumanLoopActivationConditionsConfig
            var requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfigIsNull = true;

            requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig = new Amazon.SageMaker.Model.HumanLoopActivationConditionsConfig();
            System.String requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig_humanLoopActivationConditionsConfig_HumanLoopActivationCondition = null;
            if (cmdletContext.HumanLoopActivationConditionsConfig_HumanLoopActivationCondition != null)
            {
                requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig_humanLoopActivationConditionsConfig_HumanLoopActivationCondition = cmdletContext.HumanLoopActivationConditionsConfig_HumanLoopActivationCondition;
            }
            if (requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig_humanLoopActivationConditionsConfig_HumanLoopActivationCondition != null)
            {
                requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig.HumanLoopActivationConditions = requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig_humanLoopActivationConditionsConfig_HumanLoopActivationCondition;
                requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfigIsNull = false;
            }
            // determine if requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig should be set to null
            if (requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfigIsNull)
            {
                requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig = null;
            }
            if (requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig != null)
            {
                request.HumanLoopActivationConfig.HumanLoopActivationConditionsConfig = requestHumanLoopActivationConfig_humanLoopActivationConfig_HumanLoopActivationConditionsConfig;
                requestHumanLoopActivationConfigIsNull = false;
            }
            // determine if request.HumanLoopActivationConfig should be set to null
            if (requestHumanLoopActivationConfigIsNull)
            {
                request.HumanLoopActivationConfig = null;
            }

            // populate HumanLoopConfig
            var requestHumanLoopConfigIsNull = true;

            request.HumanLoopConfig = new Amazon.SageMaker.Model.HumanLoopConfig();
            System.String requestHumanLoopConfig_humanLoopConfig_HumanTaskUiArn = null;
            if (cmdletContext.HumanLoopConfig_HumanTaskUiArn != null)
            {
                requestHumanLoopConfig_humanLoopConfig_HumanTaskUiArn = cmdletContext.HumanLoopConfig_HumanTaskUiArn;
            }
            if (requestHumanLoopConfig_humanLoopConfig_HumanTaskUiArn != null)
            {
                request.HumanLoopConfig.HumanTaskUiArn = requestHumanLoopConfig_humanLoopConfig_HumanTaskUiArn;
                requestHumanLoopConfigIsNull           = false;
            }
            System.Int32?requestHumanLoopConfig_humanLoopConfig_TaskAvailabilityLifetimeInSecond = null;
            if (cmdletContext.HumanLoopConfig_TaskAvailabilityLifetimeInSecond != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskAvailabilityLifetimeInSecond = cmdletContext.HumanLoopConfig_TaskAvailabilityLifetimeInSecond.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskAvailabilityLifetimeInSecond != null)
            {
                request.HumanLoopConfig.TaskAvailabilityLifetimeInSeconds = requestHumanLoopConfig_humanLoopConfig_TaskAvailabilityLifetimeInSecond.Value;
                requestHumanLoopConfigIsNull = false;
            }
            System.Int32?requestHumanLoopConfig_humanLoopConfig_TaskCount = null;
            if (cmdletContext.HumanLoopConfig_TaskCount != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskCount = cmdletContext.HumanLoopConfig_TaskCount.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskCount != null)
            {
                request.HumanLoopConfig.TaskCount = requestHumanLoopConfig_humanLoopConfig_TaskCount.Value;
                requestHumanLoopConfigIsNull      = false;
            }
            System.String requestHumanLoopConfig_humanLoopConfig_TaskDescription = null;
            if (cmdletContext.HumanLoopConfig_TaskDescription != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskDescription = cmdletContext.HumanLoopConfig_TaskDescription;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskDescription != null)
            {
                request.HumanLoopConfig.TaskDescription = requestHumanLoopConfig_humanLoopConfig_TaskDescription;
                requestHumanLoopConfigIsNull            = false;
            }
            List <System.String> requestHumanLoopConfig_humanLoopConfig_TaskKeyword = null;

            if (cmdletContext.HumanLoopConfig_TaskKeyword != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskKeyword = cmdletContext.HumanLoopConfig_TaskKeyword;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskKeyword != null)
            {
                request.HumanLoopConfig.TaskKeywords = requestHumanLoopConfig_humanLoopConfig_TaskKeyword;
                requestHumanLoopConfigIsNull         = false;
            }
            System.Int32?requestHumanLoopConfig_humanLoopConfig_TaskTimeLimitInSecond = null;
            if (cmdletContext.HumanLoopConfig_TaskTimeLimitInSecond != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskTimeLimitInSecond = cmdletContext.HumanLoopConfig_TaskTimeLimitInSecond.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskTimeLimitInSecond != null)
            {
                request.HumanLoopConfig.TaskTimeLimitInSeconds = requestHumanLoopConfig_humanLoopConfig_TaskTimeLimitInSecond.Value;
                requestHumanLoopConfigIsNull = false;
            }
            System.String requestHumanLoopConfig_humanLoopConfig_TaskTitle = null;
            if (cmdletContext.HumanLoopConfig_TaskTitle != null)
            {
                requestHumanLoopConfig_humanLoopConfig_TaskTitle = cmdletContext.HumanLoopConfig_TaskTitle;
            }
            if (requestHumanLoopConfig_humanLoopConfig_TaskTitle != null)
            {
                request.HumanLoopConfig.TaskTitle = requestHumanLoopConfig_humanLoopConfig_TaskTitle;
                requestHumanLoopConfigIsNull      = false;
            }
            System.String requestHumanLoopConfig_humanLoopConfig_WorkteamArn = null;
            if (cmdletContext.HumanLoopConfig_WorkteamArn != null)
            {
                requestHumanLoopConfig_humanLoopConfig_WorkteamArn = cmdletContext.HumanLoopConfig_WorkteamArn;
            }
            if (requestHumanLoopConfig_humanLoopConfig_WorkteamArn != null)
            {
                request.HumanLoopConfig.WorkteamArn = requestHumanLoopConfig_humanLoopConfig_WorkteamArn;
                requestHumanLoopConfigIsNull        = false;
            }
            Amazon.SageMaker.Model.PublicWorkforceTaskPrice requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice = null;

            // populate PublicWorkforceTaskPrice
            var requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPriceIsNull = true;

            requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice = new Amazon.SageMaker.Model.PublicWorkforceTaskPrice();
            Amazon.SageMaker.Model.USD requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd = null;

            // populate AmountInUsd
            var requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsdIsNull = true;

            requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd = new Amazon.SageMaker.Model.USD();
            System.Int32?requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Cent = null;
            if (cmdletContext.AmountInUsd_Cent != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Cent = cmdletContext.AmountInUsd_Cent.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Cent != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd.Cents = requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Cent.Value;
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsdIsNull = false;
            }
            System.Int32?requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Dollar = null;
            if (cmdletContext.AmountInUsd_Dollar != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Dollar = cmdletContext.AmountInUsd_Dollar.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Dollar != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd.Dollars = requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_Dollar.Value;
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsdIsNull   = false;
            }
            System.Int32?requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_TenthFractionsOfACent = null;
            if (cmdletContext.AmountInUsd_TenthFractionsOfACent != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_TenthFractionsOfACent = cmdletContext.AmountInUsd_TenthFractionsOfACent.Value;
            }
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_TenthFractionsOfACent != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd.TenthFractionsOfACent = requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd_amountInUsd_TenthFractionsOfACent.Value;
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsdIsNull = false;
            }
            // determine if requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd should be set to null
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsdIsNull)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd = null;
            }
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd != null)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice.AmountInUsd = requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice_humanLoopConfig_PublicWorkforceTaskPrice_AmountInUsd;
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPriceIsNull       = false;
            }
            // determine if requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice should be set to null
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPriceIsNull)
            {
                requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice = null;
            }
            if (requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice != null)
            {
                request.HumanLoopConfig.PublicWorkforceTaskPrice = requestHumanLoopConfig_humanLoopConfig_PublicWorkforceTaskPrice;
                requestHumanLoopConfigIsNull = false;
            }
            // determine if request.HumanLoopConfig should be set to null
            if (requestHumanLoopConfigIsNull)
            {
                request.HumanLoopConfig = null;
            }

            // populate HumanLoopRequestSource
            var requestHumanLoopRequestSourceIsNull = true;

            request.HumanLoopRequestSource = new Amazon.SageMaker.Model.HumanLoopRequestSource();
            Amazon.SageMaker.AwsManagedHumanLoopRequestSource requestHumanLoopRequestSource_humanLoopRequestSource_AwsManagedHumanLoopRequestSource = null;
            if (cmdletContext.HumanLoopRequestSource_AwsManagedHumanLoopRequestSource != null)
            {
                requestHumanLoopRequestSource_humanLoopRequestSource_AwsManagedHumanLoopRequestSource = cmdletContext.HumanLoopRequestSource_AwsManagedHumanLoopRequestSource;
            }
            if (requestHumanLoopRequestSource_humanLoopRequestSource_AwsManagedHumanLoopRequestSource != null)
            {
                request.HumanLoopRequestSource.AwsManagedHumanLoopRequestSource = requestHumanLoopRequestSource_humanLoopRequestSource_AwsManagedHumanLoopRequestSource;
                requestHumanLoopRequestSourceIsNull = false;
            }
            // determine if request.HumanLoopRequestSource should be set to null
            if (requestHumanLoopRequestSourceIsNull)
            {
                request.HumanLoopRequestSource = null;
            }

            // populate OutputConfig
            var requestOutputConfigIsNull = true;

            request.OutputConfig = new Amazon.SageMaker.Model.FlowDefinitionOutputConfig();
            System.String requestOutputConfig_outputConfig_KmsKeyId = null;
            if (cmdletContext.OutputConfig_KmsKeyId != null)
            {
                requestOutputConfig_outputConfig_KmsKeyId = cmdletContext.OutputConfig_KmsKeyId;
            }
            if (requestOutputConfig_outputConfig_KmsKeyId != null)
            {
                request.OutputConfig.KmsKeyId = requestOutputConfig_outputConfig_KmsKeyId;
                requestOutputConfigIsNull     = false;
            }
            System.String requestOutputConfig_outputConfig_S3OutputPath = null;
            if (cmdletContext.OutputConfig_S3OutputPath != null)
            {
                requestOutputConfig_outputConfig_S3OutputPath = cmdletContext.OutputConfig_S3OutputPath;
            }
            if (requestOutputConfig_outputConfig_S3OutputPath != null)
            {
                request.OutputConfig.S3OutputPath = requestOutputConfig_outputConfig_S3OutputPath;
                requestOutputConfigIsNull         = false;
            }
            // determine if request.OutputConfig should be set to null
            if (requestOutputConfigIsNull)
            {
                request.OutputConfig = null;
            }
            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);
        }