From e03ef6e29cccadd4809688c4f3aa46fabdb03880 Mon Sep 17 00:00:00 2001 From: Frank Natividad Date: Wed, 3 Oct 2018 12:23:33 -0700 Subject: [PATCH 1/2] Add launch stage annotations --- .../src/main/java/com/google/cloud/storage/BlobInfo.java | 6 ++++++ .../main/java/com/google/cloud/storage/BucketInfo.java | 8 ++++++++ 2 files changed, 14 insertions(+) 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..70767d2665e9 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 @@ -260,11 +260,14 @@ public abstract static class Builder { abstract Builder setKmsKeyName(String kmsKeyName); /** Sets the blob's event-based hold. */ + @GcpLaunchStage.Beta public abstract Builder setEventBasedHold(Boolean eventBasedHold); /** Sets the blob's temporary hold. */ + @GcpLaunchStage.Beta public abstract Builder setTemporaryHold(Boolean temporaryHold); + @GcpLaunchStage.Beta 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. */ + @GcpLaunchStage.Beta 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. */ + @GcpLaunchStage.Beta 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} */ + @GcpLaunchStage.Beta 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..17ec587e12f6 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 @@ -426,16 +426,20 @@ public abstract static class Builder { public abstract Builder setDefaultKmsKeyName(String defaultKmsKeyName); /** Sets the default event-based hold for this bucket. */ + @GcpLaunchStage.Beta public abstract Builder setDefaultEventBasedHold(Boolean defaultEventBasedHold); + @GcpLaunchStage.Beta abstract Builder setRetentionEffectiveTime(Long retentionEffectiveTime); + @GcpLaunchStage.Beta 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. */ + @GcpLaunchStage.Beta 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. */ + @GcpLaunchStage.Beta 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}. */ + @GcpLaunchStage.Beta 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. */ + @GcpLaunchStage.Beta public Boolean retentionPolicyIsLocked() { return Data.isNull(retentionPolicyIsLocked) ? null : retentionPolicyIsLocked; } /** Returns the retention policy retention period. */ + @GcpLaunchStage.Beta public Long getRetentionPeriod() { return retentionPeriod; } From a2a02d18fb034f913aa7871a9199c9079b6ab469 Mon Sep 17 00:00:00 2001 From: Frank Natividad Date: Wed, 3 Oct 2018 14:42:11 -0700 Subject: [PATCH 2/2] Use correct annotation --- .../com/google/cloud/storage/BlobInfo.java | 14 +++++++------- .../com/google/cloud/storage/BucketInfo.java | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 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 70767d2665e9..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,14 +260,14 @@ public abstract static class Builder { abstract Builder setKmsKeyName(String kmsKeyName); /** Sets the blob's event-based hold. */ - @GcpLaunchStage.Beta + @BetaApi public abstract Builder setEventBasedHold(Boolean eventBasedHold); /** Sets the blob's temporary hold. */ - @GcpLaunchStage.Beta + @BetaApi public abstract Builder setTemporaryHold(Boolean temporaryHold); - @GcpLaunchStage.Beta + @BetaApi abstract Builder setRetentionExpirationTime(Long retentionExpirationTime); /** Creates a {@code BlobInfo} object. */ @@ -778,7 +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. */ - @GcpLaunchStage.Beta + @BetaApi public Boolean getEventBasedHold() { return Data.isNull(eventBasedHold) ? null : eventBasedHold; } @@ -805,7 +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. */ - @GcpLaunchStage.Beta + @BetaApi public Boolean getTemporaryHold() { return Data.isNull(temporaryHold) ? null : temporaryHold; } @@ -814,7 +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} */ - @GcpLaunchStage.Beta + @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 17ec587e12f6..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,20 +426,20 @@ public abstract static class Builder { public abstract Builder setDefaultKmsKeyName(String defaultKmsKeyName); /** Sets the default event-based hold for this bucket. */ - @GcpLaunchStage.Beta + @BetaApi public abstract Builder setDefaultEventBasedHold(Boolean defaultEventBasedHold); - @GcpLaunchStage.Beta + @BetaApi abstract Builder setRetentionEffectiveTime(Long retentionEffectiveTime); - @GcpLaunchStage.Beta + @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. */ - @GcpLaunchStage.Beta + @BetaApi public abstract Builder setRetentionPeriod(Long retentionPeriod); /** Creates a {@code BucketInfo} object. */ @@ -867,7 +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. */ - @GcpLaunchStage.Beta + @BetaApi public Boolean getDefaultEventBasedHold() { return Data.isNull(defaultEventBasedHold) ? null : defaultEventBasedHold; } @@ -876,7 +876,7 @@ public Boolean getDefaultEventBasedHold() { * Returns the retention effective time a policy took effect if a retention policy is defined as a * {@code Long}. */ - @GcpLaunchStage.Beta + @BetaApi public Long getRetentionEffectiveTime() { return retentionEffectiveTime; } @@ -897,13 +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. */ - @GcpLaunchStage.Beta + @BetaApi public Boolean retentionPolicyIsLocked() { return Data.isNull(retentionPolicyIsLocked) ? null : retentionPolicyIsLocked; } /** Returns the retention policy retention period. */ - @GcpLaunchStage.Beta + @BetaApi public Long getRetentionPeriod() { return retentionPeriod; }