Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion crates/iceberg/src/io/storage_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ pub const S3_ASSUME_ROLE_ARN: &str = "client.assume-role.arn";
pub const S3_ASSUME_ROLE_EXTERNAL_ID: &str = "client.assume-role.external-id";
/// Optional session name used to assume an IAM role.
pub const S3_ASSUME_ROLE_SESSION_NAME: &str = "client.assume-role.session-name";
/// Option to skip signing request (e.g. for public buckets/folders)
pub const S3_ALLOW_ANONYMOUS: &str = "s3.allow-anonymous";
/// Option to skip loading the credential from EC2 metadata (typically used in conjunction with
/// `S3_ALLOW_ANONYMOUS`)
pub const S3_DISABLE_EC2_METADATA: &str = "s3.disable-ec2-metadata";

/// Parse iceberg props to s3 config.
pub(crate) fn s3_config_parse(mut m: HashMap<String, String>) -> Result<S3Config> {
Expand All @@ -81,7 +86,7 @@ pub(crate) fn s3_config_parse(mut m: HashMap<String, String>) -> Result<S3Config
cfg.region = Some(region);
};
if let Some(path_style_access) = m.remove(S3_PATH_STYLE_ACCESS) {
if ["true", "True", "1"].contains(&path_style_access.as_str()) {
if ["true", "t", "1"].contains(&path_style_access.to_lowercase().as_str()) {
cfg.enable_virtual_host_style = true;
}
};
Expand Down Expand Up @@ -126,6 +131,17 @@ pub(crate) fn s3_config_parse(mut m: HashMap<String, String>) -> Result<S3Config
}
};

if let Some(allow_anonymous) = m.remove(S3_ALLOW_ANONYMOUS) {
if ["true", "t", "1", "on"].contains(&allow_anonymous.to_lowercase().as_str()) {
cfg.allow_anonymous = true;
}
}
if let Some(disable_ec2_metadata) = m.remove(S3_DISABLE_EC2_METADATA) {
if ["true", "t", "1", "on"].contains(&disable_ec2_metadata.to_lowercase().as_str()) {
cfg.disable_ec2_metadata = true;
}
};

Ok(cfg)
}

Expand Down
Loading