Skip to content

Comments

feat(services/s3): add configuration aliases for better Arrow object_store compatibility#6524

Merged
Xuanwo merged 3 commits intoapache:mainfrom
jackye1995:alias-s3
Aug 25, 2025
Merged

feat(services/s3): add configuration aliases for better Arrow object_store compatibility#6524
Xuanwo merged 3 commits intoapache:mainfrom
jackye1995:alias-s3

Conversation

@jackye1995
Copy link
Contributor

@jackye1995 jackye1995 commented Aug 22, 2025

Summary

This PR adds serde aliases to S3Config fields to support multiple configuration key naming conventions, enabling seamless migration from Arrow object_store and other file system libraries. Users can now use either OpenDAL's native field names or AWS-prefixed alternatives.

Changes

Added #[serde(alias = "...")] attributes to 12 key S3 configuration fields, following the exact same patterns used by Apache Arrow's object_store library.

Example Usage

// Original OpenDAL style (still works)
{
  "bucket": "my-bucket",
  "access_key_id": "AKIAI...",
  "secret_access_key": "wJalr..."
}

// AWS SDK style (now supported!)
{
  "aws_bucket": "my-bucket", 
  "aws_access_key_id": "AKIAI...",
  "aws_secret_access_key": "wJalr..."
}

Added Aliases

OpenDAL Field Added Aliases Arrow Reference
bucket aws_bucket, aws_bucket_name, bucket_name L1026
access_key_id aws_access_key_id L1022
secret_access_key aws_secret_access_key L1023
session_token aws_session_token, aws_token, token L1028
region aws_region L1025
endpoint aws_endpoint, aws_endpoint_url, endpoint_url L1027
enable_virtual_host_style aws_virtual_hosted_style_request, virtual_hosted_style_request L1029-L1030
checksum_algorithm aws_checksum_algorithm L1036
enable_request_payer aws_request_payer, request_payer L1044
server_side_encryption aws_server_side_encryption L1047-L1048
server_side_encryption_aws_kms_key_id aws_sse_kms_key_id L1049
server_side_encryption_customer_key aws_sse_customer_key_base64 L1053-L1054

Missing Configurations (Future Work)

These Arrow configurations are not yet available in OpenDAL and could be added in future PRs:

Arrow Configuration Aliases Reference Description
DefaultRegion aws_default_region, default_region L1024 Fallback region when region not specified
ImdsV1Fallback aws_imdsv1_fallback, imdsv1_fallback L1033 Allow fallback to IMDSv1 for credentials
UnsignedPayload aws_unsigned_payload, unsigned_payload L1035 Skip payload signing for performance
MetadataEndpoint aws_metadata_endpoint, metadata_endpoint L1034 Custom metadata service endpoint
ContainerCredentialsRelativeUri aws_container_credentials_relative_uri L1037 ECS container credentials
ContainerCredentialsFullUri aws_container_credentials_full_uri L1038 EKS pod credentials
ContainerAuthorizationTokenFile aws_container_authorization_token_file L1039 EKS auth token file
CopyIfNotExists aws_copy_if_not_exists, copy_if_not_exists L1041 Conditional copy operations
ConditionalPut aws_conditional_put, conditional_put L1042 Conditional put operations
SkipSignature aws_skip_signature, skip_signature L1040 Skip request signing
DisableTagging aws_disable_tagging, disable_tagging L1043 Disable object tagging
S3Express aws_s3_express, s3_express L1032 S3 Express One Zone support
BucketKeyEnabled aws_sse_bucket_key_enabled L1051-L1052 SSE-KMS bucket key optimization

Testing

  • ✅ Added comprehensive unit tests covering all aliases
  • ✅ All existing S3 tests pass (16/16)
  • ✅ Code compiles without warnings
  • ✅ Clippy passes without issues

Backward Compatibility

This change is fully backward compatible. All existing configurations continue to work exactly as before, with the new aliases providing additional flexibility.

Contributes to #6456

…tibility

Add serde aliases to S3Config fields to support multiple configuration key naming conventions.
This enables seamless migration from AWS SDK and other S3-compatible libraries by allowing
users to use either OpenDAL's native field names or AWS-prefixed alternatives.

## Added Aliases

| OpenDAL Field | Added Aliases | Arrow Reference |
|---------------|---------------|-----------------|
| `bucket` | `aws_bucket`, `aws_bucket_name`, `bucket_name` | [L1026](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1026) |
| `access_key_id` | `aws_access_key_id` | [L1022](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1022) |
| `secret_access_key` | `aws_secret_access_key` | [L1023](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1023) |
| `session_token` | `aws_session_token`, `aws_token`, `token` | [L1028](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1028) |
| `region` | `aws_region` | [L1025](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1025) |
| `endpoint` | `aws_endpoint`, `aws_endpoint_url`, `endpoint_url` | [L1027](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1027) |
| `enable_virtual_host_style` | `aws_virtual_hosted_style_request`, `virtual_hosted_style_request` | [L1029-L1030](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1029-L1030) |
| `checksum_algorithm` | `aws_checksum_algorithm` | [L1036](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1036) |
| `enable_request_payer` | `aws_request_payer`, `request_payer` | [L1044](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1044) |
| `server_side_encryption` | `aws_server_side_encryption` | [L1047-L1048](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1047-L1048) |
| `server_side_encryption_aws_kms_key_id` | `aws_sse_kms_key_id` | [L1049](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1049) |
| `server_side_encryption_customer_key` | `aws_sse_customer_key_base64` | [L1053-L1054](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1053-L1054) |

## Missing Configurations (Future Work)

These Arrow configurations are not yet available in OpenDAL:

| Arrow Configuration | Aliases | Reference | Description |
|-------------------|---------|-----------|-------------|
| `DefaultRegion` | `aws_default_region`, `default_region` | [L1024](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1024) | Fallback region when region not specified |
| `ImdsV1Fallback` | `aws_imdsv1_fallback`, `imdsv1_fallback` | [L1033](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1033) | Allow fallback to IMDSv1 for credentials |
| `UnsignedPayload` | `aws_unsigned_payload`, `unsigned_payload` | [L1035](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1035) | Skip payload signing for performance |
| `MetadataEndpoint` | `aws_metadata_endpoint`, `metadata_endpoint` | [L1034](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1034) | Custom metadata service endpoint |
| `ContainerCredentialsRelativeUri` | `aws_container_credentials_relative_uri` | [L1037](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1037) | ECS container credentials |
| `ContainerCredentialsFullUri` | `aws_container_credentials_full_uri` | [L1038](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1038) | EKS pod credentials |
| `ContainerAuthorizationTokenFile` | `aws_container_authorization_token_file` | [L1039](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1039) | EKS auth token file |
| `CopyIfNotExists` | `aws_copy_if_not_exists`, `copy_if_not_exists` | [L1041](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1041) | Conditional copy operations |
| `ConditionalPut` | `aws_conditional_put`, `conditional_put` | [L1042](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1042) | Conditional put operations |
| `SkipSignature` | `aws_skip_signature`, `skip_signature` | [L1040](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1040) | Skip request signing |
| `DisableTagging` | `aws_disable_tagging`, `disable_tagging` | [L1043](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1043) | Disable object tagging |
| `S3Express` | `aws_s3_express`, `s3_express` | [L1032](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1032) | S3 Express One Zone support |
| `BucketKeyEnabled` | `aws_sse_bucket_key_enabled` | [L1051-L1052](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/builder.rs#L1051-L1052) | SSE-KMS bucket key optimization |

Contributes to apache#6456

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@jackye1995 jackye1995 requested a review from Xuanwo as a code owner August 22, 2025 21:18
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Aug 22, 2025
- Fix clippy::bool_assert_comparison warnings by using assert!() instead of assert_eq!() with boolean literals
- Apply rustfmt formatting for multi-line serde attributes
- All tests continue to pass
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 22, 2025
@jackye1995 jackye1995 changed the title feat(services/s3): add configuration aliases for better AWS SDK compatibility feat(services/s3): add configuration aliases for better Arrow object_store compatibility Aug 22, 2025
- Split the combined test into 4 separate tests for better clarity
- test_s3_config_original_field_names: Tests original field names
- test_s3_config_aws_prefixed_aliases: Tests AWS-prefixed aliases
- test_s3_config_additional_aliases: Tests additional alias variations
- test_s3_config_encryption_aliases: Tests encryption-related aliases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@jackye1995 jackye1995 closed this Aug 23, 2025
@jackye1995 jackye1995 reopened this Aug 23, 2025
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 25, 2025
@Xuanwo Xuanwo merged commit b735bea into apache:main Aug 25, 2025
187 of 188 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants