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

feat(storage): Soft deleted Bucket Restore #28138

Open
wants to merge 25 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

Copy link
Contributor

@bajajneha27 bajajneha27 left a comment

Choose a reason for hiding this comment

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

Mark the PR ready for review once you're ready for it to be reviewed. Also please check the CI job failures.

google-cloud-storage/lib/google/cloud/storage/bucket.rb Outdated Show resolved Hide resolved
google-cloud-storage/lib/google/cloud/storage/bucket.rb Outdated Show resolved Hide resolved
google-cloud-storage/lib/google/cloud/storage/bucket.rb Outdated Show resolved Hide resolved
google-cloud-storage/lib/google/cloud/storage/project.rb Outdated Show resolved Hide resolved
google-cloud-storage/samples/Gemfile Outdated Show resolved Hide resolved
google-cloud-storage/samples/acceptance/buckets_test.rb Outdated Show resolved Hide resolved
def object_retention_param enable_object_retention
enable_object_retention ? Google::Apis::StorageV1::Bucket::ObjectRetention.new(mode: "Enabled") : nil
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably want to revert this change back and add the newline character back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did not understand your concerns here

google-cloud-storage/test/helper.rb Outdated Show resolved Hide resolved
@shubhangi-google shubhangi-google marked this pull request as ready for review December 21, 2024 05:52
Copy link

snippet-bot bot commented Dec 21, 2024

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Contributor

@bajajneha27 bajajneha27 left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Please fix the CI issues.

@@ -223,6 +232,10 @@ def buckets prefix: nil, token: nil, max: nil, user_project: nil
# account, transit costs will be billed to the given project. This
# parameter is required with requester pays-enabled buckets. The
# default is `nil`.
# @param [Integer] generation generation no of bucket
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# @param [Integer] generation generation no of bucket
# @param [Integer] generation Generation of the bucket

google-cloud-storage/lib/google/cloud/storage/project.rb Outdated Show resolved Hide resolved
@shubhangi-google
Copy link
Contributor Author

Hi @bajajneha27 @JesseLovelace can you please take a look at the sample failure
getting permission error on sample run

Google::Cloud::PermissionDeniedError: forbidden: 542339357638-cr0dserr2evg7sv1meghqeu703274f3h@developer.gserviceaccount.com does not have storage.buckets.get access to the Google Cloud Storage bucket. Permission 'storage.buckets.get' denied on resource (or it may not exist).

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.

2 participants