From 7433dfa6f536fd819272b38574ccbbf5324b9758 Mon Sep 17 00:00:00 2001 From: Jesse Lovelace Date: Tue, 11 May 2021 09:05:47 -0700 Subject: [PATCH 1/2] Remove client side vaildation for lifecycle conditions --- .../main/java/com/google/cloud/storage/BucketInfo.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java index 602be08ac9..db1fd256a6 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java @@ -48,6 +48,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.logging.Logger; /** * Google Storage bucket metadata; @@ -101,6 +102,8 @@ public com.google.api.services.storage.model.Bucket apply(BucketInfo bucketInfo) private final String locationType; private final Logging logging; + private static final Logger log = Logger.getLogger(BucketInfo.class.getName()); + /** * The Bucket's IAM Configuration. * @@ -356,9 +359,9 @@ public LifecycleRule(LifecycleAction action, LifecycleCondition condition) { && condition.getNoncurrentTimeBefore() == null && condition.getCustomTimeBefore() == null && condition.getDaysSinceCustomTime() == null) { - throw new IllegalArgumentException( - "You must specify at least one condition to use object lifecycle " - + "management. Please see https://cloud.google.com/storage/docs/lifecycle for details."); + log.warning("Creating a lifecycle condition with no supported conditions:\n" + + this + + "\nAttempting to update with this rule may cause errors."); } this.lifecycleAction = action; From 4c70db936a60ae4768fc5f91e58c0cf54d25190f Mon Sep 17 00:00:00 2001 From: Jesse Lovelace Date: Tue, 11 May 2021 11:30:15 -0700 Subject: [PATCH 2/2] fix lint and suggest updating --- .../src/main/java/com/google/cloud/storage/BucketInfo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java index db1fd256a6..5b69814ec7 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java @@ -359,9 +359,11 @@ public LifecycleRule(LifecycleAction action, LifecycleCondition condition) { && condition.getNoncurrentTimeBefore() == null && condition.getCustomTimeBefore() == null && condition.getDaysSinceCustomTime() == null) { - log.warning("Creating a lifecycle condition with no supported conditions:\n" + log.warning( + "Creating a lifecycle condition with no supported conditions:\n" + this - + "\nAttempting to update with this rule may cause errors."); + + "\nAttempting to update with this rule may cause errors. Please update " + + " to the latest version of google-cloud-storage"); } this.lifecycleAction = action;