Class BucketAutoDeleteObjects
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.services.s3.mixins.BucketAutoDeleteObjects
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IMixin
@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)",
date="2026-03-27T13:12:07.050Z")
@Stability(Stable)
public class BucketAutoDeleteObjects
extends Mixin
S3-specific Mixin to automatically delete all objects from a bucket when the bucket is removed from the stack or when the stack is deleted.
Requires the removalPolicy to be set to RemovalPolicy.DESTROY.
Apply this mixin to a bucket will add s3:PutBucketPolicy to the
bucket policy. This is because during bucket deletion, the custom resource provider
needs to update the bucket policy by adding a deny policy for s3:PutObject to
prevent race conditions with external bucket writers.
Example:
// Apply mixins fluently with .with() // Apply mixins fluently with .with() new CfnBucket(scope, "MyL1Bucket").with(new BucketBlockPublicAccess()).with(new BucketAutoDeleteObjects()); // Apply multiple mixins to the same construct // Apply multiple mixins to the same construct new CfnBucket(scope, "MyL1Bucket").with(new BucketBlockPublicAccess(), new BucketAutoDeleteObjects()); // Mixins work with all types of constructs: // L1, L2 and even custom constructs // Mixins work with all types of constructs: // L1, L2 and even custom constructs new Bucket(stack, "MyL2Bucket").with(new BucketBlockPublicAccess()); new CustomBucket(stack, "MyCustomBucket").with(new BucketBlockPublicAccess());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IMixin
software.constructs.IMixin.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBucketAutoDeleteObjects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedBucketAutoDeleteObjects(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
BucketAutoDeleteObjects
protected BucketAutoDeleteObjects(software.amazon.jsii.JsiiObjectRef objRef) -
BucketAutoDeleteObjects
protected BucketAutoDeleteObjects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
BucketAutoDeleteObjects
@Stability(Stable) public BucketAutoDeleteObjects()
-
-
Method Details
-
applyTo
@Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct) Applies the mixin functionality to the target construct. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Determines whether this mixin can be applied to the given construct.
-