Skip to content

delete_access_grant

delete_access_grant(
    grant_id: GrantId, *, config_overrides: Optional[CloudWatchOmniClientConfig] = None
) -> DeleteAccessGrantOutput

Removes an existing AccessGrant, revoking the access it granted. A service-managed grant cannot be deleted.

Parameters:

  • grant_id (GrantId) –

    The ID of the access grant to delete.

Raises:

Examples:

Delete an access grant The following example deletes an access grant by ID, revoking the access it granted. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.delete_access_grant(grant_id='7f3e9d21-4c8b-4f6a-b1d2-3e4f5a6b7c8d')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def delete_access_grant(
    self,
    grant_id: "capo_cloudwatchomni.types.grant_id.GrantId",
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
) -> "capo_cloudwatchomni.types.delete_access_grant_output.DeleteAccessGrantOutput":
    """Removes an existing AccessGrant, revoking the access it granted. A service-managed grant cannot be deleted.

    Args:
        grant_id: The ID of the access grant to delete.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Delete an access grant
        The following example deletes an access grant by ID, revoking the access it granted. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.delete_access_grant(grant_id='7f3e9d21-4c8b-4f6a-b1d2-3e4f5a6b7c8d')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.delete_access_grant_input.DeleteAccessGrantInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.delete_access_grant_output.DeleteAccessGrantOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.delete_access_grant

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.delete_access_grant.delete_access_grant(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAccessGrant")
    )
    input_: capo_cloudwatchomni.types.delete_access_grant_input.DeleteAccessGrantInput = {
        "grant_id": grant_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output