resource_policies
Creates, updates, deletes, gets or lists a resource_policies resource.
Overview
| Name | resource_policies |
| Type | Resource |
| Id | aws.lexv2_models.resource_policies |
Fields
The following fields are returned by SELECT queries:
- describe_resource_policy
| Name | Datatype | Description |
|---|---|---|
policy | string | The JSON structure that contains the resource policy. For more information about the contents of a JSON policy document, see IAM JSON policy reference . |
resource_arn | string | The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to. |
revision_id | string | The current revision of the resource policy. Use the revision ID to make sure that you are updating the most current version of a resource policy when you add a policy statement to a resource, delete a resource, or update a resource. (pattern: <code>^[0-9]+$</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_resource_policy | select | resource_arn, region | Gets the resource policy and policy revision for a bot or bot alias. | |
create_resource_policy_statement | insert | resource_arn, region, statementId, effect, principal, action | expectedRevisionId | Adds a new resource policy statement to a bot or bot alias. If a resource policy exists, the statement is added to the current resource policy. If a policy doesn't exist, a new policy is created. You can't create a resource policy statement that allows cross-account access. You need to add the CreateResourcePolicy or UpdateResourcePolicy action to the bot role in order to call the API. |
create_resource_policy | insert | resource_arn, region, policy | Creates a new resource policy with the specified policy statements. | |
update_resource_policy | update | resource_arn, region, policy | expectedRevisionId | Replaces the existing resource policy for a bot or bot alias with a new one. If the policy doesn't exist, Amazon Lex returns an exception. |
delete_resource_policy_statement | delete | resource_arn, statement_id, region | expectedRevisionId | Deletes a policy statement from a resource policy. If you delete the last statement from a policy, the policy is deleted. If you specify a statement ID that doesn't exist in the policy, or if the bot or bot alias doesn't have a policy attached, Amazon Lex returns an exception. You need to add the DeleteResourcePolicy or UpdateResourcePolicy action to the bot role in order to call the API. |
delete_resource_policy | delete | resource_arn, region | expectedRevisionId | Removes an existing policy from a bot or bot alias. If the resource doesn't have a policy attached, Amazon Lex returns an exception. |
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) |
resource_arn | string | The Amazon Resource Name (ARN) of the bot or bot alias that has the resource policy attached. |
statement_id | string | The name of the statement (SID) to delete from the policy. |
expectedRevisionId | string | The identifier of the revision to edit. If this ID doesn't match the current revision number, Amazon Lex returns an exception If you don't specify a revision ID, Amazon Lex will delete the current policy. |
SELECT examples
- describe_resource_policy
Gets the resource policy and policy revision for a bot or bot alias.
SELECT
policy,
resource_arn,
revision_id
FROM aws.lexv2_models.resource_policies
WHERE resource_arn = '{{ resource_arn }}' -- required
AND region = '{{ region }}' -- required
;
INSERT examples
- create_resource_policy_statement
- create_resource_policy
- Manifest
Adds a new resource policy statement to a bot or bot alias. If a resource policy exists, the statement is added to the current resource policy. If a policy doesn't exist, a new policy is created. You can't create a resource policy statement that allows cross-account access. You need to add the CreateResourcePolicy or UpdateResourcePolicy action to the bot role in order to call the API.
INSERT INTO aws.lexv2_models.resource_policies (
statementId,
effect,
principal,
action,
condition,
resource_arn,
region,
expectedRevisionId
)
SELECT
'{{ statementId }}' /* required */,
'{{ effect }}' /* required */,
'{{ principal }}' /* required */,
'{{ action }}' /* required */,
'{{ condition }}',
'{{ resource_arn }}',
'{{ region }}',
'{{ expectedRevisionId }}'
RETURNING
resource_arn,
revision_id
;
Creates a new resource policy with the specified policy statements.
INSERT INTO aws.lexv2_models.resource_policies (
policy,
resource_arn,
region
)
SELECT
'{{ policy }}' /* required */,
'{{ resource_arn }}',
'{{ region }}'
RETURNING
resource_arn,
revision_id
;
# Description fields are for documentation purposes
- name: resource_policies
props:
- name: resource_arn
value: "{{ resource_arn }}"
description: Required parameter for the resource_policies resource.
- name: region
value: "{{ region }}"
description: Required parameter for the resource_policies resource.
- name: statementId
value: "{{ statementId }}"
- name: effect
value: "{{ effect }}"
valid_values: ['Allow', 'Deny']
- name: principal
value:
- service: "{{ service }}"
arn: "{{ arn }}"
- name: action
value:
- "{{ action }}"
- name: condition
value: "{{ condition }}"
- name: policy
value: "{{ policy }}"
- name: expectedRevisionId
value: "{{ expectedRevisionId }}"
description: The identifier of the revision of the policy to edit. If this revision ID doesn't match the current revision ID, Amazon Lex throws an exception. If you don't specify a revision, Amazon Lex overwrites the contents of the policy with the new values.
description: The identifier of the revision of the policy to edit. If this revision ID doesn't match the current revision ID, Amazon Lex throws an exception. If you don't specify a revision, Amazon Lex overwrites the contents of the policy with the new values.
UPDATE examples
- update_resource_policy
Replaces the existing resource policy for a bot or bot alias with a new one. If the policy doesn't exist, Amazon Lex returns an exception.
UPDATE aws.lexv2_models.resource_policies
SET
policy = '{{ policy }}'
WHERE
resource_arn = '{{ resource_arn }}' --required
AND region = '{{ region }}' --required
AND policy = '{{ policy }}' --required
AND expectedRevisionId = '{{ expectedRevisionId}}'
RETURNING
resource_arn,
revision_id;
DELETE examples
- delete_resource_policy_statement
- delete_resource_policy
Deletes a policy statement from a resource policy. If you delete the last statement from a policy, the policy is deleted. If you specify a statement ID that doesn't exist in the policy, or if the bot or bot alias doesn't have a policy attached, Amazon Lex returns an exception. You need to add the DeleteResourcePolicy or UpdateResourcePolicy action to the bot role in order to call the API.
DELETE FROM aws.lexv2_models.resource_policies
WHERE resource_arn = '{{ resource_arn }}' --required
AND statement_id = '{{ statement_id }}' --required
AND region = '{{ region }}' --required
AND expectedRevisionId = '{{ expectedRevisionId }}'
;
Removes an existing policy from a bot or bot alias. If the resource doesn't have a policy attached, Amazon Lex returns an exception.
DELETE FROM aws.lexv2_models.resource_policies
WHERE resource_arn = '{{ resource_arn }}' --required
AND region = '{{ region }}' --required
AND expectedRevisionId = '{{ expectedRevisionId }}'
;