modifyUser method

Future<User> modifyUser({
  1. required String userId,
  2. String? accessString,
  3. String? appendAccessString,
  4. AuthenticationMode? authenticationMode,
  5. String? engine,
  6. bool? noPasswordRequired,
  7. List<String>? passwords,
})

Changes user password(s) and/or access string.

May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidUserStateFault. May throw ServiceLinkedRoleNotFoundFault. May throw UserNotFoundFault.

Parameter userId : The ID of the user.

Parameter accessString : Access permissions string used for this user.

Parameter appendAccessString : Adds additional user permissions to the access string.

Parameter authenticationMode : Specifies how to authenticate the user.

Parameter engine : Modifies the engine listed for a user. The options are valkey or redis.

Parameter noPasswordRequired : Indicates no password is required for the user.

Parameter passwords : The passwords belonging to the user. You are allowed up to two.

Implementation

Future<User> modifyUser({
  required String userId,
  String? accessString,
  String? appendAccessString,
  AuthenticationMode? authenticationMode,
  String? engine,
  bool? noPasswordRequired,
  List<String>? passwords,
}) async {
  final $request = <String, String>{
    'UserId': userId,
    if (accessString != null) 'AccessString': accessString,
    if (appendAccessString != null) 'AppendAccessString': appendAccessString,
    if (authenticationMode != null)
      for (var e1 in authenticationMode.toQueryMap().entries)
        'AuthenticationMode.${e1.key}': e1.value,
    if (engine != null) 'Engine': engine,
    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],
  };
  final $result = await _protocol.send(
    $request,
    action: 'ModifyUser',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'ModifyUserResult',
  );
  return User.fromXml($result);
}