docs: add samples for object retention#2417
Conversation
|
Here is the summary of changes. You are about to add 2 region tags.
This comment is generated by snippet-bot.
|
| System.out.println("StorageClass: " + blob.getStorageClass()); | ||
| System.out.println("TimeCreated: " + new Date(blob.getCreateTime())); | ||
| System.out.println("Last Metadata Update: " + new Date(blob.getUpdateTime())); | ||
| System.out.println("Object Retention Policy: " + blob.getRetention()); |
There was a problem hiding this comment.
GetBucketMetadata and this sample are missing test changes; please add them.
| import com.google.cloud.storage.StorageOptions; | ||
|
|
||
| public class CreateBucketWithObjectRetention { | ||
| public static void createBucketWithObjectRetention(String projectId, String bucketName) { |
There was a problem hiding this comment.
Is this sample required in docs? Wondering if users could be pointed to `BucketTargetOption.enableObjectRetention(true) instead of writing this sample in 8 languages.
There was a problem hiding this comment.
It's meant to go here: https://cloud.google.com/storage/docs/using-object-lock#enable-retentions
We want to have a sample for every use case on this page
There was a problem hiding this comment.
sg, thanks for clarifying.
| System.out.println(updated.getRetention().toString()); | ||
|
|
||
| // To modify an existing policy on an Unlocked object, pass in the override parameter | ||
| blob.toBuilder() |
There was a problem hiding this comment.
This looks like two samples in one; were you planning on splitting it or keeping as-is?
There was a problem hiding this comment.
Planning to keep as is. I think it's important that a user sees both cases, so keeping them in one sample makes sure that it can't be missed.
Adds object retention samples and tests