nastra commented on code in PR #12612:
URL: https://github.com/apache/iceberg/pull/12612#discussion_r2011475530


##########
aws/src/main/java/org/apache/iceberg/aws/s3/VendedCredentialsProvider.java:
##########
@@ -43,7 +43,8 @@
 import software.amazon.awssdk.utils.cache.RefreshResult;
 
 public class VendedCredentialsProvider implements AwsCredentialsProvider, 
SdkAutoCloseable {
-  public static final String URI = "credentials.uri";
+  public static final String URI = "credentials.catalog.uri";

Review Comment:
   instead of renaming this and introducing another property, we can do it also 
like this:
   
   ```
   --- 
a/aws/src/main/java/org/apache/iceberg/aws/s3/VendedCredentialsProvider.java
   +++ 
b/aws/src/main/java/org/apache/iceberg/aws/s3/VendedCredentialsProvider.java
   @@ -24,6 +24,7 @@ import java.util.List;
    import java.util.Map;
    import java.util.Optional;
    import java.util.stream.Collectors;
   +import org.apache.iceberg.CatalogProperties;
    import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
    import org.apache.iceberg.relocated.com.google.common.base.Strings;
    import org.apache.iceberg.rest.ErrorHandlers;
   @@ -47,12 +48,16 @@ public class VendedCredentialsProvider implements 
AwsCredentialsProvider, SdkAut
      private volatile HTTPClient client;
      private final Map<String, String> properties;
      private final CachedSupplier<AwsCredentials> credentialCache;
   +  private final String catalogEndpoint;
   +  private final String credentialsEndpoint;
      private AuthManager authManager;
      private AuthSession authSession;
   
      private VendedCredentialsProvider(Map<String, String> properties) {
        Preconditions.checkArgument(null != properties, "Invalid properties: 
null");
   -    Preconditions.checkArgument(null != properties.get(URI), "Invalid URI: 
null");
   +    Preconditions.checkArgument(null != properties.get(URI), "Invalid 
credentials URI: null");
   +    this.credentialsEndpoint = properties.get(URI);
   +    this.catalogEndpoint = properties.getOrDefault(CatalogProperties.URI, 
credentialsEndpoint);
        this.properties = properties;
        this.credentialCache =
            CachedSupplier.builder(() -> 
credentialFromProperties().orElseGet(this::refreshCredential))
   @@ -82,7 +87,7 @@ public class VendedCredentialsProvider implements 
AwsCredentialsProvider, SdkAut
          synchronized (this) {
            if (null == client) {
              authManager = 
AuthManagers.loadAuthManager("s3-credentials-refresh", properties);
   -          HTTPClient httpClient = 
HTTPClient.builder(properties).uri(properties.get(URI)).build();
   +          HTTPClient httpClient = 
HTTPClient.builder(properties).uri(catalogEndpoint).build();
              authSession = authManager.catalogSession(httpClient, properties);
              client = httpClient.withAuthSession(authSession);
            }
   @@ -95,7 +100,7 @@ public class VendedCredentialsProvider implements 
AwsCredentialsProvider, SdkAut
      private LoadCredentialsResponse fetchCredentials() {
        return httpClient()
            .get(
   -            properties.get(URI),
   +            credentialsEndpoint,
                null,
                LoadCredentialsResponse.class,
                Map.of(),
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to