Skip to main content

policy_templates

Creates, updates, deletes, gets or lists a policy_templates resource.

Overview

Namepolicy_templates
TypeResource
Idaws.verifiedpermissions.policy_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the policy template, if one was assigned when the policy template was created or last updated. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
created_datestring (date-time)The date and time that the policy template was originally created.
descriptionstringThe description of the policy template.
last_updated_datestring (date-time)The date and time that the policy template was most recently updated.
policy_store_idstringThe ID of the policy store that contains the policy template. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
policy_template_idstringThe ID of the policy template. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
statementstringThe content of the body of the policy template written in the Cedar policy language.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_policy_templateselectregionRetrieve the details for the specified policy template in the specified policy store.
list_policy_templatesselectregionReturns a paginated list of all policy templates in the specified policy store.
create_policy_templateinsertregion, policyStoreId, statementCreates a policy template. A template can use placeholders for the principal and resource. A template must be instantiated into a policy by associating it with specific principals and resources to use for the placeholders. That instantiated policy can then be considered in authorization decisions. The instantiated policy works identically to any other policy, except that it is dynamically linked to the template. If the template changes, then any policies that are linked to that template are immediately updated as well. 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.
update_policy_templateupdateregion, policyStoreId, policyTemplateId, statementUpdates the specified policy template. You can update only the description and the some elements of the policyBody. Changes you make to the policy template content are immediately (within the constraints of eventual consistency) reflected in authorization decisions that involve all template-linked policies instantiated from this template. 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.
delete_policy_templatedeleteregionDeletes the specified policy template from the policy store. This operation also deletes any policies that were created from the specified policy template. Those policies are immediately removed from all future API responses, and are asynchronously deleted from the policy store.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieve the details for the specified policy template in the specified policy store.

SELECT
name,
created_date,
description,
last_updated_date,
policy_store_id,
policy_template_id,
statement
FROM aws.verifiedpermissions.policy_templates
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a policy template. A template can use placeholders for the principal and resource. A template must be instantiated into a policy by associating it with specific principals and resources to use for the placeholders. That instantiated policy can then be considered in authorization decisions. The instantiated policy works identically to any other policy, except that it is dynamically linked to the template. If the template changes, then any policies that are linked to that template are immediately updated as well. 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.

INSERT INTO aws.verifiedpermissions.policy_templates (
clientToken,
policyStoreId,
description,
statement,
name,
region
)
SELECT
'{{ clientToken }}',
'{{ policyStoreId }}' /* required */,
'{{ description }}',
'{{ statement }}' /* required */,
'{{ name }}',
'{{ region }}'
RETURNING
created_date,
last_updated_date,
policy_store_id,
policy_template_id
;

UPDATE examples

Updates the specified policy template. You can update only the description and the some elements of the policyBody. Changes you make to the policy template content are immediately (within the constraints of eventual consistency) reflected in authorization decisions that involve all template-linked policies instantiated from this template. 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.

UPDATE aws.verifiedpermissions.policy_templates
SET
policyStoreId = '{{ policyStoreId }}',
policyTemplateId = '{{ policyTemplateId }}',
description = '{{ description }}',
statement = '{{ statement }}',
name = '{{ name }}'
WHERE
region = '{{ region }}' --required
AND policyStoreId = '{{ policyStoreId }}' --required
AND policyTemplateId = '{{ policyTemplateId }}' --required
AND statement = '{{ statement }}' --required
RETURNING
created_date,
last_updated_date,
policy_store_id,
policy_template_id;

DELETE examples

Deletes the specified policy template from the policy store. This operation also deletes any policies that were created from the specified policy template. Those policies are immediately removed from all future API responses, and are asynchronously deleted from the policy store.

DELETE FROM aws.verifiedpermissions.policy_templates
WHERE region = '{{ region }}' --required
;