Skip to content

resync_mfa_device async

resync_mfa_device(
    user_name: existingUserNameType,
    serial_number: serialNumberType,
    authentication_code1: authenticationCodeType,
    authentication_code2: authenticationCodeType,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> None

Synchronizes the specified MFA device with its IAM resource object on the Amazon Web Services servers.

For more information about creating and working with virtual MFA devices, see Using a virtual MFA device in the IAM User Guide.

Parameters:

  • user_name (existingUserNameType) –

    The name of the user whose MFA device you want to resynchronize.

    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: _+=,.@-

  • serial_number (serialNumberType) –

    Serial number that uniquely identifies 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: _+=,.@-

  • authentication_code1 (authenticationCodeType) –

    An authentication code emitted by the device.

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

  • authentication_code2 (authenticationCodeType) –

    A subsequent authentication code emitted by the device.

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

Raises:

  • ConcurrentModificationException –

    The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.

  • InvalidAuthenticationCodeException –

    The request was rejected because the authentication code was not recognized. The error message describes the specific error.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.

  • NoSuchEntityException –

    The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.

  • ServiceFailureException –

    The request processing has failed because of an unknown error, exception or failure.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_iam/_services/async_iam.py
async def resync_mfa_device(
    self,
    user_name: "capo_iam.types.existing_user_name_type.existingUserNameType",
    serial_number: "capo_iam.types.serial_number_type.serialNumberType",
    authentication_code1: "capo_iam.types.authentication_code_type.authenticationCodeType",
    authentication_code2: "capo_iam.types.authentication_code_type.authenticationCodeType",
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> None:
    """<p>Synchronizes the specified MFA device with its IAM resource object on the Amazon Web Services servers.</p> <p>For more information about creating and working with virtual MFA devices, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_VirtualMFA.html">Using a virtual MFA device</a> in the <i>IAM User Guide</i>.</p>

    Args:
        user_name: <p>The name of the user whose MFA device you want to resynchronize.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
        serial_number: <p>Serial number that uniquely identifies the MFA device.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
        authentication_code1: <p>An authentication code emitted by the device.</p> <p>The format for this parameter is a sequence of six digits.</p>
        authentication_code2: <p>A subsequent authentication code emitted by the device.</p> <p>The format for this parameter is a sequence of six digits.</p>

    Raises:
        capo_iam.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.</p>
        capo_iam.errors.invalid_authentication_code_exception.InvalidAuthenticationCodeException: <p>The request was rejected because the authentication code was not recognized. The error message describes the specific error.</p>
        capo_iam.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.</p>
        capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
        capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.resync_mfa_device_request.ResyncMFADeviceRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_iam._operations.aws_identity_management_v20100508.resync_mfa_device

        (
            output,
            http_response,
        ) = await capo_iam._operations.aws_identity_management_v20100508.resync_mfa_device.async_resync_mfa_device(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ResyncMFADevice")
    )
    input_: capo_iam.types.resync_mfa_device_request.ResyncMFADeviceRequest = {
        "user_name": user_name,
        "serial_number": serial_number,
        "authentication_code1": authentication_code1,
        "authentication_code2": authentication_code2,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output