private Amazon.Connect.Model.StartChatContactResponse CallAWSServiceOperation(IAmazonConnect client, Amazon.Connect.Model.StartChatContactRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Connect Service", "StartChatContact");
     try
     {
         #if DESKTOP
         return(client.StartChatContact(request));
         #elif CORECLR
         return(client.StartChatContactAsync(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.Connect.Model.StartChatContactRequest();

            if (cmdletContext.Attribute != null)
            {
                request.Attributes = cmdletContext.Attribute;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.ContactFlowId != null)
            {
                request.ContactFlowId = cmdletContext.ContactFlowId;
            }

            // populate InitialMessage
            var requestInitialMessageIsNull = true;

            request.InitialMessage = new Amazon.Connect.Model.ChatMessage();
            System.String requestInitialMessage_initialMessage_Content = null;
            if (cmdletContext.InitialMessage_Content != null)
            {
                requestInitialMessage_initialMessage_Content = cmdletContext.InitialMessage_Content;
            }
            if (requestInitialMessage_initialMessage_Content != null)
            {
                request.InitialMessage.Content = requestInitialMessage_initialMessage_Content;
                requestInitialMessageIsNull    = false;
            }
            System.String requestInitialMessage_initialMessage_ContentType = null;
            if (cmdletContext.InitialMessage_ContentType != null)
            {
                requestInitialMessage_initialMessage_ContentType = cmdletContext.InitialMessage_ContentType;
            }
            if (requestInitialMessage_initialMessage_ContentType != null)
            {
                request.InitialMessage.ContentType = requestInitialMessage_initialMessage_ContentType;
                requestInitialMessageIsNull        = false;
            }
            // determine if request.InitialMessage should be set to null
            if (requestInitialMessageIsNull)
            {
                request.InitialMessage = null;
            }
            if (cmdletContext.InstanceId != null)
            {
                request.InstanceId = cmdletContext.InstanceId;
            }

            // populate ParticipantDetails
            var requestParticipantDetailsIsNull = true;

            request.ParticipantDetails = new Amazon.Connect.Model.ParticipantDetails();
            System.String requestParticipantDetails_participantDetails_DisplayName = null;
            if (cmdletContext.ParticipantDetails_DisplayName != null)
            {
                requestParticipantDetails_participantDetails_DisplayName = cmdletContext.ParticipantDetails_DisplayName;
            }
            if (requestParticipantDetails_participantDetails_DisplayName != null)
            {
                request.ParticipantDetails.DisplayName = requestParticipantDetails_participantDetails_DisplayName;
                requestParticipantDetailsIsNull        = false;
            }
            // determine if request.ParticipantDetails should be set to null
            if (requestParticipantDetailsIsNull)
            {
                request.ParticipantDetails = 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);
        }