public final class AWSSecretsManagerPostgreSQLDriver extends AWSSecretsManagerDriver
Provides support for accessing PostgreSQL databases using credentials stored within AWS Secrets Manager.
Configuration properties are specified using the "postgresql" subprefix (e.g drivers.postgresql.realDriverClass).
| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_DENIED_FOR_USER_USING_PASSWORD_TO_DATABASE
The PostgreSQL error code for when a user logs in using an invalid password.
|
static String |
SUBPREFIX
Set to postgresql.
|
INVALID_SECRET_STRING_JSON, MAX_RETRY, PROPERTY_PREFIX, SCHEME| Constructor and Description |
|---|
AWSSecretsManagerPostgreSQLDriver()
Constructs the driver setting the properties from the properties file using system properties as defaults.
|
AWSSecretsManagerPostgreSQLDriver(com.amazonaws.services.secretsmanager.AWSSecretsManager client)
Constructs the driver setting the properties from the properties file using system properties as defaults.
|
AWSSecretsManagerPostgreSQLDriver(com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder builder)
Constructs the driver setting the properties from the properties file using system properties as defaults.
|
AWSSecretsManagerPostgreSQLDriver(com.amazonaws.secretsmanager.caching.SecretCache cache)
Constructs the driver setting the properties from the properties file using system properties as defaults.
|
AWSSecretsManagerPostgreSQLDriver(com.amazonaws.secretsmanager.caching.SecretCacheConfiguration cacheConfig)
Constructs the driver setting the properties from the properties file using system properties as defaults.
|
| Modifier and Type | Method and Description |
|---|---|
String |
constructUrlFromEndpointPortDatabase(String endpoint,
String port,
String dbname)
Construct a database URL from the endpoint, port and database name.
|
String |
getDefaultDriverClass()
Get the default real driver class name for this driver.
|
String |
getPropertySubprefix()
Gets the "subprefix" used for configuration properties for this driver.
|
boolean |
isExceptionDueToAuthenticationError(Exception e)
Determines whether or not an
Exception is due to an authentication failure with the remote
database. |
acceptsURL, connect, getMajorVersion, getMinorVersion, getParentLogger, getPropertyInfo, getWrappedDriver, jdbcCompliant, registerpublic static final String ACCESS_DENIED_FOR_USER_USING_PASSWORD_TO_DATABASE
public static final String SUBPREFIX
public AWSSecretsManagerPostgreSQLDriver()
public AWSSecretsManagerPostgreSQLDriver(com.amazonaws.secretsmanager.caching.SecretCache cache)
cache - Secret cache to use to retrieve secretspublic AWSSecretsManagerPostgreSQLDriver(com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder builder)
builder - Builder used to instantiate cachepublic AWSSecretsManagerPostgreSQLDriver(com.amazonaws.services.secretsmanager.AWSSecretsManager client)
client - AWS Secrets Manager client to instantiate cachepublic AWSSecretsManagerPostgreSQLDriver(com.amazonaws.secretsmanager.caching.SecretCacheConfiguration cacheConfig)
cacheConfig - Cache configuration to instantiate cachepublic String getPropertySubprefix()
AWSSecretsManagerDrivergetPropertySubprefix in class AWSSecretsManagerDriverpublic boolean isExceptionDueToAuthenticationError(Exception e)
AWSSecretsManagerDriverException is due to an authentication failure with the remote
database. This method is called during connect to decide if authentication needs to be attempted
again with refreshed credentials. A good way to implement this is to look up the error codes that
java.sqlSQLExceptions will have when an authentication failure occurs. These are database
specific.isExceptionDueToAuthenticationError in class AWSSecretsManagerDrivere - The Exception to test.Exception indicates that
the credentials used for authentication are stale.public String constructUrlFromEndpointPortDatabase(String endpoint, String port, String dbname)
AWSSecretsManagerDriverconnect method is called with a secret ID instead of a URL.constructUrlFromEndpointPortDatabase in class AWSSecretsManagerDriverendpoint - The endpoint retrieved from the secret cacheport - The port retrieved from the secret cachedbname - The database name retrieved from the secret cachepublic String getDefaultDriverClass()
AWSSecretsManagerDrivergetDefaultDriverClass in class AWSSecretsManagerDriverCopyright © 2022. All rights reserved.