Skip to content

Commit

Permalink
[Storage] Add launch stage annotations around bucket lock methods (#3764
Browse files Browse the repository at this point in the history
)

* Add launch stage annotations

* Use correct annotation
  • Loading branch information
frankyn authored and chingor13 committed Oct 3, 2018
1 parent 152653d commit 7f74c5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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.<Boolean>isNull(eventBasedHold) ? null : eventBasedHold;
}
Expand All @@ -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.<Boolean>isNull(temporaryHold) ? null : temporaryHold;
}
Expand All @@ -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.<Long>isNull(retentionExpirationTime) ? null : retentionExpirationTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 7f74c5a

Please sign in to comment.