Skip to content

revoke_api_key async

revoke_api_key(
    branch_arn: BranchArn,
    api_key_id: ApiKeyId,
    *,
    config_overrides: Optional[AsyncAmplifyGen3ClientConfig] = None,
) -> RevokeApiKeyResponse

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/async_amplify_gen3.py
async 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[AsyncAmplifyGen3ClientConfig] = 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amplifygen3.types.revoke_api_key_request.RevokeApiKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_amplifygen3.types.revoke_api_key_response.RevokeApiKeyResponse"
    ]:
        import capo_amplifygen3._operations.omega.revoke_api_key

        (
            output,
            http_response,
        ) = await capo_amplifygen3._operations.omega.revoke_api_key.async_revoke_api_key(
            req.options, req.input
        )
        return AsyncOperationResponse(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 = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output