Example #1
0
 private Amazon.Connect.Model.CreateQuickConnectResponse CallAWSServiceOperation(IAmazonConnect client, Amazon.Connect.Model.CreateQuickConnectRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Connect Service", "CreateQuickConnect");
     try
     {
         #if DESKTOP
         return(client.CreateQuickConnect(request));
         #elif CORECLR
         return(client.CreateQuickConnectAsync(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;
     }
 }
Example #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Connect.Model.CreateQuickConnectRequest();

            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.InstanceId != null)
            {
                request.InstanceId = cmdletContext.InstanceId;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            // populate QuickConnectConfig
            var requestQuickConnectConfigIsNull = true;

            request.QuickConnectConfig = new Amazon.Connect.Model.QuickConnectConfig();
            Amazon.Connect.QuickConnectType requestQuickConnectConfig_quickConnectConfig_QuickConnectType = null;
            if (cmdletContext.QuickConnectConfig_QuickConnectType != null)
            {
                requestQuickConnectConfig_quickConnectConfig_QuickConnectType = cmdletContext.QuickConnectConfig_QuickConnectType;
            }
            if (requestQuickConnectConfig_quickConnectConfig_QuickConnectType != null)
            {
                request.QuickConnectConfig.QuickConnectType = requestQuickConnectConfig_quickConnectConfig_QuickConnectType;
                requestQuickConnectConfigIsNull             = false;
            }
            Amazon.Connect.Model.PhoneNumberQuickConnectConfig requestQuickConnectConfig_quickConnectConfig_PhoneConfig = null;

            // populate PhoneConfig
            var requestQuickConnectConfig_quickConnectConfig_PhoneConfigIsNull = true;

            requestQuickConnectConfig_quickConnectConfig_PhoneConfig = new Amazon.Connect.Model.PhoneNumberQuickConnectConfig();
            System.String requestQuickConnectConfig_quickConnectConfig_PhoneConfig_phoneConfig_PhoneNumber = null;
            if (cmdletContext.PhoneConfig_PhoneNumber != null)
            {
                requestQuickConnectConfig_quickConnectConfig_PhoneConfig_phoneConfig_PhoneNumber = cmdletContext.PhoneConfig_PhoneNumber;
            }
            if (requestQuickConnectConfig_quickConnectConfig_PhoneConfig_phoneConfig_PhoneNumber != null)
            {
                requestQuickConnectConfig_quickConnectConfig_PhoneConfig.PhoneNumber = requestQuickConnectConfig_quickConnectConfig_PhoneConfig_phoneConfig_PhoneNumber;
                requestQuickConnectConfig_quickConnectConfig_PhoneConfigIsNull       = false;
            }
            // determine if requestQuickConnectConfig_quickConnectConfig_PhoneConfig should be set to null
            if (requestQuickConnectConfig_quickConnectConfig_PhoneConfigIsNull)
            {
                requestQuickConnectConfig_quickConnectConfig_PhoneConfig = null;
            }
            if (requestQuickConnectConfig_quickConnectConfig_PhoneConfig != null)
            {
                request.QuickConnectConfig.PhoneConfig = requestQuickConnectConfig_quickConnectConfig_PhoneConfig;
                requestQuickConnectConfigIsNull        = false;
            }
            Amazon.Connect.Model.QueueQuickConnectConfig requestQuickConnectConfig_quickConnectConfig_QueueConfig = null;

            // populate QueueConfig
            var requestQuickConnectConfig_quickConnectConfig_QueueConfigIsNull = true;

            requestQuickConnectConfig_quickConnectConfig_QueueConfig = new Amazon.Connect.Model.QueueQuickConnectConfig();
            System.String requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_ContactFlowId = null;
            if (cmdletContext.QueueConfig_ContactFlowId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_ContactFlowId = cmdletContext.QueueConfig_ContactFlowId;
            }
            if (requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_ContactFlowId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_QueueConfig.ContactFlowId = requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_ContactFlowId;
                requestQuickConnectConfig_quickConnectConfig_QueueConfigIsNull         = false;
            }
            System.String requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_QueueId = null;
            if (cmdletContext.QueueConfig_QueueId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_QueueId = cmdletContext.QueueConfig_QueueId;
            }
            if (requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_QueueId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_QueueConfig.QueueId = requestQuickConnectConfig_quickConnectConfig_QueueConfig_queueConfig_QueueId;
                requestQuickConnectConfig_quickConnectConfig_QueueConfigIsNull   = false;
            }
            // determine if requestQuickConnectConfig_quickConnectConfig_QueueConfig should be set to null
            if (requestQuickConnectConfig_quickConnectConfig_QueueConfigIsNull)
            {
                requestQuickConnectConfig_quickConnectConfig_QueueConfig = null;
            }
            if (requestQuickConnectConfig_quickConnectConfig_QueueConfig != null)
            {
                request.QuickConnectConfig.QueueConfig = requestQuickConnectConfig_quickConnectConfig_QueueConfig;
                requestQuickConnectConfigIsNull        = false;
            }
            Amazon.Connect.Model.UserQuickConnectConfig requestQuickConnectConfig_quickConnectConfig_UserConfig = null;

            // populate UserConfig
            var requestQuickConnectConfig_quickConnectConfig_UserConfigIsNull = true;

            requestQuickConnectConfig_quickConnectConfig_UserConfig = new Amazon.Connect.Model.UserQuickConnectConfig();
            System.String requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_ContactFlowId = null;
            if (cmdletContext.UserConfig_ContactFlowId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_ContactFlowId = cmdletContext.UserConfig_ContactFlowId;
            }
            if (requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_ContactFlowId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_UserConfig.ContactFlowId = requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_ContactFlowId;
                requestQuickConnectConfig_quickConnectConfig_UserConfigIsNull         = false;
            }
            System.String requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_UserId = null;
            if (cmdletContext.UserConfig_UserId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_UserId = cmdletContext.UserConfig_UserId;
            }
            if (requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_UserId != null)
            {
                requestQuickConnectConfig_quickConnectConfig_UserConfig.UserId = requestQuickConnectConfig_quickConnectConfig_UserConfig_userConfig_UserId;
                requestQuickConnectConfig_quickConnectConfig_UserConfigIsNull  = false;
            }
            // determine if requestQuickConnectConfig_quickConnectConfig_UserConfig should be set to null
            if (requestQuickConnectConfig_quickConnectConfig_UserConfigIsNull)
            {
                requestQuickConnectConfig_quickConnectConfig_UserConfig = null;
            }
            if (requestQuickConnectConfig_quickConnectConfig_UserConfig != null)
            {
                request.QuickConnectConfig.UserConfig = requestQuickConnectConfig_quickConnectConfig_UserConfig;
                requestQuickConnectConfigIsNull       = false;
            }
            // determine if request.QuickConnectConfig should be set to null
            if (requestQuickConnectConfigIsNull)
            {
                request.QuickConnectConfig = null;
            }
            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);
        }