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


##########
core/src/test/java/org/apache/iceberg/rest/Route.java:
##########
@@ -131,7 +131,12 @@ enum Route {
       FetchScanTasksRequest.class,
       FetchScanTasksResponse.class),
   CANCEL_PLAN_TABLE_SCAN(
-      HTTPRequest.HTTPMethod.DELETE, ResourcePaths.V1_TABLE_SCAN_PLAN, null, 
null);
+      HTTPRequest.HTTPMethod.DELETE, ResourcePaths.V1_TABLE_SCAN_PLAN, null, 
null),
+  LOAD_TABLE_CREDENTIALS(

Review Comment:
   now the loadCreds supports adding `?=plan-id` in query param can we include 
that ? 



##########
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:
   I am not able to understand how the table props s3 properties are used here 
can you please elaborate ?



##########
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:
   can we add for azure ? 



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