rambleraptor commented on code in PR #14749:
URL: https://github.com/apache/iceberg/pull/14749#discussion_r2591024742


##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -418,6 +422,36 @@ public static void renameTable(Catalog catalog, 
RenameTableRequest request) {
     catalog.renameTable(request.source(), request.destination());
   }
 
+  public static LoadCredentialsResponse loadCredentials(Catalog catalog, 
TableIdentifier ident) {
+    Table table = catalog.loadTable(ident);
+    Map<String, String> properties = table.properties();
+    List<Credential> credentials = new java.util.ArrayList<>();
+
+    // S3 credentials
+    Map<String, String> s3Config = new java.util.HashMap<>();
+    for (Map.Entry<String, String> entry : properties.entrySet()) {
+      if (entry.getKey().startsWith("s3.")) {
+        s3Config.put(entry.getKey(), entry.getValue());
+      }
+    }
+    if (!s3Config.isEmpty()) {
+      
credentials.add(ImmutableCredential.builder().prefix("s3://").config(s3Config).build());
+    }
+
+    // GCS credentials
+    Map<String, String> gcsConfig = new java.util.HashMap<>();
+    for (Map.Entry<String, String> entry : properties.entrySet()) {
+      if (entry.getKey().startsWith("gcs.")) {
+        gcsConfig.put(entry.getKey(), entry.getValue());
+      }
+    }

Review Comment:
   Please ignore this. I misunderstood what this method does. I've changed this 
PR and this code doesn't exist anymore.



##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -418,6 +422,36 @@ public static void renameTable(Catalog catalog, 
RenameTableRequest request) {
     catalog.renameTable(request.source(), request.destination());
   }
 
+  public static LoadCredentialsResponse loadCredentials(Catalog catalog, 
TableIdentifier ident) {
+    Table table = catalog.loadTable(ident);
+    Map<String, String> properties = table.properties();
+    List<Credential> credentials = new java.util.ArrayList<>();
+
+    // S3 credentials
+    Map<String, String> s3Config = new java.util.HashMap<>();
+    for (Map.Entry<String, String> entry : properties.entrySet()) {
+      if (entry.getKey().startsWith("s3.")) {
+        s3Config.put(entry.getKey(), entry.getValue());
+      }
+    }
+    if (!s3Config.isEmpty()) {
+      
credentials.add(ImmutableCredential.builder().prefix("s3://").config(s3Config).build());
+    }
+
+    // GCS credentials

Review Comment:
   Same as above. Sorry about that!



-- 
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]

Reply via email to