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

Add option to support 'Requester Pays' buckets #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TomNaessens
Copy link

@TomNaessens TomNaessens commented Jan 16, 2024

Closes #57

GCS has an option on buckets to make them a "Requester Pays" type of bucket: https://cloud.google.com/storage/docs/requester-pays. In short, this allows tracing of who/what is actually requesting an upload/download.

To query a bucket where "requester pays" is enabled, the userProject needs to be added in the URL. The GCS Ruby library provides this as an optional user_project keyword argument to Project#bucket: https://github.com/googleapis/google-cloud-ruby/blob/7523214b3c64f88db5e96269b397b066abf4b92e/google-cloud-storage/lib/google/cloud/storage/project.rb#L208-L216

When this is not passed, an error is thrown when listing/uploading files in a requester-pays bucket: Bucket is a requester pays bucket but no user project provided. (Google::Cloud::InvalidArgumentError)

This MR adds support for "requester pays"-buckets by accepting a user_project parameter (defaults to nil) on the Storage initializer, which is then used when calling Project#bucket.

@TomNaessens
Copy link
Author

Hi @renchap,

I've pushed a v3.4.0 tag & release commit on our fork: Silverfin-Engineering@e400dd1. Feel free to pull that in if that would help you.

For this PR, let me know if you have any remarks, or if there's something I can help with!

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.

Support for "requester-pays" buckets
1 participant