Ejemplo n.º 1
0
 private Amazon.MediaPackage.Model.CreateHarvestJobResponse CallAWSServiceOperation(IAmazonMediaPackage client, Amazon.MediaPackage.Model.CreateHarvestJobRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaPackage", "CreateHarvestJob");
     try
     {
         #if DESKTOP
         return(client.CreateHarvestJob(request));
         #elif CORECLR
         return(client.CreateHarvestJobAsync(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.MediaPackage.Model.CreateHarvestJobRequest();

            if (cmdletContext.EndTime != null)
            {
                request.EndTime = cmdletContext.EndTime;
            }
            if (cmdletContext.Id != null)
            {
                request.Id = cmdletContext.Id;
            }
            if (cmdletContext.OriginEndpointId != null)
            {
                request.OriginEndpointId = cmdletContext.OriginEndpointId;
            }

            // populate S3Destination
            var requestS3DestinationIsNull = true;

            request.S3Destination = new Amazon.MediaPackage.Model.S3Destination();
            System.String requestS3Destination_s3Destination_BucketName = null;
            if (cmdletContext.S3Destination_BucketName != null)
            {
                requestS3Destination_s3Destination_BucketName = cmdletContext.S3Destination_BucketName;
            }
            if (requestS3Destination_s3Destination_BucketName != null)
            {
                request.S3Destination.BucketName = requestS3Destination_s3Destination_BucketName;
                requestS3DestinationIsNull       = false;
            }
            System.String requestS3Destination_s3Destination_ManifestKey = null;
            if (cmdletContext.S3Destination_ManifestKey != null)
            {
                requestS3Destination_s3Destination_ManifestKey = cmdletContext.S3Destination_ManifestKey;
            }
            if (requestS3Destination_s3Destination_ManifestKey != null)
            {
                request.S3Destination.ManifestKey = requestS3Destination_s3Destination_ManifestKey;
                requestS3DestinationIsNull        = false;
            }
            System.String requestS3Destination_s3Destination_RoleArn = null;
            if (cmdletContext.S3Destination_RoleArn != null)
            {
                requestS3Destination_s3Destination_RoleArn = cmdletContext.S3Destination_RoleArn;
            }
            if (requestS3Destination_s3Destination_RoleArn != null)
            {
                request.S3Destination.RoleArn = requestS3Destination_s3Destination_RoleArn;
                requestS3DestinationIsNull    = false;
            }
            // determine if request.S3Destination should be set to null
            if (requestS3DestinationIsNull)
            {
                request.S3Destination = null;
            }
            if (cmdletContext.StartTime != null)
            {
                request.StartTime = cmdletContext.StartTime;
            }

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