Retrieves the user name for the specified IAM user. A login profile is created when you create a password for the user to access the Amazon Web Services Management Console. If the user does not exist or does not have a password, the operation returns a 404 (NoSuchEntity) error.
If you create an IAM user with access to the console, the CreateDate reflects the date you created the initial password for the user.
If you create an IAM user with programmatic access, and then later add a password for the user to access the Amazon Web Services Management Console, the CreateDate reflects the initial password creation date. A user with programmatic access does not have a login profile unless you create a password for the user to access the Amazon Web Services Management Console.
Parameters:
-
user_name
(Optional[userNameType], default:
None
)
–
The name of the user whose login profile you want to retrieve.
This parameter is optional. If no user name is included, it defaults to the principal making the request. When you make this request with root user credentials, you must use an AssumeRoot session to omit the user name.
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 password information for an IAM user
The following command gets information about the password for the IAM user named Anika.
>>> await client.get_login_profile(user_name='Anika')
Source code in docs_src/capo_iam/_services/async_iam.py
| async def get_login_profile(
self,
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
user_name: Optional["capo_iam.types.user_name_type.userNameType"] = None,
) -> "capo_iam.types.get_login_profile_response.GetLoginProfileResponse":
"""<p>Retrieves the user name for the specified IAM user. A login profile is created when you create a password for the user to access the Amazon Web Services Management Console. If the user does not exist or does not have a password, the operation returns a 404 (<code>NoSuchEntity</code>) error.</p> <p>If you create an IAM user with access to the console, the <code>CreateDate</code> reflects the date you created the initial password for the user.</p> <p>If you create an IAM user with programmatic access, and then later add a password for the user to access the Amazon Web Services Management Console, the <code>CreateDate</code> reflects the initial password creation date. A user with programmatic access does not have a login profile unless you create a password for the user to access the Amazon Web Services Management Console.</p>
Args:
user_name: <p>The name of the user whose login profile you want to retrieve.</p> <p>This parameter is optional. If no user name is included, it defaults to the principal making the request. When you make this request with root user credentials, you must use an <a href="https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html">AssumeRoot</a> session to omit the user name.</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>
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 password information for an IAM user
The following command gets information about the password for the IAM user named Anika.
>>> await client.get_login_profile(user_name='Anika')
"""
async def _handler(
req: "AsyncOperationRequest[capo_iam.types.get_login_profile_request.GetLoginProfileRequest]",
) -> AsyncOperationResponse[
"capo_iam.types.get_login_profile_response.GetLoginProfileResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.get_login_profile
(
output,
http_response,
) = await capo_iam._operations.aws_identity_management_v20100508.get_login_profile.async_get_login_profile(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetLoginProfile")
)
input_: capo_iam.types.get_login_profile_request.GetLoginProfileRequest = {}
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
|