public class SecretCache extends Object implements AutoCloseable
getSecretString(String) or
getSecretBinary(String) to retrieve a secret from the cache.
The core concepts (and classes) in this SDK are:
SecretCache provides an in-memory cache for secrets requested from
AWS Secrets Manager.
| Constructor and Description |
|---|
SecretCache()
Constructs a new secret cache using the standard AWS Secrets Manager client with default options.
|
SecretCache(com.amazonaws.services.secretsmanager.AWSSecretsManager client)
Constructs a new secret cache using the provided AWS Secrets Manager client.
|
SecretCache(com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder builder)
Constructs a new secret cache using an AWS Secrets Manager client created using the
provided builder.
|
SecretCache(SecretCacheConfiguration config)
Constructs a new secret cache using the provided cache configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method to close the cache.
|
ByteBuffer |
getSecretBinary(String secretId)
Method to retrieve a binary secret from AWS Secrets Manager.
|
String |
getSecretString(String secretId)
Method to retrieve a string secret from AWS Secrets Manager.
|
boolean |
refreshNow(String secretId)
Method to force the refresh of a cached secret state.
|
public SecretCache()
public SecretCache(com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder builder)
builder - The builder to use for creating the AWS Secrets Manager client.public SecretCache(com.amazonaws.services.secretsmanager.AWSSecretsManager client)
client - The AWS Secrets Manager client to use for requesting secret values.public SecretCache(SecretCacheConfiguration config)
config - The secret cache configuration.public String getSecretString(String secretId)
secretId - The identifier for the secret being requested.public ByteBuffer getSecretBinary(String secretId)
secretId - The identifier for the secret being requested.public boolean refreshNow(String secretId) throws InterruptedException
secretId - The identifier for the secret being refreshed.InterruptedException - If the thread is interrupted while waiting for the refresh.public void close()
close in interface AutoCloseableCopyright © 2018. All rights reserved.