This is an automated email from the ASF dual-hosted git repository.

amoghj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new dec84c0549 Core: Remove credentials from LoadViewResponse (#11432)
dec84c0549 is described below

commit dec84c0549e80b113b3bb6799dcaf3f6d3c59fed
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Wed Oct 30 18:30:55 2024 +0100

    Core: Remove credentials from LoadViewResponse (#11432)
---
 .../iceberg/rest/responses/LoadViewResponse.java   |   8 --
 .../rest/responses/LoadViewResponseParser.java     |  16 ---
 .../rest/responses/TestLoadViewResponseParser.java | 111 ---------------------
 3 files changed, 135 deletions(-)

diff --git 
a/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponse.java 
b/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponse.java
index d7f9040e77..d07ba872fd 100644
--- a/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponse.java
+++ b/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponse.java
@@ -18,11 +18,8 @@
  */
 package org.apache.iceberg.rest.responses;
 
-import java.util.List;
 import java.util.Map;
-import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
 import org.apache.iceberg.rest.RESTResponse;
-import org.apache.iceberg.rest.credentials.Credential;
 import org.apache.iceberg.view.ViewMetadata;
 import org.immutables.value.Value;
 
@@ -34,11 +31,6 @@ public interface LoadViewResponse extends RESTResponse {
 
   Map<String, String> config();
 
-  @Value.Default
-  default List<Credential> credentials() {
-    return ImmutableList.of();
-  }
-
   @Override
   default void validate() {
     // nothing to validate as it's not possible to create an invalid instance
diff --git 
a/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponseParser.java
 
b/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponseParser.java
index aedf05cf62..a8aaf17e5d 100644
--- 
a/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponseParser.java
+++ 
b/core/src/main/java/org/apache/iceberg/rest/responses/LoadViewResponseParser.java
@@ -22,8 +22,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
-import org.apache.iceberg.rest.credentials.Credential;
-import org.apache.iceberg.rest.credentials.CredentialParser;
 import org.apache.iceberg.util.JsonUtil;
 import org.apache.iceberg.view.ViewMetadata;
 import org.apache.iceberg.view.ViewMetadataParser;
@@ -33,7 +31,6 @@ public class LoadViewResponseParser {
   private static final String METADATA_LOCATION = "metadata-location";
   private static final String METADATA = "metadata";
   private static final String CONFIG = "config";
-  private static final String STORAGE_CREDENTIALS = "storage-credentials";
 
   private LoadViewResponseParser() {}
 
@@ -59,15 +56,6 @@ public class LoadViewResponseParser {
       JsonUtil.writeStringMap(CONFIG, response.config(), gen);
     }
 
-    if (!response.credentials().isEmpty()) {
-      gen.writeArrayFieldStart(STORAGE_CREDENTIALS);
-      for (Credential credential : response.credentials()) {
-        CredentialParser.toJson(credential, gen);
-      }
-
-      gen.writeEndArray();
-    }
-
     gen.writeEndObject();
   }
 
@@ -92,10 +80,6 @@ public class LoadViewResponseParser {
       builder.config(JsonUtil.getStringMap(CONFIG, json));
     }
 
-    if (json.hasNonNull(STORAGE_CREDENTIALS)) {
-      
builder.addAllCredentials(LoadCredentialsResponseParser.fromJson(json).credentials());
-    }
-
     return builder.build();
   }
 }
diff --git 
a/core/src/test/java/org/apache/iceberg/rest/responses/TestLoadViewResponseParser.java
 
b/core/src/test/java/org/apache/iceberg/rest/responses/TestLoadViewResponseParser.java
index 086db0fec8..f3de08cd29 100644
--- 
a/core/src/test/java/org/apache/iceberg/rest/responses/TestLoadViewResponseParser.java
+++ 
b/core/src/test/java/org/apache/iceberg/rest/responses/TestLoadViewResponseParser.java
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.iceberg.Schema;
 import org.apache.iceberg.catalog.Namespace;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
-import org.apache.iceberg.rest.credentials.ImmutableCredential;
 import org.apache.iceberg.types.Types;
 import org.apache.iceberg.view.ImmutableViewVersion;
 import org.apache.iceberg.view.ViewMetadata;
@@ -246,114 +245,4 @@ public class TestLoadViewResponseParser {
     
assertThat(LoadViewResponseParser.toJson(LoadViewResponseParser.fromJson(json), 
true))
         .isEqualTo(expectedJson);
   }
-
-  @Test
-  public void roundTripSerdeWithCredentials() {
-    String uuid = "386b9f01-002b-4d8c-b77f-42c3fd3b7c9b";
-    ViewMetadata viewMetadata =
-        ViewMetadata.builder()
-            .assignUUID(uuid)
-            .setLocation("location")
-            .addSchema(new Schema(Types.NestedField.required(1, "x", 
Types.LongType.get())))
-            .addVersion(
-                ImmutableViewVersion.builder()
-                    .schemaId(0)
-                    .versionId(1)
-                    .timestampMillis(23L)
-                    .defaultNamespace(Namespace.of("ns1"))
-                    .build())
-            .setCurrentVersionId(1)
-            .build();
-
-    LoadViewResponse response =
-        ImmutableLoadViewResponse.builder()
-            .metadata(viewMetadata)
-            .metadataLocation("custom-location")
-            .addCredentials(
-                ImmutableCredential.builder()
-                    .prefix("s3://custom-uri")
-                    .config(
-                        ImmutableMap.of(
-                            "s3.access-key-id",
-                            "keyId",
-                            "s3.secret-access-key",
-                            "accessKey",
-                            "s3.session-token",
-                            "sessionToken"))
-                    .build())
-            .addCredentials(
-                ImmutableCredential.builder()
-                    .prefix("gs://custom-uri")
-                    .config(
-                        ImmutableMap.of(
-                            "gcs.oauth2.token", "gcsToken1", 
"gcs.oauth2.token-expires-at", "1000"))
-                    .build())
-            .addCredentials(
-                ImmutableCredential.builder()
-                    .prefix("gs")
-                    .config(
-                        ImmutableMap.of(
-                            "gcs.oauth2.token", "gcsToken2", 
"gcs.oauth2.token-expires-at", "2000"))
-                    .build())
-            .build();
-
-    String expectedJson =
-        "{\n"
-            + "  \"metadata-location\" : \"custom-location\",\n"
-            + "  \"metadata\" : {\n"
-            + "    \"view-uuid\" : \"386b9f01-002b-4d8c-b77f-42c3fd3b7c9b\",\n"
-            + "    \"format-version\" : 1,\n"
-            + "    \"location\" : \"location\",\n"
-            + "    \"schemas\" : [ {\n"
-            + "      \"type\" : \"struct\",\n"
-            + "      \"schema-id\" : 0,\n"
-            + "      \"fields\" : [ {\n"
-            + "        \"id\" : 1,\n"
-            + "        \"name\" : \"x\",\n"
-            + "        \"required\" : true,\n"
-            + "        \"type\" : \"long\"\n"
-            + "      } ]\n"
-            + "    } ],\n"
-            + "    \"current-version-id\" : 1,\n"
-            + "    \"versions\" : [ {\n"
-            + "      \"version-id\" : 1,\n"
-            + "      \"timestamp-ms\" : 23,\n"
-            + "      \"schema-id\" : 0,\n"
-            + "      \"summary\" : { },\n"
-            + "      \"default-namespace\" : [ \"ns1\" ],\n"
-            + "      \"representations\" : [ ]\n"
-            + "    } ],\n"
-            + "    \"version-log\" : [ {\n"
-            + "      \"timestamp-ms\" : 23,\n"
-            + "      \"version-id\" : 1\n"
-            + "    } ]\n"
-            + "  },\n"
-            + "  \"storage-credentials\" : [ {\n"
-            + "    \"prefix\" : \"s3://custom-uri\",\n"
-            + "    \"config\" : {\n"
-            + "      \"s3.access-key-id\" : \"keyId\",\n"
-            + "      \"s3.secret-access-key\" : \"accessKey\",\n"
-            + "      \"s3.session-token\" : \"sessionToken\"\n"
-            + "    }\n"
-            + "  }, {\n"
-            + "    \"prefix\" : \"gs://custom-uri\",\n"
-            + "    \"config\" : {\n"
-            + "      \"gcs.oauth2.token\" : \"gcsToken1\",\n"
-            + "      \"gcs.oauth2.token-expires-at\" : \"1000\"\n"
-            + "    }\n"
-            + "  }, {\n"
-            + "    \"prefix\" : \"gs\",\n"
-            + "    \"config\" : {\n"
-            + "      \"gcs.oauth2.token\" : \"gcsToken2\",\n"
-            + "      \"gcs.oauth2.token-expires-at\" : \"2000\"\n"
-            + "    }\n"
-            + "  } ]\n"
-            + "}";
-
-    String json = LoadViewResponseParser.toJson(response, true);
-    assertThat(json).isEqualTo(expectedJson);
-    // can't do an equality comparison because Schema doesn't implement 
equals/hashCode
-    
assertThat(LoadViewResponseParser.toJson(LoadViewResponseParser.fromJson(json), 
true))
-        .isEqualTo(expectedJson);
-  }
 }

Reply via email to