Revokes an API key for a branch. A revoked key has a status of INACTIVE and is rejected. You can't reactivate a revoked key, and Amplify doesn't create a replacement key. Revoking a key that is already revoked succeeds and leaves the key INACTIVE.
Parameters:
-
branch_arn
(BranchArn)
–
The Amazon Resource Name (ARN) of the branch that the API key belongs to.
-
api_key_id
(ApiKeyId)
–
The ID of the API key to revoke.
Raises:
Source code in docs_src/capo_amplifygen3/_services/amplify_gen3.py
| def revoke_api_key(
self,
branch_arn: "capo_amplifygen3.types.branch_arn.BranchArn",
api_key_id: "capo_amplifygen3.types.api_key_id.ApiKeyId",
*,
config_overrides: Optional[AmplifyGen3ClientConfig] = None,
) -> "capo_amplifygen3.types.revoke_api_key_response.RevokeApiKeyResponse":
"""<p>Revokes an API key for a branch. A revoked key has a status of INACTIVE and is rejected. You can't reactivate a revoked key, and Amplify doesn't create a replacement key. Revoking a key that is already revoked succeeds and leaves the key INACTIVE.</p>
Args:
branch_arn: <p>The Amazon Resource Name (ARN) of the branch that the API key belongs to.</p>
api_key_id: <p>The ID of the API key to revoke.</p>
Raises:
capo_amplifygen3.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
capo_amplifygen3.errors.internal_server_exception.InternalServerException: <p>An internal error occurred. Retry the request.</p>
capo_amplifygen3.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
capo_amplifygen3.errors.throttling_exception.ThrottlingException: <p>The request was denied because the request rate exceeds the allowed limit.</p>
capo_amplifygen3.errors.validation_exception.ValidationException: <p>The request contains invalid parameters or is otherwise malformed.</p>
capo_amplifygen3.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_amplifygen3.types.revoke_api_key_request.RevokeApiKeyRequest]",
) -> OperationResponse[
"capo_amplifygen3.types.revoke_api_key_response.RevokeApiKeyResponse"
]:
import capo_amplifygen3._operations.omega.revoke_api_key
output, http_response = (
capo_amplifygen3._operations.omega.revoke_api_key.revoke_api_key(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("RevokeApiKey")
)
input_: capo_amplifygen3.types.revoke_api_key_request.RevokeApiKeyRequest = {
"branch_arn": branch_arn,
"api_key_id": api_key_id,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|