createUser method
For Valkey engine version 7.2 onwards and Redis OSS 6.0 to 7.1: Creates a user. For more information, see Using Role Based Access Control (RBAC).
May throw DuplicateUserNameFault.
May throw InvalidParameterCombinationException.
May throw InvalidParameterValueException.
May throw ServiceLinkedRoleNotFoundFault.
May throw TagQuotaPerResourceExceeded.
May throw UserAlreadyExistsFault.
May throw UserQuotaExceededFault.
Parameter accessString :
Access permissions string used for this user.
Parameter engine :
The options are valkey or redis.
Parameter userId :
The ID of the user. This value is stored as a lowercase string.
Parameter userName :
The username of the user.
Parameter authenticationMode :
Specifies how to authenticate the user.
Parameter noPasswordRequired :
Indicates a password is not required for this user.
Parameter passwords :
Passwords used for this user. You can create up to two passwords for each
user.
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<User> createUser({
required String accessString,
required String engine,
required String userId,
required String userName,
AuthenticationMode? authenticationMode,
bool? noPasswordRequired,
List<String>? passwords,
List<Tag>? tags,
}) async {
final $request = <String, String>{
'AccessString': accessString,
'Engine': engine,
'UserId': userId,
'UserName': userName,
if (authenticationMode != null)
for (var e1 in authenticationMode.toQueryMap().entries)
'AuthenticationMode.${e1.key}': e1.value,
if (noPasswordRequired != null)
'NoPasswordRequired': noPasswordRequired.toString(),
if (passwords != null)
if (passwords.isEmpty)
'Passwords': ''
else
for (var i1 = 0; i1 < passwords.length; i1++)
'Passwords.member.${i1 + 1}': passwords[i1],
if (tags != null)
if (tags.isEmpty)
'Tags': ''
else
for (var i1 = 0; i1 < tags.length; i1++)
for (var e3 in tags[i1].toQueryMap().entries)
'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
};
final $result = await _protocol.send(
$request,
action: 'CreateUser',
version: '2015-02-02',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'CreateUserResult',
);
return User.fromXml($result);
}