aws-cdk-lib.aws_iam.AddToResourcePolicyResult

interface AddToResourcePolicyResult

LanguageType name
.NETAmazon.CDK.AWS.IAM.AddToResourcePolicyResult
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsiam#AddToResourcePolicyResult
Javasoftware.amazon.awscdk.services.iam.AddToResourcePolicyResult
Pythonaws_cdk.aws_iam.AddToResourcePolicyResult
TypeScript (source)aws-cdk-lib » aws_iam » AddToResourcePolicyResult

Obtainable from Repository.addToResourcePolicy(), RepositoryBase.addToResourcePolicy(), FileSystem.addToResourcePolicy(), EventBus.addToResourcePolicy(), Alias.addToResourcePolicy(), Key.addToResourcePolicy(), LogGroup.addToResourcePolicy(), BucketBase.addToResourcePolicy(), Secret.addToResourcePolicy(), SecretTargetAttachment.addToResourcePolicy(), TopicBase.addToResourcePolicy(), QueueBase.addToResourcePolicy()

Result of calling addToResourcePolicy.

Example

const bucket = s3.Bucket.fromBucketName(this, 'existingBucket', 'bucket-name');

// No policy statement will be added to the resource
const result = bucket.addToResourcePolicy(
  new iam.PolicyStatement({
    actions: ['s3:GetObject'],
    resources: [bucket.arnForObjects('file.txt')],
    principals: [new iam.AccountRootPrincipal()],
  })
);

Properties

NameTypeDescription
statementAddedbooleanWhether the statement was added.
policyDependable?IDependableDependable which allows depending on the policy change being applied.

statementAdded

Type: boolean

Whether the statement was added.


policyDependable?

Type: IDependable (optional, default: If statementAdded is true, the resource object itself. Otherwise, no dependable.)

Dependable which allows depending on the policy change being applied.