Skip to content

delete_resource_policy async

delete_resource_policy(
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    revision_id: Optional[str] = None,
) -> None

Deletes the resource-based policy attached to an Amazon Managed Service for Prometheus workspace.

Parameters:

  • workspace_id (WorkspaceId) –

    The ID of the workspace from which to delete the resource-based policy.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the request is safe to retry (idempotent).

  • revision_id (Optional[str], default: None ) –

    The revision ID of the policy to delete. Use this parameter to ensure that you are deleting the correct version of the policy.

Raises:

Source code in docs_src/capo_amp/_services/async_amp.py
async def delete_resource_policy(
    self,
    workspace_id: "capo_amp.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[
        "capo_amp.types.idempotency_token.IdempotencyToken"
    ] = None,
    revision_id: Optional[str] = None,
) -> None:
    """<p>Deletes the resource-based policy attached to an Amazon Managed Service for Prometheus workspace.</p>

    Args:
        workspace_id: <p>The ID of the workspace from which to delete the resource-based policy.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the request is safe to retry (idempotent).</p>
        revision_id: <p>The revision ID of the policy to delete. Use this parameter to ensure that you are deleting the correct version of the policy.</p>

    Raises:
        capo_amp.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_amp.errors.conflict_exception.ConflictException: <p>The request would cause an inconsistent state.</p>
        capo_amp.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_amp.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resources that doesn't exist.</p>
        capo_amp.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_amp.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_amp.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amp.types.delete_resource_policy_request.DeleteResourcePolicyRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_amp._operations.amazon_prometheus_service.delete_resource_policy

        (
            output,
            http_response,
        ) = await capo_amp._operations.amazon_prometheus_service.delete_resource_policy.async_delete_resource_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteResourcePolicy")
    )
    input_: capo_amp.types.delete_resource_policy_request.DeleteResourcePolicyRequest = {
        "workspace_id": workspace_id
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if revision_id is not None:
        input_["revision_id"] = revision_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output