Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ChimeSDKMessaging.Model.SendChannelMessageRequest();

            if (cmdletContext.ChannelArn != null)
            {
                request.ChannelArn = cmdletContext.ChannelArn;
            }
            if (cmdletContext.ChimeBearer != null)
            {
                request.ChimeBearer = cmdletContext.ChimeBearer;
            }
            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.Content != null)
            {
                request.Content = cmdletContext.Content;
            }
            if (cmdletContext.MessageAttribute != null)
            {
                request.MessageAttributes = cmdletContext.MessageAttribute;
            }
            if (cmdletContext.Metadata != null)
            {
                request.Metadata = cmdletContext.Metadata;
            }
            if (cmdletContext.Persistence != null)
            {
                request.Persistence = cmdletContext.Persistence;
            }

            // populate PushNotification
            var requestPushNotificationIsNull = true;

            request.PushNotification = new Amazon.ChimeSDKMessaging.Model.PushNotificationConfiguration();
            System.String requestPushNotification_pushNotification_Body = null;
            if (cmdletContext.PushNotification_Body != null)
            {
                requestPushNotification_pushNotification_Body = cmdletContext.PushNotification_Body;
            }
            if (requestPushNotification_pushNotification_Body != null)
            {
                request.PushNotification.Body = requestPushNotification_pushNotification_Body;
                requestPushNotificationIsNull = false;
            }
            System.String requestPushNotification_pushNotification_Title = null;
            if (cmdletContext.PushNotification_Title != null)
            {
                requestPushNotification_pushNotification_Title = cmdletContext.PushNotification_Title;
            }
            if (requestPushNotification_pushNotification_Title != null)
            {
                request.PushNotification.Title = requestPushNotification_pushNotification_Title;
                requestPushNotificationIsNull  = false;
            }
            Amazon.ChimeSDKMessaging.PushNotificationType requestPushNotification_pushNotification_Type = null;
            if (cmdletContext.PushNotification_Type != null)
            {
                requestPushNotification_pushNotification_Type = cmdletContext.PushNotification_Type;
            }
            if (requestPushNotification_pushNotification_Type != null)
            {
                request.PushNotification.Type = requestPushNotification_pushNotification_Type;
                requestPushNotificationIsNull = false;
            }
            // determine if request.PushNotification should be set to null
            if (requestPushNotificationIsNull)
            {
                request.PushNotification = null;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }

            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);
        }
Example #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ChimeSDKMessaging.Model.ChannelFlowCallbackRequest();

            if (cmdletContext.CallbackId != null)
            {
                request.CallbackId = cmdletContext.CallbackId;
            }
            if (cmdletContext.ChannelArn != null)
            {
                request.ChannelArn = cmdletContext.ChannelArn;
            }

            // populate ChannelMessage
            var requestChannelMessageIsNull = true;

            request.ChannelMessage = new Amazon.ChimeSDKMessaging.Model.ChannelMessageCallback();
            System.String requestChannelMessage_channelMessage_Content = null;
            if (cmdletContext.ChannelMessage_Content != null)
            {
                requestChannelMessage_channelMessage_Content = cmdletContext.ChannelMessage_Content;
            }
            if (requestChannelMessage_channelMessage_Content != null)
            {
                request.ChannelMessage.Content = requestChannelMessage_channelMessage_Content;
                requestChannelMessageIsNull    = false;
            }
            Dictionary <System.String, Amazon.ChimeSDKMessaging.Model.MessageAttributeValue> requestChannelMessage_channelMessage_MessageAttribute = null;

            if (cmdletContext.ChannelMessage_MessageAttribute != null)
            {
                requestChannelMessage_channelMessage_MessageAttribute = cmdletContext.ChannelMessage_MessageAttribute;
            }
            if (requestChannelMessage_channelMessage_MessageAttribute != null)
            {
                request.ChannelMessage.MessageAttributes = requestChannelMessage_channelMessage_MessageAttribute;
                requestChannelMessageIsNull = false;
            }
            System.String requestChannelMessage_channelMessage_MessageId = null;
            if (cmdletContext.ChannelMessage_MessageId != null)
            {
                requestChannelMessage_channelMessage_MessageId = cmdletContext.ChannelMessage_MessageId;
            }
            if (requestChannelMessage_channelMessage_MessageId != null)
            {
                request.ChannelMessage.MessageId = requestChannelMessage_channelMessage_MessageId;
                requestChannelMessageIsNull      = false;
            }
            System.String requestChannelMessage_channelMessage_Metadata = null;
            if (cmdletContext.ChannelMessage_Metadata != null)
            {
                requestChannelMessage_channelMessage_Metadata = cmdletContext.ChannelMessage_Metadata;
            }
            if (requestChannelMessage_channelMessage_Metadata != null)
            {
                request.ChannelMessage.Metadata = requestChannelMessage_channelMessage_Metadata;
                requestChannelMessageIsNull     = false;
            }
            Amazon.ChimeSDKMessaging.Model.PushNotificationConfiguration requestChannelMessage_channelMessage_PushNotification = null;

            // populate PushNotification
            var requestChannelMessage_channelMessage_PushNotificationIsNull = true;

            requestChannelMessage_channelMessage_PushNotification = new Amazon.ChimeSDKMessaging.Model.PushNotificationConfiguration();
            System.String requestChannelMessage_channelMessage_PushNotification_pushNotification_Body = null;
            if (cmdletContext.PushNotification_Body != null)
            {
                requestChannelMessage_channelMessage_PushNotification_pushNotification_Body = cmdletContext.PushNotification_Body;
            }
            if (requestChannelMessage_channelMessage_PushNotification_pushNotification_Body != null)
            {
                requestChannelMessage_channelMessage_PushNotification.Body  = requestChannelMessage_channelMessage_PushNotification_pushNotification_Body;
                requestChannelMessage_channelMessage_PushNotificationIsNull = false;
            }
            System.String requestChannelMessage_channelMessage_PushNotification_pushNotification_Title = null;
            if (cmdletContext.PushNotification_Title != null)
            {
                requestChannelMessage_channelMessage_PushNotification_pushNotification_Title = cmdletContext.PushNotification_Title;
            }
            if (requestChannelMessage_channelMessage_PushNotification_pushNotification_Title != null)
            {
                requestChannelMessage_channelMessage_PushNotification.Title = requestChannelMessage_channelMessage_PushNotification_pushNotification_Title;
                requestChannelMessage_channelMessage_PushNotificationIsNull = false;
            }
            Amazon.ChimeSDKMessaging.PushNotificationType requestChannelMessage_channelMessage_PushNotification_pushNotification_Type = null;
            if (cmdletContext.PushNotification_Type != null)
            {
                requestChannelMessage_channelMessage_PushNotification_pushNotification_Type = cmdletContext.PushNotification_Type;
            }
            if (requestChannelMessage_channelMessage_PushNotification_pushNotification_Type != null)
            {
                requestChannelMessage_channelMessage_PushNotification.Type  = requestChannelMessage_channelMessage_PushNotification_pushNotification_Type;
                requestChannelMessage_channelMessage_PushNotificationIsNull = false;
            }
            // determine if requestChannelMessage_channelMessage_PushNotification should be set to null
            if (requestChannelMessage_channelMessage_PushNotificationIsNull)
            {
                requestChannelMessage_channelMessage_PushNotification = null;
            }
            if (requestChannelMessage_channelMessage_PushNotification != null)
            {
                request.ChannelMessage.PushNotification = requestChannelMessage_channelMessage_PushNotification;
                requestChannelMessageIsNull             = false;
            }
            // determine if request.ChannelMessage should be set to null
            if (requestChannelMessageIsNull)
            {
                request.ChannelMessage = null;
            }
            if (cmdletContext.DeleteResource != null)
            {
                request.DeleteResource = cmdletContext.DeleteResource.Value;
            }

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