Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions core/services/s3/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ impl S3Builder {
self
}

/// Set assume_role_duration_seconds for this backend.
pub fn assume_role_duration_seconds(mut self, v: u32) -> Self {
self.config.assume_role_duration_seconds = Some(v);
self
}

/// Set default storage_class for this backend.
///
/// Available values:
Expand Down Expand Up @@ -850,6 +856,9 @@ impl Builder for S3Builder {
assume_role_provider =
assume_role_provider.with_role_session_name(role_session_name.clone());
}
if let Some(duration_seconds) = config.assume_role_duration_seconds {
assume_role_provider = assume_role_provider.with_duration_seconds(duration_seconds);
}
provider = ProvideCredentialChain::new().push(assume_role_provider);
}

Expand Down
2 changes: 2 additions & 0 deletions core/services/s3/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub struct S3Config {
pub external_id: Option<String>,
/// role_session_name for this backend.
pub role_session_name: Option<String>,
/// assume_role_duration_seconds for this backend.
pub assume_role_duration_seconds: Option<u32>,
/// Disable config load so that opendal will not load config from
/// environment.
///
Expand Down
Loading