You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/11/03 15:27:58 UTC
Re: [PR] [HUDI-6695] Use the AWS provider chain in Glue sync and add a new provider for STS assume role [hudi]
hussein-awala commented on code in PR #9260:
URL: https://github.com/apache/hudi/pull/9260#discussion_r1381880071
##########
hudi-aws/src/main/java/org/apache/hudi/aws/credentials/HoodieConfigAWSAssumedRoleCredentialsProvider.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.aws.credentials;
+
+import org.apache.hudi.common.util.StringUtils;
+import org.apache.hudi.config.HoodieAWSConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.auth.credentials.AwsCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+import software.amazon.awssdk.services.sts.StsClient;
+import software.amazon.awssdk.services.sts.auth.StsAssumeRoleCredentialsProvider;
+import software.amazon.awssdk.services.sts.model.AssumeRoleRequest;
+
+import java.util.Properties;
+
+/**
+ * Credentials provider which assumes AWS role from Hoodie config and fetches its credentials.
+ */
+public class HoodieConfigAWSAssumedRoleCredentialsProvider implements AwsCredentialsProvider {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HoodieConfigAWSAssumedRoleCredentialsProvider.class);
+
+ private final StsAssumeRoleCredentialsProvider credentialsProvider;
+
+ public HoodieConfigAWSAssumedRoleCredentialsProvider(Properties props) {
+ if (!validConf(props)) {
Review Comment:
The validation is needed to switch to the second provider in the chain, as we do here:
https://github.com/apache/hudi/blob/e9dd73fc08fdae2943f9f2f7db7aa8a1feb630b1/hudi-aws/src/main/java/org/apache/hudi/aws/credentials/HoodieConfigAWSCredentialsProvider.java#L47-L50
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org