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// Builds a bot, its intents, and its slot types into a specific locale. A bot can
16// be built into multiple locales. At runtime the locale is used to choose a
17// specific build of the bot.
18func (c *Client) BuildBotLocale(ctx context.Context, params *BuildBotLocaleInput, optFns ...func(*Options)) (*BuildBotLocaleOutput, error) {
19	if params == nil {
20		params = &BuildBotLocaleInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "BuildBotLocale", params, optFns, addOperationBuildBotLocaleMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*BuildBotLocaleOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type BuildBotLocaleInput struct {
34
35	// The identifier of the bot to build. The identifier is returned in the response
36	// from the operation.
37	//
38	// This member is required.
39	BotId *string
40
41	// The version of the bot to build. This can only be the draft version of the bot.
42	//
43	// This member is required.
44	BotVersion *string
45
46	// The identifier of the language and locale that the bot will be used in. The
47	// string must match one of the supported locales. All of the intents, slot types,
48	// and slots used in the bot must have the same locale. For more information, see
49	// https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html
50	// (https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html).
51	//
52	// This member is required.
53	LocaleId *string
54}
55
56type BuildBotLocaleOutput struct {
57
58	// The identifier of the specified bot.
59	BotId *string
60
61	// The bot's build status. When the status is ReadyExpressTesting you can test the
62	// bot using the utterances defined for the intents and slot types. When the status
63	// is Built, the bot is ready for use and can be tested using any utterance.
64	BotLocaleStatus types.BotLocaleStatus
65
66	// The version of the bot that was built. This is only the draft version of the
67	// bot.
68	BotVersion *string
69
70	// A timestamp indicating the date and time that the bot was last built for this
71	// locale.
72	LastBuildSubmittedDateTime *time.Time
73
74	// The language and locale specified of where the bot can be used.
75	LocaleId *string
76
77	// Metadata pertaining to the operation's result.
78	ResultMetadata middleware.Metadata
79}
80
81func addOperationBuildBotLocaleMiddlewares(stack *middleware.Stack, options Options) (err error) {
82	err = stack.Serialize.Add(&awsRestjson1_serializeOpBuildBotLocale{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBuildBotLocale{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	if err = addSetLoggerMiddleware(stack, options); err != nil {
91		return err
92	}
93	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
94		return err
95	}
96	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
97		return err
98	}
99	if err = addResolveEndpointMiddleware(stack, options); err != nil {
100		return err
101	}
102	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
103		return err
104	}
105	if err = addRetryMiddlewares(stack, options); err != nil {
106		return err
107	}
108	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
115		return err
116	}
117	if err = addClientUserAgent(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = addOpBuildBotLocaleValidationMiddleware(stack); err != nil {
127		return err
128	}
129	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBuildBotLocale(options.Region), middleware.Before); err != nil {
130		return err
131	}
132	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addResponseErrorMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addRequestResponseLogging(stack, options); err != nil {
139		return err
140	}
141	return nil
142}
143
144func newServiceMetadataMiddleware_opBuildBotLocale(region string) *awsmiddleware.RegisterServiceMetadata {
145	return &awsmiddleware.RegisterServiceMetadata{
146		Region:        region,
147		ServiceID:     ServiceID,
148		SigningName:   "lex",
149		OperationName: "BuildBotLocale",
150	}
151}
152