awslabs / awslabs/aws-sdk-rust
Provide easy way to parse s3://foo/bar URI into (bucket,key) pair
- Dominant language
- Rust
- Stars
- 3.3k
- Forks
- 290
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 3
Description
### Describe the feature
It is common to receive s3 object locations via a URI such as `s3://foo/bar`. It would be nice if there was some S3Url object that implements FromStr such that I can easily extract the correct bucket and object strings from such a url.
### Use Case
I'm always frustrated when I have to rewrite the same "s3 URI" to (bucket , object) parser for every CLI application I write. This involves importing one of the url or http::Uri crates and splitting hostname and path and providing appropriate error handling. Additional several times I messed up by not removing the initial `/` from the path.
It would be nice if the s3 SDK provided such tooling to make processing s3 URIs more easy.
### Proposed Solution
I think some sort of S3Uri object that implements `FromStr` would be ideal as this integrates nicely into structopt and other CLI tooling.
### 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](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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
Contributor guide
Research direction
Start by locating the S3 URI parsing entry point and the proposed S3Url type implementing FromStr. Define the supported s3://bucket/key forms and error cases, then add tests showing the bucket and object strings are extracted without a leading slash. Done means the public parsing API supports the stated CLI use case and its behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100