use of com.amazonaws.secretsmanager.caching.cache.SecretCacheItem in project aws-secretsmanager-caching-java by aws.
the class SecretCache method getCachedSecret.
/**
* Method to retrieve the cached secret item.
*
* @param secretId
* The identifier for the secret being requested.
* @return The cached secret item
*/
private SecretCacheItem getCachedSecret(final String secretId) {
SecretCacheItem secret = this.cache.get(secretId);
if (null == secret) {
this.cache.putIfAbsent(secretId, new SecretCacheItem(secretId, this.client, this.config));
secret = this.cache.get(secretId);
}
return secret;
}
use of com.amazonaws.secretsmanager.caching.cache.SecretCacheItem in project aws-secretsmanager-caching-java by aws.
the class SecretCache method getSecretBinary.
/**
* Method to retrieve a binary secret from AWS Secrets Manager.
*
* @param secretId
* The identifier for the secret being requested.
* @return The binary secret
*/
public ByteBuffer getSecretBinary(final String secretId) {
SecretCacheItem secret = this.getCachedSecret(secretId);
GetSecretValueResult gsv = secret.getSecretValue();
if (null == gsv) {
return null;
}
return gsv.getSecretBinary();
}
use of com.amazonaws.secretsmanager.caching.cache.SecretCacheItem in project aws-secretsmanager-caching-java by aws.
the class SecretCache method getSecretString.
/**
* Method to retrieve a string secret from AWS Secrets Manager.
*
* @param secretId
* The identifier for the secret being requested.
* @return The string secret
*/
public String getSecretString(final String secretId) {
SecretCacheItem secret = this.getCachedSecret(secretId);
GetSecretValueResult gsv = secret.getSecretValue();
if (null == gsv) {
return null;
}
return gsv.getSecretString();
}
Aggregations