SWJTU-ZhangLei commented on code in PR #49541: URL: https://github.com/apache/doris/pull/49541#discussion_r2053583328
########## fe/fe-core/src/main/java/org/apache/doris/common/util/S3Util.java: ########## @@ -39,32 +40,103 @@ import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.S3Configuration; +import software.amazon.awssdk.services.sts.StsClient; +import software.amazon.awssdk.services.sts.auth.StsAssumeRoleCredentialsProvider; import java.net.URI; import java.time.Duration; public class S3Util { - - public static S3Client buildS3Client(URI endpoint, String region, CloudCredential credential, - boolean isUsePathStyle) { - AwsCredentialsProvider scp; + private static AwsCredentialsProvider getAwsCredencialsProvider(CloudCredential credential) { + //todo zhanglei AwsCredentials awsCredential; + AwsCredentialsProvider awsCredentialsProvider; if (!credential.isTemporary()) { awsCredential = AwsBasicCredentials.create(credential.getAccessKey(), credential.getSecretKey()); } else { awsCredential = AwsSessionCredentials.create(credential.getAccessKey(), credential.getSecretKey(), credential.getSessionToken()); } + if (!credential.isWhole()) { - scp = AwsCredentialsProviderChain.of( + awsCredentialsProvider = AwsCredentialsProviderChain.of( SystemPropertyCredentialsProvider.create(), EnvironmentVariableCredentialsProvider.create(), WebIdentityTokenFileCredentialsProvider.create(), ProfileCredentialsProvider.create(), InstanceProfileCredentialsProvider.create()); } else { - scp = StaticCredentialsProvider.create(awsCredential); + awsCredentialsProvider = StaticCredentialsProvider.create(awsCredential); + } + + return awsCredentialsProvider; + } + + @Deprecated + public static S3Client buildS3Client(URI endpoint, String region, CloudCredential credential, Review Comment: > add comment what does it do and why it is deprecated I have talked with @morningman, the `DLFCatalog` which run on `aliyun oss` will used old `buildS3Client `, otherwise will use new function `buildS3Client` with different param ; so just keep the old one and mark as deprecated -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org