Пример #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LookoutforVision.Model.CreateModelRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }

            // populate OutputConfig
            var requestOutputConfigIsNull = true;

            request.OutputConfig = new Amazon.LookoutforVision.Model.OutputConfig();
            Amazon.LookoutforVision.Model.S3Location requestOutputConfig_outputConfig_S3Location = null;

            // populate S3Location
            var requestOutputConfig_outputConfig_S3LocationIsNull = true;

            requestOutputConfig_outputConfig_S3Location = new Amazon.LookoutforVision.Model.S3Location();
            System.String requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket = null;
            if (cmdletContext.Output_S3Location_Bucket != null)
            {
                requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket = cmdletContext.Output_S3Location_Bucket;
            }
            if (requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket != null)
            {
                requestOutputConfig_outputConfig_S3Location.Bucket = requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket;
                requestOutputConfig_outputConfig_S3LocationIsNull  = false;
            }
            System.String requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix = null;
            if (cmdletContext.Output_S3Location_Prefix != null)
            {
                requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix = cmdletContext.Output_S3Location_Prefix;
            }
            if (requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix != null)
            {
                requestOutputConfig_outputConfig_S3Location.Prefix = requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix;
                requestOutputConfig_outputConfig_S3LocationIsNull  = false;
            }
            // determine if requestOutputConfig_outputConfig_S3Location should be set to null
            if (requestOutputConfig_outputConfig_S3LocationIsNull)
            {
                requestOutputConfig_outputConfig_S3Location = null;
            }
            if (requestOutputConfig_outputConfig_S3Location != null)
            {
                request.OutputConfig.S3Location = requestOutputConfig_outputConfig_S3Location;
                requestOutputConfigIsNull       = false;
            }
            // determine if request.OutputConfig should be set to null
            if (requestOutputConfigIsNull)
            {
                request.OutputConfig = null;
            }
            if (cmdletContext.ProjectName != null)
            {
                request.ProjectName = cmdletContext.ProjectName;
            }
            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);
        }
Пример #2
0
 private Amazon.LookoutforVision.Model.CreateModelResponse CallAWSServiceOperation(IAmazonLookoutforVision client, Amazon.LookoutforVision.Model.CreateModelRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lookout for Vision", "CreateModel");
     try
     {
         #if DESKTOP
         return(client.CreateModel(request));
         #elif CORECLR
         return(client.CreateModelAsync(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.LookoutforVision.Model.CreateModelRequest();

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

            // populate Description
            var requestDescriptionIsNull = true;

            request.Description = new Amazon.LookoutforVision.Model.ModelDescription();
            System.DateTime?requestDescription_description_CreationTimestamp = null;
            if (cmdletContext.Description_CreationTimestamp != null)
            {
                requestDescription_description_CreationTimestamp = cmdletContext.Description_CreationTimestamp.Value;
            }
            if (requestDescription_description_CreationTimestamp != null)
            {
                request.Description.CreationTimestamp = requestDescription_description_CreationTimestamp.Value;
                requestDescriptionIsNull = false;
            }
            System.String requestDescription_description_Description = null;
            if (cmdletContext.Description_Description != null)
            {
                requestDescription_description_Description = cmdletContext.Description_Description;
            }
            if (requestDescription_description_Description != null)
            {
                request.Description.Description = requestDescription_description_Description;
                requestDescriptionIsNull        = false;
            }
            System.DateTime?requestDescription_description_EvaluationEndTimestamp = null;
            if (cmdletContext.Description_EvaluationEndTimestamp != null)
            {
                requestDescription_description_EvaluationEndTimestamp = cmdletContext.Description_EvaluationEndTimestamp.Value;
            }
            if (requestDescription_description_EvaluationEndTimestamp != null)
            {
                request.Description.EvaluationEndTimestamp = requestDescription_description_EvaluationEndTimestamp.Value;
                requestDescriptionIsNull = false;
            }
            System.String requestDescription_description_KmsKeyId = null;
            if (cmdletContext.Description_KmsKeyId != null)
            {
                requestDescription_description_KmsKeyId = cmdletContext.Description_KmsKeyId;
            }
            if (requestDescription_description_KmsKeyId != null)
            {
                request.Description.KmsKeyId = requestDescription_description_KmsKeyId;
                requestDescriptionIsNull     = false;
            }
            System.String requestDescription_description_ModelArn = null;
            if (cmdletContext.Description_ModelArn != null)
            {
                requestDescription_description_ModelArn = cmdletContext.Description_ModelArn;
            }
            if (requestDescription_description_ModelArn != null)
            {
                request.Description.ModelArn = requestDescription_description_ModelArn;
                requestDescriptionIsNull     = false;
            }
            System.String requestDescription_description_ModelVersion = null;
            if (cmdletContext.Description_ModelVersion != null)
            {
                requestDescription_description_ModelVersion = cmdletContext.Description_ModelVersion;
            }
            if (requestDescription_description_ModelVersion != null)
            {
                request.Description.ModelVersion = requestDescription_description_ModelVersion;
                requestDescriptionIsNull         = false;
            }
            Amazon.LookoutforVision.ModelStatus requestDescription_description_Status = null;
            if (cmdletContext.Description_Status != null)
            {
                requestDescription_description_Status = cmdletContext.Description_Status;
            }
            if (requestDescription_description_Status != null)
            {
                request.Description.Status = requestDescription_description_Status;
                requestDescriptionIsNull   = false;
            }
            System.String requestDescription_description_StatusMessage = null;
            if (cmdletContext.Description_StatusMessage != null)
            {
                requestDescription_description_StatusMessage = cmdletContext.Description_StatusMessage;
            }
            if (requestDescription_description_StatusMessage != null)
            {
                request.Description.StatusMessage = requestDescription_description_StatusMessage;
                requestDescriptionIsNull          = false;
            }
            Amazon.LookoutforVision.Model.OutputConfig requestDescription_description_OutputConfig = null;

            // populate OutputConfig
            var requestDescription_description_OutputConfigIsNull = true;

            requestDescription_description_OutputConfig = new Amazon.LookoutforVision.Model.OutputConfig();
            Amazon.LookoutforVision.Model.S3Location requestDescription_description_OutputConfig_description_OutputConfig_S3Location = null;

            // populate S3Location
            var requestDescription_description_OutputConfig_description_OutputConfig_S3LocationIsNull = true;

            requestDescription_description_OutputConfig_description_OutputConfig_S3Location = new Amazon.LookoutforVision.Model.S3Location();
            System.String requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Bucket = null;
            if (cmdletContext.S3Location_Bucket != null)
            {
                requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Bucket = cmdletContext.S3Location_Bucket;
            }
            if (requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Bucket != null)
            {
                requestDescription_description_OutputConfig_description_OutputConfig_S3Location.Bucket = requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Bucket;
                requestDescription_description_OutputConfig_description_OutputConfig_S3LocationIsNull  = false;
            }
            System.String requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Prefix = null;
            if (cmdletContext.S3Location_Prefix != null)
            {
                requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Prefix = cmdletContext.S3Location_Prefix;
            }
            if (requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Prefix != null)
            {
                requestDescription_description_OutputConfig_description_OutputConfig_S3Location.Prefix = requestDescription_description_OutputConfig_description_OutputConfig_S3Location_s3Location_Prefix;
                requestDescription_description_OutputConfig_description_OutputConfig_S3LocationIsNull  = false;
            }
            // determine if requestDescription_description_OutputConfig_description_OutputConfig_S3Location should be set to null
            if (requestDescription_description_OutputConfig_description_OutputConfig_S3LocationIsNull)
            {
                requestDescription_description_OutputConfig_description_OutputConfig_S3Location = null;
            }
            if (requestDescription_description_OutputConfig_description_OutputConfig_S3Location != null)
            {
                requestDescription_description_OutputConfig.S3Location = requestDescription_description_OutputConfig_description_OutputConfig_S3Location;
                requestDescription_description_OutputConfigIsNull      = false;
            }
            // determine if requestDescription_description_OutputConfig should be set to null
            if (requestDescription_description_OutputConfigIsNull)
            {
                requestDescription_description_OutputConfig = null;
            }
            if (requestDescription_description_OutputConfig != null)
            {
                request.Description.OutputConfig = requestDescription_description_OutputConfig;
                requestDescriptionIsNull         = false;
            }
            Amazon.LookoutforVision.Model.OutputS3Object requestDescription_description_EvaluationManifest = null;

            // populate EvaluationManifest
            var requestDescription_description_EvaluationManifestIsNull = true;

            requestDescription_description_EvaluationManifest = new Amazon.LookoutforVision.Model.OutputS3Object();
            System.String requestDescription_description_EvaluationManifest_evaluationManifest_Bucket = null;
            if (cmdletContext.EvaluationManifest_Bucket != null)
            {
                requestDescription_description_EvaluationManifest_evaluationManifest_Bucket = cmdletContext.EvaluationManifest_Bucket;
            }
            if (requestDescription_description_EvaluationManifest_evaluationManifest_Bucket != null)
            {
                requestDescription_description_EvaluationManifest.Bucket = requestDescription_description_EvaluationManifest_evaluationManifest_Bucket;
                requestDescription_description_EvaluationManifestIsNull  = false;
            }
            System.String requestDescription_description_EvaluationManifest_evaluationManifest_Key = null;
            if (cmdletContext.EvaluationManifest_Key != null)
            {
                requestDescription_description_EvaluationManifest_evaluationManifest_Key = cmdletContext.EvaluationManifest_Key;
            }
            if (requestDescription_description_EvaluationManifest_evaluationManifest_Key != null)
            {
                requestDescription_description_EvaluationManifest.Key   = requestDescription_description_EvaluationManifest_evaluationManifest_Key;
                requestDescription_description_EvaluationManifestIsNull = false;
            }
            // determine if requestDescription_description_EvaluationManifest should be set to null
            if (requestDescription_description_EvaluationManifestIsNull)
            {
                requestDescription_description_EvaluationManifest = null;
            }
            if (requestDescription_description_EvaluationManifest != null)
            {
                request.Description.EvaluationManifest = requestDescription_description_EvaluationManifest;
                requestDescriptionIsNull = false;
            }
            Amazon.LookoutforVision.Model.OutputS3Object requestDescription_description_EvaluationResult = null;

            // populate EvaluationResult
            var requestDescription_description_EvaluationResultIsNull = true;

            requestDescription_description_EvaluationResult = new Amazon.LookoutforVision.Model.OutputS3Object();
            System.String requestDescription_description_EvaluationResult_evaluationResult_Bucket = null;
            if (cmdletContext.EvaluationResult_Bucket != null)
            {
                requestDescription_description_EvaluationResult_evaluationResult_Bucket = cmdletContext.EvaluationResult_Bucket;
            }
            if (requestDescription_description_EvaluationResult_evaluationResult_Bucket != null)
            {
                requestDescription_description_EvaluationResult.Bucket = requestDescription_description_EvaluationResult_evaluationResult_Bucket;
                requestDescription_description_EvaluationResultIsNull  = false;
            }
            System.String requestDescription_description_EvaluationResult_evaluationResult_Key = null;
            if (cmdletContext.EvaluationResult_Key != null)
            {
                requestDescription_description_EvaluationResult_evaluationResult_Key = cmdletContext.EvaluationResult_Key;
            }
            if (requestDescription_description_EvaluationResult_evaluationResult_Key != null)
            {
                requestDescription_description_EvaluationResult.Key   = requestDescription_description_EvaluationResult_evaluationResult_Key;
                requestDescription_description_EvaluationResultIsNull = false;
            }
            // determine if requestDescription_description_EvaluationResult should be set to null
            if (requestDescription_description_EvaluationResultIsNull)
            {
                requestDescription_description_EvaluationResult = null;
            }
            if (requestDescription_description_EvaluationResult != null)
            {
                request.Description.EvaluationResult = requestDescription_description_EvaluationResult;
                requestDescriptionIsNull             = false;
            }
            Amazon.LookoutforVision.Model.ModelPerformance requestDescription_description_Performance = null;

            // populate Performance
            var requestDescription_description_PerformanceIsNull = true;

            requestDescription_description_Performance = new Amazon.LookoutforVision.Model.ModelPerformance();
            System.Single?requestDescription_description_Performance_performance_F1Score = null;
            if (cmdletContext.Performance_F1Score != null)
            {
                requestDescription_description_Performance_performance_F1Score = cmdletContext.Performance_F1Score.Value;
            }
            if (requestDescription_description_Performance_performance_F1Score != null)
            {
                requestDescription_description_Performance.F1Score = requestDescription_description_Performance_performance_F1Score.Value;
                requestDescription_description_PerformanceIsNull   = false;
            }
            System.Single?requestDescription_description_Performance_performance_Precision = null;
            if (cmdletContext.Performance_Precision != null)
            {
                requestDescription_description_Performance_performance_Precision = cmdletContext.Performance_Precision.Value;
            }
            if (requestDescription_description_Performance_performance_Precision != null)
            {
                requestDescription_description_Performance.Precision = requestDescription_description_Performance_performance_Precision.Value;
                requestDescription_description_PerformanceIsNull     = false;
            }
            System.Single?requestDescription_description_Performance_performance_Recall = null;
            if (cmdletContext.Performance_Recall != null)
            {
                requestDescription_description_Performance_performance_Recall = cmdletContext.Performance_Recall.Value;
            }
            if (requestDescription_description_Performance_performance_Recall != null)
            {
                requestDescription_description_Performance.Recall = requestDescription_description_Performance_performance_Recall.Value;
                requestDescription_description_PerformanceIsNull  = false;
            }
            // determine if requestDescription_description_Performance should be set to null
            if (requestDescription_description_PerformanceIsNull)
            {
                requestDescription_description_Performance = null;
            }
            if (requestDescription_description_Performance != null)
            {
                request.Description.Performance = requestDescription_description_Performance;
                requestDescriptionIsNull        = false;
            }
            // determine if request.Description should be set to null
            if (requestDescriptionIsNull)
            {
                request.Description = null;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }

            // populate OutputConfig
            var requestOutputConfigIsNull = true;

            request.OutputConfig = new Amazon.LookoutforVision.Model.OutputConfig();
            Amazon.LookoutforVision.Model.S3Location requestOutputConfig_outputConfig_S3Location = null;

            // populate S3Location
            var requestOutputConfig_outputConfig_S3LocationIsNull = true;

            requestOutputConfig_outputConfig_S3Location = new Amazon.LookoutforVision.Model.S3Location();
            System.String requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket = null;
            if (cmdletContext.Output_S3Location_Bucket != null)
            {
                requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket = cmdletContext.Output_S3Location_Bucket;
            }
            if (requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket != null)
            {
                requestOutputConfig_outputConfig_S3Location.Bucket = requestOutputConfig_outputConfig_S3Location_output_S3Location_Bucket;
                requestOutputConfig_outputConfig_S3LocationIsNull  = false;
            }
            System.String requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix = null;
            if (cmdletContext.Output_S3Location_Prefix != null)
            {
                requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix = cmdletContext.Output_S3Location_Prefix;
            }
            if (requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix != null)
            {
                requestOutputConfig_outputConfig_S3Location.Prefix = requestOutputConfig_outputConfig_S3Location_output_S3Location_Prefix;
                requestOutputConfig_outputConfig_S3LocationIsNull  = false;
            }
            // determine if requestOutputConfig_outputConfig_S3Location should be set to null
            if (requestOutputConfig_outputConfig_S3LocationIsNull)
            {
                requestOutputConfig_outputConfig_S3Location = null;
            }
            if (requestOutputConfig_outputConfig_S3Location != null)
            {
                request.OutputConfig.S3Location = requestOutputConfig_outputConfig_S3Location;
                requestOutputConfigIsNull       = false;
            }
            // determine if request.OutputConfig should be set to null
            if (requestOutputConfigIsNull)
            {
                request.OutputConfig = null;
            }
            if (cmdletContext.ProjectName != null)
            {
                request.ProjectName = cmdletContext.ProjectName;
            }

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