Skip to main content

policies

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

Overview

Namepolicies
TypeResource
Idaws.verifiedpermissions.policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the policy, if one was assigned when the policy was created or last updated. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
actionsarrayThe action that a policy permits or forbids. For example, {"actions": [{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}]}.
created_datestring (date-time)The date and time that the policy was originally created.
definitionobjectThe definition of the requested policy.
effectstringThe effect of the decision that a policy returns to an authorization request. For example, "effect": "Permit". (Permit, Forbid)
last_updated_datestring (date-time)The date and time that the policy was last updated.
policy_idstringThe unique ID of the policy that you want information about. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
policy_store_idstringThe ID of the policy store that contains the policy that you want information about. (pattern: <code>[a-zA-Z0-9-/_]*</code>)
policy_typestringThe type of the policy. (STATIC, TEMPLATE_LINKED)
principalobjectContains the identifier of an entity, including its ID and type. This data type is used as a request parameter for IsAuthorized operation, and as a response parameter for the CreatePolicy, GetPolicy, and UpdatePolicy operations. Example: {"entityId":"string","entityType":"string"}
resourceobjectContains the identifier of an entity, including its ID and type. This data type is used as a request parameter for IsAuthorized operation, and as a response parameter for the CreatePolicy, GetPolicy, and UpdatePolicy operations. Example: {"entityId":"string","entityType":"string"}

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_policyselectregionRetrieves information about the specified policy.
batch_get_policyselectregionRetrieves information about a group (batch) of policies. The BatchGetPolicy operation doesn't have its own IAM permission. To authorize this operation for Amazon Web Services principals, include the permission verifiedpermissions:GetPolicy in their IAM policies.
list_policiesselectregionReturns a paginated list of all policies stored in the specified policy store.
create_policyinsertregion, policyStoreId, definitionCreates a Cedar policy and saves it in the specified policy store. You can create either a static policy or a policy linked to a policy template. To create a static policy, provide the Cedar policy text in the StaticPolicy section of the PolicyDefinition. To create a policy that is dynamically linked to a policy template, specify the policy template ID and the principal and resource to associate with this policy in the templateLinked section of the PolicyDefinition. If the policy template is ever updated, any policies linked to the policy template automatically use the updated template. Creating a policy causes it to be validated against the schema in the policy store. If the policy doesn't pass validation, the operation fails and the policy isn't stored. 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_policyupdateregion, policyStoreId, policyIdModifies a Cedar static policy in the specified policy store. You can change only certain elements of the UpdatePolicyDefinition parameter. You can directly update only static policies. To change a template-linked policy, you must update the template instead, using UpdatePolicyTemplate. If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn't pass validation, the operation fails and the update isn't stored. When you edit a static policy, you can change only certain elements of a static policy: The action referenced by the policy. A condition clause, such as when and unless. You can't change these elements of a static policy: Changing a policy from a static policy to a template-linked policy. Changing the effect of a static policy from permit or forbid. The principal referenced by a static policy. The resource referenced by a static policy. To update a template-linked policy, you must update the template instead. 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_policydeleteregionDeletes the specified policy from the policy store. This operation is idempotent; if you specify a policy that doesn't exist, the request response returns a successful HTTP 200 status code.

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

Retrieves information about the specified policy.

SELECT
name,
actions,
created_date,
definition,
effect,
last_updated_date,
policy_id,
policy_store_id,
policy_type,
principal,
resource
FROM aws.verifiedpermissions.policies
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a Cedar policy and saves it in the specified policy store. You can create either a static policy or a policy linked to a policy template. To create a static policy, provide the Cedar policy text in the StaticPolicy section of the PolicyDefinition. To create a policy that is dynamically linked to a policy template, specify the policy template ID and the principal and resource to associate with this policy in the templateLinked section of the PolicyDefinition. If the policy template is ever updated, any policies linked to the policy template automatically use the updated template. Creating a policy causes it to be validated against the schema in the policy store. If the policy doesn't pass validation, the operation fails and the policy isn't stored. 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.policies (
clientToken,
policyStoreId,
definition,
name,
region
)
SELECT
'{{ clientToken }}',
'{{ policyStoreId }}' /* required */,
'{{ definition }}' /* required */,
'{{ name }}',
'{{ region }}'
RETURNING
actions,
created_date,
effect,
last_updated_date,
policy_id,
policy_store_id,
policy_type,
principal,
resource
;

UPDATE examples

Modifies a Cedar static policy in the specified policy store. You can change only certain elements of the UpdatePolicyDefinition parameter. You can directly update only static policies. To change a template-linked policy, you must update the template instead, using UpdatePolicyTemplate. If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn't pass validation, the operation fails and the update isn't stored. When you edit a static policy, you can change only certain elements of a static policy: The action referenced by the policy. A condition clause, such as when and unless. You can't change these elements of a static policy: Changing a policy from a static policy to a template-linked policy. Changing the effect of a static policy from permit or forbid. The principal referenced by a static policy. The resource referenced by a static policy. To update a template-linked policy, you must update the template instead. 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.policies
SET
policyStoreId = '{{ policyStoreId }}',
policyId = '{{ policyId }}',
definition = '{{ definition }}',
name = '{{ name }}'
WHERE
region = '{{ region }}' --required
AND policyStoreId = '{{ policyStoreId }}' --required
AND policyId = '{{ policyId }}' --required
RETURNING
actions,
created_date,
effect,
last_updated_date,
policy_id,
policy_store_id,
policy_type,
principal,
resource;

DELETE examples

Deletes the specified policy from the policy store. This operation is idempotent; if you specify a policy that doesn't exist, the request response returns a successful HTTP 200 status code.

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