create_change_set
¶
create_change_set(
agent_context_id: AgentContextIdentifier,
operations: ChangeSetOperationList,
*,
config_overrides: Optional[ContextClientConfig] = None,
client_token: Optional[ClientToken] = None,
access_control_config: Optional[AccessControlConfig] = None,
) -> CreateChangeSetResponse
Proposes a change to an agent context, as ChangeSetOperation items (the same items that ListChangeSetOperations returns), each setting one of put, update, or delete.
Parameters:
-
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier that you provide to make the request idempotent. A retry with the same token returns the same change set.
-
access_control_config(Optional[AccessControlConfig], default:None) –Who can read the nodes that this change set writes. AWS Context refuses it on a change set that only deletes. If you omit it, every reader of the agent context can read a node that the change creates, and every other node keeps its access control. If you specify it, it replaces the access control of every node that the change set writes, and an absent or empty
accessControlListlets nobody read them. -
agent_context_id(AgentContextIdentifier) –The agent context to change, by its ID or ARN.
-
operations(ChangeSetOperationList) –The operations to write, each a
ChangeSetOperation, from 1 to 1,000. If the list is empty or names the same entity twice, the request fails withValidationException.
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
quotaCodenames, reduce your usage, and then retry the request. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create or replace the retrieval instructions The following example creates or replaces the retrieval instructions of an agent context with one update operation on the fixed instructions node. No curation policy holds direct changes, so AWS Context applies the change set right away.
>>> client.create_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', client_token='3d5f7a9c-1e2b-4d6f-8a0c-4e6b8d0f2a5c', operations=[{'update': {'entity': {'nodeId': 'https://ontology.context.aws.dev/retrievalInstruction:default'}, 'properties': {'nodeType': {'stringValue': 'AWS::CONTEXT::RETRIEVAL_INSTRUCTION'}, 'retrievalInstructionId': {'stringValue': 'default'}, 'retrievalInstructionText': {'stringValue': '# Rules for every query\n- If two sources disagree, use the most recent one.'}}}}])
Create a relationship in a change set that only one group can read
The following example adds a relationship between two existing concepts. Because the request specifies accessControlConfig, only members of the group can read the change set's operations, and the change set is ACL_RESTRICTED. The relationship itself is visible to anyone who can read both concepts. AWS Context applies the change set right away because no curation policy holds it.
>>> client.create_change_set(agent_context_id='ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c', client_token='6f8b0d2a-4c6e-4a8b-9d1f-5b7d9f1a3c6e', access_control_config={'accessControlList': [{'access': 'ALLOW', 'principalId': '94a8f4e8-60d1-70a4-b2c3-1f5e9d7c3a20', 'principalType': 'GROUP'}]}, operations=[{'put': {'entity': {'edgeId': {'from': 'concept:forecast-margin', 'to': 'concept:gross-margin'}}, 'properties': {'edgeType': {'stringValue': 'AWS::CONTEXT::RELATED_TO'}}}}])
Source code in docs_src/capo_context/_services/context.py
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | |