Skip to content

Commit 5ec84cc

Browse files
feat: Remove client side vaildation for lifecycle conditions (#816)
* Remove client side vaildation for lifecycle conditions * fix lint and suggest updating
1 parent 1a576ca commit 5ec84cc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.Map;
4949
import java.util.Objects;
5050
import java.util.Set;
51+
import java.util.logging.Logger;
5152

5253
/**
5354
* Google Storage bucket metadata;
@@ -101,6 +102,8 @@ public com.google.api.services.storage.model.Bucket apply(BucketInfo bucketInfo)
101102
private final String locationType;
102103
private final Logging logging;
103104

105+
private static final Logger log = Logger.getLogger(BucketInfo.class.getName());
106+
104107
/**
105108
* The Bucket's IAM Configuration.
106109
*
@@ -356,9 +359,11 @@ public LifecycleRule(LifecycleAction action, LifecycleCondition condition) {
356359
&& condition.getNoncurrentTimeBefore() == null
357360
&& condition.getCustomTimeBefore() == null
358361
&& condition.getDaysSinceCustomTime() == null) {
359-
throw new IllegalArgumentException(
360-
"You must specify at least one condition to use object lifecycle "
361-
+ "management. Please see https://cloud.google.com/storage/docs/lifecycle for details.");
362+
log.warning(
363+
"Creating a lifecycle condition with no supported conditions:\n"
364+
+ this
365+
+ "\nAttempting to update with this rule may cause errors. Please update "
366+
+ " to the latest version of google-cloud-storage");
362367
}
363368

364369
this.lifecycleAction = action;

0 commit comments

Comments
 (0)