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));
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forBucketPolicyPropsstatic final classAn implementation forBucketPolicyProps -
Method Summary
Modifier and TypeMethodDescriptionstatic BucketPolicyProps.Builderbuilder()The Amazon S3 bucket that the policy applies to.default PolicyDocumentPolicy document to apply to the bucket.default RemovalPolicyPolicy to apply when the policy is removed from this stack.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getBucket
The Amazon S3 bucket that the policy applies to. -
getDocument
Policy document to apply to the bucket.Default: - A new empty PolicyDocument will be created.
-
getRemovalPolicy
Policy to apply when the policy is removed from this stack.Default: - RemovalPolicy.DESTROY.
-
builder
- Returns:
- a
BucketPolicyProps.BuilderofBucketPolicyProps
-