create_resource_policy_statement
async
¶
create_resource_policy_statement(
resource_arn: AmazonResourceName,
statement_id: Name,
effect: Effect,
principal: PrincipalList,
action: OperationList,
*,
config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
condition: Optional[ConditionMap] = None,
expected_revision_id: Optional[RevisionId] = None,
) -> CreateResourcePolicyStatementResponse
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.
Parameters:
-
resource_arn(AmazonResourceName) –The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.
-
statement_id(Name) –The name of the statement. The ID is the same as the
SidIAM property. The statement name must be unique within the policy. For more information, see IAM JSON policy elements: Sid. -
effect(Effect) –Determines whether the statement allows or denies access to the resource.
-
principal(PrincipalList) –An IAM principal, such as an IAM user, IAM role, or Amazon Web Services services that is allowed or denied access to a resource. For more information, see Amazon Web Services JSON policy elements: Principal.
-
action(OperationList) –The Amazon Lex action that this policy either allows or denies. The action must apply to the resource type of the specified ARN. For more information, see Actions, resources, and condition keys for Amazon Lex V2.
-
condition(Optional[ConditionMap], default:None) –Specifies a condition when the policy is in effect. If the principal of the policy is a service principal, you must provide two condition blocks, one with a SourceAccount global condition key and one with a SourceArn global condition key.
For more information, see IAM JSON policy elements: Condition .
-
expected_revision_id(Optional[RevisionId], default:None) –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.
Raises:
-
ConflictException–The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.
-
InternalServerException–The service encountered an unexpected condition. Try your request again.
-
PreconditionFailedException–Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.
-
ResourceNotFoundException–You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.
-
ServiceQuotaExceededException–You have reached a quota for your bot.
-
ThrottlingException–Your request rate is too high. Reduce the frequency of requests.
-
ValidationException–One of the input parameters in your request isn't valid. Check the parameters and try your request again.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | |