private Amazon.MediaLive.Model.CreateChannelResponse CallAWSServiceOperation(IAmazonMediaLive client, Amazon.MediaLive.Model.CreateChannelRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaLive", "CreateChannel"); try { #if DESKTOP return(client.CreateChannel(request)); #elif CORECLR return(client.CreateChannelAsync(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.MediaLive.Model.CreateChannelRequest(); // populate CdiInputSpecification var requestCdiInputSpecificationIsNull = true; request.CdiInputSpecification = new Amazon.MediaLive.Model.CdiInputSpecification(); Amazon.MediaLive.CdiInputResolution requestCdiInputSpecification_cdiInputSpecification_Resolution = null; if (cmdletContext.CdiInputSpecification_Resolution != null) { requestCdiInputSpecification_cdiInputSpecification_Resolution = cmdletContext.CdiInputSpecification_Resolution; } if (requestCdiInputSpecification_cdiInputSpecification_Resolution != null) { request.CdiInputSpecification.Resolution = requestCdiInputSpecification_cdiInputSpecification_Resolution; requestCdiInputSpecificationIsNull = false; } // determine if request.CdiInputSpecification should be set to null if (requestCdiInputSpecificationIsNull) { request.CdiInputSpecification = null; } if (cmdletContext.ChannelClass != null) { request.ChannelClass = cmdletContext.ChannelClass; } if (cmdletContext.Destination != null) { request.Destinations = cmdletContext.Destination; } if (cmdletContext.EncoderSetting != null) { request.EncoderSettings = cmdletContext.EncoderSetting; } if (cmdletContext.InputAttachment != null) { request.InputAttachments = cmdletContext.InputAttachment; } // populate InputSpecification var requestInputSpecificationIsNull = true; request.InputSpecification = new Amazon.MediaLive.Model.InputSpecification(); Amazon.MediaLive.InputCodec requestInputSpecification_inputSpecification_Codec = null; if (cmdletContext.InputSpecification_Codec != null) { requestInputSpecification_inputSpecification_Codec = cmdletContext.InputSpecification_Codec; } if (requestInputSpecification_inputSpecification_Codec != null) { request.InputSpecification.Codec = requestInputSpecification_inputSpecification_Codec; requestInputSpecificationIsNull = false; } Amazon.MediaLive.InputMaximumBitrate requestInputSpecification_inputSpecification_MaximumBitrate = null; if (cmdletContext.InputSpecification_MaximumBitrate != null) { requestInputSpecification_inputSpecification_MaximumBitrate = cmdletContext.InputSpecification_MaximumBitrate; } if (requestInputSpecification_inputSpecification_MaximumBitrate != null) { request.InputSpecification.MaximumBitrate = requestInputSpecification_inputSpecification_MaximumBitrate; requestInputSpecificationIsNull = false; } Amazon.MediaLive.InputResolution requestInputSpecification_inputSpecification_Resolution = null; if (cmdletContext.InputSpecification_Resolution != null) { requestInputSpecification_inputSpecification_Resolution = cmdletContext.InputSpecification_Resolution; } if (requestInputSpecification_inputSpecification_Resolution != null) { request.InputSpecification.Resolution = requestInputSpecification_inputSpecification_Resolution; requestInputSpecificationIsNull = false; } // determine if request.InputSpecification should be set to null if (requestInputSpecificationIsNull) { request.InputSpecification = null; } if (cmdletContext.LogLevel != null) { request.LogLevel = cmdletContext.LogLevel; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.RequestId != null) { request.RequestId = cmdletContext.RequestId; } #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.Reserved != null) { request.Reserved = cmdletContext.Reserved; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.RoleArn != null) { request.RoleArn = cmdletContext.RoleArn; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }