private Amazon.LexModelsV2.Model.UpdateBotAliasResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.UpdateBotAliasRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "UpdateBotAlias"); try { #if DESKTOP return(client.UpdateBotAlias(request)); #elif CORECLR return(client.UpdateBotAliasAsync(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.UpdateBotAliasRequest(); if (cmdletContext.BotAliasId != null) { request.BotAliasId = cmdletContext.BotAliasId; } if (cmdletContext.BotAliasLocaleSetting != null) { request.BotAliasLocaleSettings = cmdletContext.BotAliasLocaleSetting; } if (cmdletContext.BotAliasName != null) { request.BotAliasName = cmdletContext.BotAliasName; } if (cmdletContext.BotId != null) { request.BotId = cmdletContext.BotId; } if (cmdletContext.BotVersion != null) { request.BotVersion = cmdletContext.BotVersion; } // populate ConversationLogSettings var requestConversationLogSettingsIsNull = true; request.ConversationLogSettings = new Amazon.LexModelsV2.Model.ConversationLogSettings(); List <Amazon.LexModelsV2.Model.AudioLogSetting> requestConversationLogSettings_conversationLogSettings_AudioLogSetting = null; if (cmdletContext.ConversationLogSettings_AudioLogSetting != null) { requestConversationLogSettings_conversationLogSettings_AudioLogSetting = cmdletContext.ConversationLogSettings_AudioLogSetting; } if (requestConversationLogSettings_conversationLogSettings_AudioLogSetting != null) { request.ConversationLogSettings.AudioLogSettings = requestConversationLogSettings_conversationLogSettings_AudioLogSetting; requestConversationLogSettingsIsNull = false; } List <Amazon.LexModelsV2.Model.TextLogSetting> requestConversationLogSettings_conversationLogSettings_TextLogSetting = null; if (cmdletContext.ConversationLogSettings_TextLogSetting != null) { requestConversationLogSettings_conversationLogSettings_TextLogSetting = cmdletContext.ConversationLogSettings_TextLogSetting; } if (requestConversationLogSettings_conversationLogSettings_TextLogSetting != null) { request.ConversationLogSettings.TextLogSettings = requestConversationLogSettings_conversationLogSettings_TextLogSetting; requestConversationLogSettingsIsNull = false; } // determine if request.ConversationLogSettings should be set to null if (requestConversationLogSettingsIsNull) { request.ConversationLogSettings = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } // populate SentimentAnalysisSettings var requestSentimentAnalysisSettingsIsNull = true; request.SentimentAnalysisSettings = new Amazon.LexModelsV2.Model.SentimentAnalysisSettings(); System.Boolean?requestSentimentAnalysisSettings_sentimentAnalysisSettings_DetectSentiment = null; if (cmdletContext.SentimentAnalysisSettings_DetectSentiment != null) { requestSentimentAnalysisSettings_sentimentAnalysisSettings_DetectSentiment = cmdletContext.SentimentAnalysisSettings_DetectSentiment.Value; } if (requestSentimentAnalysisSettings_sentimentAnalysisSettings_DetectSentiment != null) { request.SentimentAnalysisSettings.DetectSentiment = requestSentimentAnalysisSettings_sentimentAnalysisSettings_DetectSentiment.Value; requestSentimentAnalysisSettingsIsNull = false; } // determine if request.SentimentAnalysisSettings should be set to null if (requestSentimentAnalysisSettingsIsNull) { request.SentimentAnalysisSettings = null; } 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); }