public abstract class SecretCacheObject<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.amazonaws.services.secretsmanager.AWSSecretsManager |
client
The AWS Secrets Manager client to use for requesting secrets.
|
protected SecretCacheConfiguration |
config
The Secret Cache Configuration.
|
protected RuntimeException |
exception
If the last request to AWS Secrets Manager resulted in an exception,
that exception will be thrown back to the caller when requesting
secret data.
|
protected Object |
lock
A private object to synchronize access to certain methods.
|
protected String |
secretId
The secret identifier for this cached object.
|
| Constructor and Description |
|---|
SecretCacheObject(String secretId,
com.amazonaws.services.secretsmanager.AWSSecretsManager client,
SecretCacheConfiguration config)
Construct a new cached item for the secret.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
equals(Object obj) |
protected abstract T |
executeRefresh()
Execute the actual refresh of the cached secret state.
|
com.amazonaws.services.secretsmanager.model.GetSecretValueResult |
getSecretValue()
Return the cached result from AWS Secrets Manager for GetSecretValue.
|
protected abstract com.amazonaws.services.secretsmanager.model.GetSecretValueResult |
getSecretValue(T result)
Execute the actual refresh of the cached secret state.
|
abstract int |
hashCode() |
protected boolean |
isRefreshNeeded()
Determine if the secret object should be refreshed.
|
boolean |
refreshNow()
Method to force the refresh of a cached secret state.
|
abstract String |
toString() |
protected <T extends com.amazonaws.AmazonWebServiceRequest> |
updateUserAgent(T request) |
protected final String secretId
protected final Object lock
protected final com.amazonaws.services.secretsmanager.AWSSecretsManager client
protected final SecretCacheConfiguration config
protected RuntimeException exception
public SecretCacheObject(String secretId, com.amazonaws.services.secretsmanager.AWSSecretsManager client, SecretCacheConfiguration config)
secretId - The secret identifier. This identifier could be the full ARN
or the friendly name for the secret.client - The AWS Secrets Manager client to use for requesting the secret.config - The secret cache configuration.protected abstract T executeRefresh()
protected abstract com.amazonaws.services.secretsmanager.model.GetSecretValueResult getSecretValue(T result)
result - The AWS Secrets Manager result for the secret state.protected <T extends com.amazonaws.AmazonWebServiceRequest> T updateUserAgent(T request)
protected boolean isRefreshNeeded()
public boolean refreshNow()
throws InterruptedException
InterruptedException - If the thread is interrupted while waiting for the refresh.public com.amazonaws.services.secretsmanager.model.GetSecretValueResult getSecretValue()
Copyright © 2018. All rights reserved.