Class: AWSCDK::S3::LifecycleRule

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
s3/lifecycle_rule.rb

Overview

Declaration of a Life cycle rule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(abort_incomplete_multipart_upload_after: nil, enabled: nil, expiration: nil, expiration_date: nil, expired_object_delete_marker: nil, id: nil, noncurrent_version_expiration: nil, noncurrent_versions_to_retain: nil, noncurrent_version_transitions: nil, object_size_greater_than: nil, object_size_less_than: nil, prefix: nil, tag_filters: nil, transitions: nil) ⇒ LifecycleRule

Returns a new instance of LifecycleRule.

Parameters:

  • abort_incomplete_multipart_upload_after (AWSCDK::Duration, nil) (defaults to: nil)

    Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket.

  • enabled (Boolean, nil) (defaults to: nil)

    Whether this rule is enabled.

  • expiration (AWSCDK::Duration, nil) (defaults to: nil)

    Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier.

  • expiration_date (DateTime, nil) (defaults to: nil)

    Indicates when objects are deleted from Amazon S3 and Amazon Glacier.

  • expired_object_delete_marker (Boolean, nil) (defaults to: nil)

    Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions.

  • id (String, nil) (defaults to: nil)

    A unique identifier for this rule.

  • noncurrent_version_expiration (AWSCDK::Duration, nil) (defaults to: nil)

    Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire.

  • noncurrent_versions_to_retain (Numeric, nil) (defaults to: nil)

    Indicates a maximum number of noncurrent versions to retain.

  • noncurrent_version_transitions (Array<AWSCDK::S3::NoncurrentVersionTransition>, nil) (defaults to: nil)

    One or more transition rules that specify when non-current objects transition to a specified storage class.

  • object_size_greater_than (Numeric, nil) (defaults to: nil)

    Specifies the minimum object size in bytes for this rule to apply to.

  • object_size_less_than (Numeric, nil) (defaults to: nil)

    Specifies the maximum object size in bytes for this rule to apply to.

  • prefix (String, nil) (defaults to: nil)

    Object key prefix that identifies one or more objects to which this rule applies.

  • tag_filters (Hash{String => Object}, nil) (defaults to: nil)

    The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket.

  • transitions (Array<AWSCDK::S3::Transition>, nil) (defaults to: nil)

    One or more transition rules that specify when an object transitions to a specified storage class.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 's3/lifecycle_rule.rb', line 21

def initialize(abort_incomplete_multipart_upload_after: nil, enabled: nil, expiration: nil, expiration_date: nil, expired_object_delete_marker: nil, id: nil, noncurrent_version_expiration: nil, noncurrent_versions_to_retain: nil, noncurrent_version_transitions: nil, object_size_greater_than: nil, object_size_less_than: nil, prefix: nil, tag_filters: nil, transitions: nil)
  @abort_incomplete_multipart_upload_after = abort_incomplete_multipart_upload_after
  Jsii::Type.check_type(@abort_incomplete_multipart_upload_after, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "abortIncompleteMultipartUploadAfter") unless @abort_incomplete_multipart_upload_after.nil?
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil?
  @expiration = expiration
  Jsii::Type.check_type(@expiration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "expiration") unless @expiration.nil?
  @expiration_date = expiration_date
  Jsii::Type.check_type(@expiration_date, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJkYXRlIn0=")), "expirationDate") unless @expiration_date.nil?
  @expired_object_delete_marker = expired_object_delete_marker
  Jsii::Type.check_type(@expired_object_delete_marker, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "expiredObjectDeleteMarker") unless @expired_object_delete_marker.nil?
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") unless @id.nil?
  @noncurrent_version_expiration = noncurrent_version_expiration
  Jsii::Type.check_type(@noncurrent_version_expiration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "noncurrentVersionExpiration") unless @noncurrent_version_expiration.nil?
  @noncurrent_versions_to_retain = noncurrent_versions_to_retain
  Jsii::Type.check_type(@noncurrent_versions_to_retain, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "noncurrentVersionsToRetain") unless @noncurrent_versions_to_retain.nil?
  @noncurrent_version_transitions = noncurrent_version_transitions.is_a?(Array) ? noncurrent_version_transitions.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::S3::NoncurrentVersionTransition.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : noncurrent_version_transitions
  Jsii::Type.check_type(@noncurrent_version_transitions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zMy5Ob25jdXJyZW50VmVyc2lvblRyYW5zaXRpb24ifSwia2luZCI6ImFycmF5In19")), "noncurrentVersionTransitions") unless @noncurrent_version_transitions.nil?
  @object_size_greater_than = object_size_greater_than
  Jsii::Type.check_type(@object_size_greater_than, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "objectSizeGreaterThan") unless @object_size_greater_than.nil?
  @object_size_less_than = object_size_less_than
  Jsii::Type.check_type(@object_size_less_than, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "objectSizeLessThan") unless @object_size_less_than.nil?
  @prefix = prefix
  Jsii::Type.check_type(@prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "prefix") unless @prefix.nil?
  @tag_filters = tag_filters
  Jsii::Type.check_type(@tag_filters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "tagFilters") unless @tag_filters.nil?
  @transitions = transitions.is_a?(Array) ? transitions.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::S3::Transition.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : transitions
  Jsii::Type.check_type(@transitions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zMy5UcmFuc2l0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "transitions") unless @transitions.nil?
end

Instance Attribute Details

#abort_incomplete_multipart_upload_afterAWSCDK::Duration? (readonly)

Note:

Default: - Incomplete uploads are never aborted

Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket.

The AbortIncompleteMultipartUpload property type creates a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. When Amazon S3 aborts a multipart upload, it deletes all parts associated with the multipart upload.

The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.

Returns:



64
65
66
# File 's3/lifecycle_rule.rb', line 64

def abort_incomplete_multipart_upload_after
  @abort_incomplete_multipart_upload_after
end

#enabledBoolean? (readonly)

Note:

Default: true

Whether this rule is enabled.

Returns:

  • (Boolean, nil)


69
70
71
# File 's3/lifecycle_rule.rb', line 69

def enabled
  @enabled
end

#expirationAWSCDK::Duration? (readonly)

Note:

Default: - No expiration timeout

Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier.

If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.

The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.

Returns:



81
82
83
# File 's3/lifecycle_rule.rb', line 81

def expiration
  @expiration
end

#expiration_dateDateTime? (readonly)

Note:

Default: - No expiration date

Indicates when objects are deleted from Amazon S3 and Amazon Glacier.

The date value must be in ISO 8601 format. The time is always midnight UTC.

If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.

Returns:

  • (DateTime, nil)


92
93
94
# File 's3/lifecycle_rule.rb', line 92

def expiration_date
  @expiration_date
end

#expired_object_delete_markerBoolean? (readonly)

Note:

Default: false

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions.

If set to true, the delete marker will be expired.

Returns:

  • (Boolean, nil)


99
100
101
# File 's3/lifecycle_rule.rb', line 99

def expired_object_delete_marker
  @expired_object_delete_marker
end

#idString? (readonly)

A unique identifier for this rule.

The value cannot be more than 255 characters.

Returns:

  • (String, nil)


105
106
107
# File 's3/lifecycle_rule.rb', line 105

def id
  @id
end

#noncurrent_version_expirationAWSCDK::Duration? (readonly)

Note:

Default: - No noncurrent version expiration

Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire.

For buckets with versioning enabled (or suspended), specifies the time, in days, between when a new version of the object is uploaded to the bucket and when old versions of the object expire. When object versions expire, Amazon S3 permanently deletes them. If you specify a transition and expiration time, the expiration time must be later than the transition time.

The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.

Returns:



120
121
122
# File 's3/lifecycle_rule.rb', line 120

def noncurrent_version_expiration
  @noncurrent_version_expiration
end

#noncurrent_version_transitionsArray<AWSCDK::S3::NoncurrentVersionTransition>? (readonly)

One or more transition rules that specify when non-current objects transition to a specified storage class.

Only for buckets with versioning enabled (or suspended).

If you specify a transition and expiration time, the expiration time must be later than the transition time.



137
138
139
# File 's3/lifecycle_rule.rb', line 137

def noncurrent_version_transitions
  @noncurrent_version_transitions
end

#noncurrent_versions_to_retainNumeric? (readonly)

Note:

Default: - No noncurrent versions to retain

Indicates a maximum number of noncurrent versions to retain.

If there are this many more noncurrent versions, Amazon S3 permanently deletes them.

Returns:

  • (Numeric, nil)


128
129
130
# File 's3/lifecycle_rule.rb', line 128

def noncurrent_versions_to_retain
  @noncurrent_versions_to_retain
end

#object_size_greater_thanNumeric? (readonly)

Note:

Default: - No rule

Specifies the minimum object size in bytes for this rule to apply to.

Objects must be larger than this value in bytes.

Returns:

  • (Numeric, nil)


144
145
146
# File 's3/lifecycle_rule.rb', line 144

def object_size_greater_than
  @object_size_greater_than
end

#object_size_less_thanNumeric? (readonly)

Note:

Default: - No rule

Specifies the maximum object size in bytes for this rule to apply to.

Objects must be smaller than this value in bytes.

Returns:

  • (Numeric, nil)


151
152
153
# File 's3/lifecycle_rule.rb', line 151

def object_size_less_than
  @object_size_less_than
end

#prefixString? (readonly)

Note:

Default: - Rule applies to all objects

Object key prefix that identifies one or more objects to which this rule applies.

Returns:

  • (String, nil)


156
157
158
# File 's3/lifecycle_rule.rb', line 156

def prefix
  @prefix
end

#tag_filtersHash{String => Object}? (readonly)

Note:

Default: - Rule applies to all objects

The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket.

Returns:

  • (Hash{String => Object}, nil)


161
162
163
# File 's3/lifecycle_rule.rb', line 161

def tag_filters
  @tag_filters
end

#transitionsArray<AWSCDK::S3::Transition>? (readonly)

Note:

Default: - No transition rules

One or more transition rules that specify when an object transitions to a specified storage class.

If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.

Returns:



170
171
172
# File 's3/lifecycle_rule.rb', line 170

def transitions
  @transitions
end

Class Method Details

.jsii_propertiesObject



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 's3/lifecycle_rule.rb', line 172

def self.jsii_properties
  {
    :abort_incomplete_multipart_upload_after => "abortIncompleteMultipartUploadAfter",
    :enabled => "enabled",
    :expiration => "expiration",
    :expiration_date => "expirationDate",
    :expired_object_delete_marker => "expiredObjectDeleteMarker",
    :id => "id",
    :noncurrent_version_expiration => "noncurrentVersionExpiration",
    :noncurrent_versions_to_retain => "noncurrentVersionsToRetain",
    :noncurrent_version_transitions => "noncurrentVersionTransitions",
    :object_size_greater_than => "objectSizeGreaterThan",
    :object_size_less_than => "objectSizeLessThan",
    :prefix => "prefix",
    :tag_filters => "tagFilters",
    :transitions => "transitions",
  }
end

Instance Method Details

#to_jsiiObject



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 's3/lifecycle_rule.rb', line 191

def to_jsii
  result = {}
  result.merge!({
    "abortIncompleteMultipartUploadAfter" => @abort_incomplete_multipart_upload_after,
    "enabled" => @enabled,
    "expiration" => @expiration,
    "expirationDate" => @expiration_date,
    "expiredObjectDeleteMarker" => @expired_object_delete_marker,
    "id" => @id,
    "noncurrentVersionExpiration" => @noncurrent_version_expiration,
    "noncurrentVersionsToRetain" => @noncurrent_versions_to_retain,
    "noncurrentVersionTransitions" => @noncurrent_version_transitions,
    "objectSizeGreaterThan" => @object_size_greater_than,
    "objectSizeLessThan" => @object_size_less_than,
    "prefix" => @prefix,
    "tagFilters" => @tag_filters,
    "transitions" => @transitions,
  })
  result.compact
end