Skip to content

update_change_set async

update_change_set(
    change_set_id: ChangeSetId,
    agent_context_id: AgentContextIdentifier,
    change_set_version: ChangeSetVersionInteger,
    operations_to_remove: ChangeSetOperationList,
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateChangeSetResponse

Drops operations from a change set that is held for curator review. Returns the updated change set.

Parameters:

  • change_set_id (ChangeSetId) –

    The change set to edit: the changeSetId that GetCurationProposal returns.

  • agent_context_id (AgentContextIdentifier) –

    The agent context that the change set belongs to, by its ID or ARN. AWS Context authorizes the request on this agent context's ARN. If the change set belongs to another agent context, the request fails with ResourceNotFoundException.

  • change_set_version (ChangeSetVersionInteger) –

    The change set version that you read with GetChangeSet. The edit applies only if it's still the latest version. Otherwise, the request fails with ConflictException.

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

    A unique, case-sensitive identifier that you provide to make the request idempotent. For 8 hours, a retry of the same request with the same token returns the change set's latest version without writing again, and the same token used for another change set or a different request returns a ValidationException.

  • operations_to_remove (ChangeSetOperationList) –

    Operations to remove, copied unchanged from ListChangeSetOperations. A retry must resend the same list with the same clientToken.

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:

Drop a link from a change set The following example drops one column link from a grounding change set that is held for review, copying the operation unchanged from ListChangeSetOperations, and returns the change set's new version.

>>> await client.update_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', change_set_id='cs-6d8f0b2c4e1a4c7d9f3b5e7a9c1d3f5b', change_set_version=1, client_token='2c4e6a8b-0d1f-4c3e-a5b7-9d1f3b5d7f0a', operations_to_remove=[{'put': {'entity': {'edgeId': {'from': 'glueColumn:glueTable%3Aarn%253Aaws%253Aglue%253Aus-east-1%253A111122223333%253Atable%252Fsales_db%252Forders:region_code', 'to': 'iri:https://example.com/ontology/sales%23salesRegion'}}, 'properties': {'edgeType': {'stringValue': 'MAPPED_TO'}}}}])
Update a change set with a stale version, which fails with ConflictException
The following example fails with a ConflictException because the change set was edited after the caller read version 1 with GetChangeSet.
>>> await client.update_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', change_set_id='cs-6d8f0b2c4e1a4c7d9f3b5e7a9c1d3f5b', change_set_version=1, operations_to_remove=[{'put': {'entity': {'edgeId': {'from': 'glueColumn:glueTable%3Aarn%253Aaws%253Aglue%253Aus-east-1%253A111122223333%253Atable%252Fsales_db%252Forders:order_total', 'to': 'iri:https://example.com/ontology/sales%23orderTotal'}}, 'properties': {'edgeType': {'stringValue': 'MAPPED_TO'}}}}])
Source code in docs_src/capo_context/_services/async_context.py
async def update_change_set(
    self,
    change_set_id: "capo_context.types.change_set_id.ChangeSetId",
    agent_context_id: "capo_context.types.agent_context_identifier.AgentContextIdentifier",
    change_set_version: "capo_context.types.change_set_version_integer.ChangeSetVersionInteger",
    operations_to_remove: "capo_context.types.change_set_operation_list.ChangeSetOperationList",
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
    client_token: Optional["capo_context.types.client_token.ClientToken"] = None,
) -> "capo_context.types.update_change_set_response.UpdateChangeSetResponse":
    """<p>Drops operations from a change set that is held for curator review. Returns the updated change set.</p>

    Args:
        change_set_id: <p>The change set to edit: the <code>changeSetId</code> that GetCurationProposal returns.</p>
        agent_context_id: <p>The agent context that the change set belongs to, by its ID or ARN. AWS Context authorizes the request on this agent context's ARN. If the change set belongs to another agent context, the request fails with <code>ResourceNotFoundException</code>.</p>
        change_set_version: <p>The change set version that you read with GetChangeSet. The edit applies only if it's still the latest version. Otherwise, the request fails with <code>ConflictException</code>.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to make the request idempotent. For 8 hours, a retry of the same request with the same token returns the change set's latest version without writing again, and the same token used for another change set or a different request returns a <code>ValidationException</code>.</p>
        operations_to_remove: <p>Operations to remove, copied unchanged from <code>ListChangeSetOperations</code>. A retry must resend the same list with the same clientToken.</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:
        Drop a link from a change set
        The following example drops one column link from a grounding change set that is held for review, copying the operation unchanged from ListChangeSetOperations, and returns the change set's new version.

        >>> await client.update_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', change_set_id='cs-6d8f0b2c4e1a4c7d9f3b5e7a9c1d3f5b', change_set_version=1, client_token='2c4e6a8b-0d1f-4c3e-a5b7-9d1f3b5d7f0a', operations_to_remove=[{'put': {'entity': {'edgeId': {'from': 'glueColumn:glueTable%3Aarn%253Aaws%253Aglue%253Aus-east-1%253A111122223333%253Atable%252Fsales_db%252Forders:region_code', 'to': 'iri:https://example.com/ontology/sales%23salesRegion'}}, 'properties': {'edgeType': {'stringValue': 'MAPPED_TO'}}}}])
        Update a change set with a stale version, which fails with ConflictException
        The following example fails with a ConflictException because the change set was edited after the caller read version 1 with GetChangeSet.

        >>> await client.update_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', change_set_id='cs-6d8f0b2c4e1a4c7d9f3b5e7a9c1d3f5b', change_set_version=1, operations_to_remove=[{'put': {'entity': {'edgeId': {'from': 'glueColumn:glueTable%3Aarn%253Aaws%253Aglue%253Aus-east-1%253A111122223333%253Atable%252Fsales_db%252Forders:order_total', 'to': 'iri:https://example.com/ontology/sales%23orderTotal'}}, 'properties': {'edgeType': {'stringValue': 'MAPPED_TO'}}}}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_context.types.update_change_set_request.UpdateChangeSetRequest]",
    ) -> AsyncOperationResponse[
        "capo_context.types.update_change_set_response.UpdateChangeSetResponse"
    ]:
        import capo_context._operations.context.update_change_set

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

    def _redact_input(
        input_: "capo_context.types.update_change_set_request.UpdateChangeSetRequest",
    ) -> dict[str, Any]:
        import capo_context.types.update_change_set_request

        return capo_context.types.update_change_set_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateChangeSet", redact_input=_redact_input),
    )
    input_: capo_context.types.update_change_set_request.UpdateChangeSetRequest = {
        "change_set_id": change_set_id,
        "agent_context_id": agent_context_id,
        "change_set_version": change_set_version,
        "operations_to_remove": operations_to_remove,
    }
    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