public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.MediaConnect.Model.CreateFlowRequest(); if (cmdletContext.AvailabilityZone != null) { request.AvailabilityZone = cmdletContext.AvailabilityZone; } if (cmdletContext.Entitlement != null) { request.Entitlements = cmdletContext.Entitlement; } if (cmdletContext.MediaStream != null) { request.MediaStreams = cmdletContext.MediaStream; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.Output != null) { request.Outputs = cmdletContext.Output; } // populate SourceFailoverConfig var requestSourceFailoverConfigIsNull = true; request.SourceFailoverConfig = new Amazon.MediaConnect.Model.FailoverConfig(); Amazon.MediaConnect.FailoverMode requestSourceFailoverConfig_sourceFailoverConfig_FailoverMode = null; if (cmdletContext.SourceFailoverConfig_FailoverMode != null) { requestSourceFailoverConfig_sourceFailoverConfig_FailoverMode = cmdletContext.SourceFailoverConfig_FailoverMode; } if (requestSourceFailoverConfig_sourceFailoverConfig_FailoverMode != null) { request.SourceFailoverConfig.FailoverMode = requestSourceFailoverConfig_sourceFailoverConfig_FailoverMode; requestSourceFailoverConfigIsNull = false; } System.Int32?requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow = null; if (cmdletContext.SourceFailoverConfig_RecoveryWindow != null) { requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow = cmdletContext.SourceFailoverConfig_RecoveryWindow.Value; } if (requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow != null) { request.SourceFailoverConfig.RecoveryWindow = requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow.Value; requestSourceFailoverConfigIsNull = false; } Amazon.MediaConnect.State requestSourceFailoverConfig_sourceFailoverConfig_State = null; if (cmdletContext.SourceFailoverConfig_State != null) { requestSourceFailoverConfig_sourceFailoverConfig_State = cmdletContext.SourceFailoverConfig_State; } if (requestSourceFailoverConfig_sourceFailoverConfig_State != null) { request.SourceFailoverConfig.State = requestSourceFailoverConfig_sourceFailoverConfig_State; requestSourceFailoverConfigIsNull = false; } Amazon.MediaConnect.Model.SourcePriority requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority = null; // populate SourcePriority var requestSourceFailoverConfig_sourceFailoverConfig_SourcePriorityIsNull = true; requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority = new Amazon.MediaConnect.Model.SourcePriority(); System.String requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority_sourcePriority_PrimarySource = null; if (cmdletContext.SourcePriority_PrimarySource != null) { requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority_sourcePriority_PrimarySource = cmdletContext.SourcePriority_PrimarySource; } if (requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority_sourcePriority_PrimarySource != null) { requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority.PrimarySource = requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority_sourcePriority_PrimarySource; requestSourceFailoverConfig_sourceFailoverConfig_SourcePriorityIsNull = false; } // determine if requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority should be set to null if (requestSourceFailoverConfig_sourceFailoverConfig_SourcePriorityIsNull) { requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority = null; } if (requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority != null) { request.SourceFailoverConfig.SourcePriority = requestSourceFailoverConfig_sourceFailoverConfig_SourcePriority; requestSourceFailoverConfigIsNull = false; } // determine if request.SourceFailoverConfig should be set to null if (requestSourceFailoverConfigIsNull) { request.SourceFailoverConfig = null; } if (cmdletContext.Source != null) { request.Sources = cmdletContext.Source; } if (cmdletContext.VpcInterface != null) { request.VpcInterfaces = cmdletContext.VpcInterface; } 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); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.MediaConnect.Model.UpdateFlowRequest(); if (cmdletContext.FlowArn != null) { request.FlowArn = cmdletContext.FlowArn; } // populate SourceFailoverConfig var requestSourceFailoverConfigIsNull = true; request.SourceFailoverConfig = new Amazon.MediaConnect.Model.UpdateFailoverConfig(); System.Int32?requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow = null; if (cmdletContext.SourceFailoverConfig_RecoveryWindow != null) { requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow = cmdletContext.SourceFailoverConfig_RecoveryWindow.Value; } if (requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow != null) { request.SourceFailoverConfig.RecoveryWindow = requestSourceFailoverConfig_sourceFailoverConfig_RecoveryWindow.Value; requestSourceFailoverConfigIsNull = false; } Amazon.MediaConnect.State requestSourceFailoverConfig_sourceFailoverConfig_State = null; if (cmdletContext.SourceFailoverConfig_State != null) { requestSourceFailoverConfig_sourceFailoverConfig_State = cmdletContext.SourceFailoverConfig_State; } if (requestSourceFailoverConfig_sourceFailoverConfig_State != null) { request.SourceFailoverConfig.State = requestSourceFailoverConfig_sourceFailoverConfig_State; requestSourceFailoverConfigIsNull = false; } // determine if request.SourceFailoverConfig should be set to null if (requestSourceFailoverConfigIsNull) { request.SourceFailoverConfig = 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); }