adutra commented on code in PR #4103:
URL: https://github.com/apache/polaris/pull/4103#discussion_r3022017493


##########
polaris-core/src/main/java/org/apache/polaris/core/credentials/connection/ConnectionCredentials.java:
##########
@@ -33,52 +32,28 @@
  * other Iceberg REST catalogs).
  *
  * <p>Credentials may be temporary and include an expiration time.
- *
- * <p><b>Note:</b> This interface currently includes only {@code credentials} 
and {@code expiresAt}.
- * Additional fields like {@code extraProperties} and {@code 
internalProperties} (similar to {@link
- * StorageAccessConfig}) are not included for now but can be added later if 
needed for more complex
- * credential scenarios.
  */
-@PolarisImmutable
-public interface ConnectionCredentials {
-  /** Sensitive credential properties (e.g., access keys, tokens). */
-  Map<String, String> credentials();
+public record ConnectionCredentials(Map<String, String> credentials, 
Optional<Instant> expiresAt) {
 
-  /** Optional expiration time for the credentials. */
-  Optional<Instant> expiresAt();
+  public static final ConnectionCredentials EMPTY =
+      new ConnectionCredentials(Map.of(), Optional.empty());
 
   /**
-   * Get a credential value by property key.
-   *
-   * @param key the credential property to retrieve
-   * @return the credential value, or null if not present
+   * Creates ConnectionCredentials from a map of catalog access properties. 
Expiration timestamps
+   * are extracted and stored separately; credential properties are stored in 
the credentials map.
    */
-  default String get(CatalogAccessProperty key) {
-    return credentials().get(key.getPropertyName());
-  }
-
-  static ConnectionCredentials.Builder builder() {
-    return ImmutableConnectionCredentials.builder();
-  }
-
-  interface Builder {
-    @CanIgnoreReturnValue
-    Builder putCredential(String key, String value);
-
-    @CanIgnoreReturnValue
-    Builder expiresAt(Instant expiresAt);
-
-    default Builder put(CatalogAccessProperty key, String value) {
+  public static ConnectionCredentials of(Map<CatalogAccessProperty, String> 
properties) {

Review Comment:
   Just FYI it is possible to generate a builder for records with the 
Immutables library. But I agree that here, a factory method is good enough.



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

Reply via email to