private Amazon.MediaTailor.Model.CreateProgramResponse CallAWSServiceOperation(IAmazonMediaTailor client, Amazon.MediaTailor.Model.CreateProgramRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaTailor", "CreateProgram");
     try
     {
         #if DESKTOP
         return(client.CreateProgram(request));
         #elif CORECLR
         return(client.CreateProgramAsync(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.MediaTailor.Model.CreateProgramRequest();

            if (cmdletContext.AdBreak != null)
            {
                request.AdBreaks = cmdletContext.AdBreak;
            }
            if (cmdletContext.ChannelName != null)
            {
                request.ChannelName = cmdletContext.ChannelName;
            }
            if (cmdletContext.ProgramName != null)
            {
                request.ProgramName = cmdletContext.ProgramName;
            }

            // populate ScheduleConfiguration
            var requestScheduleConfigurationIsNull = true;

            request.ScheduleConfiguration = new Amazon.MediaTailor.Model.ScheduleConfiguration();
            Amazon.MediaTailor.Model.Transition requestScheduleConfiguration_scheduleConfiguration_Transition = null;

            // populate Transition
            var requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull = true;

            requestScheduleConfiguration_scheduleConfiguration_Transition = new Amazon.MediaTailor.Model.Transition();
            Amazon.MediaTailor.RelativePosition requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativePosition = null;
            if (cmdletContext.Transition_RelativePosition != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativePosition = cmdletContext.Transition_RelativePosition;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativePosition != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition.RelativePosition = requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativePosition;
                requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull            = false;
            }
            System.String requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativeProgram = null;
            if (cmdletContext.Transition_RelativeProgram != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativeProgram = cmdletContext.Transition_RelativeProgram;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativeProgram != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition.RelativeProgram = requestScheduleConfiguration_scheduleConfiguration_Transition_transition_RelativeProgram;
                requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull           = false;
            }
            System.Int64?requestScheduleConfiguration_scheduleConfiguration_Transition_transition_ScheduledStartTimeMilli = null;
            if (cmdletContext.Transition_ScheduledStartTimeMilli != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition_transition_ScheduledStartTimeMilli = cmdletContext.Transition_ScheduledStartTimeMilli.Value;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_Transition_transition_ScheduledStartTimeMilli != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition.ScheduledStartTimeMillis = requestScheduleConfiguration_scheduleConfiguration_Transition_transition_ScheduledStartTimeMilli.Value;
                requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull = false;
            }
            System.String requestScheduleConfiguration_scheduleConfiguration_Transition_transition_Type = null;
            if (cmdletContext.Transition_Type != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition_transition_Type = cmdletContext.Transition_Type;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_Transition_transition_Type != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition.Type  = requestScheduleConfiguration_scheduleConfiguration_Transition_transition_Type;
                requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull = false;
            }
            // determine if requestScheduleConfiguration_scheduleConfiguration_Transition should be set to null
            if (requestScheduleConfiguration_scheduleConfiguration_TransitionIsNull)
            {
                requestScheduleConfiguration_scheduleConfiguration_Transition = null;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_Transition != null)
            {
                request.ScheduleConfiguration.Transition = requestScheduleConfiguration_scheduleConfiguration_Transition;
                requestScheduleConfigurationIsNull       = false;
            }
            // determine if request.ScheduleConfiguration should be set to null
            if (requestScheduleConfigurationIsNull)
            {
                request.ScheduleConfiguration = null;
            }
            if (cmdletContext.SourceLocationName != null)
            {
                request.SourceLocationName = cmdletContext.SourceLocationName;
            }
            if (cmdletContext.VodSourceName != null)
            {
                request.VodSourceName = cmdletContext.VodSourceName;
            }

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