update_access_key
async
¶
update_access_key(
access_key_id: accessKeyIdType,
status: statusType,
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
user_name: Optional[existingUserNameType] = None,
) -> None
Changes the status of the specified access key from Active to Inactive, or vice versa. This operation can be used to disable a user's key as part of a key rotation workflow.
If the UserName is not specified, the user name is determined implicitly based on the Amazon Web Services access key ID used to sign the request. If a temporary access key is used, then UserName is required. If a long-term key is assigned to the user, then UserName is not required. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated users.
For information about rotating keys, see Managing keys and certificates in the IAM User Guide.
Parameters:
-
user_name(Optional[existingUserNameType], default:None) –The name of the user whose key you want to update.
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: _+=,.@-
-
access_key_id(accessKeyIdType) –The access key ID of the secret access key you want to update.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
-
status(statusType) –The status you want to assign to the secret access key.
Activemeans that the key can be used for programmatic calls to Amazon Web Services, whileInactivemeans that the key cannot be used.
Raises:
-
InvalidInputException–The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
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.
Examples:
To activate or deactivate an access key for an IAM user The following command deactivates the specified access key (access key ID and secret access key) for the IAM user named Bob.
>>> await client.update_access_key(user_name='Bob', status='Inactive', access_key_id='AKIAIOSFODNN7EXAMPLE')
Source code in docs_src/capo_iam/_services/async_iam.py
10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 | |