jackye1995 commented on code in PR #5684:
URL: https://github.com/apache/iceberg/pull/5684#discussion_r971331414
##########
aws/src/main/java/org/apache/iceberg/aws/AwsProperties.java:
##########
@@ -726,13 +829,129 @@ public void setS3DeleteEnabled(boolean s3DeleteEnabled) {
this.isS3DeleteEnabled = s3DeleteEnabled;
}
- private Set<Tag> toTags(Map<String, String> properties, String prefix) {
+ private Set<Tag> toS3Tags(Map<String, String> properties, String prefix) {
return PropertyUtil.propertiesWithPrefix(properties,
prefix).entrySet().stream()
.map(e -> Tag.builder().key(e.getKey()).value(e.getValue()).build())
.collect(Collectors.toSet());
}
+ private Set<software.amazon.awssdk.services.sts.model.Tag> toStsTags(
+ Map<String, String> properties, String prefix) {
+ return PropertyUtil.propertiesWithPrefix(properties,
prefix).entrySet().stream()
+ .map(
+ e ->
+ software.amazon.awssdk.services.sts.model.Tag.builder()
+ .key(e.getKey())
+ .value(e.getValue())
+ .build())
+ .collect(Collectors.toSet());
+ }
+
public Map<String, String> s3BucketToAccessPointMapping() {
return s3BucketToAccessPointMapping;
}
+
+ private boolean s3KeyIdAccessKeyBothConfigured() {
+ return (s3AccessKeyId == null) == (s3SecretAccessKey == null);
+ }
+
+ private AwsCredentialsProvider credentialsProvider(
+ String accessKeyId, String secretAccessKey, String sessionToken) {
+ if (accessKeyId != null) {
+ if (sessionToken == null) {
+ return StaticCredentialsProvider.create(
+ AwsBasicCredentials.create(accessKeyId, secretAccessKey));
+ } else {
+ return StaticCredentialsProvider.create(
+ AwsSessionCredentials.create(accessKeyId, secretAccessKey,
sessionToken));
+ }
+ } else {
+ return DefaultCredentialsProvider.create();
+ }
+ }
+
+ /**
+ * Configure the credentials for an S3 client.
+ *
+ * <p>Sample usage:
Review Comment:
use `<pre>` tag for code examples
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]