コード例 #1
0
 private Amazon.LexModelBuildingService.Model.PutIntentResponse CallAWSServiceOperation(IAmazonLexModelBuildingService client, Amazon.LexModelBuildingService.Model.PutIntentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building Service", "PutIntent");
     try
     {
         #if DESKTOP
         return(client.PutIntent(request));
         #elif CORECLR
         return(client.PutIntentAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LexModelBuildingService.Model.PutIntentRequest();

            if (cmdletContext.Checksum != null)
            {
                request.Checksum = cmdletContext.Checksum;
            }
            if (cmdletContext.ConclusionStatement != null)
            {
                request.ConclusionStatement = cmdletContext.ConclusionStatement;
            }

            // populate ConfirmationPrompt
            var requestConfirmationPromptIsNull = true;

            request.ConfirmationPrompt = new Amazon.LexModelBuildingService.Model.Prompt();
            System.Int32?requestConfirmationPrompt_confirmationPrompt_MaxAttempt = null;
            if (cmdletContext.ConfirmationPrompt_MaxAttempt != null)
            {
                requestConfirmationPrompt_confirmationPrompt_MaxAttempt = cmdletContext.ConfirmationPrompt_MaxAttempt.Value;
            }
            if (requestConfirmationPrompt_confirmationPrompt_MaxAttempt != null)
            {
                request.ConfirmationPrompt.MaxAttempts = requestConfirmationPrompt_confirmationPrompt_MaxAttempt.Value;
                requestConfirmationPromptIsNull        = false;
            }
            List <Amazon.LexModelBuildingService.Model.Message> requestConfirmationPrompt_confirmationPrompt_Message = null;

            if (cmdletContext.ConfirmationPrompt_Message != null)
            {
                requestConfirmationPrompt_confirmationPrompt_Message = cmdletContext.ConfirmationPrompt_Message;
            }
            if (requestConfirmationPrompt_confirmationPrompt_Message != null)
            {
                request.ConfirmationPrompt.Messages = requestConfirmationPrompt_confirmationPrompt_Message;
                requestConfirmationPromptIsNull     = false;
            }
            System.String requestConfirmationPrompt_confirmationPrompt_ResponseCard = null;
            if (cmdletContext.ConfirmationPrompt_ResponseCard != null)
            {
                requestConfirmationPrompt_confirmationPrompt_ResponseCard = cmdletContext.ConfirmationPrompt_ResponseCard;
            }
            if (requestConfirmationPrompt_confirmationPrompt_ResponseCard != null)
            {
                request.ConfirmationPrompt.ResponseCard = requestConfirmationPrompt_confirmationPrompt_ResponseCard;
                requestConfirmationPromptIsNull         = false;
            }
            // determine if request.ConfirmationPrompt should be set to null
            if (requestConfirmationPromptIsNull)
            {
                request.ConfirmationPrompt = null;
            }
            if (cmdletContext.CreateVersion != null)
            {
                request.CreateVersion = cmdletContext.CreateVersion.Value;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }

            // populate DialogCodeHook
            var requestDialogCodeHookIsNull = true;

            request.DialogCodeHook = new Amazon.LexModelBuildingService.Model.CodeHook();
            System.String requestDialogCodeHook_dialogCodeHook_MessageVersion = null;
            if (cmdletContext.DialogCodeHook_MessageVersion != null)
            {
                requestDialogCodeHook_dialogCodeHook_MessageVersion = cmdletContext.DialogCodeHook_MessageVersion;
            }
            if (requestDialogCodeHook_dialogCodeHook_MessageVersion != null)
            {
                request.DialogCodeHook.MessageVersion = requestDialogCodeHook_dialogCodeHook_MessageVersion;
                requestDialogCodeHookIsNull           = false;
            }
            System.String requestDialogCodeHook_dialogCodeHook_Uri = null;
            if (cmdletContext.DialogCodeHook_Uri != null)
            {
                requestDialogCodeHook_dialogCodeHook_Uri = cmdletContext.DialogCodeHook_Uri;
            }
            if (requestDialogCodeHook_dialogCodeHook_Uri != null)
            {
                request.DialogCodeHook.Uri  = requestDialogCodeHook_dialogCodeHook_Uri;
                requestDialogCodeHookIsNull = false;
            }
            // determine if request.DialogCodeHook should be set to null
            if (requestDialogCodeHookIsNull)
            {
                request.DialogCodeHook = null;
            }

            // populate FollowUpPrompt
            var requestFollowUpPromptIsNull = true;

            request.FollowUpPrompt = new Amazon.LexModelBuildingService.Model.FollowUpPrompt();
            Amazon.LexModelBuildingService.Model.Statement requestFollowUpPrompt_followUpPrompt_RejectionStatement = null;
            if (cmdletContext.FollowUpPrompt_RejectionStatement != null)
            {
                requestFollowUpPrompt_followUpPrompt_RejectionStatement = cmdletContext.FollowUpPrompt_RejectionStatement;
            }
            if (requestFollowUpPrompt_followUpPrompt_RejectionStatement != null)
            {
                request.FollowUpPrompt.RejectionStatement = requestFollowUpPrompt_followUpPrompt_RejectionStatement;
                requestFollowUpPromptIsNull = false;
            }
            Amazon.LexModelBuildingService.Model.Prompt requestFollowUpPrompt_followUpPrompt_Prompt = null;

            // populate Prompt
            var requestFollowUpPrompt_followUpPrompt_PromptIsNull = true;

            requestFollowUpPrompt_followUpPrompt_Prompt = new Amazon.LexModelBuildingService.Model.Prompt();
            System.Int32?requestFollowUpPrompt_followUpPrompt_Prompt_prompt_MaxAttempt = null;
            if (cmdletContext.Prompt_MaxAttempt != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt_prompt_MaxAttempt = cmdletContext.Prompt_MaxAttempt.Value;
            }
            if (requestFollowUpPrompt_followUpPrompt_Prompt_prompt_MaxAttempt != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt.MaxAttempts = requestFollowUpPrompt_followUpPrompt_Prompt_prompt_MaxAttempt.Value;
                requestFollowUpPrompt_followUpPrompt_PromptIsNull       = false;
            }
            List <Amazon.LexModelBuildingService.Model.Message> requestFollowUpPrompt_followUpPrompt_Prompt_prompt_Message = null;

            if (cmdletContext.Prompt_Message != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt_prompt_Message = cmdletContext.Prompt_Message;
            }
            if (requestFollowUpPrompt_followUpPrompt_Prompt_prompt_Message != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt.Messages = requestFollowUpPrompt_followUpPrompt_Prompt_prompt_Message;
                requestFollowUpPrompt_followUpPrompt_PromptIsNull    = false;
            }
            System.String requestFollowUpPrompt_followUpPrompt_Prompt_prompt_ResponseCard = null;
            if (cmdletContext.Prompt_ResponseCard != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt_prompt_ResponseCard = cmdletContext.Prompt_ResponseCard;
            }
            if (requestFollowUpPrompt_followUpPrompt_Prompt_prompt_ResponseCard != null)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt.ResponseCard = requestFollowUpPrompt_followUpPrompt_Prompt_prompt_ResponseCard;
                requestFollowUpPrompt_followUpPrompt_PromptIsNull        = false;
            }
            // determine if requestFollowUpPrompt_followUpPrompt_Prompt should be set to null
            if (requestFollowUpPrompt_followUpPrompt_PromptIsNull)
            {
                requestFollowUpPrompt_followUpPrompt_Prompt = null;
            }
            if (requestFollowUpPrompt_followUpPrompt_Prompt != null)
            {
                request.FollowUpPrompt.Prompt = requestFollowUpPrompt_followUpPrompt_Prompt;
                requestFollowUpPromptIsNull   = false;
            }
            // determine if request.FollowUpPrompt should be set to null
            if (requestFollowUpPromptIsNull)
            {
                request.FollowUpPrompt = null;
            }

            // populate FulfillmentActivity
            var requestFulfillmentActivityIsNull = true;

            request.FulfillmentActivity = new Amazon.LexModelBuildingService.Model.FulfillmentActivity();
            Amazon.LexModelBuildingService.FulfillmentActivityType requestFulfillmentActivity_fulfillmentActivity_Type = null;
            if (cmdletContext.FulfillmentActivity_Type != null)
            {
                requestFulfillmentActivity_fulfillmentActivity_Type = cmdletContext.FulfillmentActivity_Type;
            }
            if (requestFulfillmentActivity_fulfillmentActivity_Type != null)
            {
                request.FulfillmentActivity.Type = requestFulfillmentActivity_fulfillmentActivity_Type;
                requestFulfillmentActivityIsNull = false;
            }
            Amazon.LexModelBuildingService.Model.CodeHook requestFulfillmentActivity_fulfillmentActivity_CodeHook = null;

            // populate CodeHook
            var requestFulfillmentActivity_fulfillmentActivity_CodeHookIsNull = true;

            requestFulfillmentActivity_fulfillmentActivity_CodeHook = new Amazon.LexModelBuildingService.Model.CodeHook();
            System.String requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_MessageVersion = null;
            if (cmdletContext.CodeHook_MessageVersion != null)
            {
                requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_MessageVersion = cmdletContext.CodeHook_MessageVersion;
            }
            if (requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_MessageVersion != null)
            {
                requestFulfillmentActivity_fulfillmentActivity_CodeHook.MessageVersion = requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_MessageVersion;
                requestFulfillmentActivity_fulfillmentActivity_CodeHookIsNull          = false;
            }
            System.String requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_Uri = null;
            if (cmdletContext.CodeHook_Uri != null)
            {
                requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_Uri = cmdletContext.CodeHook_Uri;
            }
            if (requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_Uri != null)
            {
                requestFulfillmentActivity_fulfillmentActivity_CodeHook.Uri   = requestFulfillmentActivity_fulfillmentActivity_CodeHook_codeHook_Uri;
                requestFulfillmentActivity_fulfillmentActivity_CodeHookIsNull = false;
            }
            // determine if requestFulfillmentActivity_fulfillmentActivity_CodeHook should be set to null
            if (requestFulfillmentActivity_fulfillmentActivity_CodeHookIsNull)
            {
                requestFulfillmentActivity_fulfillmentActivity_CodeHook = null;
            }
            if (requestFulfillmentActivity_fulfillmentActivity_CodeHook != null)
            {
                request.FulfillmentActivity.CodeHook = requestFulfillmentActivity_fulfillmentActivity_CodeHook;
                requestFulfillmentActivityIsNull     = false;
            }
            // determine if request.FulfillmentActivity should be set to null
            if (requestFulfillmentActivityIsNull)
            {
                request.FulfillmentActivity = null;
            }

            // populate KendraConfiguration
            var requestKendraConfigurationIsNull = true;

            request.KendraConfiguration = new Amazon.LexModelBuildingService.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.String requestKendraConfiguration_kendraConfiguration_Role = null;
            if (cmdletContext.KendraConfiguration_Role != null)
            {
                requestKendraConfiguration_kendraConfiguration_Role = cmdletContext.KendraConfiguration_Role;
            }
            if (requestKendraConfiguration_kendraConfiguration_Role != null)
            {
                request.KendraConfiguration.Role = requestKendraConfiguration_kendraConfiguration_Role;
                requestKendraConfigurationIsNull = false;
            }
            // determine if request.KendraConfiguration should be set to null
            if (requestKendraConfigurationIsNull)
            {
                request.KendraConfiguration = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.ParentIntentSignature != null)
            {
                request.ParentIntentSignature = cmdletContext.ParentIntentSignature;
            }
            if (cmdletContext.RejectionStatement != null)
            {
                request.RejectionStatement = cmdletContext.RejectionStatement;
            }
            if (cmdletContext.SampleUtterance != null)
            {
                request.SampleUtterances = cmdletContext.SampleUtterance;
            }
            if (cmdletContext.Slot != null)
            {
                request.Slots = cmdletContext.Slot;
            }

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