We can implement a helper function for S3Builder like async fn detect_region(&self) -> Result<Option<String>> to make it easier to find region.
I want an API of S3Builder like async fn detect_region(&self) -> Result<Option<String>>, it's used to fetch region with input endpoint and bucket. (Maybe API should be async fn detect_region(&self, endpoint: &str, bucket: &str)?)
The API should use the client in S3Builder to detect the region, the behavior will be similiar to
https://github.com/apache/incubator-opendal/blob/44e93563227e58520f07e0ebcf3be14601b59d9a/src/services/s3/backend.rs#L504-L604
The caller can use this function to detect region when they needed in async context. (Please note that S3Builder::build is blocking API, so we can't do this.)
We can implement a helper function for
S3Builderlikeasync fn detect_region(&self) -> Result<Option<String>>to make it easier to find region.I want an API of
S3Builderlikeasync fn detect_region(&self) -> Result<Option<String>>, it's used to fetchregionwith inputendpointandbucket. (Maybe API should beasync fn detect_region(&self, endpoint: &str, bucket: &str)?)The API should use the client in
S3Builderto detect the region, the behavior will be similiar tohttps://github.com/apache/incubator-opendal/blob/44e93563227e58520f07e0ebcf3be14601b59d9a/src/services/s3/backend.rs#L504-L604
The caller can use this function to detect region when they needed in async context. (Please note that
S3Builder::buildis blocking API, so we can't do this.)