createUser method
Creates a user account for the specified Amazon Connect instance.
For information about how to create user accounts using the Amazon Connect console, see Add Users in the Amazon Connect Administrator Guide.
May throw InvalidRequestException. May throw InvalidParameterException. May throw LimitExceededException. May throw DuplicateResourceException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalServiceException.
Parameter instanceId
:
The identifier of the Amazon Connect instance.
Parameter phoneConfig
:
The phone settings for the user.
Parameter routingProfileId
:
The identifier of the routing profile for the user.
Parameter securityProfileIds
:
The identifier of the security profile for the user.
Parameter username
:
The user name for the account. For instances not using SAML for identity
management, the user name can include up to 20 characters. If you are
using SAML for identity management, the user name can include up to 64
characters from a-zA-Z0-9_-.\@
+.
Parameter directoryUserId
:
The identifier of the user account in the directory used for identity
management. If Amazon Connect cannot access the directory, you can specify
this identifier to authenticate users. If you include the identifier, we
assume that Amazon Connect cannot access the directory. Otherwise, the
identity information is used to authenticate users from your directory.
This parameter is required if you are using an existing directory for identity management in Amazon Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity management and include this parameter, an error is returned.
Parameter hierarchyGroupId
:
The identifier of the hierarchy group for the user.
Parameter identityInfo
:
The information about the identity of the user.
Parameter password
:
The password for the user account. A password is required if you are using
Amazon Connect for identity management. Otherwise, it is an error to
include a password.
Parameter tags
:
One or more tags.
Implementation
Future<CreateUserResponse> createUser({
required String instanceId,
required UserPhoneConfig phoneConfig,
required String routingProfileId,
required List<String> securityProfileIds,
required String username,
String? directoryUserId,
String? hierarchyGroupId,
UserIdentityInfo? identityInfo,
String? password,
Map<String, String>? tags,
}) async {
ArgumentError.checkNotNull(instanceId, 'instanceId');
_s.validateStringLength(
'instanceId',
instanceId,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(phoneConfig, 'phoneConfig');
ArgumentError.checkNotNull(routingProfileId, 'routingProfileId');
ArgumentError.checkNotNull(securityProfileIds, 'securityProfileIds');
ArgumentError.checkNotNull(username, 'username');
_s.validateStringLength(
'username',
username,
1,
100,
isRequired: true,
);
final $payload = <String, dynamic>{
'PhoneConfig': phoneConfig,
'RoutingProfileId': routingProfileId,
'SecurityProfileIds': securityProfileIds,
'Username': username,
if (directoryUserId != null) 'DirectoryUserId': directoryUserId,
if (hierarchyGroupId != null) 'HierarchyGroupId': hierarchyGroupId,
if (identityInfo != null) 'IdentityInfo': identityInfo,
if (password != null) 'Password': password,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/users/${Uri.encodeComponent(instanceId)}',
exceptionFnMap: _exceptionFns,
);
return CreateUserResponse.fromJson(response);
}