BucketLifecycleConfiguration makeLifecycleConfiguration(BucketLifecycleConfiguration existing, int expirationInDays) { BucketLifecycleConfiguration.Rule rule = new BucketLifecycleConfiguration.Rule() .withId(LIFECYCLE_EXPIRATION_RULE_ID) .withFilter(new LifecycleFilter( new LifecycleTagPredicate(DELETED_TAG))) .withExpirationInDays(expirationInDays) .withStatus(BucketLifecycleConfiguration.ENABLED.toString()); if (existing != null) { existing.getRules().add(rule); return existing; } else { return new BucketLifecycleConfiguration().withRules(rule); } }
private void writeLifecycleFilter(XmlWriter xml, LifecycleFilter filter) { if (filter == null) { return; } xml.start("Filter"); writeLifecycleFilterPredicate(xml, filter.getPredicate()); xml.end(); }
@Override protected void doStartElement( String uri, String name, String qName, Attributes attrs) { if (in("LifecycleConfiguration")) { if (name.equals("Rule")) { currentRule = new Rule(); } } else if (in("LifecycleConfiguration", "Rule")) { if (name.equals("Transition")) { currentTransition = new Transition(); } else if (name.equals("NoncurrentVersionTransition")) { currentNcvTransition = new NoncurrentVersionTransition(); } else if (name.equals("AbortIncompleteMultipartUpload")) { abortIncompleteMultipartUpload = new AbortIncompleteMultipartUpload(); } else if (name.equals("Filter")) { currentFilter = new LifecycleFilter(); } } else if (in("LifecycleConfiguration", "Rule", "Filter")) { if (name.equals("And")) { andOperandsList = new ArrayList<LifecycleFilterPredicate>(); } } }
BucketLifecycleConfiguration makeLifecycleConfiguration(BucketLifecycleConfiguration existing, int expirationInDays) { BucketLifecycleConfiguration.Rule rule = new BucketLifecycleConfiguration.Rule() .withId(LIFECYCLE_EXPIRATION_RULE_ID) .withFilter(new LifecycleFilter( new LifecycleTagPredicate(DELETED_TAG))) .withExpirationInDays(expirationInDays) .withStatus(BucketLifecycleConfiguration.ENABLED); if (existing != null) { existing.getRules().add(rule); return existing; } else { return new BucketLifecycleConfiguration().withRules(rule); } }
/** * Returns a {@link LifecycleFilter} that is used to identify objects that a Lifecycle Rule applies to. */ public LifecycleFilter getFilter() { return filter; }
/** * Sets the {@link LifecycleFilter} that is used to identify objects that a Lifecycle Rule applies to. * A rule cannot have both {@link LifecycleFilter} and the deprecated {@link #prefix}. * * @param filter {@link LifecycleFilter} */ public void setFilter(LifecycleFilter filter) { this.filter = filter; }
/** * Fluent method to set the {@link LifecycleFilter} that is used to identify objects * that a Lifecycle Rule applies to. A rule cannot have both {@link LifecycleFilter} * and the deprecated {@link #prefix}. * * @param filter {@link LifecycleFilter} * @return This object for method chaining. */ public Rule withFilter(LifecycleFilter filter) { setFilter(filter); return this; }