putSchema
inline suspend fun VerifiedPermissionsClient.putSchema(crossinline block: PutSchemaRequest.Builder.() -> Unit): PutSchemaResponse
Creates or updates the policy schema in the specified policy store. The schema is used to validate any Cedar policies and policy templates submitted to the policy store. Any changes to the schema validate only policies and templates submitted after the schema change. Existing policies and templates are not re-evaluated against the changed schema. If you later update a policy, then it is evaluated against the new schema at that time.
Verified Permissions is eventually consistent. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.
Samples
import aws.sdk.kotlin.services.verifiedpermissions.model.SchemaDefinition
fun main() {
//sampleStart
// The following example creates a new schema, or updates an existing schema, in the specified policy
// store. Note that the schema text is shown line wrapped for readability. You should submit the entire
// schema text as a single line of text. Note The JSON in the parameters of this operation are strings that
// can contain embedded quotation marks
// (") within the outermost quotation mark pair. This requires that you stringify the JSON object by preceding all embedded quotation marks with a backslash character ( \" ) and combining all lines into a single text line with no line breaks. Example strings might be
// displayed wrapped across multiple lines here for readability, but the operation requires the parameters be
// submitted as single line strings.
val resp = verifiedPermissionsClient.putSchema {
policyStoreId = "C7v5xMplfFH3i3e4Jrzb1a"
definition = SchemaDefinition.CedarJson("{\"MySampleNamespace\": {\"actions\": {\"remoteAccess\": {\"appliesTo\": {\"principalTypes\": [\"Employee\"]}}},\"entityTypes\": {\"Employee\": {\"shape\": {\"attributes\": {\"jobLevel\": {\"type\": \"Long\"},\"name\": {\"type\": \"String\"}},\"type\": \"Record\"}}}}}")
}
//sampleEnd
}