policy_templates
Creates, updates, deletes, gets or lists a policy_templates resource.
Overview
| Name | policy_templates |
| Type | Resource |
| Id | aws.verifiedpermissions.policy_templates |
Fields
The following fields are returned by SELECT queries:
- get_policy_template
- list_policy_templates
| Name | Datatype | Description |
|---|---|---|
name | string | The 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_date | string (date-time) | The date and time that the policy template was originally created. |
description | string | The description of the policy template. |
last_updated_date | string (date-time) | The date and time that the policy template was most recently updated. |
policy_store_id | string | The ID of the policy store that contains the policy template. (pattern: <code>[a-zA-Z0-9-/_]*</code>) |
policy_template_id | string | The ID of the policy template. (pattern: <code>[a-zA-Z0-9-/_]*</code>) |
statement | string | The content of the body of the policy template written in the Cedar policy language. |
| Name | Datatype | Description |
|---|---|---|
name | string | The 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_date | string (date-time) | The date and time that the policy template was created. |
description | string | The description attached to the policy template. |
last_updated_date | string (date-time) | The date and time that the policy template was most recently updated. |
policy_store_id | string | The unique identifier of the policy store that contains the template. (pattern: <code>[a-zA-Z0-9-/_]*</code>) |
policy_template_id | string | The unique identifier of the policy template. (pattern: <code>[a-zA-Z0-9-/_]*</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_policy_template | select | region | Retrieve the details for the specified policy template in the specified policy store. | |
list_policy_templates | select | region | Returns a paginated list of all policy templates in the specified policy store. | |
create_policy_template | insert | region, policyStoreId, statement | 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. | |
update_policy_template | update | region, policyStoreId, policyTemplateId, statement | 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. | |
delete_policy_template | delete | region | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_policy_template
- list_policy_templates
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
;
Returns a paginated list of all policy templates in the specified policy store.
SELECT
name,
created_date,
description,
last_updated_date,
policy_store_id,
policy_template_id
FROM aws.verifiedpermissions.policy_templates
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_policy_template
- Manifest
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
;
# Description fields are for documentation purposes
- name: policy_templates
props:
- name: region
value: "{{ region }}"
description: Required parameter for the policy_templates resource.
- name: clientToken
value: "{{ clientToken }}"
description: |
Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.. If you don't provide this value, then Amazon Web Services generates a random one for you. If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an ConflictException error. Verified Permissions recognizes a ClientToken for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of ClientToken.
- name: policyStoreId
value: "{{ policyStoreId }}"
description: |
The ID of the policy store in which to create the policy template. 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 To view aliases, use ListPolicyStoreAliases.
- name: description
value: "{{ description }}"
description: |
Specifies a description for the policy template.
- name: statement
value: "{{ statement }}"
description: |
Specifies the content that you want to use for the new policy template, written in the Cedar policy language.
- name: name
value: "{{ name }}"
description: |
Specifies a name for the policy template that is unique among all policy templates within the policy store. You can use the name in place of the policy template ID in API operations that reference the policy template. The name must be prefixed with name/. If you specify a name that is already associated with another policy template in the policy store, you receive a ConflictException error.
UPDATE examples
- update_policy_template
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
- delete_policy_template
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
;