rotate_webhook_credentials
¶
rotate_webhook_credentials(
event_source_arn: WebhookEventSourceArn,
*,
config_overrides: Optional[EventBridgeV2ClientConfig] = None,
credential: Optional[WebhookCredential] = None,
client_token: Optional[ClientToken] = None,
) -> RotateWebhookCredentialsResponse
Sets a new credential on a webhook EventSource. If you supply Credential, EventBridge uses that value. Otherwise, EventBridge generates one. For HTTP Basic authentication, only the password changes. The username does not change. EventBridge never returns the credential. To read a generated value, call secretsmanager:GetSecretValue on the secret that SecretArn identifies.
You can rotate the credential of an EventSource in the ACTIVE, UPDATING, or UPDATE_FAILED state. For a revoked EventSource or an EventSource in any other state, EventBridge returns InvalidStateException. EventBridge also returns InvalidStateException if the secret of the EventSource is scheduled for deletion or has been deleted.
If you rotate the credential of one EventSource too many times in 24 hours, EventBridge returns LimitExceededException. Retry later. The limit becomes available again automatically.
If AWS Secrets Manager throttles the call, EventBridge returns ThrottlingException. Retry later.
To use this operation, you must have the following permissions in your IAM policy:
-
secretsmanager:PutSecretValue on the secret of the EventSource
-
secretsmanager:GetSecretValue on the secret of the EventSource, for HTTP Basic authentication only
-
kms:GenerateDataKey and kms:Decrypt on the AWS KMS key that encrypts the secret
The resource policy of the secret must not deny the secretsmanager actions.
EventBridge accepts the new credential when this call returns. In rare cases, the new credential takes up to 2 minutes to reach every EventBridge endpoint.
EventBridge also accepts the previous credential for 15 minutes after the rotation. The window ends at the CreatedDate of the AWSCURRENT secret version plus 15 minutes. Only the credential that the most recent rotation replaced stays valid. If you rotate again within 15 minutes, the older credential stops working immediately.
A retry with the same ClientToken within 8 hours returns the same result and does not rotate again. A retry of a rotation that supplied a value can arrive after a later rotation completed. In that case, the retried value becomes the current credential, and the credential it replaces does not stay valid.
Parameters:
-
event_source_arn(WebhookEventSourceArn) –The ARN of the webhook EventSource.
-
credential(Optional[WebhookCredential], default:None) –The new credential. Set the member that matches the authentication type of the EventSource. If you set a member that does not match the authentication type, EventBridge returns InvalidInputException. If you omit Credential, EventBridge generates a value.
-
client_token(Optional[ClientToken], default:None) –Unique, case-sensitive identifier that ensures the idempotency of the request. The SDK generates one automatically when the field is omitted.
Raises:
-
AccessDeniedException–The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.
-
InternalException–The request failed because of an internal service error. Retry the request.
-
InvalidInputException–A request parameter is missing or not valid.
-
ThrottlingException–The request was throttled because it exceeds a request rate limit. Retry the request with backoff.
-
ConcurrentModificationException–Another change to the resource is already in progress. Retry the request.
-
IdempotentParameterMismatchException–The request reuses the client token of an earlier request with different parameters. Use a new client token, or resend the earlier request unchanged.
-
InvalidStateException–The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.
-
LimitExceededException–The request would exceed a service quota for the account.
-
ResourceNotFoundException–The resource does not exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_eventbridgev2/_services/event_bridge_v2.py
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | |