Interface LifecycleRule

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

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:22.979Z") @Stability(Stable) public interface LifecycleRule extends software.amazon.jsii.JsiiSerializable
Declaration of a Life cycle rule.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.*;
 import software.amazon.awscdk.services.s3.*;
 StorageClass storageClass;
 Object tagFilters;
 LifecycleRule lifecycleRule = LifecycleRule.builder()
         .abortIncompleteMultipartUploadAfter(Duration.minutes(30))
         .enabled(false)
         .expiration(Duration.minutes(30))
         .expirationDate(new Date())
         .expiredObjectDeleteMarker(false)
         .id("id")
         .noncurrentVersionExpiration(Duration.minutes(30))
         .noncurrentVersionsToRetain(123)
         .noncurrentVersionTransitions(List.of(NoncurrentVersionTransition.builder()
                 .storageClass(storageClass)
                 .transitionAfter(Duration.minutes(30))
                 // the properties below are optional
                 .noncurrentVersionsToRetain(123)
                 .build()))
         .objectSizeGreaterThan(123)
         .objectSizeLessThan(123)
         .prefix("prefix")
         .tagFilters(Map.of(
                 "tagFiltersKey", tagFilters))
         .transitions(List.of(Transition.builder()
                 .storageClass(storageClass)
                 // the properties below are optional
                 .transitionAfter(Duration.minutes(30))
                 .transitionDate(new Date())
                 .build()))
         .build();
 
  • Method Details

    • getAbortIncompleteMultipartUploadAfter

      @Stability(Stable) @Nullable default Duration getAbortIncompleteMultipartUploadAfter()
      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.

      Default: - Incomplete uploads are never aborted

    • getEnabled

      @Stability(Stable) @Nullable default Boolean getEnabled()
      Whether this rule is enabled.

      Default: true

    • getExpiration

      @Stability(Stable) @Nullable default Duration getExpiration()
      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.

      Default: - No expiration timeout

    • getExpirationDate

      @Stability(Stable) @Nullable default Instant getExpirationDate()
      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.

      Default: - No expiration date

    • getExpiredObjectDeleteMarker

      @Stability(Stable) @Nullable default Boolean getExpiredObjectDeleteMarker()
      Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions.

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

      Default: false

    • getId

      @Stability(Stable) @Nullable default String getId()
      A unique identifier for this rule.

      The value cannot be more than 255 characters.

    • getNoncurrentVersionExpiration

      @Stability(Stable) @Nullable default Duration getNoncurrentVersionExpiration()
      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.

      Default: - No noncurrent version expiration

    • getNoncurrentVersionsToRetain

      @Stability(Stable) @Nullable default Number getNoncurrentVersionsToRetain()
      Indicates a maximum number of noncurrent versions to retain.

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

      Default: - No noncurrent versions to retain

    • getNoncurrentVersionTransitions

      @Stability(Stable) @Nullable default List<NoncurrentVersionTransition> getNoncurrentVersionTransitions()
      One or more transition rules that specify when non-current objects transition to a specified storage class.

      Only for 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.

    • getObjectSizeGreaterThan

      @Stability(Stable) @Nullable default Number getObjectSizeGreaterThan()
      Specifies the minimum object size in bytes for this rule to apply to.

      Objects must be larger than this value in bytes.

      Default: - No rule

    • getObjectSizeLessThan

      @Stability(Stable) @Nullable default Number getObjectSizeLessThan()
      Specifies the maximum object size in bytes for this rule to apply to.

      Objects must be smaller than this value in bytes.

      Default: - No rule

    • getPrefix

      @Stability(Stable) @Nullable default String getPrefix()
      Object key prefix that identifies one or more objects to which this rule applies.

      Default: - Rule applies to all objects

    • getTagFilters

      @Stability(Stable) @Nullable default Map<String,Object> getTagFilters()
      The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket.

      Default: - Rule applies to all objects

    • getTransitions

      @Stability(Stable) @Nullable default List<Transition> getTransitions()
      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.

      Default: - No transition rules

    • builder

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