aws-sdk-rust
aws-sdk-rust copied to clipboard
Conversion from *Input to *FluentBuilder
Describe the feature
An easy way to convert from *Inputs to *FluentBuilders or a way to use an *Input as a request as-is.
(I suspect the former is easier to accomplish and less of a semver hazard.)
Use Case
When an *Input is constructed elsewhere and passed into a function that starts constructing the *FluentBuilder using the S3 client, we are forced to deconstruct the already valid Input into the .set_*() methods provided which is error prone.
Proposed Solution
Using Rust RFC format:
impl ListObjectsV2FluentBuilder {
pub fn from_input(input: ListObjectsV2Input) -> Self;
}
and etc. for other operations.
I'm mostly familiar with the S3 crate but imagine this applies to a wider scope.
Other Information
No response
Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
A note for the community
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue, please leave a comment
Very reasonable! If you want to take a stab at it yourself, the relevant code is here.
For your use case, would you want a From impl, or would something like .set_input() or input_mut() work?
I'm also interested in your use case—you could construct the fluent builder and pass it around, but is the issue that you don't have access to the client at the time?
Exactly. Our use case uses the Input and Output types in a trait interface that abstracts over in-memory, disk, and S3 "backends" but always trying to respect S3 parameter semantics.
Any of those alternative solutions would work for us, too.
I don't know if this helps your situation, but all input builder types have a send_with method: https://docs.rs/aws-sdk-s3/latest/aws_sdk_s3/operation/list_objects_v2/builders/struct.ListObjectsV2InputBuilder.html#method.send_with
Almost. Would be enough if there was either:
- a way to convert an Input back into an InputBuilder
- a similar
Input::send_with()
In general this just seems like a weird type dance that's done internally. Like, the thing that is sent is not the InputBuilder or the FluentBuilder; it's the Input! But it's so hard to use an input you have in any way.
Luckily, I have control of the interface so I decided to change everything to *InputBuilders which does solve my specific issue since I now have access to send_with().