Skip to main content

resource_policies

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

Overview

Nameresource_policies
TypeResource
Idaws.lexv2_models.resource_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policystringThe JSON structure that contains the resource policy. For more information about the contents of a JSON policy document, see IAM JSON policy reference .
resource_arnstringThe Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.
revision_idstringThe 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:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_resource_policyselectresource_arn, regionGets the resource policy and policy revision for a bot or bot alias.
create_resource_policy_statementinsertresource_arn, region, statementId, effect, principal, actionexpectedRevisionIdAdds 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_policyinsertresource_arn, region, policyCreates a new resource policy with the specified policy statements.
update_resource_policyupdateresource_arn, region, policyexpectedRevisionIdReplaces 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_statementdeleteresource_arn, statement_id, regionexpectedRevisionIdDeletes 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_policydeleteresource_arn, regionexpectedRevisionIdRemoves 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
resource_arnstringThe Amazon Resource Name (ARN) of the bot or bot alias that has the resource policy attached.
statement_idstringThe name of the statement (SID) to delete from the policy.
expectedRevisionIdstringThe 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

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

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
;

UPDATE examples

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

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 }}'
;