deactivateMFADevice method

Future<void> deactivateMFADevice({
  1. required String serialNumber,
  2. required String userName,
})

Deactivates the specified MFA device and removes it from association with the user name for which it was originally enabled.

For more information about creating and working with virtual MFA devices, go to Enabling a Virtual Multi-factor Authentication (MFA) Device in the IAM User Guide.

May throw EntityTemporarilyUnmodifiableException. May throw NoSuchEntityException. May throw LimitExceededException. May throw ServiceFailureException.

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 user whose MFA device you want to deactivate.

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> deactivateMFADevice({
  required String serialNumber,
  required String userName,
}) async {
  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['SerialNumber'] = serialNumber;
  $request['UserName'] = userName;
  await _protocol.send(
    $request,
    action: 'DeactivateMFADevice',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeactivateMFADeviceRequest'],
    shapes: shapes,
  );
}