File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ use super::{
6969// in bytes
7070// const MULTIPART_UPLOAD_SIZE: usize = 1024 * 1024 * 100;
7171const AWS_CONTAINER_CREDENTIALS_RELATIVE_URI : & str = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" ;
72+ const AWS_WEB_IDENTITY_TOKEN_FILE : & str = "AWS_WEB_IDENTITY_TOKEN_FILE" ;
73+ const AWS_ROLE_ARN : & str = "AWS_ROLE_ARN" ;
74+ const AWS_ROLE_SESSION_NAME : & str = "AWS_ROLE_SESSION_NAME" ;
7275
7376#[ derive( Debug , Clone , clap:: Args ) ]
7477#[ command(
@@ -269,6 +272,20 @@ impl S3Config {
269272 . with_secret_access_key ( secret_key) ;
270273 }
271274
275+ if self . access_key_id . is_none ( ) && self . secret_key . is_none ( ) {
276+ if let Ok ( token_file) = std:: env:: var ( AWS_WEB_IDENTITY_TOKEN_FILE ) {
277+ builder = builder. with_config ( AmazonS3ConfigKey :: WebIdentityTokenFile , token_file) ;
278+ }
279+
280+ if let Ok ( role_arn) = std:: env:: var ( AWS_ROLE_ARN ) {
281+ builder = builder. with_config ( AmazonS3ConfigKey :: RoleArn , role_arn) ;
282+ }
283+
284+ if let Ok ( session_name) = std:: env:: var ( AWS_ROLE_SESSION_NAME ) {
285+ builder = builder. with_config ( AmazonS3ConfigKey :: RoleSessionName , session_name) ;
286+ }
287+ }
288+
272289 if let Some ( ssec_encryption_key) = & self . ssec_encryption_key {
273290 match ssec_encryption_key {
274291 SSECEncryptionKey :: SseC {
You can’t perform that action at this time.
0 commit comments