Skip to content

list_curation_policies

list_curation_policies(
    *,
    config_overrides: Optional[ContextClientConfig] = None,
    agent_context_id: Optional[AgentContextIdentifier] = None,
    status: Optional[CurationPolicyStatusFilter] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListCurationPoliciesResponse

Lists the curation policies in your account, or the ones associated with an agent context. Each item is a summary without the policy document. GetCurationPolicy returns the document. If agentContextId doesn't name an agent context in your account, the operation returns an empty page instead of an error.

Parameters:

  • agent_context_id (Optional[AgentContextIdentifier], default: None ) –

    The agent context whose associated policies you want to list, by its ID or ARN. If you omit it, every policy in your account is listed.

  • status (Optional[CurationPolicyStatusFilter], default: None ) –

    Return only policies with this status. If you omit it, policies in both statuses are returned.

    Valid values:

    • DRAFT - Policies that have never been published.

    • ACTIVE - Policies with a published version.

  • max_results (Optional[MaxResults], default: None ) –

    Maximum number of results per page (upper bound, not a target). The service might return fewer. Defaults to 50. A value outside 1–100 fails with ValidationException.

  • next_token (Optional[PaginationToken], default: None ) –

    Opaque pagination cursor from a prior response. Omit for the first page.

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.

  • UnknownServiceError –

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

Examples:

List the curation policies in your account The following example lists the curation policies in the account, one published and one still a draft.

>>> client.list_curation_policies(max_results=10)
Source code in docs_src/capo_context/_services/context.py
def list_curation_policies(
    self,
    *,
    config_overrides: Optional[ContextClientConfig] = None,
    agent_context_id: Optional[
        "capo_context.types.agent_context_identifier.AgentContextIdentifier"
    ] = None,
    status: Optional[
        "capo_context.types.curation_policy_status_filter.CurationPolicyStatusFilter"
    ] = None,
    max_results: Optional["capo_context.types.max_results.MaxResults"] = None,
    next_token: Optional[
        "capo_context.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_context.types.list_curation_policies_response.ListCurationPoliciesResponse":
    """<p>Lists the curation policies in your account, or the ones associated with an agent context. Each item is a summary without the policy document. GetCurationPolicy returns the document. If <code>agentContextId</code> doesn't name an agent context in your account, the operation returns an empty page instead of an error.</p>

    Args:
        agent_context_id: <p>The agent context whose associated policies you want to list, by its ID or ARN. If you omit it, every policy in your account is listed.</p>
        status: <p>Return only policies with this status. If you omit it, policies in both statuses are returned.</p> <p>Valid values:</p> <ul> <li> <p> <code>DRAFT</code> - Policies that have never been published.</p> </li> <li> <p> <code>ACTIVE</code> - Policies with a published version.</p> </li> </ul>
        max_results: <p>Maximum number of results per page (upper bound, not a target). The service might return fewer. Defaults to 50. A value outside 1–100 fails with <code>ValidationException</code>.</p>
        next_token: <p>Opaque pagination cursor from a prior response. Omit for the first page.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List the curation policies in your account
        The following example lists the curation policies in the account, one published and one still a draft.

        >>> client.list_curation_policies(max_results=10)
    """

    def _handler(
        req: "OperationRequest[capo_context.types.list_curation_policies_request.ListCurationPoliciesRequest]",
    ) -> OperationResponse[
        "capo_context.types.list_curation_policies_response.ListCurationPoliciesResponse"
    ]:
        import capo_context._operations.context.list_curation_policies

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCurationPolicies")
    )
    input_: capo_context.types.list_curation_policies_request.ListCurationPoliciesRequest = {}
    if agent_context_id is not None:
        input_["agent_context_id"] = agent_context_id
    if status is not None:
        input_["status"] = status
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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