registerUser method
Creates an Amazon QuickSight user, whose identity is associated with the AWS Identity and Access Management (IAM) identity or role specified in the request.
May throw AccessDeniedException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw LimitExceededException. May throw ResourceExistsException. May throw PreconditionNotMetException. May throw InternalFailureException. May throw ResourceUnavailableException.
Parameter awsAccountId :
The ID for the AWS account that the user is in. Currently, you use the ID
for the AWS account that contains your Amazon QuickSight account.
Parameter email :
The email address of the user that you want to register.
Parameter identityType :
Amazon QuickSight supports several ways of managing the identity of users.
This parameter accepts two values:
-
IAM: A user whose identity maps to an existing IAM user or role. -
QUICKSIGHT: A user whose identity is owned and managed internally by Amazon QuickSight.
Parameter namespace :
The namespace. Currently, you should set this to default.
Parameter userRole :
The Amazon QuickSight role for the user. The user role can be one of the
following:
-
READER: A user who has read-only access to dashboards. -
AUTHOR: A user who can create data sources, datasets, analyses, and dashboards. -
ADMIN: A user who is an author, who can also manage Amazon QuickSight settings. -
RESTRICTED_READER: This role isn't currently available for use. -
RESTRICTED_AUTHOR: This role isn't currently available for use.
Parameter customPermissionsName :
(Enterprise edition only) The name of the custom permissions profile that
you want to assign to this user. Customized permissions allows you to
control a user's access by restricting access the following operations:
- Create and update data sources
- Create and update datasets
- Create and update email reports
- Subscribe to email reports
UpdateUser instead.
A set of custom permissions includes any combination of these
restrictions. Currently, you need to create the profile names for custom
permission sets by using the QuickSight console. Then, you use the
RegisterUser API operation to assign the named set of
permissions to a QuickSight user.
QuickSight custom permissions are applied through IAM policies. Therefore, they override the permissions typically granted by assigning QuickSight users to one of the default security cohorts in QuickSight (admin, author, reader).
This feature is available only to QuickSight Enterprise edition subscriptions that use SAML 2.0-Based Federation for Single Sign-On (SSO).
Parameter iamArn :
The ARN of the IAM user or role that you are registering with Amazon
QuickSight.
Parameter sessionName :
You need to use this parameter only when you register one or more users
using an assumed IAM role. You don't need to provide the session name for
other scenarios, for example when you are registering an IAM user or an
Amazon QuickSight user. You can register multiple users using the same IAM
role if each user has a different session name. For more information on
assuming IAM roles, see
assume-role in the AWS CLI Reference.
Parameter userName :
The Amazon QuickSight user name that you want to create for the user you
are registering.
Implementation
Future<RegisterUserResponse> registerUser({
required String awsAccountId,
required String email,
required IdentityType identityType,
required String namespace,
required UserRole userRole,
String? customPermissionsName,
String? iamArn,
String? sessionName,
String? userName,
}) async {
ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
_s.validateStringLength(
'awsAccountId',
awsAccountId,
12,
12,
isRequired: true,
);
ArgumentError.checkNotNull(email, 'email');
ArgumentError.checkNotNull(identityType, 'identityType');
ArgumentError.checkNotNull(namespace, 'namespace');
_s.validateStringLength(
'namespace',
namespace,
0,
64,
isRequired: true,
);
ArgumentError.checkNotNull(userRole, 'userRole');
_s.validateStringLength(
'customPermissionsName',
customPermissionsName,
1,
64,
);
_s.validateStringLength(
'sessionName',
sessionName,
2,
64,
);
_s.validateStringLength(
'userName',
userName,
1,
1152921504606846976,
);
final $payload = <String, dynamic>{
'Email': email,
'IdentityType': identityType.toValue(),
'UserRole': userRole.toValue(),
if (customPermissionsName != null)
'CustomPermissionsName': customPermissionsName,
if (iamArn != null) 'IamArn': iamArn,
if (sessionName != null) 'SessionName': sessionName,
if (userName != null) 'UserName': userName,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/accounts/${Uri.encodeComponent(awsAccountId)}/namespaces/${Uri.encodeComponent(namespace)}/users',
exceptionFnMap: _exceptionFns,
);
return RegisterUserResponse.fromJson(response);
}