AddToResourcePolicyResult

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

Bases: object

Result of calling addToResourcePolicy.

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

  • 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.

ExampleMetadata:

infused

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.

statement_added

Whether the statement was added.