Skip to content

update_curation_policy async

update_curation_policy(
    curation_policy_id: CurationPolicyId,
    revision_id: CurationPolicyRevision,
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    name: Optional[ResourceName] = None,
    description: Optional[UserDefinedString] = None,
    policy_document: Optional[PolicyText] = None,
    auto_reject_after_seconds: Optional[AutoRejectAfterSeconds] = None,
) -> UpdateCurationPolicyResponse

Updates a curation policy's working copy.

Parameters:

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

    Makes a retry safe: the same token with the same parameters returns the current policy instead of a ConflictException. A token used with different parameters is a ValidationException whose message names clientToken, checked first. A retry with the same parameters after the policy was deleted is a ConflictException.

  • curation_policy_id (CurationPolicyId) –

    The ID of the curation policy to update.

  • revision_id (CurationPolicyRevision) –

    The revisionId of the working copy that you edited, as you last read it. If a concurrent edit advanced the revision, the request fails with ConflictException.

  • name (Optional[ResourceName], default: None ) –

    The new name. If you omit it, the name is unchanged. This operation updates only the members that you include. You can't use it to clear an optional member.

  • description (Optional[UserDefinedString], default: None ) –

    The new description. If you omit it, the description is unchanged.

  • policy_document (Optional[PolicyText], default: None ) –

    The new Cedar policy document. If you omit it, the document is unchanged.

  • auto_reject_after_seconds (Optional[AutoRejectAfterSeconds], default: None ) –

    The new auto-reject window, in seconds, from 86,400 (1 day) to 15,552,000 (180 days). If you omit it, the window is unchanged. You can't clear it with this operation.

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:

Update a curation policy The following example changes the working copy of a curation policy to also hold change sets that ontology grounding generates, and extends the auto-reject window to 14 days.

>>> await client.update_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='e3a5c7b9-1d4f-4b6a-8c2e-9f0b1d3a5c7e', policy_document='forbid (\n    principal,\n    action == AWS::Context::Action::"PublishChangeSet",\n    resource is AWS::Context::ChangeSet\n)\nwhen { resource has generatedBy && (resource.generatedBy == AWS::Context::Activity::"TRACE_ANALYSIS" || resource.generatedBy == AWS::Context::Activity::"ONTOLOGY_GROUNDING") };', auto_reject_after_seconds=1209600)
Update a curation policy with a stale revision ID, which fails with ConflictException
The following example fails because another edit changed the policy's working copy after the caller last read it, so the revision ID no longer matches.
>>> await client.update_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='8f14e45f-ceea-4e7a-9b1d-2c3a4b5c6d7e', description='Holds trace analysis and ontology grounding changes for review.')
Source code in docs_src/capo_context/_services/async_context.py
async def update_curation_policy(
    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,
    name: Optional["capo_context.types.resource_name.ResourceName"] = None,
    description: Optional[
        "capo_context.types.user_defined_string.UserDefinedString"
    ] = None,
    policy_document: Optional["capo_context.types.policy_text.PolicyText"] = None,
    auto_reject_after_seconds: Optional[
        "capo_context.types.auto_reject_after_seconds.AutoRejectAfterSeconds"
    ] = None,
) -> "capo_context.types.update_curation_policy_response.UpdateCurationPolicyResponse":
    r"""<p>Updates a curation policy's working copy.</p>

    Args:
        client_token: <p>Makes a retry safe: the same token with the same parameters returns the current policy instead of a ConflictException. A token used with different parameters is a ValidationException whose message names <code>clientToken</code>, checked first. A retry with the same parameters after the policy was deleted is a ConflictException.</p>
        curation_policy_id: <p>The ID of the curation policy to update.</p>
        revision_id: <p>The <code>revisionId</code> of the working copy that you edited, as you last read it. If a concurrent edit advanced the revision, the request fails with <code>ConflictException</code>.</p>
        name: <p>The new name. If you omit it, the name is unchanged. This operation updates only the members that you include. You can't use it to clear an optional member.</p>
        description: <p>The new description. If you omit it, the description is unchanged.</p>
        policy_document: <p>The new Cedar policy document. If you omit it, the document is unchanged.</p>
        auto_reject_after_seconds: <p>The new auto-reject window, in seconds, from 86,400 (1 day) to 15,552,000 (180 days). If you omit it, the window is unchanged. You can't clear it with this operation.</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:
        Update a curation policy
        The following example changes the working copy of a curation policy to also hold change sets that ontology grounding generates, and extends the auto-reject window to 14 days.

        >>> await client.update_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='e3a5c7b9-1d4f-4b6a-8c2e-9f0b1d3a5c7e', policy_document='forbid (\n    principal,\n    action == AWS::Context::Action::"PublishChangeSet",\n    resource is AWS::Context::ChangeSet\n)\nwhen { resource has generatedBy && (resource.generatedBy == AWS::Context::Activity::"TRACE_ANALYSIS" || resource.generatedBy == AWS::Context::Activity::"ONTOLOGY_GROUNDING") };', auto_reject_after_seconds=1209600)
        Update a curation policy with a stale revision ID, which fails with ConflictException
        The following example fails because another edit changed the policy's working copy after the caller last read it, so the revision ID no longer matches.

        >>> await client.update_curation_policy(curation_policy_id='pol-3e7a9c1b5d2f4a6e8b0c2d4f6a8b1c3e', revision_id='8f14e45f-ceea-4e7a-9b1d-2c3a4b5c6d7e', description='Holds trace analysis and ontology grounding changes for review.')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_context.types.update_curation_policy_request.UpdateCurationPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_context.types.update_curation_policy_response.UpdateCurationPolicyResponse"
    ]:
        import capo_context._operations.context.update_curation_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateCurationPolicy")
    )
    input_: capo_context.types.update_curation_policy_request.UpdateCurationPolicyRequest = {
        "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
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    if policy_document is not None:
        input_["policy_document"] = policy_document
    if auto_reject_after_seconds is not None:
        input_["auto_reject_after_seconds"] = auto_reject_after_seconds

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