From 7f74c5a87cd3a96dec121c850fc8350c72a352fa Mon Sep 17 00:00:00 2001 From: Frank Natividad Date: Wed, 3 Oct 2018 15:23:08 -0700 Subject: [PATCH] [Storage] Add launch stage annotations around bucket lock methods (#3764) * Add launch stage annotations * Use correct annotation --- .../main/java/com/google/cloud/storage/BlobInfo.java | 8 +++++++- .../main/java/com/google/cloud/storage/BucketInfo.java | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java index d356a8d813ff..98b2793efe77 100644 --- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java +++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java @@ -21,10 +21,10 @@ import com.google.api.client.util.Data; import com.google.api.client.util.DateTime; +import com.google.api.core.BetaApi; import com.google.api.services.storage.model.ObjectAccessControl; import com.google.api.services.storage.model.StorageObject; import com.google.api.services.storage.model.StorageObject.Owner; -import com.google.cloud.GcpLaunchStage; import com.google.cloud.storage.Blob.Builder; import com.google.common.base.Function; import com.google.common.base.MoreObjects; @@ -260,11 +260,14 @@ public abstract static class Builder { abstract Builder setKmsKeyName(String kmsKeyName); /** Sets the blob's event-based hold. */ + @BetaApi public abstract Builder setEventBasedHold(Boolean eventBasedHold); /** Sets the blob's temporary hold. */ + @BetaApi public abstract Builder setTemporaryHold(Boolean temporaryHold); + @BetaApi abstract Builder setRetentionExpirationTime(Long retentionExpirationTime); /** Creates a {@code BlobInfo} object. */ @@ -775,6 +778,7 @@ public String getKmsKeyName() { * Storage#update(BlobInfo, Storage.BlobTargetOption...)} in which case the value of event-based * hold will remain {@code false} for the given instance. */ + @BetaApi public Boolean getEventBasedHold() { return Data.isNull(eventBasedHold) ? null : eventBasedHold; } @@ -801,6 +805,7 @@ public Boolean getEventBasedHold() { * Storage#update(BlobInfo, Storage.BlobTargetOption...)} in which case the value of temporary * hold will remain {@code false} for the given instance. */ + @BetaApi public Boolean getTemporaryHold() { return Data.isNull(temporaryHold) ? null : temporaryHold; } @@ -809,6 +814,7 @@ public Boolean getTemporaryHold() { * Returns the retention expiration time of the blob as {@code Long}, if a retention period is * defined. If retention period is not defined this value returns {@code null} */ + @BetaApi public Long getRetentionExpirationTime() { return Data.isNull(retentionExpirationTime) ? null : retentionExpirationTime; } diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java index 0c417a8aee0d..c799edba71d2 100644 --- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java +++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java @@ -23,6 +23,7 @@ import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.Data; import com.google.api.client.util.DateTime; +import com.google.api.core.BetaApi; import com.google.api.services.storage.model.*; import com.google.api.services.storage.model.Bucket; import com.google.api.services.storage.model.Bucket.Encryption; @@ -31,7 +32,6 @@ import com.google.api.services.storage.model.Bucket.Owner; import com.google.api.services.storage.model.Bucket.Versioning; import com.google.api.services.storage.model.Bucket.Website; -import com.google.cloud.GcpLaunchStage; import com.google.cloud.storage.Acl.Entity; import com.google.common.base.Function; import com.google.common.base.MoreObjects; @@ -426,16 +426,20 @@ public abstract static class Builder { public abstract Builder setDefaultKmsKeyName(String defaultKmsKeyName); /** Sets the default event-based hold for this bucket. */ + @BetaApi public abstract Builder setDefaultEventBasedHold(Boolean defaultEventBasedHold); + @BetaApi abstract Builder setRetentionEffectiveTime(Long retentionEffectiveTime); + @BetaApi abstract Builder setRetentionPolicyIsLocked(Boolean retentionPolicyIsLocked); /** * If policy is not locked this value can be cleared, increased, and decreased. If policy is * locked the retention period can only be increased. */ + @BetaApi public abstract Builder setRetentionPeriod(Long retentionPeriod); /** Creates a {@code BucketInfo} object. */ @@ -863,6 +867,7 @@ public String getDefaultKmsKeyName() { * Storage#update(BucketInfo, Storage.BucketTargetOption...)} in which case the value of default * event-based hold will remain {@code false} for the given instance. */ + @BetaApi public Boolean getDefaultEventBasedHold() { return Data.isNull(defaultEventBasedHold) ? null : defaultEventBasedHold; } @@ -871,6 +876,7 @@ public Boolean getDefaultEventBasedHold() { * Returns the retention effective time a policy took effect if a retention policy is defined as a * {@code Long}. */ + @BetaApi public Long getRetentionEffectiveTime() { return retentionEffectiveTime; } @@ -891,11 +897,13 @@ public Long getRetentionEffectiveTime() { * com.google.cloud.storage.Storage.BucketField#RETENTION_POLICY} is not selected in a {@link * Storage#get(String, Storage.BucketGetOption...)}, and the state for this field is unknown. */ + @BetaApi public Boolean retentionPolicyIsLocked() { return Data.isNull(retentionPolicyIsLocked) ? null : retentionPolicyIsLocked; } /** Returns the retention policy retention period. */ + @BetaApi public Long getRetentionPeriod() { return retentionPeriod; }