Skip to content
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

Sample(storage): Soft deleted Bucket Restore #28760

Draft
wants to merge 71 commits into
base: main
Choose a base branch
from

Conversation

shubhangi-google
Copy link
Contributor

Add support for restoring soft deleted bucket.

Operation Supported:

  • Get Bucket Generation
  • Get a Soft Deleted Bucket (Also soft-delete time and hard-delete time)
  • List Soft Deleted Buckets
  • Restore a Soft Deleted Bucket
@example
require "google/cloud/storage"
storage = Google::Cloud::Storage.new
bucket = storage.bucket "my-bucket"
bucket.delete
##fetch bucket generation
 generation= bucket.generation
## list soft_deleted buckets
deleted_buckets= storage.buckets soft_deleted: true
## restore bucket
bucket = storage.restore_bucket "my-bucket", generation

@shubhangi-google shubhangi-google force-pushed the soft_deleted_bucket_restore_with_sample branch 2 times, most recently from 0085055 to 4bdeb8b Compare January 28, 2025 11:59
@shubhangi-google
Copy link
Contributor Author

shubhangi-google commented Jan 28, 2025

Please ignore ci issues in this PR for now, This Pr is for tracking sample failures
we will update the PR when feature Pr is merged (#28138)

@bajajneha27 bajajneha27 added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jan 28, 2025
let(:new_bucket_name) { random_bucket_name }

it "get soft deleted bucket, its soft_delete_time and hard_delete_time" do
new_bucket = storage_client.create_bucket new_bucket_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this new bucket have soft_delete_policy ?
If not, we won't be able to recover the bucket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bajajneha27 on console I can see this for one of the ruby sample test bucket
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the soft_delete_policy set by default if you create a new bucket?

If not, you'll have to pass it while creating the new bucket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this is set by default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. Can you explicitly check the policy in test too, so that we're sure we've the policy in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bajajneha27 tried to set retention period for the bucket explicitly but getting same result
also I can see in this doc (https://cloud.google.com/storage/docs/soft-delete#retention-duration) that default soft deleted policy is set as 7 days for a bucket

@bajajneha27 bajajneha27 added kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:run Add this label to force Kokoro to re-run the tests. labels Feb 11, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants