Class: AWSCDK::S3::Mixins::BucketAutoDeleteObjects
- Inherits:
-
Mixin
- Object
- Mixin
- AWSCDK::S3::Mixins::BucketAutoDeleteObjects
- Defined in:
- s3/mixins/bucket_auto_delete_objects.rb
Overview
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 removal_policy 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#apply_to(construct) ⇒ void
Applies the mixin functionality to the target construct.
-
#initialize ⇒ BucketAutoDeleteObjects
constructor
A new instance of BucketAutoDeleteObjects.
-
#supports(construct) ⇒ Boolean
Determines whether this mixin can be applied to the given construct.
Constructor Details
#initialize ⇒ BucketAutoDeleteObjects
Returns a new instance of BucketAutoDeleteObjects.
15 16 17 |
# File 's3/mixins/bucket_auto_delete_objects.rb', line 15 def initialize Jsii::Object.instance_method(:initialize).bind(self).call end |
Class Method Details
.jsii_overridable_methods ⇒ Object
19 20 21 22 23 24 |
# File 's3/mixins/bucket_auto_delete_objects.rb', line 19 def self.jsii_overridable_methods { :apply_to => { kind: :method, name: "applyTo", is_optional: false }, :supports => { kind: :method, name: "supports", is_optional: false }, } end |
Instance Method Details
#apply_to(construct) ⇒ void
This method returns an undefined value.
Applies the mixin functionality to the target construct.
30 31 32 33 |
# File 's3/mixins/bucket_auto_delete_objects.rb', line 30 def apply_to(construct) Jsii::Type.check_type(construct, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "construct") jsii_call_method("applyTo", [construct]) end |
#supports(construct) ⇒ Boolean
Determines whether this mixin can be applied to the given construct.
39 40 41 42 |
# File 's3/mixins/bucket_auto_delete_objects.rb', line 39 def supports(construct) Jsii::Type.check_type(construct, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "construct") jsii_call_method("supports", [construct]) end |