private Amazon.MediaConvert.Model.PutPolicyResponse CallAWSServiceOperation(IAmazonMediaConvert client, Amazon.MediaConvert.Model.PutPolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaConvert", "PutPolicy"); try { #if DESKTOP return(client.PutPolicy(request)); #elif CORECLR return(client.PutPolicyAsync(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.MediaConvert.Model.PutPolicyRequest(); // populate Policy var requestPolicyIsNull = true; request.Policy = new Amazon.MediaConvert.Model.Policy(); Amazon.MediaConvert.InputPolicy requestPolicy_policy_HttpInput = null; if (cmdletContext.Policy_HttpInput != null) { requestPolicy_policy_HttpInput = cmdletContext.Policy_HttpInput; } if (requestPolicy_policy_HttpInput != null) { request.Policy.HttpInputs = requestPolicy_policy_HttpInput; requestPolicyIsNull = false; } Amazon.MediaConvert.InputPolicy requestPolicy_policy_HttpsInput = null; if (cmdletContext.Policy_HttpsInput != null) { requestPolicy_policy_HttpsInput = cmdletContext.Policy_HttpsInput; } if (requestPolicy_policy_HttpsInput != null) { request.Policy.HttpsInputs = requestPolicy_policy_HttpsInput; requestPolicyIsNull = false; } Amazon.MediaConvert.InputPolicy requestPolicy_policy_S3Input = null; if (cmdletContext.Policy_S3Input != null) { requestPolicy_policy_S3Input = cmdletContext.Policy_S3Input; } if (requestPolicy_policy_S3Input != null) { request.Policy.S3Inputs = requestPolicy_policy_S3Input; requestPolicyIsNull = false; } // determine if request.Policy should be set to null if (requestPolicyIsNull) { request.Policy = null; } 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); }