private Amazon.LexModelsV2.Model.CreateBotLocaleResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.CreateBotLocaleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "CreateBotLocale"); try { #if DESKTOP return(client.CreateBotLocale(request)); #elif CORECLR return(client.CreateBotLocaleAsync(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.CreateBotLocaleRequest(); if (cmdletContext.BotId != null) { request.BotId = cmdletContext.BotId; } if (cmdletContext.BotVersion != null) { request.BotVersion = cmdletContext.BotVersion; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.LocaleId != null) { request.LocaleId = cmdletContext.LocaleId; } if (cmdletContext.NluIntentConfidenceThreshold != null) { request.NluIntentConfidenceThreshold = cmdletContext.NluIntentConfidenceThreshold.Value; } // populate VoiceSettings var requestVoiceSettingsIsNull = true; request.VoiceSettings = new Amazon.LexModelsV2.Model.VoiceSettings(); Amazon.LexModelsV2.VoiceEngine requestVoiceSettings_voiceSettings_Engine = null; if (cmdletContext.VoiceSettings_Engine != null) { requestVoiceSettings_voiceSettings_Engine = cmdletContext.VoiceSettings_Engine; } if (requestVoiceSettings_voiceSettings_Engine != null) { request.VoiceSettings.Engine = requestVoiceSettings_voiceSettings_Engine; requestVoiceSettingsIsNull = false; } System.String requestVoiceSettings_voiceSettings_VoiceId = null; if (cmdletContext.VoiceSettings_VoiceId != null) { requestVoiceSettings_voiceSettings_VoiceId = cmdletContext.VoiceSettings_VoiceId; } if (requestVoiceSettings_voiceSettings_VoiceId != null) { request.VoiceSettings.VoiceId = requestVoiceSettings_voiceSettings_VoiceId; requestVoiceSettingsIsNull = false; } // determine if request.VoiceSettings should be set to null if (requestVoiceSettingsIsNull) { request.VoiceSettings = 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); }