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

storage: SignedURL should use Client/Bucket #1495

Closed
derekperkins opened this issue Jul 8, 2019 · 13 comments
Closed

storage: SignedURL should use Client/Bucket #1495

derekperkins opened this issue Jul 8, 2019 · 13 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@derekperkins
Copy link
Contributor

Client

storage

Describe Your Environment

Docker on GKE

Expected Behavior

SignedURL is available on a Bucket object, using the client stored on the bucket

Actual Behavior

SignedURLs uses a completely separate auth and client path

Is there a good reason for these to be separate? I know that #1130 is waiting to be merged that makes it a little less onerous to created SignedURLs, but my expectation is that the api should be bucketHandle.SignedURL("shared-object", opts), and the access details would be retrieved from the client. Would you be open to a PR?

cc @josephbergevin @mordfustang

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jul 9, 2019
@jeanbza jeanbza added api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Jul 9, 2019
@jeanbza
Copy link
Member

jeanbza commented Jul 9, 2019

cc @frankyn

Speaking for myself, I don't have a strong preference either way. I believe SignedURL_ is sometimes used to hand out URLs for a variety of projects/buckets, so doing the NewClient/Bucket song and dance repeatedly could be annoying. But I could see this being convenient, too, and probably pretty low footprint.

FYI we don't accept PRs - see our CONTRIBUTING.md for details on the contributing process. (we use gerrit)

@frankyn
Copy link
Member

frankyn commented Jul 9, 2019

Hi @derekperkins,

A subset of other storage language clients such as the PHP, Python and Ruby provide resource level signed URLs for both bucket and object. It can help reduce context overhead of providing the bucket name each time.

The best way to get this in is if you can send us a Gerrit contribution and we can help review and get it into the library.

Thanks for your feedback!

@derekperkins
Copy link
Contributor Author

I think we'll go ahead and submit a Gerrit contribution. It's just very strange that almost everything in the package runs from the client except SignedURL. We generally make all our clients in main() and pass through into our code, but this breaks that assumption.

@frankyn
Copy link
Member

frankyn commented Jul 10, 2019

You have a good point, it's very strange that almost everything in the package runs from the client except SignedURL. I honestly didn't see it until you pointed it out.

Looking at history in the past bucket and object operations were in a similar situation. It may have been missed or as Jean stated reduced overhead by not adding it into the client.

After #1130 is resolved then the method SignedUrl being added to at the Client and Bucket would help improve the experience when passing only the client in projects.
That said, I don't think this feature should be blocked by #1130 given it's an alias storage.SignedUrl. Please move forward if you are available.

Thanks @derekperkins, we look forward to your contribution!

@broady
Copy link
Contributor

broady commented Jul 17, 2019

Kinda my fault.

When I moved the storage package to the Client/BucketHandle/ObjectHandle pattern, I didn't move SignedURL because it didn't perform any network operation. There's no other reason that it isn't under Client/BucketHandle/ObjectHandle. I didn't foresee the client options being useful for the SignedURL function.

Today, I think it makes sense to move under ObjectHandle.

@broady
Copy link
Contributor

broady commented Jul 17, 2019

FWIW, I didn't read OP closely, which suggests BucketHandle. I do think this should be on ObjectHandle (or Client, if we really think we want to avoid allocs of the Handles).

@odeke-em
Copy link
Contributor

Thank you Derek, Jean, Frank and Chris!

FWIW, I didn't read OP closely, which suggests BucketHandle. I do think this should be on ObjectHandle (or Client, if we really think we want to avoid allocs of the Handles).

I think let's add the method SignedURL to the BucketHandle because:
a) The bucket is a must
b) If an object isn't specified, then the user has requested for signed access to a bucket

Adding the method to ObjectHandle would mean (as you've mentioned) that we are creating a new ObjectHandle and yet as per point b) an object is optional but the bucket is a must.

@odeke-em
Copy link
Contributor

To kick off the conversation, I've mailed https://code-review.googlesource.com/c/gocloud/+/42871

@derekperkins
Copy link
Contributor Author

derekperkins commented Jul 18, 2019

Thanks! That works exactly how I would expect it to. If someone feels strongly about it also being available on ObjectHandle, it's a pretty simple convenience wrapper to use this BucketHandle method.

@broady
Copy link
Contributor

broady commented Jul 18, 2019 via email

@voodoo-dn
Copy link

What about this feature? Will be this feature reanimated?

@tritone
Copy link
Contributor

tritone commented Sep 8, 2021

A PR for this is up at #4604, taking the BucketHandle approach and also taking care of auth requirements automatically. Feel free to comment if you have thoughts.

@tritone
Copy link
Contributor

tritone commented Oct 11, 2021

This was resolved in #4604.

@tritone tritone closed this as completed Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

8 participants