Exemple #1
0
 private Amazon.AugmentedAIRuntime.Model.StartHumanLoopResponse CallAWSServiceOperation(IAmazonAugmentedAIRuntime client, Amazon.AugmentedAIRuntime.Model.StartHumanLoopRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Augmented AI (A2I) Runtime", "StartHumanLoop");
     try
     {
         #if DESKTOP
         return(client.StartHumanLoop(request));
         #elif CORECLR
         return(client.StartHumanLoopAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AugmentedAIRuntime.Model.StartHumanLoopRequest();


            // populate DataAttributes
            var requestDataAttributesIsNull = true;

            request.DataAttributes = new Amazon.AugmentedAIRuntime.Model.HumanLoopDataAttributes();
            List <System.String> requestDataAttributes_dataAttributes_ContentClassifier = null;

            if (cmdletContext.DataAttributes_ContentClassifier != null)
            {
                requestDataAttributes_dataAttributes_ContentClassifier = cmdletContext.DataAttributes_ContentClassifier;
            }
            if (requestDataAttributes_dataAttributes_ContentClassifier != null)
            {
                request.DataAttributes.ContentClassifiers = requestDataAttributes_dataAttributes_ContentClassifier;
                requestDataAttributesIsNull = false;
            }
            // determine if request.DataAttributes should be set to null
            if (requestDataAttributesIsNull)
            {
                request.DataAttributes = null;
            }
            if (cmdletContext.FlowDefinitionArn != null)
            {
                request.FlowDefinitionArn = cmdletContext.FlowDefinitionArn;
            }

            // populate HumanLoopInput
            var requestHumanLoopInputIsNull = true;

            request.HumanLoopInput = new Amazon.AugmentedAIRuntime.Model.HumanLoopInput();
            System.String requestHumanLoopInput_humanLoopInput_InputContent = null;
            if (cmdletContext.HumanLoopInput_InputContent != null)
            {
                requestHumanLoopInput_humanLoopInput_InputContent = cmdletContext.HumanLoopInput_InputContent;
            }
            if (requestHumanLoopInput_humanLoopInput_InputContent != null)
            {
                request.HumanLoopInput.InputContent = requestHumanLoopInput_humanLoopInput_InputContent;
                requestHumanLoopInputIsNull         = false;
            }
            // determine if request.HumanLoopInput should be set to null
            if (requestHumanLoopInputIsNull)
            {
                request.HumanLoopInput = null;
            }
            if (cmdletContext.HumanLoopName != null)
            {
                request.HumanLoopName = cmdletContext.HumanLoopName;
            }

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