r4ntix commented on PR #4035:
URL: https://github.com/apache/arrow-rs/pull/4035#issuecomment-1500352681
> Would it work to instead provide a method to get values by config key?
Exposing the internals of these structs is problematic from the perspective of
being able to make changes without breaking API compatibility
@tustvold thanks for the feedback.
Do you mean providing a function like `try_with_option` to convert the
config value back to `String` again?
I have considered code such as:
```rust
pub fn get_config_value(&self, key: impl AsRef<str>) ->
Result<Option<String>> {
let value = match AmazonS3ConfigKey::from_str(key.as_ref())? {
AmazonS3ConfigKey::AccessKeyId => self.access_key_id.clone(),
AmazonS3ConfigKey::SecretAccessKey =>
self.secret_access_key.clone(),
AmazonS3ConfigKey::Region | AmazonS3ConfigKey::DefaultRegion => {
self.region.clone()
}
AmazonS3ConfigKey::Bucket => self.bucket_name.clone(),
AmazonS3ConfigKey::Endpoint => self.endpoint.clone(),
AmazonS3ConfigKey::Token => self.token.clone(),
AmazonS3ConfigKey::ImdsV1Fallback =>
Some(self.imdsv1_fallback.to_string()),
AmazonS3ConfigKey::VirtualHostedStyleRequest => {
Some(self.virtual_hosted_style_request.to_string())
}
AmazonS3ConfigKey::MetadataEndpoint =>
self.metadata_endpoint.clone(),
AmazonS3ConfigKey::Profile => self.profile.clone(),
AmazonS3ConfigKey::UnsignedPayload =>
Some(self.unsigned_payload.to_string()),
AmazonS3ConfigKey::Checksum =>
Some(self.checksum_algorithm.to_string()),
};
Ok(value)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]