Skip to content

delete_curation_policy

delete_curation_policy(
    curation_policy_id: CurationPolicyId,
    *,
    config_overrides: Optional[ContextClientConfig] = None,
) -> DeleteCurationPolicyResponse

Deletes a curation policy. While the policy is associated with any agent context, the request fails with ConflictException. Disassociate it with DisassociateCurationPolicy first. You can't delete a default policy that AWS Context created in your account: the request fails with ConflictException. Disassociate it instead. After the delete, GetCurationPolicy returns the policy with status DELETED, and ListCurationPolicies doesn't return it. Deleting a policy that is already deleted succeeds.

Parameters:

  • curation_policy_id (CurationPolicyId) –

    The ID of the curation policy to delete.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.

  • InternalServerException –

    The request failed because of an internal error. Retry the request.

  • ThrottlingException –

    The request was denied because it exceeded a request rate quota. Wait, then retry the request.

  • ValidationException –

    The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.

  • ConflictException –

    The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.

  • ResourceNotFoundException –

    The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Delete a curation policy The following example deletes a curation policy that isn't associated with any agent context.

>>> client.delete_curation_policy(curation_policy_id='pol-9b2d4f6a8c0e4b1d3f5a7c9e1b3d5f7a')
Delete a curation policy that is still associated with an agent context, which fails with ConflictException
The following example fails because the curation policy is still associated with an agent context; disassociate it with DisassociateCurationPolicy first.
>>> client.delete_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e')
Source code in docs_src/capo_context/_services/context.py
def delete_curation_policy(
    self,
    curation_policy_id: "capo_context.types.curation_policy_id.CurationPolicyId",
    *,
    config_overrides: Optional[ContextClientConfig] = None,
) -> "capo_context.types.delete_curation_policy_response.DeleteCurationPolicyResponse":
    """<p>Deletes a curation policy. While the policy is associated with any agent context, the request fails with <code>ConflictException</code>. Disassociate it with DisassociateCurationPolicy first. You can't delete a default policy that AWS Context created in your account: the request fails with <code>ConflictException</code>. Disassociate it instead. After the delete, GetCurationPolicy returns the policy with status <code>DELETED</code>, and ListCurationPolicies doesn't return it. Deleting a policy that is already deleted succeeds.</p>

    Args:
        curation_policy_id: <p>The ID of the curation policy to delete.</p>

    Raises:
        capo_context.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.</p>
        capo_context.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Retry the request.</p>
        capo_context.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded a request rate quota. Wait, then retry the request.</p>
        capo_context.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.</p>
        capo_context.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.</p>
        capo_context.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.</p>
        capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Delete a curation policy
        The following example deletes a curation policy that isn't associated with any agent context.

        >>> client.delete_curation_policy(curation_policy_id='pol-9b2d4f6a8c0e4b1d3f5a7c9e1b3d5f7a')
        Delete a curation policy that is still associated with an agent context, which fails with ConflictException
        The following example fails because the curation policy is still associated with an agent context; disassociate it with DisassociateCurationPolicy first.

        >>> client.delete_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e')
    """

    def _handler(
        req: "OperationRequest[capo_context.types.delete_curation_policy_request.DeleteCurationPolicyRequest]",
    ) -> OperationResponse[
        "capo_context.types.delete_curation_policy_response.DeleteCurationPolicyResponse"
    ]:
        import capo_context._operations.context.delete_curation_policy

        output, http_response = (
            capo_context._operations.context.delete_curation_policy.delete_curation_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteCurationPolicy")
    )
    input_: capo_context.types.delete_curation_policy_request.DeleteCurationPolicyRequest = {
        "curation_policy_id": curation_policy_id
    }

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