Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011-2015 Amazon Technologies, Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at:
   *
   *    http://aws.amazon.com/apache2.0
   *
  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  * OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.amazonaws.services.s3.model;
 
 import java.util.Date;
 import java.util.List;

Container for bucket lifecycle configuration operations.
 
 public class BucketLifecycleConfiguration {

    
 
     public static final String ENABLED = "Enabled";

    
 
     public static final String DISABLED = "Disabled";
 
     private List<Rulerules;

    
Returns the list of rules that comprise this configuration.
 
     public List<RulegetRules() {
         return ;
     }

    
Sets the rules that comprise this configuration.
 
     public void setRules(List<Rulerules) {
         this. = rules;
     }

    
Sets the rules that comprise this configuration and returns a reference to this object for easy method chaining.
 
     public BucketLifecycleConfiguration withRules(List<Rulerules) {
         setRules(rules);
         return this;
     }

    
Convenience array style method for withRules(java.util.List)
 
     public BucketLifecycleConfiguration withRules(Rule... rules) {
         setRules(Arrays.asList(rules));
         return this;
     }

    
Constructs a new BucketLifecycleConfiguration object with the rules given.

Parameters:
rules
 
     public BucketLifecycleConfiguration(List<Rulerules) {
         this. = rules;
     }
 
     public BucketLifecycleConfiguration() {
         super();
     }
 
     public static class Rule {
 
         private String id;
         private String prefix;
         private String status;

        
The time, in days, between when the object is uploaded to the bucket and when it expires. Should not coexist with expirationDate within one lifecycle rule.
 
         private int expirationInDays = -1;

        
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.
        private int noncurrentVersionExpirationInDays = -1;

        
The expiration date of the object and should not coexist with expirationInDays within one lifecycle rule.
        private Date expirationDate;
        private Transition transition;
        private NoncurrentVersionTransition noncurrentVersionTransition;

        
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.
        public void setId(String id) {
            this. = id;
        }

        
Sets the key prefix for which this rule will apply.
        public void setPrefix(String prefix) {
            this. = prefix;
        }

        
Sets the time, in days, between when an object is uploaded to the bucket and when it expires.
        public void setExpirationInDays(int expirationInDays) {
            this. = expirationInDays;
        }

        
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.
        public void setNoncurrentVersionExpirationInDays(int value) {
            this. = value;
        }

        
Returns the ID of this rule.
        public String getId() {
            return ;
        }

        
Sets the ID of this rule and returns a reference to this object for method chaining.

        public Rule withId(String id) {
            this. = id;
            return this;
        }

        
Returns the key prefix for which this rule will apply.
        public String getPrefix() {
            return ;
        }

        
Sets the key prefix for this rule and returns a reference to this object for method chaining.

        public Rule withPrefix(String prefix) {
            this. = prefix;
            return this;
        }

        
Returns the time in days from an object's creation to its expiration.
        public int getExpirationInDays() {
            return ;
        }

        
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.

        public Rule withExpirationInDays(int expirationInDays) {
            this. = expirationInDays;
            return this;
        }

        
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.
        public int getNoncurrentVersionExpirationInDays() {
            return ;
        }

        
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.
        public Rule withNoncurrentVersionExpirationInDays(int value) {
            setNoncurrentVersionExpirationInDays(value);
            return this;
        }

        
        public String getStatus() {
            return ;
        }

        
        public void setStatus(String status) {
            this. = status;
        }

        
Sets the status of this rule and returns a reference to this object for method chaining.

        public Rule withStatus(String status) {
            setStatus(status);
            return this;
        }

        
Sets the expiration date of the object.
        public void setExpirationDate(Date expirationDate) {
            this. = expirationDate;
        }

        
Returns the expiration date of the object.
        public Date getExpirationDate() {
            return this.;
        }

        
Sets the expiration date of the object and returns a reference to this object(Rule) for method chaining.
        public Rule withExpirationDate(Date expirationDate) {
            this. = expirationDate;
            return this;
        }

        
Sets the transition describing how this object will move between different storage classes in Amazon S3.
        public void setTransition(Transition transition) {
            this. = transition;
        }

        
Returns the transition attribute of the rule.
        public Transition getTransition() {
            return this.;
        }

        
Sets the transition describing how this object will move between different storage classes in Amazon S3 and returns a reference to this object(Rule) for method chaining.
        public Rule withTransition(Transition transition) {
            this. = transition;
            return this;
        }

        
Sets the transition describing how non-current versions of objects will move between different storage classes in Amazon S3.
        public void setNoncurrentVersionTransition(
                NoncurrentVersionTransition value) {
             = value;
        }

        
Returns the transition describing how non-current versions of objects will move between different storage classes in Amazon S3.
            return ;
        }

        
Sets the transition describing how non-current versions of objects will move between different storage classes in Amazon S3, and returns a reference to this object for method chaining.
        public Rule withNoncurrentVersionTransition(
                NoncurrentVersionTransition value) {
            setNoncurrentVersionTransition(value);
            return this;
        }
    }

    
The transition attribute of the rule describing how this object will move between different storage classes in Amazon S3.
    public static class Transition {

        
The time, in days, between when the object is uploaded to the bucket and when it expires. Should not coexist with expirationDate within one lifecycle rule.
        private int days = -1;

        
The expiration date of the object and should not coexist with expirationInDays within one lifecycle rule.
        private Date date;
        private StorageClass storageClass;

        
Sets the time, in days, between when an object is uploaded to the bucket and when it expires.
        public void setDays(int expirationInDays) {
            this. = expirationInDays;
        }

        
Returns the time in days from an object's creation to its expiration.
        public int getDays() {
            return ;
        }

        
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.

        public Transition withDays(int expirationInDays) {
            this. = expirationInDays;
            return this;
        }

        
Sets the storage class of this object.
        public void setStorageClass(StorageClass storageClass) {
            this. = storageClass;
        }

        
Returns the storage class of this object.
        public StorageClass getStorageClass() {
            return this.;
        }

        
Sets the storage class of this object and returns a reference to this object(Transition) for method chaining.
        public Transition withStorageClass(StorageClass storageClass) {
            this. = storageClass;
            return this;
        }

        
Set the expiration date of this object.
        public void setDate(Date expirationDate) {
            this. = expirationDate;
        }

        
Returns the expiration date of this object.
        public Date getDate() {
            return this.;
        }

        
Set the expiration date of this object and returns a reference to this object(Transition) for method chaining.
        public Transition withDate(Date expirationDate) {
            this. = expirationDate;
            return this;
        }
    }

    
The non-current-version transition attribute of the rule, describing how non-current versions of objects will move between different storage classes in Amazon S3.
    public static class NoncurrentVersionTransition {

        
The time, in days, between when a new version of the object is uploaded to the bucket and when older version are archived.
        private int days = -1;
        private StorageClass storageClass;

        
Sets the time, in days, between when a new version of the object is uploaded to the bucket and when older versions are archived.
        public void setDays(int expirationInDays) {
            this. = expirationInDays;
        }

        
Returns the time in days from when a new version of the object is uploaded to the bucket and when older versions are archived.
        public int getDays() {
            return ;
        }

        
Sets the time in days from when a new version of the object is uploaded to the bucket and when older versions are archived, and returns a reference to this object for method chaining.
        public NoncurrentVersionTransition withDays(int expirationInDays) {
            this. = expirationInDays;
            return this;
        }

        
Sets the storage class of this object.
        public void setStorageClass(StorageClass storageClass) {
            this. = storageClass;
        }

        
Returns the storage class of this object.
        public StorageClass getStorageClass() {
            return this.;
        }

        
Sets the storage class of this object and returns a reference to this object for method chaining.
                StorageClass storageClass) {
            this. = storageClass;
            return this;
        }
    }
New to GrepCode? Check out our FAQ X