private Amazon.SSMIncidents.Model.CreateResponsePlanResponse CallAWSServiceOperation(IAmazonSSMIncidents client, Amazon.SSMIncidents.Model.CreateResponsePlanRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Systems Manager Incident Manager", "CreateResponsePlan");
     try
     {
         #if DESKTOP
         return(client.CreateResponsePlan(request));
         #elif CORECLR
         return(client.CreateResponsePlanAsync(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.SSMIncidents.Model.CreateResponsePlanRequest();

            if (cmdletContext.Action != null)
            {
                request.Actions = cmdletContext.Action;
            }

            // populate ChatChannel
            var requestChatChannelIsNull = true;

            request.ChatChannel = new Amazon.SSMIncidents.Model.ChatChannel();
            List <System.String> requestChatChannel_chatChannel_ChatbotSn = null;

            if (cmdletContext.ChatChannel_ChatbotSn != null)
            {
                requestChatChannel_chatChannel_ChatbotSn = cmdletContext.ChatChannel_ChatbotSn;
            }
            if (requestChatChannel_chatChannel_ChatbotSn != null)
            {
                request.ChatChannel.ChatbotSns = requestChatChannel_chatChannel_ChatbotSn;
                requestChatChannelIsNull       = false;
            }
            Amazon.SSMIncidents.Model.EmptyChatChannel requestChatChannel_chatChannel_Empty = null;
            if (cmdletContext.ChatChannel_Empty != null)
            {
                requestChatChannel_chatChannel_Empty = cmdletContext.ChatChannel_Empty;
            }
            if (requestChatChannel_chatChannel_Empty != null)
            {
                request.ChatChannel.Empty = requestChatChannel_chatChannel_Empty;
                requestChatChannelIsNull  = false;
            }
            // determine if request.ChatChannel should be set to null
            if (requestChatChannelIsNull)
            {
                request.ChatChannel = null;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.DisplayName != null)
            {
                request.DisplayName = cmdletContext.DisplayName;
            }
            if (cmdletContext.Engagement != null)
            {
                request.Engagements = cmdletContext.Engagement;
            }

            // populate IncidentTemplate
            var requestIncidentTemplateIsNull = true;

            request.IncidentTemplate = new Amazon.SSMIncidents.Model.IncidentTemplate();
            System.String requestIncidentTemplate_incidentTemplate_DedupeString = null;
            if (cmdletContext.IncidentTemplate_DedupeString != null)
            {
                requestIncidentTemplate_incidentTemplate_DedupeString = cmdletContext.IncidentTemplate_DedupeString;
            }
            if (requestIncidentTemplate_incidentTemplate_DedupeString != null)
            {
                request.IncidentTemplate.DedupeString = requestIncidentTemplate_incidentTemplate_DedupeString;
                requestIncidentTemplateIsNull         = false;
            }
            System.Int32?requestIncidentTemplate_incidentTemplate_Impact = null;
            if (cmdletContext.IncidentTemplate_Impact != null)
            {
                requestIncidentTemplate_incidentTemplate_Impact = cmdletContext.IncidentTemplate_Impact.Value;
            }
            if (requestIncidentTemplate_incidentTemplate_Impact != null)
            {
                request.IncidentTemplate.Impact = requestIncidentTemplate_incidentTemplate_Impact.Value;
                requestIncidentTemplateIsNull   = false;
            }
            List <Amazon.SSMIncidents.Model.NotificationTargetItem> requestIncidentTemplate_incidentTemplate_NotificationTarget = null;

            if (cmdletContext.IncidentTemplate_NotificationTarget != null)
            {
                requestIncidentTemplate_incidentTemplate_NotificationTarget = cmdletContext.IncidentTemplate_NotificationTarget;
            }
            if (requestIncidentTemplate_incidentTemplate_NotificationTarget != null)
            {
                request.IncidentTemplate.NotificationTargets = requestIncidentTemplate_incidentTemplate_NotificationTarget;
                requestIncidentTemplateIsNull = false;
            }
            System.String requestIncidentTemplate_incidentTemplate_Summary = null;
            if (cmdletContext.IncidentTemplate_Summary != null)
            {
                requestIncidentTemplate_incidentTemplate_Summary = cmdletContext.IncidentTemplate_Summary;
            }
            if (requestIncidentTemplate_incidentTemplate_Summary != null)
            {
                request.IncidentTemplate.Summary = requestIncidentTemplate_incidentTemplate_Summary;
                requestIncidentTemplateIsNull    = false;
            }
            System.String requestIncidentTemplate_incidentTemplate_Title = null;
            if (cmdletContext.IncidentTemplate_Title != null)
            {
                requestIncidentTemplate_incidentTemplate_Title = cmdletContext.IncidentTemplate_Title;
            }
            if (requestIncidentTemplate_incidentTemplate_Title != null)
            {
                request.IncidentTemplate.Title = requestIncidentTemplate_incidentTemplate_Title;
                requestIncidentTemplateIsNull  = false;
            }
            // determine if request.IncidentTemplate should be set to null
            if (requestIncidentTemplateIsNull)
            {
                request.IncidentTemplate = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            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);
        }