Package codes.grow.packages.vault
Class Database
java.lang.Object
codes.grow.packages.vault.Database
Database secrets engine on one mount:
client.database() (mount database).
Lease<DatabaseCredentials> lease = client.database().getCredentials("readonly");
String user = lease.data().username();
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureConnection(String name, ConnectionConfig config) Creates or replaces a connection:POST <mount>/config/<name>(verified by default; bad credentials raiseValidationException).AsynchronousconfigureConnection(String, ConnectionConfig).voidcreateRole(String name, RoleConfig config) Creates or replaces a dynamic role:POST <mount>/roles/<name>.createRoleAsync(String name, RoleConfig c) AsynchronouscreateRole(String, RoleConfig).voiddeleteConnection(String name) Deletes a connection.deleteConnectionAsync(String name) AsynchronousdeleteConnection(String).voiddeleteRole(String name) Deletes a role.deleteRoleAsync(String name) AsynchronousdeleteRole(String).getCredentials(String role) Generates credentials for a role:GET <mount>/creds/<role>.getCredentialsAsync(String role) AsynchronousgetCredentials(String).mount()Returns the mount.readConnection(String name) Reads a connection (without its password);NotFoundExceptionwhen missing.readConnectionAsync(String name) AsynchronousreadConnection(String).Reads a role;NotFoundExceptionwhen missing.readRoleAsync(String name) AsynchronousreadRole(String).toString()
-
Method Details
-
mount
Returns the mount.- Returns:
- the mount path
-
getCredentials
Generates credentials for a role:GET <mount>/creds/<role>. Unknown roles raiseValidationException. Never retried blindly (each call creates a user).- Parameters:
role- role name- Returns:
- the lease with the credentials
-
getCredentialsAsync
AsynchronousgetCredentials(String).- Parameters:
role- role name- Returns:
- a future with the lease
-
configureConnection
Creates or replaces a connection:POST <mount>/config/<name>(verified by default; bad credentials raiseValidationException).- Parameters:
name- connection nameconfig- settings
-
configureConnectionAsync
AsynchronousconfigureConnection(String, ConnectionConfig).- Parameters:
name- connection namec- settings- Returns:
- a future completed when done
-
readConnection
Reads a connection (without its password);NotFoundExceptionwhen missing.- Parameters:
name- connection name- Returns:
- the connection
-
readConnectionAsync
AsynchronousreadConnection(String).- Parameters:
name- connection name- Returns:
- a future with the connection
-
deleteConnection
Deletes a connection.- Parameters:
name- connection name
-
deleteConnectionAsync
AsynchronousdeleteConnection(String).- Parameters:
name- connection name- Returns:
- a future completed when done
-
createRole
Creates or replaces a dynamic role:POST <mount>/roles/<name>.- Parameters:
name- role nameconfig- settings
-
createRoleAsync
AsynchronouscreateRole(String, RoleConfig).- Parameters:
name- role namec- settings- Returns:
- a future completed when done
-
readRole
Reads a role;NotFoundExceptionwhen missing.- Parameters:
name- role name- Returns:
- the role
-
readRoleAsync
AsynchronousreadRole(String).- Parameters:
name- role name- Returns:
- a future with the role
-
deleteRole
Deletes a role.- Parameters:
name- role name
-
deleteRoleAsync
AsynchronousdeleteRole(String).- Parameters:
name- role name- Returns:
- a future completed when done
-
toString
-