Please provide a data structure for common S3 information for modular libraries #1108
Closed
1 of 2 tasks
Labels
feature-request
A feature should be added or improved.
Describe the feature
When building a modular library that uses S3 as a backend, there are several things the library needs:
aws_sdk_s3::Client
to make requests with.expected_bucket_owner
, as a security cross-checkIt'd be nice to be able to put all of these together in a common data structure and pass that data structure to a library. Then, the library could make
get_object
orput_object
requests (for instance) with a default for thebucket
andexpected_bucket_owner
fields and a default prefix on thekey
.Use Case
I'd like to build modular libraries, and avoid having to pass all four of these fields separately to the
fn new
for the library's object(s) and handle them separately for each method.Proposed Solution
I can see 3 reasonable ways to do this:
Option 1 (simplest to implement):
key
prepend the prefix before setting the key.Downsides of this approach are that the library has to remember to pass the structure to every method call, and that the library has to accept both an S3 client and the structure.
Option 2 (simplest to use, slight overhead):
aws_sdk_s3::Client
(outside of theArc
, so that they're not shared amongClient
instances).Option 3 (reasonably simple to use, no overhead if not used, requires much more work in code generation):
aws_sdk_s3::Client
and adding these fields.Client
. When calling those methods, set the defaults.Of these three, I would personally recommend Option 2 or option 1, in that order of preference.
Other Information
No response
Acknowledgements
A note for the community
Community Note
The text was updated successfully, but these errors were encountered: