Exemplo n.º 1
0
 private Amazon.ChimeSDKMessaging.Model.ChannelFlowCallbackResponse CallAWSServiceOperation(IAmazonChimeSDKMessaging client, Amazon.ChimeSDKMessaging.Model.ChannelFlowCallbackRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Chime SDK Messaging", "ChannelFlowCallback");
     try
     {
         #if DESKTOP
         return(client.ChannelFlowCallback(request));
         #elif CORECLR
         return(client.ChannelFlowCallbackAsync(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;
     }
 }
Exemplo n.º 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);
        }