This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 19af3d3 io: add support to set assume role session name (#555)
19af3d3 is described below
commit 19af3d371775a20f49e7ec263c3f55b2f1e73d05
Author: Matheus Alcantara <[email protected]>
AuthorDate: Fri Aug 16 10:00:28 2024 -0300
io: add support to set assume role session name (#555)
Partial fix for #527
---
crates/iceberg/src/io/storage_s3.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/crates/iceberg/src/io/storage_s3.rs
b/crates/iceberg/src/io/storage_s3.rs
index 7c5400c..1156401 100644
--- a/crates/iceberg/src/io/storage_s3.rs
+++ b/crates/iceberg/src/io/storage_s3.rs
@@ -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> {
@@ -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() {