-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
|
@@ -68,6 +68,7 @@ public static void getObjectMetadata(String projectId, String bucketName, String | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like two samples in one; were you planning on splitting it or keeping as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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