Class SecretCacheObject<T>
java.lang.Object
com.amazonaws.secretsmanager.caching.cache.SecretCacheObject<T>
- Direct Known Subclasses:
SecretCacheItem,SecretCacheVersion
Basic secret caching object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final software.amazon.awssdk.services.secretsmanager.SecretsManagerClientThe AWS Secrets Manager client to use for requesting secrets.protected final SecretCacheConfigurationThe Secret Cache Configuration.protected RuntimeExceptionIf 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 final ObjectA private object to synchronize access to certain methods.protected final StringThe secret identifier for this cached object. -
Constructor Summary
ConstructorsConstructorDescriptionSecretCacheObject(String secretId, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client, SecretCacheConfiguration config) Construct a new cached item for the secret. -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanprotected abstract TExecute the actual refresh of the cached secret state.software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponseReturn the cached result from AWS Secrets Manager for GetSecretValue.protected abstract software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponsegetSecretValue(T result) Execute the actual refresh of the cached secret state.abstract inthashCode()protected booleanDetermine if the secret object should be refreshed.booleanMethod to force the refresh of a cached secret state.abstract StringtoString()
-
Field Details
-
secretId
The secret identifier for this cached object. -
lock
A private object to synchronize access to certain methods. -
client
protected final software.amazon.awssdk.services.secretsmanager.SecretsManagerClient clientThe AWS Secrets Manager client to use for requesting secrets. -
config
The Secret Cache Configuration. -
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.
-
-
Constructor Details
-
SecretCacheObject
public SecretCacheObject(String secretId, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client, SecretCacheConfiguration config) Construct a new cached item for the secret.- Parameters:
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.
-
-
Method Details
-
executeRefresh
Execute the actual refresh of the cached secret state.- Returns:
- The result of the refresh
-
getSecretValue
protected abstract software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse getSecretValue(T result) Execute the actual refresh of the cached secret state.- Parameters:
result- The AWS Secrets Manager result for the secret state.- Returns:
- The cached GetSecretValue result based on the current cached state.
-
equals
-
hashCode
public abstract int hashCode() -
toString
-
isRefreshNeeded
protected boolean isRefreshNeeded()Determine if the secret object should be refreshed.- Returns:
- True if the secret item should be refreshed.
-
refreshNow
Method to force the refresh of a cached secret state.- Returns:
- True if the refresh completed without error.
- Throws:
InterruptedException- If the thread is interrupted while waiting for the refresh.
-
getSecretValue
public software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse getSecretValue()Return the cached result from AWS Secrets Manager for GetSecretValue.- Returns:
- The cached GetSecretValue result.
-