createUser method
For Redis engine version 6.x onwards: Creates a Redis user. For more information, see Using Role Based Access Control (RBAC).
May throw UserAlreadyExistsFault. May throw UserQuotaExceededFault. May throw DuplicateUserNameFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.
Parameter accessString
:
Access permissions string used for this user.
Parameter engine
:
The current supported value is Redis.
Parameter userId
:
The ID of the user.
Parameter userName
:
The username of 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.
Implementation
Future<User> createUser({
required String accessString,
required String engine,
required String userId,
required String userName,
bool? noPasswordRequired,
List<String>? passwords,
}) async {
ArgumentError.checkNotNull(accessString, 'accessString');
ArgumentError.checkNotNull(engine, 'engine');
ArgumentError.checkNotNull(userId, 'userId');
_s.validateStringLength(
'userId',
userId,
1,
1152921504606846976,
isRequired: true,
);
ArgumentError.checkNotNull(userName, 'userName');
_s.validateStringLength(
'userName',
userName,
1,
1152921504606846976,
isRequired: true,
);
final $request = <String, dynamic>{};
$request['AccessString'] = accessString;
$request['Engine'] = engine;
$request['UserId'] = userId;
$request['UserName'] = userName;
noPasswordRequired?.also((arg) => $request['NoPasswordRequired'] = arg);
passwords?.also((arg) => $request['Passwords'] = arg);
final $result = await _protocol.send(
$request,
action: 'CreateUser',
version: '2015-02-02',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['CreateUserMessage'],
shapes: shapes,
resultWrapper: 'CreateUserResult',
);
return User.fromXml($result);
}