private Amazon.LexModelsV2.Model.CreateIntentResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.CreateIntentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "CreateIntent");
     try
     {
         #if DESKTOP
         return(client.CreateIntent(request));
         #elif CORECLR
         return(client.CreateIntentAsync(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.LexModelsV2.Model.CreateIntentRequest();

            if (cmdletContext.BotId != null)
            {
                request.BotId = cmdletContext.BotId;
            }
            if (cmdletContext.BotVersion != null)
            {
                request.BotVersion = cmdletContext.BotVersion;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }

            // populate DialogCodeHook
            var requestDialogCodeHookIsNull = true;

            request.DialogCodeHook = new Amazon.LexModelsV2.Model.DialogCodeHookSettings();
            System.Boolean?requestDialogCodeHook_dialogCodeHook_Enabled = null;
            if (cmdletContext.DialogCodeHook_Enabled != null)
            {
                requestDialogCodeHook_dialogCodeHook_Enabled = cmdletContext.DialogCodeHook_Enabled.Value;
            }
            if (requestDialogCodeHook_dialogCodeHook_Enabled != null)
            {
                request.DialogCodeHook.Enabled = requestDialogCodeHook_dialogCodeHook_Enabled.Value;
                requestDialogCodeHookIsNull    = false;
            }
            // determine if request.DialogCodeHook should be set to null
            if (requestDialogCodeHookIsNull)
            {
                request.DialogCodeHook = null;
            }

            // populate FulfillmentCodeHook
            var requestFulfillmentCodeHookIsNull = true;

            request.FulfillmentCodeHook = new Amazon.LexModelsV2.Model.FulfillmentCodeHookSettings();
            System.Boolean?requestFulfillmentCodeHook_fulfillmentCodeHook_Enabled = null;
            if (cmdletContext.FulfillmentCodeHook_Enabled != null)
            {
                requestFulfillmentCodeHook_fulfillmentCodeHook_Enabled = cmdletContext.FulfillmentCodeHook_Enabled.Value;
            }
            if (requestFulfillmentCodeHook_fulfillmentCodeHook_Enabled != null)
            {
                request.FulfillmentCodeHook.Enabled = requestFulfillmentCodeHook_fulfillmentCodeHook_Enabled.Value;
                requestFulfillmentCodeHookIsNull    = false;
            }
            // determine if request.FulfillmentCodeHook should be set to null
            if (requestFulfillmentCodeHookIsNull)
            {
                request.FulfillmentCodeHook = null;
            }
            if (cmdletContext.InputContext != null)
            {
                request.InputContexts = cmdletContext.InputContext;
            }

            // populate IntentClosingSetting
            var requestIntentClosingSettingIsNull = true;

            request.IntentClosingSetting = new Amazon.LexModelsV2.Model.IntentClosingSetting();
            Amazon.LexModelsV2.Model.ResponseSpecification requestIntentClosingSetting_intentClosingSetting_ClosingResponse = null;

            // populate ClosingResponse
            var requestIntentClosingSetting_intentClosingSetting_ClosingResponseIsNull = true;

            requestIntentClosingSetting_intentClosingSetting_ClosingResponse = new Amazon.LexModelsV2.Model.ResponseSpecification();
            System.Boolean?requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_AllowInterrupt = null;
            if (cmdletContext.ClosingResponse_AllowInterrupt != null)
            {
                requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_AllowInterrupt = cmdletContext.ClosingResponse_AllowInterrupt.Value;
            }
            if (requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_AllowInterrupt != null)
            {
                requestIntentClosingSetting_intentClosingSetting_ClosingResponse.AllowInterrupt = requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_AllowInterrupt.Value;
                requestIntentClosingSetting_intentClosingSetting_ClosingResponseIsNull          = false;
            }
            List <Amazon.LexModelsV2.Model.MessageGroup> requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_MessageGroup = null;

            if (cmdletContext.ClosingResponse_MessageGroup != null)
            {
                requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_MessageGroup = cmdletContext.ClosingResponse_MessageGroup;
            }
            if (requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_MessageGroup != null)
            {
                requestIntentClosingSetting_intentClosingSetting_ClosingResponse.MessageGroups = requestIntentClosingSetting_intentClosingSetting_ClosingResponse_closingResponse_MessageGroup;
                requestIntentClosingSetting_intentClosingSetting_ClosingResponseIsNull         = false;
            }
            // determine if requestIntentClosingSetting_intentClosingSetting_ClosingResponse should be set to null
            if (requestIntentClosingSetting_intentClosingSetting_ClosingResponseIsNull)
            {
                requestIntentClosingSetting_intentClosingSetting_ClosingResponse = null;
            }
            if (requestIntentClosingSetting_intentClosingSetting_ClosingResponse != null)
            {
                request.IntentClosingSetting.ClosingResponse = requestIntentClosingSetting_intentClosingSetting_ClosingResponse;
                requestIntentClosingSettingIsNull            = false;
            }
            // determine if request.IntentClosingSetting should be set to null
            if (requestIntentClosingSettingIsNull)
            {
                request.IntentClosingSetting = null;
            }

            // populate IntentConfirmationSetting
            var requestIntentConfirmationSettingIsNull = true;

            request.IntentConfirmationSetting = new Amazon.LexModelsV2.Model.IntentConfirmationSetting();
            Amazon.LexModelsV2.Model.ResponseSpecification requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse = null;

            // populate DeclinationResponse
            var requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponseIsNull = true;

            requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse = new Amazon.LexModelsV2.Model.ResponseSpecification();
            System.Boolean?requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_AllowInterrupt = null;
            if (cmdletContext.DeclinationResponse_AllowInterrupt != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_AllowInterrupt = cmdletContext.DeclinationResponse_AllowInterrupt.Value;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_AllowInterrupt != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse.AllowInterrupt = requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_AllowInterrupt.Value;
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponseIsNull          = false;
            }
            List <Amazon.LexModelsV2.Model.MessageGroup> requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_MessageGroup = null;

            if (cmdletContext.DeclinationResponse_MessageGroup != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_MessageGroup = cmdletContext.DeclinationResponse_MessageGroup;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_MessageGroup != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse.MessageGroups = requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse_declinationResponse_MessageGroup;
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponseIsNull         = false;
            }
            // determine if requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse should be set to null
            if (requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponseIsNull)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse = null;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse != null)
            {
                request.IntentConfirmationSetting.DeclinationResponse = requestIntentConfirmationSetting_intentConfirmationSetting_DeclinationResponse;
                requestIntentConfirmationSettingIsNull = false;
            }
            Amazon.LexModelsV2.Model.PromptSpecification requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification = null;

            // populate PromptSpecification
            var requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecificationIsNull = true;

            requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification = new Amazon.LexModelsV2.Model.PromptSpecification();
            System.Boolean?requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_AllowInterrupt = null;
            if (cmdletContext.PromptSpecification_AllowInterrupt != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_AllowInterrupt = cmdletContext.PromptSpecification_AllowInterrupt.Value;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_AllowInterrupt != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification.AllowInterrupt = requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_AllowInterrupt.Value;
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecificationIsNull          = false;
            }
            System.Int32?requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MaxRetry = null;
            if (cmdletContext.PromptSpecification_MaxRetry != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MaxRetry = cmdletContext.PromptSpecification_MaxRetry.Value;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MaxRetry != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification.MaxRetries = requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MaxRetry.Value;
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecificationIsNull      = false;
            }
            List <Amazon.LexModelsV2.Model.MessageGroup> requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MessageGroup = null;

            if (cmdletContext.PromptSpecification_MessageGroup != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MessageGroup = cmdletContext.PromptSpecification_MessageGroup;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MessageGroup != null)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification.MessageGroups = requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification_promptSpecification_MessageGroup;
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecificationIsNull         = false;
            }
            // determine if requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification should be set to null
            if (requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecificationIsNull)
            {
                requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification = null;
            }
            if (requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification != null)
            {
                request.IntentConfirmationSetting.PromptSpecification = requestIntentConfirmationSetting_intentConfirmationSetting_PromptSpecification;
                requestIntentConfirmationSettingIsNull = false;
            }
            // determine if request.IntentConfirmationSetting should be set to null
            if (requestIntentConfirmationSettingIsNull)
            {
                request.IntentConfirmationSetting = null;
            }
            if (cmdletContext.IntentName != null)
            {
                request.IntentName = cmdletContext.IntentName;
            }

            // populate KendraConfiguration
            var requestKendraConfigurationIsNull = true;

            request.KendraConfiguration = new Amazon.LexModelsV2.Model.KendraConfiguration();
            System.String requestKendraConfiguration_kendraConfiguration_KendraIndex = null;
            if (cmdletContext.KendraConfiguration_KendraIndex != null)
            {
                requestKendraConfiguration_kendraConfiguration_KendraIndex = cmdletContext.KendraConfiguration_KendraIndex;
            }
            if (requestKendraConfiguration_kendraConfiguration_KendraIndex != null)
            {
                request.KendraConfiguration.KendraIndex = requestKendraConfiguration_kendraConfiguration_KendraIndex;
                requestKendraConfigurationIsNull        = false;
            }
            System.String requestKendraConfiguration_kendraConfiguration_QueryFilterString = null;
            if (cmdletContext.KendraConfiguration_QueryFilterString != null)
            {
                requestKendraConfiguration_kendraConfiguration_QueryFilterString = cmdletContext.KendraConfiguration_QueryFilterString;
            }
            if (requestKendraConfiguration_kendraConfiguration_QueryFilterString != null)
            {
                request.KendraConfiguration.QueryFilterString = requestKendraConfiguration_kendraConfiguration_QueryFilterString;
                requestKendraConfigurationIsNull = false;
            }
            System.Boolean?requestKendraConfiguration_kendraConfiguration_QueryFilterStringEnabled = null;
            if (cmdletContext.KendraConfiguration_QueryFilterStringEnabled != null)
            {
                requestKendraConfiguration_kendraConfiguration_QueryFilterStringEnabled = cmdletContext.KendraConfiguration_QueryFilterStringEnabled.Value;
            }
            if (requestKendraConfiguration_kendraConfiguration_QueryFilterStringEnabled != null)
            {
                request.KendraConfiguration.QueryFilterStringEnabled = requestKendraConfiguration_kendraConfiguration_QueryFilterStringEnabled.Value;
                requestKendraConfigurationIsNull = false;
            }
            // determine if request.KendraConfiguration should be set to null
            if (requestKendraConfigurationIsNull)
            {
                request.KendraConfiguration = null;
            }
            if (cmdletContext.LocaleId != null)
            {
                request.LocaleId = cmdletContext.LocaleId;
            }
            if (cmdletContext.OutputContext != null)
            {
                request.OutputContexts = cmdletContext.OutputContext;
            }
            if (cmdletContext.ParentIntentSignature != null)
            {
                request.ParentIntentSignature = cmdletContext.ParentIntentSignature;
            }
            if (cmdletContext.SampleUtterance != null)
            {
                request.SampleUtterances = cmdletContext.SampleUtterance;
            }

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