Skip to content

get_user async

get_user(
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    user_name: Optional[existingUserNameType] = None,
) -> GetUserResponse

Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.

If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web Services access key ID used to sign the request to this operation.

Parameters:

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

    The name of the user to get information about.

    This parameter is optional. If it is not included, it defaults to the user making the request. 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: _+=,.@-

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.

Examples:

To get information about an IAM user The following command gets information about the IAM user named Bob.

>>> await client.get_user(user_name='Bob')
Source code in docs_src/capo_iam/_services/async_iam.py
async def get_user(
    self,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
    user_name: Optional[
        "capo_iam.types.existing_user_name_type.existingUserNameType"
    ] = None,
) -> "capo_iam.types.get_user_response.GetUserResponse":
    """<p>Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.</p> <p>If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web Services access key ID used to sign the request to this operation.</p>

    Args:
        user_name: <p>The name of the user to get information about.</p> <p>This parameter is optional. If it is not included, it defaults to the user making the request. 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>

    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.

    Examples:
        To get information about an IAM user
        The following command gets information about the IAM user named Bob.

        >>> await client.get_user(user_name='Bob')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.get_user_request.GetUserRequest]",
    ) -> AsyncOperationResponse["capo_iam.types.get_user_response.GetUserResponse"]:
        import capo_iam._operations.aws_identity_management_v20100508.get_user

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetUser")
    )
    input_: capo_iam.types.get_user_request.GetUserRequest = {}
    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