Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: add support to set assume role session name #555

Merged
merged 1 commit into from
Aug 16, 2024
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
6 changes: 5 additions & 1 deletion crates/iceberg/src/io/storage_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub const S3_SSE_MD5: &str = "s3.sse.md5";
pub const S3_ASSUME_ROLE_ARN: &str = "client.assume-role.arn";
/// Optional external ID used to assume an IAM role.
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";

/// Parse iceberg props to s3 config.
pub(crate) fn s3_config_parse(mut m: HashMap<String, String>) -> Result<S3Config> {
Expand All @@ -76,13 +78,15 @@ pub(crate) fn s3_config_parse(mut m: HashMap<String, String>) -> Result<S3Config
cfg.enable_virtual_host_style = true;
}
};

if let Some(arn) = m.remove(S3_ASSUME_ROLE_ARN) {
cfg.role_arn = Some(arn);
}
if let Some(external_id) = m.remove(S3_ASSUME_ROLE_EXTERNAL_ID) {
cfg.external_id = Some(external_id);
};
if let Some(session_name) = m.remove(S3_ASSUME_ROLE_SESSION_NAME) {
cfg.role_session_name = Some(session_name);
};
let s3_sse_key = m.remove(S3_SSE_KEY);
if let Some(sse_type) = m.remove(S3_SSE_TYPE) {
match sse_type.to_lowercase().as_str() {
Expand Down
Loading