Class BucketLifecycleConfiguration.Rule

java.lang.Object
com.amazonaws.services.s3.model.BucketLifecycleConfiguration.Rule
All Implemented Interfaces:
Serializable
Enclosing class:
BucketLifecycleConfiguration

public static class BucketLifecycleConfiguration.Rule extends Object implements Serializable
See Also:
  • Constructor Details

    • Rule

      public Rule()
  • Method Details

    • setId

      public void setId(String id)
      Sets the ID of this rule. Rules must be less than 255 alphanumeric characters, and must be unique for a bucket. If you do not assign an ID, one will be generated.
    • setPrefix

      public void setPrefix(String prefix)
      Sets the key prefix for which this rule will apply.
    • setExpirationInDays

      public void setExpirationInDays(int expirationInDays)
      Sets the time, in days, between when an object is uploaded to the bucket and when it expires.
    • setNoncurrentVersionExpirationInDays

      public void setNoncurrentVersionExpirationInDays(int value)
      Sets the time, in days, between when a new version of the object is uploaded to the bucket and when older versions of the object expire.
    • getId

      public String getId()
      Returns the ID of this rule.
    • withId

      Sets the ID of this rule and returns a reference to this object for method chaining.
      See Also:
    • getPrefix

      public String getPrefix()
      Returns the key prefix for which this rule will apply.
    • withPrefix

      public BucketLifecycleConfiguration.Rule withPrefix(String prefix)
      Sets the key prefix for this rule and returns a reference to this object for method chaining.
      See Also:
    • getExpirationInDays

      public int getExpirationInDays()
      Returns the time in days from an object's creation to its expiration.
    • withExpirationInDays

      public BucketLifecycleConfiguration.Rule withExpirationInDays(int expirationInDays)
      Sets the time, in days, between when an object is uploaded to the bucket and when it expires, and returns a reference to this object for method chaining.
      See Also:
    • getNoncurrentVersionExpirationInDays

      public int getNoncurrentVersionExpirationInDays()
      Returns the time, in days, between when a new version of the object is uploaded to the bucket and when older versions of the object expire.
    • withNoncurrentVersionExpirationInDays

      public BucketLifecycleConfiguration.Rule withNoncurrentVersionExpirationInDays(int value)
      Sets the time, in days, between when a new version of the object is uploaded to the bucket and when older versions of the object expire, and returns a reference to this object for method chaining.
    • getStatus

      public String getStatus()
      Returns the status of this rule.
      See Also:
    • setStatus

      public void setStatus(String status)
      Sets the status of this rule.
      See Also:
    • withStatus

      public BucketLifecycleConfiguration.Rule withStatus(String status)
      Sets the status of this rule and returns a reference to this object for method chaining.
      See Also:
    • setExpirationDate

      public void setExpirationDate(Date expirationDate)
      Sets the expiration date of the object.
    • getExpirationDate

      public Date getExpirationDate()
      Returns the expiration date of the object.
    • withExpirationDate

      public BucketLifecycleConfiguration.Rule withExpirationDate(Date expirationDate)
      Sets the expiration date of the object and returns a reference to this object(Rule) for method chaining.
    • setTransition

      @Deprecated public void setTransition(BucketLifecycleConfiguration.Transition transition)
      Deprecated.
      Sets the transition describing how this object will move between different storage classes in Amazon S3. Bucket Life cycle configuration can now accept multiple transitions in a rule. Note : This method overwrites all the existing transitions with given transition. @Deprecated in favor of setTransitions(List)
    • getTransition

      Deprecated.
      Returns the transition associated with the rule. If there are more than one transition associated with a given rule, this method returns the last transition rule.
    • withTransition

      Deprecated.
      Sets the transition describing how this object will move between different storage classes in Amazon S3. Bucket Life cycle configuration can now accept multiple transitions in a rule.
    • setNoncurrentVersionTransition

      @Deprecated public void setNoncurrentVersionTransition(BucketLifecycleConfiguration.NoncurrentVersionTransition nonCurrentVersionTransition)
      Deprecated.
      Sets the transition describing how non-current versions of objects will move between different storage classes in Amazon S3. Bucket Life cycle configuration can now accept multiple non current transitions in a rule. Note: This method overwrites all the existing transitions with given transition. @Deprecated in favor of setNoncurrentVersionTransitions(List)
    • getNoncurrentVersionTransition

      Deprecated.
      Returns the non-current transition associated with the life cycle configuration rule. If there are more than one transitions associated with a rule, this method returns the last transition in the rule. @Deprecated in favor of getNoncurrentVersionTransitions()
    • withNoncurrentVersionTransition

      @Deprecated public BucketLifecycleConfiguration.Rule withNoncurrentVersionTransition(BucketLifecycleConfiguration.NoncurrentVersionTransition nonCurrentVersionTransition)
      Deprecated.
      Sets the transition describing how non-current versions of objects will move between different storage classes in Amazon S3. Bucket Life cycle configuration can now accept multiple non current transitions in a rule. @Deprecated in favor of withNoncurrentVersionTransitions(List) Returns a updated reference of this object.
    • getTransitions

      Returns the Amazon S3 object transition rules associated with the given rule.
    • setTransitions

      public void setTransitions(List<BucketLifecycleConfiguration.Transition> transitions)
      Sets the Amazon S3 object transition rules for the given bucket.
    • withTransitions

      Sets the Amazon S3 object transition rules for the given bucket. Returns an updated version of this object.
    • addTransition

      Adds a new transition to the rule.
    • getNoncurrentVersionTransitions

      public List<BucketLifecycleConfiguration.NoncurrentVersionTransition> getNoncurrentVersionTransitions()
      Returns the Amazon S3 non current object transition rules associated with the given rule.
    • setNoncurrentVersionTransitions

      public void setNoncurrentVersionTransitions(List<BucketLifecycleConfiguration.NoncurrentVersionTransition> noncurrentVersionTransitions)
      Sets the Amazon S3 non current object transition rules for the given bucket.
    • withNoncurrentVersionTransitions

      public BucketLifecycleConfiguration.Rule withNoncurrentVersionTransitions(List<BucketLifecycleConfiguration.NoncurrentVersionTransition> noncurrentVersionTransitions)
      Sets the Amazon S3 non current object transition rules for the given bucket. Returns an updated version of this object.
    • addNoncurrentVersionTransition

      public BucketLifecycleConfiguration.Rule addNoncurrentVersionTransition(BucketLifecycleConfiguration.NoncurrentVersionTransition noncurrentVersionTransition)
      Adds a new Non current transition to the rule.
    • getAbortIncompleteMultipartUpload

      public AbortIncompleteMultipartUpload getAbortIncompleteMultipartUpload()
    • setAbortIncompleteMultipartUpload

      public void setAbortIncompleteMultipartUpload(AbortIncompleteMultipartUpload abortIncompleteMultipartUpload)
    • withAbortIncompleteMultipartUpload

      public BucketLifecycleConfiguration.Rule withAbortIncompleteMultipartUpload(AbortIncompleteMultipartUpload abortIncompleteMultipartUpload)
    • isExpiredObjectDeleteMarker

      public boolean isExpiredObjectDeleteMarker()
      Returns whether the current expiration policy for the object is set to remove objects when only a delete marker is left

      If set to true the lifecycle policy will delete the current version of an object if and only if the current version is a expired object delete marker. This option only makes sense to use for versioned buckets and cannot be used in conjunction with expirationInDays or expirationDate. Note that the current version can only be removed if all non-current versions have been removed (either through a non-current version expiration policy or being explicitly deleted)

      Returns:
      True if this lifecycle's configuration is configured to delete the current version of an object if it's the only version left and it's a delete marker. False otherwise
    • setExpiredObjectDeleteMarker

      public void setExpiredObjectDeleteMarker(boolean expiredObjectDeleteMarker)
      Sets the value of the ExpiredObjectDeleteMarkers attribute.
      Parameters:
      expiredObjectDeleteMarker - True to allow the current expiration policy to remove the current version of the object if it's the only version left and it's a delete marker. False has no effect on the current expiration policy
    • withExpiredObjectDeleteMarker

      public BucketLifecycleConfiguration.Rule withExpiredObjectDeleteMarker(boolean expiredObjectDeleteMarker)
      Fluent method for setting the value of the ExpiredObjectDeleteMarkers attributes. See setExpiredObjectDeleteMarker(boolean)
      Parameters:
      expiredObjectDeleteMarker -
      Returns:
      This object for method chaining