1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package quicksight
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/quicksight/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an Amazon QuickSight user, whose identity is associated with the AWS
15// Identity and Access Management (IAM) identity or role specified in the request.
16func (c *Client) RegisterUser(ctx context.Context, params *RegisterUserInput, optFns ...func(*Options)) (*RegisterUserOutput, error) {
17	if params == nil {
18		params = &RegisterUserInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "RegisterUser", params, optFns, addOperationRegisterUserMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*RegisterUserOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type RegisterUserInput struct {
32
33	// The ID for the AWS account that the user is in. Currently, you use the ID for
34	// the AWS account that contains your Amazon QuickSight account.
35	//
36	// This member is required.
37	AwsAccountId *string
38
39	// The email address of the user that you want to register.
40	//
41	// This member is required.
42	Email *string
43
44	// Amazon QuickSight supports several ways of managing the identity of users. This
45	// parameter accepts two values:
46	//
47	// * IAM: A user whose identity maps to an existing
48	// IAM user or role.
49	//
50	// * QUICKSIGHT: A user whose identity is owned and managed
51	// internally by Amazon QuickSight.
52	//
53	// This member is required.
54	IdentityType types.IdentityType
55
56	// The namespace. Currently, you should set this to default.
57	//
58	// This member is required.
59	Namespace *string
60
61	// The Amazon QuickSight role for the user. The user role can be one of the
62	// following:
63	//
64	// * READER: A user who has read-only access to dashboards.
65	//
66	// * AUTHOR:
67	// A user who can create data sources, datasets, analyses, and dashboards.
68	//
69	// *
70	// ADMIN: A user who is an author, who can also manage Amazon QuickSight
71	// settings.
72	//
73	// * RESTRICTED_READER: This role isn't currently available for use.
74	//
75	// *
76	// RESTRICTED_AUTHOR: This role isn't currently available for use.
77	//
78	// This member is required.
79	UserRole types.UserRole
80
81	// (Enterprise edition only) The name of the custom permissions profile that you
82	// want to assign to this user. Customized permissions allows you to control a
83	// user's access by restricting access the following operations:
84	//
85	// * Create and
86	// update data sources
87	//
88	// * Create and update datasets
89	//
90	// * Create and update email
91	// reports
92	//
93	// * Subscribe to email reports
94	//
95	// To add custom permissions to an existing
96	// user, use UpdateUser instead. A set of custom permissions includes any
97	// combination of these restrictions. Currently, you need to create the profile
98	// names for custom permission sets by using the QuickSight console. Then, you use
99	// the RegisterUser API operation to assign the named set of permissions to a
100	// QuickSight user. QuickSight custom permissions are applied through IAM policies.
101	// Therefore, they override the permissions typically granted by assigning
102	// QuickSight users to one of the default security cohorts in QuickSight (admin,
103	// author, reader). This feature is available only to QuickSight Enterprise edition
104	// subscriptions that use SAML 2.0-Based Federation for Single Sign-On (SSO).
105	CustomPermissionsName *string
106
107	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
108	IamArn *string
109
110	// You need to use this parameter only when you register one or more users using an
111	// assumed IAM role. You don't need to provide the session name for other
112	// scenarios, for example when you are registering an IAM user or an Amazon
113	// QuickSight user. You can register multiple users using the same IAM role if each
114	// user has a different session name. For more information on assuming IAM roles,
115	// see assume-role
116	// (https://docs.aws.amazon.com/cli/latest/reference/sts/assume-role.html) in the
117	// AWS CLI Reference.
118	SessionName *string
119
120	// The Amazon QuickSight user name that you want to create for the user you are
121	// registering.
122	UserName *string
123}
124
125type RegisterUserOutput struct {
126
127	// The AWS request ID for this operation.
128	RequestId *string
129
130	// The HTTP status of the request.
131	Status int32
132
133	// The user's user name.
134	User *types.User
135
136	// The URL the user visits to complete registration and provide a password. This is
137	// returned only for users with an identity type of QUICKSIGHT.
138	UserInvitationUrl *string
139
140	// Metadata pertaining to the operation's result.
141	ResultMetadata middleware.Metadata
142}
143
144func addOperationRegisterUserMiddlewares(stack *middleware.Stack, options Options) (err error) {
145	err = stack.Serialize.Add(&awsRestjson1_serializeOpRegisterUser{}, middleware.After)
146	if err != nil {
147		return err
148	}
149	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRegisterUser{}, middleware.After)
150	if err != nil {
151		return err
152	}
153	if err = addSetLoggerMiddleware(stack, options); err != nil {
154		return err
155	}
156	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
157		return err
158	}
159	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
160		return err
161	}
162	if err = addResolveEndpointMiddleware(stack, options); err != nil {
163		return err
164	}
165	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
166		return err
167	}
168	if err = addRetryMiddlewares(stack, options); err != nil {
169		return err
170	}
171	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
172		return err
173	}
174	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
175		return err
176	}
177	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
178		return err
179	}
180	if err = addClientUserAgent(stack); err != nil {
181		return err
182	}
183	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
184		return err
185	}
186	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
187		return err
188	}
189	if err = addOpRegisterUserValidationMiddleware(stack); err != nil {
190		return err
191	}
192	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterUser(options.Region), middleware.Before); err != nil {
193		return err
194	}
195	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
196		return err
197	}
198	if err = addResponseErrorMiddleware(stack); err != nil {
199		return err
200	}
201	if err = addRequestResponseLogging(stack, options); err != nil {
202		return err
203	}
204	return nil
205}
206
207func newServiceMetadataMiddleware_opRegisterUser(region string) *awsmiddleware.RegisterServiceMetadata {
208	return &awsmiddleware.RegisterServiceMetadata{
209		Region:        region,
210		ServiceID:     ServiceID,
211		SigningName:   "quicksight",
212		OperationName: "RegisterUser",
213	}
214}
215