Skip to content

create_curation_policy_version async

create_curation_policy_version(
    curation_policy_id: CurationPolicyId,
    revision_id: CurationPolicyRevision,
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateCurationPolicyVersionResponse

Publishes a curation policy's working copy as a new, immutable version. The agent contexts associated with the policy start enforcing the new version. Returns the updated policy.

Parameters:

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

    A token that makes a retry safe. A retry with the same token and the same parameters returns the current policy instead of creating another version. A token used with different parameters is a ValidationException, checked first, and a retry with the same parameters after the policy was deleted is a ConflictException. Required at run time. The AWS SDKs generate one.

  • curation_policy_id (CurationPolicyId) –

    The ID of the curation policy to publish a new version of.

  • revision_id (CurationPolicyRevision) –

    The revisionId of the working copy to publish, as last read. A working copy whose revision has since advanced is a ConflictException.

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.

  • ServiceQuotaExceededException –

    The request would exceed a service quota. Check the quota that quotaCode names, reduce your usage, and then retry the request.

  • UnknownServiceError –

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

Examples:

Publish a curation policy The following example publishes the working copy of a draft curation policy as version 1, so the agent contexts associated with the policy start enforcing it.

>>> await client.create_curation_policy_version(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='8f14e45f-ceea-4e7a-9b1d-2c3a4b5c6d7e')
Source code in docs_src/capo_context/_services/async_context.py
async def create_curation_policy_version(
    self,
    curation_policy_id: "capo_context.types.curation_policy_id.CurationPolicyId",
    revision_id: "capo_context.types.curation_policy_revision.CurationPolicyRevision",
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
    client_token: Optional["capo_context.types.client_token.ClientToken"] = None,
) -> "capo_context.types.create_curation_policy_version_response.CreateCurationPolicyVersionResponse":
    """<p>Publishes a curation policy's working copy as a new, immutable version. The agent contexts associated with the policy start enforcing the new version. Returns the updated policy.</p>

    Args:
        client_token: <p>A token that makes a retry safe. A retry with the same token and the same parameters returns the current policy instead of creating another version. A token used with different parameters is a ValidationException, checked first, and a retry with the same parameters after the policy was deleted is a ConflictException. Required at run time. The AWS SDKs generate one.</p>
        curation_policy_id: <p>The ID of the curation policy to publish a new version of.</p>
        revision_id: <p>The <code>revisionId</code> of the working copy to publish, as last read. A working copy whose revision has since advanced is a ConflictException.</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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota. Check the quota that <code>quotaCode</code> names, reduce your usage, and then retry the request.</p>
        capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Publish a curation policy
        The following example publishes the working copy of a draft curation policy as version 1, so the agent contexts associated with the policy start enforcing it.

        >>> await client.create_curation_policy_version(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='8f14e45f-ceea-4e7a-9b1d-2c3a4b5c6d7e')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_context.types.create_curation_policy_version_request.CreateCurationPolicyVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_context.types.create_curation_policy_version_response.CreateCurationPolicyVersionResponse"
    ]:
        import capo_context._operations.context.create_curation_policy_version

        (
            output,
            http_response,
        ) = await capo_context._operations.context.create_curation_policy_version.async_create_curation_policy_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCurationPolicyVersion")
    )
    input_: capo_context.types.create_curation_policy_version_request.CreateCurationPolicyVersionRequest = {
        "curation_policy_id": curation_policy_id,
        "revision_id": revision_id,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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