1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package appstream
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/appstream/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new user in the user pool.
15func (c *Client) CreateUser(ctx context.Context, params *CreateUserInput, optFns ...func(*Options)) (*CreateUserOutput, error) {
16	if params == nil {
17		params = &CreateUserInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateUser", params, optFns, addOperationCreateUserMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateUserOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CreateUserInput struct {
31
32	// The authentication type for the user. You must specify USERPOOL.
33	//
34	// This member is required.
35	AuthenticationType types.AuthenticationType
36
37	// The email address of the user. Users' email addresses are case-sensitive. During
38	// login, if they specify an email address that doesn't use the same capitalization
39	// as the email address specified when their user pool account was created, a "user
40	// does not exist" error message displays.
41	//
42	// This member is required.
43	UserName *string
44
45	// The first name, or given name, of the user.
46	FirstName *string
47
48	// The last name, or surname, of the user.
49	LastName *string
50
51	// The action to take for the welcome email that is sent to a user after the user
52	// is created in the user pool. If you specify SUPPRESS, no email is sent. If you
53	// specify RESEND, do not specify the first name or last name of the user. If the
54	// value is null, the email is sent. The temporary password in the welcome email is
55	// valid for only 7 days. If users don’t set their passwords within 7 days, you
56	// must send them a new welcome email.
57	MessageAction types.MessageAction
58}
59
60type CreateUserOutput struct {
61	// Metadata pertaining to the operation's result.
62	ResultMetadata middleware.Metadata
63}
64
65func addOperationCreateUserMiddlewares(stack *middleware.Stack, options Options) (err error) {
66	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateUser{}, middleware.After)
67	if err != nil {
68		return err
69	}
70	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateUser{}, middleware.After)
71	if err != nil {
72		return err
73	}
74	if err = addSetLoggerMiddleware(stack, options); err != nil {
75		return err
76	}
77	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
78		return err
79	}
80	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
81		return err
82	}
83	if err = addResolveEndpointMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
87		return err
88	}
89	if err = addRetryMiddlewares(stack, options); err != nil {
90		return err
91	}
92	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
93		return err
94	}
95	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
99		return err
100	}
101	if err = addClientUserAgent(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
105		return err
106	}
107	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
108		return err
109	}
110	if err = addOpCreateUserValidationMiddleware(stack); err != nil {
111		return err
112	}
113	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUser(options.Region), middleware.Before); err != nil {
114		return err
115	}
116	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addResponseErrorMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addRequestResponseLogging(stack, options); err != nil {
123		return err
124	}
125	return nil
126}
127
128func newServiceMetadataMiddleware_opCreateUser(region string) *awsmiddleware.RegisterServiceMetadata {
129	return &awsmiddleware.RegisterServiceMetadata{
130		Region:        region,
131		ServiceID:     ServiceID,
132		SigningName:   "appstream",
133		OperationName: "CreateUser",
134	}
135}
136