createUser method
Creates a user in a Simple AD or Microsoft AD directory. The status of a newly created user is "ACTIVE". New users can access Amazon WorkDocs.
May throw EntityAlreadyExistsException.
May throw FailedDependencyException.
May throw ServiceUnavailableException.
May throw UnauthorizedOperationException.
May throw UnauthorizedResourceAccessException.
Parameter givenName :
The given name of the user.
Parameter password :
The password of the user.
Parameter surname :
The surname of the user.
Parameter username :
The login name of the user.
Parameter authenticationToken :
Amazon WorkDocs authentication token. Not required when using Amazon Web
Services administrator credentials to access the API.
Parameter emailAddress :
The email address of the user.
Parameter organizationId :
The ID of the organization.
Parameter storageRule :
The amount of storage for the user.
Parameter timeZoneId :
The time zone ID of the user.
Implementation
Future<CreateUserResponse> createUser({
required String givenName,
required String password,
required String surname,
required String username,
String? authenticationToken,
String? emailAddress,
String? organizationId,
StorageRuleType? storageRule,
String? timeZoneId,
}) async {
final headers = <String, String>{
if (authenticationToken != null)
'Authentication': authenticationToken.toString(),
};
final $payload = <String, dynamic>{
'GivenName': givenName,
'Password': password,
'Surname': surname,
'Username': username,
if (emailAddress != null) 'EmailAddress': emailAddress,
if (organizationId != null) 'OrganizationId': organizationId,
if (storageRule != null) 'StorageRule': storageRule,
if (timeZoneId != null) 'TimeZoneId': timeZoneId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/api/v1/users',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateUserResponse.fromJson(response);
}