Ejemplo n.º 1
0
 private Amazon.Rekognition.Model.CreateDatasetResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.CreateDatasetRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "CreateDataset");
     try
     {
         #if DESKTOP
         return(client.CreateDataset(request));
         #elif CORECLR
         return(client.CreateDatasetAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Rekognition.Model.CreateDatasetRequest();


            // populate DatasetSource
            var requestDatasetSourceIsNull = true;

            request.DatasetSource = new Amazon.Rekognition.Model.DatasetSource();
            System.String requestDatasetSource_datasetSource_DatasetArn = null;
            if (cmdletContext.DatasetSource_DatasetArn != null)
            {
                requestDatasetSource_datasetSource_DatasetArn = cmdletContext.DatasetSource_DatasetArn;
            }
            if (requestDatasetSource_datasetSource_DatasetArn != null)
            {
                request.DatasetSource.DatasetArn = requestDatasetSource_datasetSource_DatasetArn;
                requestDatasetSourceIsNull       = false;
            }
            Amazon.Rekognition.Model.GroundTruthManifest requestDatasetSource_datasetSource_GroundTruthManifest = null;

            // populate GroundTruthManifest
            var requestDatasetSource_datasetSource_GroundTruthManifestIsNull = true;

            requestDatasetSource_datasetSource_GroundTruthManifest = new Amazon.Rekognition.Model.GroundTruthManifest();
            Amazon.Rekognition.Model.S3Object requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object = null;

            // populate S3Object
            var requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull = true;

            requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object = new Amazon.Rekognition.Model.S3Object();
            System.String requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Bucket = null;
            if (cmdletContext.S3Object_Bucket != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Bucket = cmdletContext.S3Object_Bucket;
            }
            if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Bucket != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object.Bucket = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Bucket;
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull  = false;
            }
            System.String requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Name = null;
            if (cmdletContext.S3Object_Name != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Name = cmdletContext.S3Object_Name;
            }
            if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Name != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object.Name  = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Name;
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull = false;
            }
            System.String requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Version = null;
            if (cmdletContext.S3Object_Version != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Version = cmdletContext.S3Object_Version;
            }
            if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Version != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object.Version = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Version;
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull   = false;
            }
            // determine if requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object should be set to null
            if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object = null;
            }
            if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object != null)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest.S3Object = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object;
                requestDatasetSource_datasetSource_GroundTruthManifestIsNull    = false;
            }
            // determine if requestDatasetSource_datasetSource_GroundTruthManifest should be set to null
            if (requestDatasetSource_datasetSource_GroundTruthManifestIsNull)
            {
                requestDatasetSource_datasetSource_GroundTruthManifest = null;
            }
            if (requestDatasetSource_datasetSource_GroundTruthManifest != null)
            {
                request.DatasetSource.GroundTruthManifest = requestDatasetSource_datasetSource_GroundTruthManifest;
                requestDatasetSourceIsNull = false;
            }
            // determine if request.DatasetSource should be set to null
            if (requestDatasetSourceIsNull)
            {
                request.DatasetSource = null;
            }
            if (cmdletContext.DatasetType != null)
            {
                request.DatasetType = cmdletContext.DatasetType;
            }
            if (cmdletContext.ProjectArn != null)
            {
                request.ProjectArn = cmdletContext.ProjectArn;
            }

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