createUser method

Future<CreateUserResponse> createUser({
  1. required String accessString,
  2. required AuthenticationMode authenticationMode,
  3. required String userName,
  4. List<Tag>? tags,
})

Creates a MemoryDB user. For more information, see Authenticating users with Access Contol Lists (ACLs).

May throw DuplicateUserNameFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw TagQuotaPerResourceExceeded. May throw UserAlreadyExistsFault. May throw UserQuotaExceededFault.

Parameter accessString : Access permissions string used for this user.

Parameter authenticationMode : Denotes the user's authentication properties, such as whether it requires a password to authenticate.

Parameter userName : The name of the user. This value must be unique as it also serves as the user identifier.

Parameter tags : A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

Implementation

Future<CreateUserResponse> createUser({
  required String accessString,
  required AuthenticationMode authenticationMode,
  required String userName,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonMemoryDB.CreateUser'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessString': accessString,
      'AuthenticationMode': authenticationMode,
      'UserName': userName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateUserResponse.fromJson(jsonResponse.body);
}