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, c.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	noSmithyDocumentSerde
75}
76
77type CreateBotOutput struct {
78
79	// A unique identifier for a particular bot. You use this to identify the bot when
80	// you call other Amazon Lex API operations.
81	BotId *string
82
83	// The name specified for the bot.
84	BotName *string
85
86	// Shows the current status of the bot. The bot is first in the Creating status.
87	// Once the bot is read for use, it changes to the Available status. After the bot
88	// is created, you can use the Draft version of the bot.
89	BotStatus types.BotStatus
90
91	// A list of tags associated with the bot.
92	BotTags map[string]string
93
94	// A timestamp indicating the date and time that the bot was created.
95	CreationDateTime *time.Time
96
97	// The data privacy settings specified for the bot.
98	DataPrivacy *types.DataPrivacy
99
100	// The description specified for the bot.
101	Description *string
102
103	// The session idle time specified for the bot.
104	IdleSessionTTLInSeconds *int32
105
106	// The IAM role specified for the bot.
107	RoleArn *string
108
109	// A list of tags associated with the test alias for the bot.
110	TestBotAliasTags map[string]string
111
112	// Metadata pertaining to the operation's result.
113	ResultMetadata middleware.Metadata
114
115	noSmithyDocumentSerde
116}
117
118func (c *Client) addOperationCreateBotMiddlewares(stack *middleware.Stack, options Options) (err error) {
119	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateBot{}, middleware.After)
120	if err != nil {
121		return err
122	}
123	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateBot{}, middleware.After)
124	if err != nil {
125		return err
126	}
127	if err = addSetLoggerMiddleware(stack, options); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addResolveEndpointMiddleware(stack, options); err != nil {
137		return err
138	}
139	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
140		return err
141	}
142	if err = addRetryMiddlewares(stack, options); err != nil {
143		return err
144	}
145	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
146		return err
147	}
148	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
149		return err
150	}
151	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
152		return err
153	}
154	if err = addClientUserAgent(stack); err != nil {
155		return err
156	}
157	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
158		return err
159	}
160	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
161		return err
162	}
163	if err = addOpCreateBotValidationMiddleware(stack); err != nil {
164		return err
165	}
166	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBot(options.Region), middleware.Before); err != nil {
167		return err
168	}
169	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
170		return err
171	}
172	if err = addResponseErrorMiddleware(stack); err != nil {
173		return err
174	}
175	if err = addRequestResponseLogging(stack, options); err != nil {
176		return err
177	}
178	return nil
179}
180
181func newServiceMetadataMiddleware_opCreateBot(region string) *awsmiddleware.RegisterServiceMetadata {
182	return &awsmiddleware.RegisterServiceMetadata{
183		Region:        region,
184		ServiceID:     ServiceID,
185		SigningName:   "lex",
186		OperationName: "CreateBot",
187	}
188}
189