createChangeSet
Proposes a change to an agent context, as ChangeSetOperation items (the same items that ListChangeSetOperations returns), each setting one of put, update, or delete.
Samples
// 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.
val resp = contextClient.createChangeSet {
agentContextId = "ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c"
clientToken = "3d5f7a9c-1e2b-4d6f-8a0c-4e6b8d0f2a5c"
operations = listOf<ChangeSetOperation>(
ChangeSetOperation.Update(UpdateOperation {
entity = Entity.NodeId("https://ontology.context.aws.dev/retrievalInstruction:default")
properties = mapOf<String, AnyValue>(
"nodeType" to AnyValue.StringValue("AWS::CONTEXT::RETRIEVAL_INSTRUCTION"),
"retrievalInstructionId" to AnyValue.StringValue("default"),
"retrievalInstructionText" to AnyValue.StringValue("# Rules for every query\n- If two sources disagree, use the most recent one.")
)
}
)
)
}Content copied to clipboard
// 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.
val resp = contextClient.createChangeSet {
agentContextId = "ac-4f2a9c1e7b3d4a6f8e0c2b5d7a9f1e3c"
clientToken = "6f8b0d2a-4c6e-4a8b-9d1f-5b7d9f1a3c6e"
accessControlConfig = AccessControlConfig {
accessControlList = listOf<AccessControlEntry>(
AccessControlEntry {
access = AccessEffect.fromValue("ALLOW")
principalId = "94a8f4e8-60d1-70a4-b2c3-1f5e9d7c3a20"
principalType = PrincipalType.fromValue("GROUP")
}
)
}
operations = listOf<ChangeSetOperation>(
ChangeSetOperation.Put(PutOperation {
entity = Entity.EdgeId(EdgeIdentifier {
from = "concept:forecast-margin"
to = "concept:gross-margin"
}
)
properties = mapOf<String, AnyValue>(
"edgeType" to AnyValue.StringValue("AWS::CONTEXT::RELATED_TO")
)
}
)
)
}Content copied to clipboard