listDefaultAcls() {
return storage.listDefaultAcls(getName());
}
- /**
- * Locks bucket retention policy. Requires a local metageneration value in the request. Review example below.
- *
- * Accepts an optional userProject {@link BucketTargetOption} option which defines the project id
- * to assign operational costs.
- *
- *
Warning: Once a retention policy is locked, it can't be unlocked, removed, or shortened.
- *
- *
Example of locking a retention policy on a bucket, only if its local metageneration value matches the bucket's
- * service metageneration otherwise a {@link StorageException} is thrown.
- *
{@code
- * String bucketName = "my_unique_bucket";
- * Bucket bucket = storage.get(bucketName, BucketGetOption.fields(BucketField.METAGENERATION));
- * storage.lockRetentionPolicy(bucket, BucketTargetOption.metagenerationMatch());
- * }
- *
- * @return a {@code Bucket} object of the locked bucket
- * @throws StorageException upon failure
- */
- public Bucket lockRetentionPolicy(BucketTargetOption... options) {
- return storage.lockRetentionPolicy(this, options);
- }
-
/**
* Returns the bucket's {@code Storage} object used to issue requests.
*/
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 e24a5a7a89eb..6e0b3e2c38e9 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
@@ -88,10 +88,6 @@ public com.google.api.services.storage.model.Bucket apply(BucketInfo bucketInfo)
private final StorageClass storageClass;
private final Map labels;
private final String defaultKmsKeyName;
- private final Boolean defaultEventBasedHold;
- private final Long retentionEffectiveTime;
- private final Boolean retentionPolicyIsLocked;
- private final Long retentionPeriod;
/**
* Base class for bucket's delete rules. Allows to configure automatic deletion of blobs and blobs
@@ -350,6 +346,7 @@ public abstract static class Builder {
* Sets whether a user accessing the bucket or an object it contains should assume the transit costs
* related to the access.
*
+ * GcpLaunchStage.Alpha
*/
public abstract Builder setRequesterPays(Boolean requesterPays);
@@ -432,23 +429,9 @@ public abstract static class Builder {
/**
* Sets the default Cloud KMS key name for this bucket.
*/
+ @GcpLaunchStage.Beta
public abstract Builder setDefaultKmsKeyName(String defaultKmsKeyName);
- /**
- * Sets the default event based hold for this bucket.
- */
- public abstract Builder setDefaultEventBasedHold(Boolean defaultEventBasedHold);
-
- abstract Builder setRetentionEffectiveTime(Long retentionEffectiveTime);
-
- 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.
- */
- public abstract Builder setRetentionPeriod(Long retentionPeriod);
-
/**
* Creates a {@code BucketInfo} object.
*/
@@ -476,10 +459,6 @@ static final class BuilderImpl extends Builder {
private List defaultAcl;
private Map labels;
private String defaultKmsKeyName;
- private Boolean defaultEventBasedHold;
- private Long retentionEffectiveTime;
- private Boolean retentionPolicyIsLocked;
- private Long retentionPeriod;
BuilderImpl(String name) {
this.name = name;
@@ -505,10 +484,6 @@ static final class BuilderImpl extends Builder {
labels = bucketInfo.labels;
requesterPays = bucketInfo.requesterPays;
defaultKmsKeyName = bucketInfo.defaultKmsKeyName;
- defaultEventBasedHold = bucketInfo.defaultEventBasedHold;
- retentionEffectiveTime = bucketInfo.retentionEffectiveTime;
- retentionPolicyIsLocked = bucketInfo.retentionPolicyIsLocked;
- retentionPeriod = bucketInfo.retentionPeriod;
}
@Override
@@ -541,6 +516,7 @@ public Builder setVersioningEnabled(Boolean enable) {
return this;
}
+ /** GcpLaunchStage.Alpha */
@Override
public Builder setRequesterPays(Boolean enable) {
this.requesterPays = firstNonNull(enable, Data.nullOf(Boolean.class));
@@ -619,6 +595,7 @@ public Builder setLabels(Map labels) {
return this;
}
+ @GcpLaunchStage.Beta
@Override
public Builder setDefaultKmsKeyName(String defaultKmsKeyName) {
this.defaultKmsKeyName = defaultKmsKeyName != null
@@ -626,30 +603,6 @@ public Builder setDefaultKmsKeyName(String defaultKmsKeyName) {
return this;
}
- @Override
- public Builder setDefaultEventBasedHold(Boolean defaultEventBasedHold) {
- this.defaultEventBasedHold = firstNonNull(defaultEventBasedHold, Data.nullOf(Boolean.class));
- return this;
- }
-
- @Override
- Builder setRetentionEffectiveTime(Long retentionEffectiveTime) {
- this.retentionEffectiveTime = firstNonNull(retentionEffectiveTime, Data.nullOf(Long.class));
- return this;
- }
-
- @Override
- Builder setRetentionPolicyIsLocked(Boolean retentionPolicyIsLocked) {
- this.retentionPolicyIsLocked = firstNonNull(retentionPolicyIsLocked, Data.nullOf(Boolean.class));
- return this;
- }
-
- @Override
- public Builder setRetentionPeriod(Long retentionPeriod) {
- this.retentionPeriod = firstNonNull(retentionPeriod, Data.nullOf(Long.class));
- return this;
- }
-
@Override
public BucketInfo build() {
checkNotNull(name);
@@ -677,10 +630,6 @@ public BucketInfo build() {
labels = builder.labels;
requesterPays = builder.requesterPays;
defaultKmsKeyName = builder.defaultKmsKeyName;
- defaultEventBasedHold = builder.defaultEventBasedHold;
- retentionEffectiveTime = builder.retentionEffectiveTime;
- retentionPolicyIsLocked = builder.retentionPolicyIsLocked;
- retentionPeriod = builder.retentionPeriod;
}
/**
@@ -718,10 +667,12 @@ public Boolean versioningEnabled() {
return Data.isNull(versioningEnabled) ? null : versioningEnabled;
}
+
/**
* Returns {@code true} if a user accessing the bucket or an object it contains should assume the transit costs
* related to the access, {@code false} otherwise.
*
+ * GcpLaunchStage.Alpha
*/
public Boolean requesterPays() {
return Data.isNull(requesterPays) ? null : requesterPays;
@@ -834,32 +785,11 @@ public Map getLabels() {
/**
* Returns the default Cloud KMS key to be applied to newly inserted objects in this bucket.
*/
+ @GcpLaunchStage.Beta
public String getDefaultKmsKeyName() {
return defaultKmsKeyName;
}
- /**
- * Returns the default event based hold value used for inserted objects in this bucket.
- */
- public Boolean getDefaultEventBasedHold() { return defaultEventBasedHold; }
-
- /**
- * Returns the retention effective time a policy took effect if a retention policy is defined.
- */
- public Long getRetentionEffectiveTime() { return retentionEffectiveTime; }
-
- /**
- * Returns {@code true} if the bucket retention policy is locked, {@code false} otherwise.
- */
- public Boolean retentionPolicyIsLocked() {
- return Data.isNull(retentionPolicyIsLocked) ? null : retentionPolicyIsLocked;
- }
-
- /**
- * Returns the retention policy retention period.
- */
- public Long getRetentionPeriod() { return retentionPeriod; }
-
/**
* Returns a builder for the current bucket.
*/
@@ -958,23 +888,6 @@ public Rule apply(DeleteRule deleteRule) {
if (defaultKmsKeyName != null) {
bucketPb.setEncryption(new Encryption().setDefaultKmsKeyName(defaultKmsKeyName));
}
- if (defaultEventBasedHold != null) {
- bucketPb.setDefaultEventBasedHold(defaultEventBasedHold);
- }
- if (retentionPeriod != null || retentionEffectiveTime != null || retentionPolicyIsLocked != null) {
- Bucket.RetentionPolicy retentionPolicy = new Bucket.RetentionPolicy();
- if (retentionPeriod != null) {
- retentionPolicy.setRetentionPeriod(retentionPeriod);
- }
- if (retentionEffectiveTime != null) {
- retentionPolicy.setEffectiveTime(new DateTime(retentionEffectiveTime));
- }
- if (retentionPolicyIsLocked != null) {
- retentionPolicy.setIsLocked(retentionPolicyIsLocked);
- }
- bucketPb.setRetentionPolicy(retentionPolicy);
- }
-
return bucketPb;
}
@@ -1066,21 +979,6 @@ public DeleteRule apply(Rule rule) {
if (encryption != null && encryption.getDefaultKmsKeyName() != null && !encryption.getDefaultKmsKeyName().isEmpty()) {
builder.setDefaultKmsKeyName(encryption.getDefaultKmsKeyName());
}
- if (bucketPb.getDefaultEventBasedHold() != null) {
- builder.setDefaultEventBasedHold(bucketPb.getDefaultEventBasedHold());
- }
- Bucket.RetentionPolicy retentionPolicy = bucketPb.getRetentionPolicy();
- if (retentionPolicy != null) {
- if (retentionPolicy.getEffectiveTime() != null) {
- builder.setRetentionEffectiveTime(retentionPolicy.getEffectiveTime().getValue());
- }
- if (retentionPolicy.getIsLocked() != null) {
- builder.setRetentionPolicyIsLocked(retentionPolicy.getIsLocked());
- }
- if (retentionPolicy.getRetentionPeriod() != null) {
- builder.setRetentionPeriod(retentionPolicy.getRetentionPeriod());
- }
- }
return builder.build();
}
}
diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
index b67fe2645541..78f9390a67e4 100644
--- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
+++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
@@ -93,10 +93,9 @@ enum BucketField implements FieldSelector {
CORS("cors"),
STORAGE_CLASS("storageClass"),
ETAG("etag"),
+ @GcpLaunchStage.Beta
ENCRYPTION("encryption"),
- BILLING("billing"),
- DEFAULT_EVENT_BASED_HOLD("defaultEventBasedHold"),
- RETENTION_POLICY("retentionPolicy");
+ BILLING("billing");
static final List extends FieldSelector> REQUIRED_FIELDS = ImmutableList.of(NAME);
@@ -137,10 +136,8 @@ enum BlobField implements FieldSelector {
SIZE("size"),
STORAGE_CLASS("storageClass"),
TIME_DELETED("timeDeleted"),
+ @GcpLaunchStage.Beta
KMS_KEY_NAME("kmsKeyName"),
- EVENT_BASED_HOLD("eventBasedHold"),
- TEMPORARY_HOLD("temporaryHold"),
- RETENTION_EXPIRATION_TIME("retentionExpirationTime"),
UPDATED("updated");
static final List extends FieldSelector> REQUIRED_FIELDS = ImmutableList.of(BUCKET, NAME);
@@ -391,6 +388,7 @@ public static BlobTargetOption encryptionKey(String key) {
/**
* Returns an option to set a customer-managed key for server-side encryption of the blob.
*/
+ @GcpLaunchStage.Beta
public static BlobTargetOption kmsKeyName(String kmsKeyName) {
return new BlobTargetOption(StorageRpc.Option.KMS_KEY_NAME, kmsKeyName);
}
@@ -552,6 +550,7 @@ public static BlobWriteOption encryptionKey(String key) {
*
* @param kmsKeyName the KMS key resource id
*/
+ @GcpLaunchStage.Beta
public static BlobWriteOption kmsKeyName(String kmsKeyName) {
return new BlobWriteOption(Option.KMS_KEY_NAME, kmsKeyName);
}
@@ -1538,27 +1537,6 @@ public static Builder newBuilder() {
*/
Bucket get(String bucket, BucketGetOption... options);
- /**
- * Locks bucket retention policy. Requires a local metageneration value in the request. Review example below.
- *
- * Accepts an optional userProject {@link BucketTargetOption} option which defines the project id
- * to assign operational costs.
- *
- *
Warning: Once a retention policy is locked, it can't be unlocked, removed, or shortened.
- *
- *
Example of locking a retention policy on a bucket, only if its local metageneration value matches the bucket's
- * service metageneration otherwise a {@link StorageException} is thrown.
- *
{@code
- * String bucketName = "my_unique_bucket";
- * Bucket bucket = storage.get(bucketName, BucketGetOption.fields(BucketField.METAGENERATION));
- * storage.lockRetentionPolicy(bucket, BucketTargetOption.metagenerationMatch());
- * }
- *
- * @return a {@code Bucket} object of the locked bucket
- * @throws StorageException upon failure
- */
- Bucket lockRetentionPolicy(BucketInfo bucket, BucketTargetOption... options);
-
/**
* Returns the requested blob or {@code null} if not found.
*
diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
index 787388006571..e49445d13646 100644
--- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
+++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
@@ -983,23 +983,6 @@ public Boolean apply(String permission) {
}
}
- @Override
- public Bucket lockRetentionPolicy(BucketInfo bucketInfo, BucketTargetOption... options) {
- final com.google.api.services.storage.model.Bucket bucketPb = bucketInfo.toPb();
- final Map optionsMap = optionMap(bucketInfo, options);
- try {
- return Bucket.fromPb(this, runWithRetries(
- new Callable() {
- @Override
- public com.google.api.services.storage.model.Bucket call() {
- return storageRpc.lockRetentionPolicy(bucketPb, optionsMap);
- }
- }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()));
- } catch (RetryHelperException e) {
- throw StorageException.translateAndThrow(e);
- }
- }
-
@Override
public ServiceAccount getServiceAccount(final String projectId) {
try {
diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
index 39cbc3f99ef2..03db33dae835 100644
--- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
+++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
@@ -1208,23 +1208,6 @@ public Notification createNotification(String bucket, Notification notification)
}
}
- @Override
- public Bucket lockRetentionPolicy(Bucket bucket, Map