예제 #1
0
 private Amazon.DataExchange.Model.CreateJobResponse CallAWSServiceOperation(IAmazonDataExchange client, Amazon.DataExchange.Model.CreateJobRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Data Exchange", "CreateJob");
     try
     {
         #if DESKTOP
         return(client.CreateJob(request));
         #elif CORECLR
         return(client.CreateJobAsync(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;
     }
 }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.DataExchange.Model.CreateJobRequest();


            // populate Details
            var requestDetailsIsNull = true;

            request.Details = new Amazon.DataExchange.Model.RequestDetails();
            Amazon.DataExchange.Model.ExportAssetsToS3RequestDetails requestDetails_details_ExportAssetsToS3 = null;

            // populate ExportAssetsToS3
            var requestDetails_details_ExportAssetsToS3IsNull = true;

            requestDetails_details_ExportAssetsToS3 = new Amazon.DataExchange.Model.ExportAssetsToS3RequestDetails();
            List <Amazon.DataExchange.Model.AssetDestinationEntry> requestDetails_details_ExportAssetsToS3_exportAssetsToS3_AssetDestination = null;

            if (cmdletContext.ExportAssetsToS3_AssetDestination != null)
            {
                requestDetails_details_ExportAssetsToS3_exportAssetsToS3_AssetDestination = cmdletContext.ExportAssetsToS3_AssetDestination;
            }
            if (requestDetails_details_ExportAssetsToS3_exportAssetsToS3_AssetDestination != null)
            {
                requestDetails_details_ExportAssetsToS3.AssetDestinations = requestDetails_details_ExportAssetsToS3_exportAssetsToS3_AssetDestination;
                requestDetails_details_ExportAssetsToS3IsNull             = false;
            }
            System.String requestDetails_details_ExportAssetsToS3_exportAssetsToS3_DataSetId = null;
            if (cmdletContext.ExportAssetsToS3_DataSetId != null)
            {
                requestDetails_details_ExportAssetsToS3_exportAssetsToS3_DataSetId = cmdletContext.ExportAssetsToS3_DataSetId;
            }
            if (requestDetails_details_ExportAssetsToS3_exportAssetsToS3_DataSetId != null)
            {
                requestDetails_details_ExportAssetsToS3.DataSetId = requestDetails_details_ExportAssetsToS3_exportAssetsToS3_DataSetId;
                requestDetails_details_ExportAssetsToS3IsNull     = false;
            }
            System.String requestDetails_details_ExportAssetsToS3_exportAssetsToS3_RevisionId = null;
            if (cmdletContext.ExportAssetsToS3_RevisionId != null)
            {
                requestDetails_details_ExportAssetsToS3_exportAssetsToS3_RevisionId = cmdletContext.ExportAssetsToS3_RevisionId;
            }
            if (requestDetails_details_ExportAssetsToS3_exportAssetsToS3_RevisionId != null)
            {
                requestDetails_details_ExportAssetsToS3.RevisionId = requestDetails_details_ExportAssetsToS3_exportAssetsToS3_RevisionId;
                requestDetails_details_ExportAssetsToS3IsNull      = false;
            }
            // determine if requestDetails_details_ExportAssetsToS3 should be set to null
            if (requestDetails_details_ExportAssetsToS3IsNull)
            {
                requestDetails_details_ExportAssetsToS3 = null;
            }
            if (requestDetails_details_ExportAssetsToS3 != null)
            {
                request.Details.ExportAssetsToS3 = requestDetails_details_ExportAssetsToS3;
                requestDetailsIsNull             = false;
            }
            Amazon.DataExchange.Model.ExportAssetToSignedUrlRequestDetails requestDetails_details_ExportAssetToSignedUrl = null;

            // populate ExportAssetToSignedUrl
            var requestDetails_details_ExportAssetToSignedUrlIsNull = true;

            requestDetails_details_ExportAssetToSignedUrl = new Amazon.DataExchange.Model.ExportAssetToSignedUrlRequestDetails();
            System.String requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_AssetId = null;
            if (cmdletContext.ExportAssetToSignedUrl_AssetId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_AssetId = cmdletContext.ExportAssetToSignedUrl_AssetId;
            }
            if (requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_AssetId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl.AssetId = requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_AssetId;
                requestDetails_details_ExportAssetToSignedUrlIsNull   = false;
            }
            System.String requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_DataSetId = null;
            if (cmdletContext.ExportAssetToSignedUrl_DataSetId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_DataSetId = cmdletContext.ExportAssetToSignedUrl_DataSetId;
            }
            if (requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_DataSetId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl.DataSetId = requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_DataSetId;
                requestDetails_details_ExportAssetToSignedUrlIsNull     = false;
            }
            System.String requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_RevisionId = null;
            if (cmdletContext.ExportAssetToSignedUrl_RevisionId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_RevisionId = cmdletContext.ExportAssetToSignedUrl_RevisionId;
            }
            if (requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_RevisionId != null)
            {
                requestDetails_details_ExportAssetToSignedUrl.RevisionId = requestDetails_details_ExportAssetToSignedUrl_exportAssetToSignedUrl_RevisionId;
                requestDetails_details_ExportAssetToSignedUrlIsNull      = false;
            }
            // determine if requestDetails_details_ExportAssetToSignedUrl should be set to null
            if (requestDetails_details_ExportAssetToSignedUrlIsNull)
            {
                requestDetails_details_ExportAssetToSignedUrl = null;
            }
            if (requestDetails_details_ExportAssetToSignedUrl != null)
            {
                request.Details.ExportAssetToSignedUrl = requestDetails_details_ExportAssetToSignedUrl;
                requestDetailsIsNull = false;
            }
            Amazon.DataExchange.Model.ImportAssetsFromS3RequestDetails requestDetails_details_ImportAssetsFromS3 = null;

            // populate ImportAssetsFromS3
            var requestDetails_details_ImportAssetsFromS3IsNull = true;

            requestDetails_details_ImportAssetsFromS3 = new Amazon.DataExchange.Model.ImportAssetsFromS3RequestDetails();
            List <Amazon.DataExchange.Model.AssetSourceEntry> requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_AssetSource = null;

            if (cmdletContext.ImportAssetsFromS3_AssetSource != null)
            {
                requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_AssetSource = cmdletContext.ImportAssetsFromS3_AssetSource;
            }
            if (requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_AssetSource != null)
            {
                requestDetails_details_ImportAssetsFromS3.AssetSources = requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_AssetSource;
                requestDetails_details_ImportAssetsFromS3IsNull        = false;
            }
            System.String requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_DataSetId = null;
            if (cmdletContext.ImportAssetsFromS3_DataSetId != null)
            {
                requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_DataSetId = cmdletContext.ImportAssetsFromS3_DataSetId;
            }
            if (requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_DataSetId != null)
            {
                requestDetails_details_ImportAssetsFromS3.DataSetId = requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_DataSetId;
                requestDetails_details_ImportAssetsFromS3IsNull     = false;
            }
            System.String requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_RevisionId = null;
            if (cmdletContext.ImportAssetsFromS3_RevisionId != null)
            {
                requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_RevisionId = cmdletContext.ImportAssetsFromS3_RevisionId;
            }
            if (requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_RevisionId != null)
            {
                requestDetails_details_ImportAssetsFromS3.RevisionId = requestDetails_details_ImportAssetsFromS3_importAssetsFromS3_RevisionId;
                requestDetails_details_ImportAssetsFromS3IsNull      = false;
            }
            // determine if requestDetails_details_ImportAssetsFromS3 should be set to null
            if (requestDetails_details_ImportAssetsFromS3IsNull)
            {
                requestDetails_details_ImportAssetsFromS3 = null;
            }
            if (requestDetails_details_ImportAssetsFromS3 != null)
            {
                request.Details.ImportAssetsFromS3 = requestDetails_details_ImportAssetsFromS3;
                requestDetailsIsNull = false;
            }
            Amazon.DataExchange.Model.ImportAssetFromSignedUrlRequestDetails requestDetails_details_ImportAssetFromSignedUrl = null;

            // populate ImportAssetFromSignedUrl
            var requestDetails_details_ImportAssetFromSignedUrlIsNull = true;

            requestDetails_details_ImportAssetFromSignedUrl = new Amazon.DataExchange.Model.ImportAssetFromSignedUrlRequestDetails();
            System.String requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_AssetName = null;
            if (cmdletContext.ImportAssetFromSignedUrl_AssetName != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_AssetName = cmdletContext.ImportAssetFromSignedUrl_AssetName;
            }
            if (requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_AssetName != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl.AssetName = requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_AssetName;
                requestDetails_details_ImportAssetFromSignedUrlIsNull     = false;
            }
            System.String requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_DataSetId = null;
            if (cmdletContext.ImportAssetFromSignedUrl_DataSetId != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_DataSetId = cmdletContext.ImportAssetFromSignedUrl_DataSetId;
            }
            if (requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_DataSetId != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl.DataSetId = requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_DataSetId;
                requestDetails_details_ImportAssetFromSignedUrlIsNull     = false;
            }
            System.String requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_Md5Hash = null;
            if (cmdletContext.ImportAssetFromSignedUrl_Md5Hash != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_Md5Hash = cmdletContext.ImportAssetFromSignedUrl_Md5Hash;
            }
            if (requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_Md5Hash != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl.Md5Hash = requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_Md5Hash;
                requestDetails_details_ImportAssetFromSignedUrlIsNull   = false;
            }
            System.String requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_RevisionId = null;
            if (cmdletContext.ImportAssetFromSignedUrl_RevisionId != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_RevisionId = cmdletContext.ImportAssetFromSignedUrl_RevisionId;
            }
            if (requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_RevisionId != null)
            {
                requestDetails_details_ImportAssetFromSignedUrl.RevisionId = requestDetails_details_ImportAssetFromSignedUrl_importAssetFromSignedUrl_RevisionId;
                requestDetails_details_ImportAssetFromSignedUrlIsNull      = false;
            }
            // determine if requestDetails_details_ImportAssetFromSignedUrl should be set to null
            if (requestDetails_details_ImportAssetFromSignedUrlIsNull)
            {
                requestDetails_details_ImportAssetFromSignedUrl = null;
            }
            if (requestDetails_details_ImportAssetFromSignedUrl != null)
            {
                request.Details.ImportAssetFromSignedUrl = requestDetails_details_ImportAssetFromSignedUrl;
                requestDetailsIsNull = false;
            }
            // determine if request.Details should be set to null
            if (requestDetailsIsNull)
            {
                request.Details = null;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }

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