singhpk234 commented on code in PR #17111:
URL: https://github.com/apache/iceberg/pull/17111#discussion_r3611404741
##########
gcp/src/main/java/org/apache/iceberg/gcp/GCPProperties.java:
##########
@@ -44,6 +44,14 @@ public class GCPProperties implements Serializable {
public static final String GCS_ENCRYPTION_KEY = "gcs.encryption-key";
public static final String GCS_USER_PROJECT = "gcs.user-project";
+ /**
+ * Configure an alternative endpoint of the KMS service for
GcpKeyManagementClient to access.
+ *
+ * <p>This could be used to use KMS key management with any KMS-compatible
service that has a
+ * different endpoint
+ */
+ public static final String KMS_ENDPOINT = "kms.endpoint";
Review Comment:
interesting / no action required : i think this config makes sense, now
though when i see everything is gcs prefixed :( , I wish we cloud standarized
this before.
##########
gcp/src/test/java/org/apache/iceberg/gcp/TestGcpKeyManagementClient.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.iceberg.gcp;
+
+import static org.apache.iceberg.gcp.GCPProperties.GCS_NO_AUTH;
+import static org.apache.iceberg.gcp.GCPProperties.KMS_ENDPOINT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+
+class TestGcpKeyManagementClient {
+ @Test
+ void kmsEndpoint() {
+ try (GcpKeyManagementClient client = new GcpKeyManagementClient()) {
+ String endpoint = "example.com:443";
+ client.initialize(Map.of(GCS_NO_AUTH, "true", KMS_ENDPOINT, endpoint));
+
+
assertThat(client.kmsClient().getSettings().getEndpoint()).isEqualTo(endpoint);
+ }
+ }
+
+ @Test
+ void invalidKmsEndpoint() {
+ try (GcpKeyManagementClient client = new GcpKeyManagementClient()) {
+ client.initialize(Map.of(GCS_NO_AUTH, "true", KMS_ENDPOINT,
"example.com"));
Review Comment:
This is an SDK side validation ?
##########
gcp/src/main/java/org/apache/iceberg/gcp/GCPProperties.java:
##########
@@ -231,6 +241,10 @@ public Optional<String> userProject() {
return Optional.ofNullable(gcsUserProject);
}
+ public Optional<String> kmsEndpoint() {
+ return Optional.ofNullable(kmsEndpoint);
+ }
Review Comment:
should we add a test inside GCPProperties for this too ?
--
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]