private Amazon.Pinpoint.Model.CreateJourneyResponse CallAWSServiceOperation(IAmazonPinpoint client, Amazon.Pinpoint.Model.CreateJourneyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint", "CreateJourney"); try { #if DESKTOP return(client.CreateJourney(request)); #elif CORECLR return(client.CreateJourneyAsync(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.Pinpoint.Model.CreateJourneyRequest(); if (cmdletContext.ApplicationId != null) { request.ApplicationId = cmdletContext.ApplicationId; } // populate WriteJourneyRequest var requestWriteJourneyRequestIsNull = true; request.WriteJourneyRequest = new Amazon.Pinpoint.Model.WriteJourneyRequest(); Dictionary <System.String, Amazon.Pinpoint.Model.Activity> requestWriteJourneyRequest_writeJourneyRequest_Activity = null; if (cmdletContext.WriteJourneyRequest_Activity != null) { requestWriteJourneyRequest_writeJourneyRequest_Activity = cmdletContext.WriteJourneyRequest_Activity; } if (requestWriteJourneyRequest_writeJourneyRequest_Activity != null) { request.WriteJourneyRequest.Activities = requestWriteJourneyRequest_writeJourneyRequest_Activity; requestWriteJourneyRequestIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_CreationDate = null; if (cmdletContext.WriteJourneyRequest_CreationDate != null) { requestWriteJourneyRequest_writeJourneyRequest_CreationDate = cmdletContext.WriteJourneyRequest_CreationDate; } if (requestWriteJourneyRequest_writeJourneyRequest_CreationDate != null) { request.WriteJourneyRequest.CreationDate = requestWriteJourneyRequest_writeJourneyRequest_CreationDate; requestWriteJourneyRequestIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_LastModifiedDate = null; if (cmdletContext.WriteJourneyRequest_LastModifiedDate != null) { requestWriteJourneyRequest_writeJourneyRequest_LastModifiedDate = cmdletContext.WriteJourneyRequest_LastModifiedDate; } if (requestWriteJourneyRequest_writeJourneyRequest_LastModifiedDate != null) { request.WriteJourneyRequest.LastModifiedDate = requestWriteJourneyRequest_writeJourneyRequest_LastModifiedDate; requestWriteJourneyRequestIsNull = false; } System.Boolean?requestWriteJourneyRequest_writeJourneyRequest_LocalTime = null; if (cmdletContext.WriteJourneyRequest_LocalTime != null) { requestWriteJourneyRequest_writeJourneyRequest_LocalTime = cmdletContext.WriteJourneyRequest_LocalTime.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_LocalTime != null) { request.WriteJourneyRequest.LocalTime = requestWriteJourneyRequest_writeJourneyRequest_LocalTime.Value; requestWriteJourneyRequestIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_Name = null; if (cmdletContext.WriteJourneyRequest_Name != null) { requestWriteJourneyRequest_writeJourneyRequest_Name = cmdletContext.WriteJourneyRequest_Name; } if (requestWriteJourneyRequest_writeJourneyRequest_Name != null) { request.WriteJourneyRequest.Name = requestWriteJourneyRequest_writeJourneyRequest_Name; requestWriteJourneyRequestIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_RefreshFrequency = null; if (cmdletContext.WriteJourneyRequest_RefreshFrequency != null) { requestWriteJourneyRequest_writeJourneyRequest_RefreshFrequency = cmdletContext.WriteJourneyRequest_RefreshFrequency; } if (requestWriteJourneyRequest_writeJourneyRequest_RefreshFrequency != null) { request.WriteJourneyRequest.RefreshFrequency = requestWriteJourneyRequest_writeJourneyRequest_RefreshFrequency; requestWriteJourneyRequestIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_StartActivity = null; if (cmdletContext.WriteJourneyRequest_StartActivity != null) { requestWriteJourneyRequest_writeJourneyRequest_StartActivity = cmdletContext.WriteJourneyRequest_StartActivity; } if (requestWriteJourneyRequest_writeJourneyRequest_StartActivity != null) { request.WriteJourneyRequest.StartActivity = requestWriteJourneyRequest_writeJourneyRequest_StartActivity; requestWriteJourneyRequestIsNull = false; } Amazon.Pinpoint.State requestWriteJourneyRequest_writeJourneyRequest_State = null; if (cmdletContext.WriteJourneyRequest_State != null) { requestWriteJourneyRequest_writeJourneyRequest_State = cmdletContext.WriteJourneyRequest_State; } if (requestWriteJourneyRequest_writeJourneyRequest_State != null) { request.WriteJourneyRequest.State = requestWriteJourneyRequest_writeJourneyRequest_State; requestWriteJourneyRequestIsNull = false; } Amazon.Pinpoint.Model.QuietTime requestWriteJourneyRequest_writeJourneyRequest_QuietTime = null; // populate QuietTime var requestWriteJourneyRequest_writeJourneyRequest_QuietTimeIsNull = true; requestWriteJourneyRequest_writeJourneyRequest_QuietTime = new Amazon.Pinpoint.Model.QuietTime(); System.String requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_End = null; if (cmdletContext.QuietTime_End != null) { requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_End = cmdletContext.QuietTime_End; } if (requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_End != null) { requestWriteJourneyRequest_writeJourneyRequest_QuietTime.End = requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_End; requestWriteJourneyRequest_writeJourneyRequest_QuietTimeIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_Start = null; if (cmdletContext.QuietTime_Start != null) { requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_Start = cmdletContext.QuietTime_Start; } if (requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_Start != null) { requestWriteJourneyRequest_writeJourneyRequest_QuietTime.Start = requestWriteJourneyRequest_writeJourneyRequest_QuietTime_quietTime_Start; requestWriteJourneyRequest_writeJourneyRequest_QuietTimeIsNull = false; } // determine if requestWriteJourneyRequest_writeJourneyRequest_QuietTime should be set to null if (requestWriteJourneyRequest_writeJourneyRequest_QuietTimeIsNull) { requestWriteJourneyRequest_writeJourneyRequest_QuietTime = null; } if (requestWriteJourneyRequest_writeJourneyRequest_QuietTime != null) { request.WriteJourneyRequest.QuietTime = requestWriteJourneyRequest_writeJourneyRequest_QuietTime; requestWriteJourneyRequestIsNull = false; } Amazon.Pinpoint.Model.StartCondition requestWriteJourneyRequest_writeJourneyRequest_StartCondition = null; // populate StartCondition var requestWriteJourneyRequest_writeJourneyRequest_StartConditionIsNull = true; requestWriteJourneyRequest_writeJourneyRequest_StartCondition = new Amazon.Pinpoint.Model.StartCondition(); System.String requestWriteJourneyRequest_writeJourneyRequest_StartCondition_startCondition_Description = null; if (cmdletContext.StartCondition_Description != null) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition_startCondition_Description = cmdletContext.StartCondition_Description; } if (requestWriteJourneyRequest_writeJourneyRequest_StartCondition_startCondition_Description != null) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition.Description = requestWriteJourneyRequest_writeJourneyRequest_StartCondition_startCondition_Description; requestWriteJourneyRequest_writeJourneyRequest_StartConditionIsNull = false; } Amazon.Pinpoint.Model.SegmentCondition requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition = null; // populate SegmentStartCondition var requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartConditionIsNull = true; requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition = new Amazon.Pinpoint.Model.SegmentCondition(); System.String requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition_segmentStartCondition_SegmentId = null; if (cmdletContext.SegmentStartCondition_SegmentId != null) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition_segmentStartCondition_SegmentId = cmdletContext.SegmentStartCondition_SegmentId; } if (requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition_segmentStartCondition_SegmentId != null) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition.SegmentId = requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition_segmentStartCondition_SegmentId; requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartConditionIsNull = false; } // determine if requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition should be set to null if (requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartConditionIsNull) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition = null; } if (requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition != null) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition.SegmentStartCondition = requestWriteJourneyRequest_writeJourneyRequest_StartCondition_writeJourneyRequest_StartCondition_SegmentStartCondition; requestWriteJourneyRequest_writeJourneyRequest_StartConditionIsNull = false; } // determine if requestWriteJourneyRequest_writeJourneyRequest_StartCondition should be set to null if (requestWriteJourneyRequest_writeJourneyRequest_StartConditionIsNull) { requestWriteJourneyRequest_writeJourneyRequest_StartCondition = null; } if (requestWriteJourneyRequest_writeJourneyRequest_StartCondition != null) { request.WriteJourneyRequest.StartCondition = requestWriteJourneyRequest_writeJourneyRequest_StartCondition; requestWriteJourneyRequestIsNull = false; } Amazon.Pinpoint.Model.JourneyLimits requestWriteJourneyRequest_writeJourneyRequest_Limits = null; // populate Limits var requestWriteJourneyRequest_writeJourneyRequest_LimitsIsNull = true; requestWriteJourneyRequest_writeJourneyRequest_Limits = new Amazon.Pinpoint.Model.JourneyLimits(); System.Int32?requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_DailyCap = null; if (cmdletContext.Limits_DailyCap != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_DailyCap = cmdletContext.Limits_DailyCap.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_DailyCap != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits.DailyCap = requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_DailyCap.Value; requestWriteJourneyRequest_writeJourneyRequest_LimitsIsNull = false; } System.Int32?requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_EndpointReentryCap = null; if (cmdletContext.Limits_EndpointReentryCap != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_EndpointReentryCap = cmdletContext.Limits_EndpointReentryCap.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_EndpointReentryCap != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits.EndpointReentryCap = requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_EndpointReentryCap.Value; requestWriteJourneyRequest_writeJourneyRequest_LimitsIsNull = false; } System.Int32?requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_MessagesPerSecond = null; if (cmdletContext.Limits_MessagesPerSecond != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_MessagesPerSecond = cmdletContext.Limits_MessagesPerSecond.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_MessagesPerSecond != null) { requestWriteJourneyRequest_writeJourneyRequest_Limits.MessagesPerSecond = requestWriteJourneyRequest_writeJourneyRequest_Limits_limits_MessagesPerSecond.Value; requestWriteJourneyRequest_writeJourneyRequest_LimitsIsNull = false; } // determine if requestWriteJourneyRequest_writeJourneyRequest_Limits should be set to null if (requestWriteJourneyRequest_writeJourneyRequest_LimitsIsNull) { requestWriteJourneyRequest_writeJourneyRequest_Limits = null; } if (requestWriteJourneyRequest_writeJourneyRequest_Limits != null) { request.WriteJourneyRequest.Limits = requestWriteJourneyRequest_writeJourneyRequest_Limits; requestWriteJourneyRequestIsNull = false; } Amazon.Pinpoint.Model.JourneySchedule requestWriteJourneyRequest_writeJourneyRequest_Schedule = null; // populate Schedule var requestWriteJourneyRequest_writeJourneyRequest_ScheduleIsNull = true; requestWriteJourneyRequest_writeJourneyRequest_Schedule = new Amazon.Pinpoint.Model.JourneySchedule(); System.DateTime?requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_EndTime = null; if (cmdletContext.Schedule_EndTime != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_EndTime = cmdletContext.Schedule_EndTime.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_EndTime != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule.EndTime = requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_EndTime.Value; requestWriteJourneyRequest_writeJourneyRequest_ScheduleIsNull = false; } System.DateTime?requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_StartTime = null; if (cmdletContext.Schedule_StartTime != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_StartTime = cmdletContext.Schedule_StartTime.Value; } if (requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_StartTime != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule.StartTime = requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_StartTime.Value; requestWriteJourneyRequest_writeJourneyRequest_ScheduleIsNull = false; } System.String requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_Timezone = null; if (cmdletContext.Schedule_Timezone != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_Timezone = cmdletContext.Schedule_Timezone; } if (requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_Timezone != null) { requestWriteJourneyRequest_writeJourneyRequest_Schedule.Timezone = requestWriteJourneyRequest_writeJourneyRequest_Schedule_schedule_Timezone; requestWriteJourneyRequest_writeJourneyRequest_ScheduleIsNull = false; } // determine if requestWriteJourneyRequest_writeJourneyRequest_Schedule should be set to null if (requestWriteJourneyRequest_writeJourneyRequest_ScheduleIsNull) { requestWriteJourneyRequest_writeJourneyRequest_Schedule = null; } if (requestWriteJourneyRequest_writeJourneyRequest_Schedule != null) { request.WriteJourneyRequest.Schedule = requestWriteJourneyRequest_writeJourneyRequest_Schedule; requestWriteJourneyRequestIsNull = false; } // determine if request.WriteJourneyRequest should be set to null if (requestWriteJourneyRequestIsNull) { request.WriteJourneyRequest = 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); }