Skip to content

Commit bcb28f2

Browse files
authored
[Storage] Bucket Lock (googleapis#3727)
* [Storage] Replay GCS Bucket Lock (googleapis#3645) * Add support for defaultEventBasedHold * Add support for Blob eventBasedHold * Add support for blob temporary holds * Remove Beta launch annotations for CMEK * Add support for lockRetentionPolicy and RetentionPolicy * Update FakeStorageRPC * codacy-bot review fix (final only) * Update getRetentionPolicyIsLocked() -> retentionPolicyIsLocked() and misc. * Address comments * Address comments * Address comments. * Small nits * Fix additional comments * [Storage] Bucket lock samples and bug fixes. (googleapis#3709) * Fix issue in tests, write bucket lock samples, and resolve issue in client library * Update documentation around Boolean returns to clarify different return caes. * Fix broken unit test * Address feedback * Fix typo in comments
1 parent c79f280 commit bcb28f2

19 files changed

Lines changed: 1255 additions & 285 deletions

File tree

google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
* <li>createBatch
6666
* <li>checksums, etags
6767
* <li>IAM operations</li>
68+
* <li>BucketLock operations</li>
6869
* </ul>
6970
* </ul>
7071
*/
@@ -520,6 +521,11 @@ public Notification createNotification(String bucket, Notification notification)
520521
throw new UnsupportedOperationException();
521522
}
522523

524+
@Override
525+
public Bucket lockRetentionPolicy(Bucket bucket, Map<Option, ?> options) {
526+
throw new UnsupportedOperationException();
527+
}
528+
523529
@Override
524530
public ServiceAccount getServiceAccount(String projectId) {
525531
return null;

google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,30 @@ Builder setCustomerEncryption(CustomerEncryption customerEncryption) {
402402
return this;
403403
}
404404

405-
@GcpLaunchStage.Beta
406405
@Override
407406
Builder setKmsKeyName(String kmsKeyName) {
408407
infoBuilder.setKmsKeyName(kmsKeyName);
409408
return this;
410409
}
411410

411+
@Override
412+
public Builder setEventBasedHold(Boolean eventBasedHold) {
413+
infoBuilder.setEventBasedHold(eventBasedHold);
414+
return this;
415+
}
416+
417+
@Override
418+
public Builder setTemporaryHold(Boolean temporaryHold) {
419+
infoBuilder.setTemporaryHold(temporaryHold);
420+
return this;
421+
}
422+
423+
@Override
424+
Builder setRetentionExpirationTime(Long retentionExpirationTime) {
425+
infoBuilder.setRetentionExpirationTime(retentionExpirationTime);
426+
return this;
427+
}
428+
412429
@Override
413430
public Blob build() {
414431
return new Blob(storage, infoBuilder);

0 commit comments

Comments
 (0)