dimas-b commented on code in PR #2190:
URL: https://github.com/apache/polaris/pull/2190#discussion_r2277855485


##########
polaris-core/src/main/java/org/apache/polaris/core/secrets/SecretReference.java:
##########
@@ -51,7 +51,7 @@
  * the stored "secret material" as well as the referencePayload and any 
associated keys used for
  * encryption.
  */
-public class UserSecretReference {
+public class SecretReference {

Review Comment:
   nit: Is this rename critical to adding SigV4 support? It would have been 
nicer to do it in a separate PR without functional changes (to reduce 
distraction) :slightly_smiling_face: 



##########
polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java:
##########
@@ -338,6 +338,14 @@ public Builder setConnectionConfigInfoDpoWithSecrets(
       return this;
     }
 
+    public Builder setConnectionConfigInfoDpo(

Review Comment:
   This mean appears to be unused :thinking: 



##########
polaris-core/src/main/java/org/apache/polaris/core/identity/ServiceIdentityType.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.polaris.core.identity;
+
+import jakarta.annotation.Nonnull;
+import java.util.Arrays;
+import org.apache.polaris.core.identity.dpo.ServiceIdentityInfoDpo;
+
+/**
+ * The internal persistence-object counterpart to 
ServiceIdentityTypeInfo.ServiceIdentityTypeEnum
+ * defined in the API model. We define integer type codes in this enum for 
better compatibility
+ * within persisted data in case the names of enum types are ever changed in 
place.
+ *
+ * <p>Important: Codes must be kept in-sync with JsonSubTypes annotated within 
{@link
+ * ServiceIdentityInfoDpo}.
+ */
+public enum ServiceIdentityType {
+  NULL_TYPE(0),
+  AWS_IAM(1),
+  ;
+
+  private static final ServiceIdentityType[] REVERSE_MAPPING_ARRAY;
+
+  static {
+    // find max array size
+    int maxCode =
+        Arrays.stream(ServiceIdentityType.values())
+            .mapToInt(ServiceIdentityType::getCode)
+            .max()
+            .orElse(0);
+
+    // allocate mapping array
+    REVERSE_MAPPING_ARRAY = new ServiceIdentityType[maxCode + 1];
+
+    // populate mapping array
+    for (ServiceIdentityType authType : ServiceIdentityType.values()) {
+      REVERSE_MAPPING_ARRAY[authType.code] = authType;
+    }
+  }
+
+  private final int code;
+
+  ServiceIdentityType(int code) {
+    this.code = code;
+  }
+
+  /**
+   * Given the code associated with the type, return the associated 
ServiceIdentityType. Return
+   * NULL_TYPE if not found
+   *
+   * @param identityTypeCode code associated to the service identity type
+   * @return ServiceIdentityType corresponding to that code or null if mapping 
not found
+   */
+  public static @Nonnull ServiceIdentityType fromCode(int identityTypeCode) {
+    // ensure it is within bounds
+    if (identityTypeCode < 0 || identityTypeCode >= 
REVERSE_MAPPING_ARRAY.length) {
+      return NULL_TYPE;

Review Comment:
   What is the purpose of `NULL_TYPE`? It has a specific type code (`0`) but we 
map to it from other specific type codes... how is that meant to work 
end-to-end? :thinking: 



##########
polaris-core/src/main/java/org/apache/polaris/core/connection/ConnectionConfigInfoDpo.java:
##########
@@ -173,6 +194,15 @@ public static ConnectionConfigInfoDpo 
fromConnectionConfigInfoModelWithSecrets(
     return config;
   }
 
+  /**
+   * Creates a new copy of the ConnectionConfigInfoDpo with the given service 
identity info.
+   *
+   * @param serviceIdentityInfo The service identity info to set.
+   * @return A new copy of the ConnectionConfigInfoDpo with the given service 
identity info.
+   */
+  public abstract ConnectionConfigInfoDpo withServiceIdentity(

Review Comment:
   This method appears to be never called... Why add it in this PR?



##########
polaris-core/src/main/java/org/apache/polaris/core/identity/ServiceIdentityType.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.polaris.core.identity;
+
+import jakarta.annotation.Nonnull;
+import java.util.Arrays;
+import org.apache.polaris.core.identity.dpo.ServiceIdentityInfoDpo;
+
+/**
+ * The internal persistence-object counterpart to 
ServiceIdentityTypeInfo.ServiceIdentityTypeEnum
+ * defined in the API model. We define integer type codes in this enum for 
better compatibility
+ * within persisted data in case the names of enum types are ever changed in 
place.
+ *
+ * <p>Important: Codes must be kept in-sync with JsonSubTypes annotated within 
{@link
+ * ServiceIdentityInfoDpo}.
+ */
+public enum ServiceIdentityType {
+  NULL_TYPE(0),

Review Comment:
   What is the purpose of `NULL_TYPE`?



##########
polaris-core/src/main/java/org/apache/polaris/core/identity/ServiceIdentityType.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.polaris.core.identity;
+
+import jakarta.annotation.Nonnull;
+import java.util.Arrays;
+import org.apache.polaris.core.identity.dpo.ServiceIdentityInfoDpo;
+
+/**
+ * The internal persistence-object counterpart to 
ServiceIdentityTypeInfo.ServiceIdentityTypeEnum
+ * defined in the API model. We define integer type codes in this enum for 
better compatibility
+ * within persisted data in case the names of enum types are ever changed in 
place.
+ *
+ * <p>Important: Codes must be kept in-sync with JsonSubTypes annotated within 
{@link
+ * ServiceIdentityInfoDpo}.
+ */
+public enum ServiceIdentityType {
+  NULL_TYPE(0),

Review Comment:
   What is the purpose of `NULL_TYPE`?



-- 
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...@polaris.apache.org

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

Reply via email to