createUser method
Creates a new User within a collection specified by
CollectionId. Takes UserId as a parameter, which
is a user provided ID which should be unique within the collection. The
provided UserId will alias the system generated UUID to make
the UserId more user friendly.
Uses a ClientToken, an idempotency token that ensures a call
to CreateUser completes only once. If the value is not
supplied, the AWS SDK generates an idempotency token for the requests.
This prevents retries after a network error results from making multiple
CreateUser calls.
May throw AccessDeniedException.
May throw ConflictException.
May throw IdempotentParameterMismatchException.
May throw InternalServerError.
May throw InvalidParameterException.
May throw ProvisionedThroughputExceededException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
Parameter collectionId :
The ID of an existing collection to which the new UserID needs to be
created.
Parameter userId :
ID for the UserID to be created. This ID needs to be unique within the
collection.
Parameter clientRequestToken :
Idempotent token used to identify the request to CreateUser.
If you use the same token with multiple CreateUser requests,
the same response is returned. Use ClientRequestToken to prevent the same
request from being processed more than once.
Implementation
Future<void> createUser({
required String collectionId,
required String userId,
String? clientRequestToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'RekognitionService.CreateUser'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'CollectionId': collectionId,
'UserId': userId,
'ClientRequestToken':
clientRequestToken ?? _s.generateIdempotencyToken(),
},
);
}