Interface BucketPolicyProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
BucketPolicyProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-04-02T21:55:18.764Z") @Stability(Stable) public interface BucketPolicyProps extends software.amazon.jsii.JsiiSerializable
Example:

 import software.amazon.awscdk.mixins.preview.services.cloudfront.mixins.*;
 // Create CloudFront distribution
 IBucket origin;
 Distribution distribution = Distribution.Builder.create(scope, "Distribution")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(S3BucketOrigin.withOriginAccessControl(origin))
                 .build())
         .build();
 // Create destination bucket
 Bucket destBucket = new Bucket(scope, "DeliveryBucket");
 // Add permissions to bucket to facilitate log delivery
 BucketPolicy bucketPolicy = BucketPolicy.Builder.create(scope, "DeliveryBucketPolicy")
         .bucket(destBucket)
         .document(new PolicyDocument())
         .build();
 // Create S3 delivery destination for logs
 CfnDeliveryDestination destination = CfnDeliveryDestination.Builder.create(scope, "Destination")
         .destinationResourceArn(destBucket.getBucketArn())
         .name("unique-destination-name")
         .deliveryDestinationType("S3")
         .build();
 distribution.with(CfnDistributionLogsMixin.CONNECTION_LOGS.toDestination(destination));
 
  • Method Details

    • getBucket

      @Stability(Stable) @NotNull IBucket getBucket()
      The Amazon S3 bucket that the policy applies to.
    • getDocument

      @Stability(Stable) @Nullable default PolicyDocument getDocument()
      Policy document to apply to the bucket.

      Default: - A new empty PolicyDocument will be created.

    • getRemovalPolicy

      @Stability(Stable) @Nullable default RemovalPolicy getRemovalPolicy()
      Policy to apply when the policy is removed from this stack.

      Default: - RemovalPolicy.DESTROY.

    • builder

      @Stability(Stable) static BucketPolicyProps.Builder builder()
      Returns:
      a BucketPolicyProps.Builder of BucketPolicyProps