private Amazon.LookoutforVision.Model.CreateDatasetResponse CallAWSServiceOperation(IAmazonLookoutforVision client, Amazon.LookoutforVision.Model.CreateDatasetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lookout for Vision", "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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.LookoutforVision.Model.CreateDatasetRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } // populate DatasetSource var requestDatasetSourceIsNull = true; request.DatasetSource = new Amazon.LookoutforVision.Model.DatasetSource(); Amazon.LookoutforVision.Model.DatasetGroundTruthManifest requestDatasetSource_datasetSource_GroundTruthManifest = null; // populate GroundTruthManifest var requestDatasetSource_datasetSource_GroundTruthManifestIsNull = true; requestDatasetSource_datasetSource_GroundTruthManifest = new Amazon.LookoutforVision.Model.DatasetGroundTruthManifest(); Amazon.LookoutforVision.Model.InputS3Object 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.LookoutforVision.Model.InputS3Object(); 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_Key = null; if (cmdletContext.S3Object_Key != null) { requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Key = cmdletContext.S3Object_Key; } if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Key != null) { requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object.Key = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_Key; requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3ObjectIsNull = false; } System.String requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_VersionId = null; if (cmdletContext.S3Object_VersionId != null) { requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_VersionId = cmdletContext.S3Object_VersionId; } if (requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_VersionId != null) { requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object.VersionId = requestDatasetSource_datasetSource_GroundTruthManifest_datasetSource_GroundTruthManifest_S3Object_s3Object_VersionId; 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.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); }