Esempio n. 1
0
 private Amazon.LexModelsV2.Model.UpdateBotRecommendationResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.UpdateBotRecommendationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "UpdateBotRecommendation");
     try
     {
         #if DESKTOP
         return(client.UpdateBotRecommendation(request));
         #elif CORECLR
         return(client.UpdateBotRecommendationAsync(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;
     }
 }
Esempio n. 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LexModelsV2.Model.UpdateBotRecommendationRequest();

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

            // populate EncryptionSetting
            var requestEncryptionSettingIsNull = true;

            request.EncryptionSetting = new Amazon.LexModelsV2.Model.EncryptionSetting();
            System.String requestEncryptionSetting_encryptionSetting_AssociatedTranscriptsPassword = null;
            if (cmdletContext.EncryptionSetting_AssociatedTranscriptsPassword != null)
            {
                requestEncryptionSetting_encryptionSetting_AssociatedTranscriptsPassword = cmdletContext.EncryptionSetting_AssociatedTranscriptsPassword;
            }
            if (requestEncryptionSetting_encryptionSetting_AssociatedTranscriptsPassword != null)
            {
                request.EncryptionSetting.AssociatedTranscriptsPassword = requestEncryptionSetting_encryptionSetting_AssociatedTranscriptsPassword;
                requestEncryptionSettingIsNull = false;
            }
            System.String requestEncryptionSetting_encryptionSetting_BotLocaleExportPassword = null;
            if (cmdletContext.EncryptionSetting_BotLocaleExportPassword != null)
            {
                requestEncryptionSetting_encryptionSetting_BotLocaleExportPassword = cmdletContext.EncryptionSetting_BotLocaleExportPassword;
            }
            if (requestEncryptionSetting_encryptionSetting_BotLocaleExportPassword != null)
            {
                request.EncryptionSetting.BotLocaleExportPassword = requestEncryptionSetting_encryptionSetting_BotLocaleExportPassword;
                requestEncryptionSettingIsNull = false;
            }
            System.String requestEncryptionSetting_encryptionSetting_KmsKeyArn = null;
            if (cmdletContext.EncryptionSetting_KmsKeyArn != null)
            {
                requestEncryptionSetting_encryptionSetting_KmsKeyArn = cmdletContext.EncryptionSetting_KmsKeyArn;
            }
            if (requestEncryptionSetting_encryptionSetting_KmsKeyArn != null)
            {
                request.EncryptionSetting.KmsKeyArn = requestEncryptionSetting_encryptionSetting_KmsKeyArn;
                requestEncryptionSettingIsNull      = false;
            }
            // determine if request.EncryptionSetting should be set to null
            if (requestEncryptionSettingIsNull)
            {
                request.EncryptionSetting = null;
            }
            if (cmdletContext.LocaleId != null)
            {
                request.LocaleId = cmdletContext.LocaleId;
            }

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