private Amazon.Rekognition.Model.CreateProjectVersionResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.CreateProjectVersionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "CreateProjectVersion");
     try
     {
         #if DESKTOP
         return(client.CreateProjectVersion(request));
         #elif CORECLR
         return(client.CreateProjectVersionAsync(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.Rekognition.Model.CreateProjectVersionRequest();


            // populate OutputConfig
            var requestOutputConfigIsNull = true;

            request.OutputConfig = new Amazon.Rekognition.Model.OutputConfig();
            System.String requestOutputConfig_outputConfig_S3Bucket = null;
            if (cmdletContext.OutputConfig_S3Bucket != null)
            {
                requestOutputConfig_outputConfig_S3Bucket = cmdletContext.OutputConfig_S3Bucket;
            }
            if (requestOutputConfig_outputConfig_S3Bucket != null)
            {
                request.OutputConfig.S3Bucket = requestOutputConfig_outputConfig_S3Bucket;
                requestOutputConfigIsNull     = false;
            }
            System.String requestOutputConfig_outputConfig_S3KeyPrefix = null;
            if (cmdletContext.OutputConfig_S3KeyPrefix != null)
            {
                requestOutputConfig_outputConfig_S3KeyPrefix = cmdletContext.OutputConfig_S3KeyPrefix;
            }
            if (requestOutputConfig_outputConfig_S3KeyPrefix != null)
            {
                request.OutputConfig.S3KeyPrefix = requestOutputConfig_outputConfig_S3KeyPrefix;
                requestOutputConfigIsNull        = false;
            }
            // determine if request.OutputConfig should be set to null
            if (requestOutputConfigIsNull)
            {
                request.OutputConfig = null;
            }
            if (cmdletContext.ProjectArn != null)
            {
                request.ProjectArn = cmdletContext.ProjectArn;
            }

            // populate TestingData
            var requestTestingDataIsNull = true;

            request.TestingData = new Amazon.Rekognition.Model.TestingData();
            List <Amazon.Rekognition.Model.Asset> requestTestingData_testingData_Asset = null;

            if (cmdletContext.TestingData_Asset != null)
            {
                requestTestingData_testingData_Asset = cmdletContext.TestingData_Asset;
            }
            if (requestTestingData_testingData_Asset != null)
            {
                request.TestingData.Assets = requestTestingData_testingData_Asset;
                requestTestingDataIsNull   = false;
            }
            System.Boolean?requestTestingData_testingData_AutoCreate = null;
            if (cmdletContext.TestingData_AutoCreate != null)
            {
                requestTestingData_testingData_AutoCreate = cmdletContext.TestingData_AutoCreate.Value;
            }
            if (requestTestingData_testingData_AutoCreate != null)
            {
                request.TestingData.AutoCreate = requestTestingData_testingData_AutoCreate.Value;
                requestTestingDataIsNull       = false;
            }
            // determine if request.TestingData should be set to null
            if (requestTestingDataIsNull)
            {
                request.TestingData = null;
            }

            // populate TrainingData
            var requestTrainingDataIsNull = true;

            request.TrainingData = new Amazon.Rekognition.Model.TrainingData();
            List <Amazon.Rekognition.Model.Asset> requestTrainingData_trainingData_Asset = null;

            if (cmdletContext.TrainingData_Asset != null)
            {
                requestTrainingData_trainingData_Asset = cmdletContext.TrainingData_Asset;
            }
            if (requestTrainingData_trainingData_Asset != null)
            {
                request.TrainingData.Assets = requestTrainingData_trainingData_Asset;
                requestTrainingDataIsNull   = false;
            }
            // determine if request.TrainingData should be set to null
            if (requestTrainingDataIsNull)
            {
                request.TrainingData = null;
            }
            if (cmdletContext.VersionName != null)
            {
                request.VersionName = cmdletContext.VersionName;
            }

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