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 Amazon Lex conversational bot. 16func (c *Client) CreateBot(ctx context.Context, params *CreateBotInput, optFns ...func(*Options)) (*CreateBotOutput, error) { 17 if params == nil { 18 params = &CreateBotInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "CreateBot", params, optFns, addOperationCreateBotMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*CreateBotOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type CreateBotInput struct { 32 33 // The name of the bot. The bot name must be unique in the account that creates the 34 // bot. 35 // 36 // This member is required. 37 BotName *string 38 39 // Provides information on additional privacy protections Amazon Lex should use 40 // with the bot's data. 41 // 42 // This member is required. 43 DataPrivacy *types.DataPrivacy 44 45 // The time, in seconds, that Amazon Lex should keep information about a user's 46 // conversation with the bot. A user interaction remains active for the amount of 47 // time specified. If no conversation occurs during this time, the session expires 48 // and Amazon Lex deletes any data provided before the timeout. You can specify 49 // between 60 (1 minute) and 86,400 (24 hours) seconds. 50 // 51 // This member is required. 52 IdleSessionTTLInSeconds *int32 53 54 // The Amazon Resource Name (ARN) of an IAM role that has permission to access the 55 // bot. 56 // 57 // This member is required. 58 RoleArn *string 59 60 // A list of tags to add to the bot. You can only add tags when you create a bot. 61 // You can't use the UpdateBot operation to update tags. To update tags, use the 62 // TagResource operation. 63 BotTags map[string]string 64 65 // A description of the bot. It appears in lists to help you identify a particular 66 // bot. 67 Description *string 68 69 // A list of tags to add to the test alias for a bot. You can only add tags when 70 // you create a bot. You can't use the UpdateAlias operation to update tags. To 71 // update tags on the test alias, use the TagResource operation. 72 TestBotAliasTags map[string]string 73} 74 75type CreateBotOutput struct { 76 77 // A unique identifier for a particular bot. You use this to identify the bot when 78 // you call other Amazon Lex API operations. 79 BotId *string 80 81 // The name specified for the bot. 82 BotName *string 83 84 // Shows the current status of the bot. The bot is first in the Creating status. 85 // Once the bot is read for use, it changes to the Available status. After the bot 86 // is created, you can use the Draft version of the bot. 87 BotStatus types.BotStatus 88 89 // A list of tags associated with the bot. 90 BotTags map[string]string 91 92 // A timestamp indicating the date and time that the bot was created. 93 CreationDateTime *time.Time 94 95 // The data privacy settings specified for the bot. 96 DataPrivacy *types.DataPrivacy 97 98 // The description specified for the bot. 99 Description *string 100 101 // The session idle time specified for the bot. 102 IdleSessionTTLInSeconds *int32 103 104 // The IAM role specified for the bot. 105 RoleArn *string 106 107 // A list of tags associated with the test alias for the bot. 108 TestBotAliasTags map[string]string 109 110 // Metadata pertaining to the operation's result. 111 ResultMetadata middleware.Metadata 112} 113 114func addOperationCreateBotMiddlewares(stack *middleware.Stack, options Options) (err error) { 115 err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateBot{}, middleware.After) 116 if err != nil { 117 return err 118 } 119 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateBot{}, middleware.After) 120 if err != nil { 121 return err 122 } 123 if err = addSetLoggerMiddleware(stack, options); err != nil { 124 return err 125 } 126 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 130 return err 131 } 132 if err = addResolveEndpointMiddleware(stack, options); err != nil { 133 return err 134 } 135 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 136 return err 137 } 138 if err = addRetryMiddlewares(stack, options); err != nil { 139 return err 140 } 141 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 142 return err 143 } 144 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 145 return err 146 } 147 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 148 return err 149 } 150 if err = addClientUserAgent(stack); err != nil { 151 return err 152 } 153 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 154 return err 155 } 156 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 157 return err 158 } 159 if err = addOpCreateBotValidationMiddleware(stack); err != nil { 160 return err 161 } 162 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBot(options.Region), middleware.Before); err != nil { 163 return err 164 } 165 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 166 return err 167 } 168 if err = addResponseErrorMiddleware(stack); err != nil { 169 return err 170 } 171 if err = addRequestResponseLogging(stack, options); err != nil { 172 return err 173 } 174 return nil 175} 176 177func newServiceMetadataMiddleware_opCreateBot(region string) *awsmiddleware.RegisterServiceMetadata { 178 return &awsmiddleware.RegisterServiceMetadata{ 179 Region: region, 180 ServiceID: ServiceID, 181 SigningName: "lex", 182 OperationName: "CreateBot", 183 } 184} 185