From d329af2c67fea7fcc0384e8ef287c2b4b0c0bf28 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 9 Mar 2025 11:31:02 +0100 Subject: [PATCH] deprecate default methods to read specific database credentials (#92) The interface has some methods to read database credentials from specific mountpoints like "mysql". While ann database mounts share the same credential endpoints, the mount point itself can have any name. Let's clean up some methods of low benefit and deprecate the convenience methods. Trivial replacement is `getDbCredentials()` with explicit mount point, if it's actually mounted on that path. --- CHANGELOG.md | 3 +++ .../stklcode/jvault/connector/VaultConnector.java | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92d6957..f8d61d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## unreleased +### Deprecations +* `read...Credentials()` methods for specific database mounts (#92) + ### Dependencies * Updated Jackson to 2.18.3 (#90) diff --git a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java index 3d82ba1..8ad17ea 100644 --- a/src/main/java/de/stklcode/jvault/connector/VaultConnector.java +++ b/src/main/java/de/stklcode/jvault/connector/VaultConnector.java @@ -681,7 +681,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return the credentials response * @throws VaultConnectorException on error * @since 0.5.0 + * @deprecated use {@link #readDbCredentials(String, String)} your MySQL mountpoint */ + @Deprecated(since = "1.5.0", forRemoval = true) default CredentialsResponse readMySqlCredentials(final String role) throws VaultConnectorException { return readDbCredentials(role, "mysql"); } @@ -693,7 +695,9 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return the credentials response * @throws VaultConnectorException on error * @since 0.5.0 + * @deprecated use {@link #readDbCredentials(String, String)} your PostgreSQL mountpoint */ + @Deprecated(since = "1.5.0", forRemoval = true) default CredentialsResponse readPostgreSqlCredentials(final String role) throws VaultConnectorException { return readDbCredentials(role, "postgresql"); } @@ -705,28 +709,32 @@ public interface VaultConnector extends AutoCloseable, Serializable { * @return the credentials response * @throws VaultConnectorException on error * @since 0.5.0 + * @deprecated use {@link #readDbCredentials(String, String)} your MSSQL mountpoint */ + @Deprecated(since = "1.5.0", forRemoval = true) default CredentialsResponse readMsSqlCredentials(final String role) throws VaultConnectorException { return readDbCredentials(role, "mssql"); } /** - * Read credentials for MSSQL backend at default mount point. + * Read credentials for MongoDB backend at default mount point. * * @param role the role name * @return the credentials response * @throws VaultConnectorException on error * @since 0.5.0 + * @deprecated use {@link #readDbCredentials(String, String)} your MongoDB mountpoint */ + @Deprecated(since = "1.5.0", forRemoval = true) default CredentialsResponse readMongoDbCredentials(final String role) throws VaultConnectorException { return readDbCredentials(role, "mongodb"); } /** - * Read credentials for SQL backends. + * Read credentials for database backends. * * @param role the role name - * @param mount mount point of the SQL backend + * @param mount mount point of the database backend * @return the credentials response * @throws VaultConnectorException on error * @since 0.5.0