1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package lexmodelsv2 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/lexmodelsv2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "time" 13) 14 15// Creates an alias for the specified version of a bot. Use an alias to enable you 16// to change the version of a bot without updating applications that use the bot. 17// For example, you can create an alias called "PROD" that your applications use to 18// call the Amazon Lex bot. 19func (c *Client) CreateBotAlias(ctx context.Context, params *CreateBotAliasInput, optFns ...func(*Options)) (*CreateBotAliasOutput, error) { 20 if params == nil { 21 params = &CreateBotAliasInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "CreateBotAlias", params, optFns, addOperationCreateBotAliasMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*CreateBotAliasOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type CreateBotAliasInput struct { 35 36 // The alias to create. The name must be unique for the bot. 37 // 38 // This member is required. 39 BotAliasName *string 40 41 // The unique identifier of the bot that the alias applies to. 42 // 43 // This member is required. 44 BotId *string 45 46 // Maps configuration information to a specific locale. You can use this parameter 47 // to specify a specific Lambda function to run different functions in different 48 // locales. 49 BotAliasLocaleSettings map[string]types.BotAliasLocaleSettings 50 51 // The version of the bot that this alias points to. You can use the operation to 52 // change the bot version associated with the alias. 53 BotVersion *string 54 55 // Specifies whether Amazon Lex logs text and audio for a conversation with the 56 // bot. When you enable conversation logs, text logs store text input, transcripts 57 // of audio input, and associated metadata in Amazon CloudWatch Logs. Audio logs 58 // store audio input in Amazon S3. 59 ConversationLogSettings *types.ConversationLogSettings 60 61 // A description of the alias. Use this description to help identify the alias. 62 Description *string 63 64 // Determines whether Amazon Lex will use Amazon Comprehend to detect the sentiment 65 // of user utterances. 66 SentimentAnalysisSettings *types.SentimentAnalysisSettings 67 68 // A list of tags to add to the bot alias. You can only add tags when you create an 69 // alias, you can't use the UpdateBotAlias operation to update the tags on a bot 70 // alias. To update tags, use the TagResource operation. 71 Tags map[string]string 72} 73 74type CreateBotAliasOutput struct { 75 76 // The unique identifier of the bot alias. 77 BotAliasId *string 78 79 // Configuration information for a specific locale. 80 BotAliasLocaleSettings map[string]types.BotAliasLocaleSettings 81 82 // The name specified for the bot alias. 83 BotAliasName *string 84 85 // The current status of the alias. The alias is first put into the Creating state. 86 // When the alias is ready to be used, it is put into the Available state. You can 87 // use the DescribeBotAlias operation to get the current state of an alias. 88 BotAliasStatus types.BotAliasStatus 89 90 // The unique identifier of the bot that this alias applies to. 91 BotId *string 92 93 // The version of the bot associated with this alias. 94 BotVersion *string 95 96 // The conversation log settings specified for the alias. 97 ConversationLogSettings *types.ConversationLogSettings 98 99 // A Unix timestamp indicating the date and time that the bot alias was created. 100 CreationDateTime *time.Time 101 102 // The description specified for the bot alias. 103 Description *string 104 105 // Determines whether Amazon Lex will use Amazon Comprehend to detect the sentiment 106 // of user utterances. 107 SentimentAnalysisSettings *types.SentimentAnalysisSettings 108 109 // A list of tags associated with the bot alias. 110 Tags map[string]string 111 112 // Metadata pertaining to the operation's result. 113 ResultMetadata middleware.Metadata 114} 115 116func addOperationCreateBotAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { 117 err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateBotAlias{}, middleware.After) 118 if err != nil { 119 return err 120 } 121 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateBotAlias{}, middleware.After) 122 if err != nil { 123 return err 124 } 125 if err = addSetLoggerMiddleware(stack, options); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addResolveEndpointMiddleware(stack, options); err != nil { 135 return err 136 } 137 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 138 return err 139 } 140 if err = addRetryMiddlewares(stack, options); err != nil { 141 return err 142 } 143 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 144 return err 145 } 146 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 147 return err 148 } 149 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 150 return err 151 } 152 if err = addClientUserAgent(stack); err != nil { 153 return err 154 } 155 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 156 return err 157 } 158 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addOpCreateBotAliasValidationMiddleware(stack); err != nil { 162 return err 163 } 164 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBotAlias(options.Region), middleware.Before); err != nil { 165 return err 166 } 167 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 168 return err 169 } 170 if err = addResponseErrorMiddleware(stack); err != nil { 171 return err 172 } 173 if err = addRequestResponseLogging(stack, options); err != nil { 174 return err 175 } 176 return nil 177} 178 179func newServiceMetadataMiddleware_opCreateBotAlias(region string) *awsmiddleware.RegisterServiceMetadata { 180 return &awsmiddleware.RegisterServiceMetadata{ 181 Region: region, 182 ServiceID: ServiceID, 183 SigningName: "lex", 184 OperationName: "CreateBotAlias", 185 } 186} 187