putSchema method
- required SchemaDefinition definition,
- required String policyStoreId,
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.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
Parameter definition :
Specifies the definition of the schema to be stored. The schema definition
must be written in Cedar schema JSON.
Parameter policyStoreId :
Specifies the ID of the policy store in which to place the schema.
To specify a policy store, use its ID or alias name. When using an alias
name, prefix it with policy-store-alias/. For example:
-
ID:
PSEXAMPLEabcdefg111111 -
Alias name:
policy-store-alias/example-policy-store
Implementation
Future<PutSchemaOutput> putSchema({
required SchemaDefinition definition,
required String policyStoreId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'VerifiedPermissions.PutSchema'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'definition': definition,
'policyStoreId': policyStoreId,
},
);
return PutSchemaOutput.fromJson(jsonResponse.body);
}