AddToResourcePolicyResult

class aws_cdk.aws_iam.AddToResourcePolicyResult(*, policy_dependable=None, statement_added)

Bases: object

Result of calling addToResourcePolicy.

Parameters
  • policy_dependable (Optional[IDependable]) – Dependable which allows depending on the policy change being applied. Default: - If statementAdded is true, the resource object itself. Otherwise, no dependable.

  • statement_added (bool) – Whether the statement was added.

Example:

bucket = s3.Bucket.from_bucket_name(self, "existingBucket", "bucket-name")

# No policy statement will be added to the resource
result = bucket.add_to_resource_policy(iam.PolicyStatement(
    actions=["s3:GetObject"],
    resources=[bucket.arn_for_objects("file.txt")],
    principals=[iam.AccountRootPrincipal()]
))

Attributes

policy_dependable

Dependable which allows depending on the policy change being applied.

Default

  • If statementAdded is true, the resource object itself.

Otherwise, no dependable.

Return type

Optional[IDependable]

statement_added

Whether the statement was added.

Return type

bool