tustvold commented on code in PR #3436:
URL: https://github.com/apache/arrow-rs/pull/3436#discussion_r1061644871
##########
object_store/src/aws/mod.rs:
##########
@@ -379,6 +390,197 @@ pub struct AmazonS3Builder {
client_options: ClientOptions,
}
+/// Configuration keys for [`AmazonS3Builder`]
+///
+/// Configuration via keys can be dome via the
[`try_with_option`](AmazonS3Builder::try_with_option)
+/// or [`with_options`](AmazonS3Builder::try_with_options) methods on the
builder.
+///
+/// # Example
+/// ```
+/// use std::collections::HashMap;
+/// use object_store::aws::{AmazonS3Builder, AmazonS3ConfigKey};
+///
+/// let options = HashMap::from([
+/// ("aws_access_key_id", "my-access-key-id"),
+/// ("aws_secret_access_key", "my-secret-access-key"),
+/// ]);
+/// let typed_options = vec![
+/// (AmazonS3ConfigKey::DefaultRegion, "my-default-region"),
+/// ];
+/// let azure = AmazonS3Builder::new()
+/// .try_with_options(options)
+/// .unwrap()
+/// .try_with_options(typed_options)
+/// .unwrap()
+/// .try_with_option(AmazonS3ConfigKey::Region, "my-region")
+/// .unwrap();
+/// ```
+#[derive(PartialEq, Eq, Hash, Clone, Debug, Copy, Serialize, Deserialize)]
+pub enum AmazonS3ConfigKey {
+ /// AWS Access Key
+ ///
+ /// See [`AmazonS3Builder::with_access_key_id`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_access_key_id`
+ /// - `access_key_id`
+ AccessKeyId,
+
+ /// Secret Access Key
+ ///
+ /// See [`AmazonS3Builder::with_secret_access_key`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_secret_access_key`
+ /// - `secret_access_key`
+ SecretAccessKey,
+
+ /// Region
+ ///
+ /// See [`AmazonS3Builder::with_region`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_region`
+ /// - `region`
+ Region,
+
+ /// Default region
+ ///
+ /// See [`AmazonS3Builder::with_region`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_default_region`
+ /// - `default_region`
+ DefaultRegion,
+
+ /// Bucket name
+ ///
+ /// See [`AmazonS3Builder::with_bucket_name`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_bucket`
+ /// - `aws_bucket_name`
+ /// - `bucket`
+ /// - `bucket_name`
+ Bucket,
+
+ /// Sets custom endpoint for communicating with AWS S3.
+ ///
+ /// See [`AmazonS3Builder::with_endpoint`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_endpoint`
+ /// - `aws_endpoint_url`
+ /// - `endpoint`
+ /// - `endpoint_url`
+ Endpoint,
+
+ /// Token to use for requests (passed to underlying provider)
+ ///
+ /// See [`AmazonS3Builder::with_token`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_session_token`
+ /// - `aws_token`
+ /// - `session_token`
+ /// - `token`
+ Token,
+
+ /// Fall back to ImdsV1
+ ///
+ /// See [`AmazonS3Builder::with_imdsv1_fallback`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_imdsv1_fallback`
+ /// - `imdsv1_fallback`
+ ImdsV1Fallback,
+
+ /// If virtual hosted style request has to be used
+ ///
+ /// See [`AmazonS3Builder::with_virtual_hosted_style_request`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_virtual_hosted_style_request`
+ /// - `virtual_hosted_style_request`
+ VirtualHostedStyleRequest,
+
+ /// Set the instance metadata endpoint
+ ///
+ /// See [`AmazonS3Builder::with_metadata_endpoint`] for details.
+ ///
+ /// Supported keys:
+ /// - `aws_metadata_endpoint`
+ /// - `metadata_endpoint`
+ MetadataEndpoint,
+
+ /// AWS profile name
+ ///
+ /// Supported keys:
+ /// - `aws_profile`
+ /// - `profile`
+ Profile,
+}
+
+impl AmazonS3ConfigKey {
+ /// Helper function to filter an iterator to only contain valid
configuration keys.
+ pub fn filter_options<
Review Comment:
Do we really need this?
--
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]