public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.LexModelBuildingService.Model.PutBotAliasRequest(); if (cmdletContext.BotName != null) { request.BotName = cmdletContext.BotName; } if (cmdletContext.BotVersion != null) { request.BotVersion = cmdletContext.BotVersion; } if (cmdletContext.Checksum != null) { request.Checksum = cmdletContext.Checksum; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } 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); }
private Amazon.LexModelBuildingService.Model.PutBotAliasResponse CallAWSServiceOperation(IAmazonLexModelBuildingService client, Amazon.LexModelBuildingService.Model.PutBotAliasRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building Service", "PutBotAlias"); try { #if DESKTOP return(client.PutBotAlias(request)); #elif CORECLR return(client.PutBotAliasAsync(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.LexModelBuildingService.Model.PutBotAliasRequest(); if (cmdletContext.BotName != null) { request.BotName = cmdletContext.BotName; } if (cmdletContext.BotVersion != null) { request.BotVersion = cmdletContext.BotVersion; } if (cmdletContext.Checksum != null) { request.Checksum = cmdletContext.Checksum; } // populate ConversationLogs var requestConversationLogsIsNull = true; request.ConversationLogs = new Amazon.LexModelBuildingService.Model.ConversationLogsRequest(); System.String requestConversationLogs_conversationLogs_IamRoleArn = null; if (cmdletContext.ConversationLogs_IamRoleArn != null) { requestConversationLogs_conversationLogs_IamRoleArn = cmdletContext.ConversationLogs_IamRoleArn; } if (requestConversationLogs_conversationLogs_IamRoleArn != null) { request.ConversationLogs.IamRoleArn = requestConversationLogs_conversationLogs_IamRoleArn; requestConversationLogsIsNull = false; } List <Amazon.LexModelBuildingService.Model.LogSettingsRequest> requestConversationLogs_conversationLogs_LogSetting = null; if (cmdletContext.ConversationLogs_LogSetting != null) { requestConversationLogs_conversationLogs_LogSetting = cmdletContext.ConversationLogs_LogSetting; } if (requestConversationLogs_conversationLogs_LogSetting != null) { request.ConversationLogs.LogSettings = requestConversationLogs_conversationLogs_LogSetting; requestConversationLogsIsNull = false; } // determine if request.ConversationLogs should be set to null if (requestConversationLogsIsNull) { request.ConversationLogs = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } 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); }