Skip to content

get_mfa_device async

get_mfa_device(
    serial_number: serialNumberType,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    user_name: Optional[userNameType] = None,
) -> GetMFADeviceResponse

Retrieves information about an MFA device for a specified user.

Parameters:

  • serial_number (serialNumberType) –

    Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key ARNs.

  • user_name (Optional[userNameType], default: None ) –

    The friendly name identifying the user.

Raises:

  • 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 get_mfa_device(
    self,
    serial_number: "capo_iam.types.serial_number_type.serialNumberType",
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    user_name: Optional["capo_iam.types.user_name_type.userNameType"] = None,
) -> "capo_iam.types.get_mfa_device_response.GetMFADeviceResponse":
    """<p>Retrieves information about an MFA device for a specified user.</p>

    Args:
        serial_number: <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
        user_name: <p>The friendly name identifying the user.</p>

    Raises:
        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.get_mfa_device_request.GetMFADeviceRequest]",
    ) -> AsyncOperationResponse[
        "capo_iam.types.get_mfa_device_response.GetMFADeviceResponse"
    ]:
        import capo_iam._operations.aws_identity_management_v20100508.get_mfa_device

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetMFADevice")
    )
    input_: capo_iam.types.get_mfa_device_request.GetMFADeviceRequest = {
        "serial_number": serial_number
    }
    if user_name is not None:
        input_["user_name"] = user_name

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