enableMFADevice method

Future<void> enableMFADevice({
  1. required String authenticationCode1,
  2. required String authenticationCode2,
  3. required String serialNumber,
  4. required String userName,
})

Enables the specified MFA device and associates it with the specified IAM user. When enabled, the MFA device is required for every subsequent login by the IAM user associated with the device.

May throw EntityAlreadyExistsException. May throw EntityTemporarilyUnmodifiableException. May throw InvalidAuthenticationCodeException. May throw LimitExceededException. May throw NoSuchEntityException. May throw ServiceFailureException.

Parameter authenticationCode1 : An authentication code emitted by the device.

The format for this parameter is a string of six digits.

Parameter authenticationCode2 : A subsequent authentication code emitted by the device.

The format for this parameter is a string of six digits.

Parameter serialNumber : The serial number that uniquely identifies the MFA device. For virtual MFA devices, the serial number is the device ARN.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.@:/-

Parameter userName : The name of the IAM user for whom you want to enable the MFA device.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Implementation

Future<void> enableMFADevice({
  required String authenticationCode1,
  required String authenticationCode2,
  required String serialNumber,
  required String userName,
}) async {
  ArgumentError.checkNotNull(authenticationCode1, 'authenticationCode1');
  _s.validateStringLength(
    'authenticationCode1',
    authenticationCode1,
    6,
    6,
    isRequired: true,
  );
  ArgumentError.checkNotNull(authenticationCode2, 'authenticationCode2');
  _s.validateStringLength(
    'authenticationCode2',
    authenticationCode2,
    6,
    6,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serialNumber, 'serialNumber');
  _s.validateStringLength(
    'serialNumber',
    serialNumber,
    9,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userName, 'userName');
  _s.validateStringLength(
    'userName',
    userName,
    1,
    128,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['AuthenticationCode1'] = authenticationCode1;
  $request['AuthenticationCode2'] = authenticationCode2;
  $request['SerialNumber'] = serialNumber;
  $request['UserName'] = userName;
  await _protocol.send(
    $request,
    action: 'EnableMFADevice',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['EnableMFADeviceRequest'],
    shapes: shapes,
  );
}