use of com.amazonaws.services.secretsmanager.model.DescribeSecretRequest in project aws-secretsmanager-caching-java by aws.
the class SecretCacheItem method executeRefresh.
/**
* Execute the logic to perform the actual refresh of the item.
*
* @return The result from AWS Secrets Manager for the refresh.
*/
@Override
protected DescribeSecretResult executeRefresh() {
DescribeSecretResult describeSecretResult = client.describeSecret(updateUserAgent(new DescribeSecretRequest().withSecretId(this.secretId)));
long ttl = this.config.getCacheItemTTL();
this.nextRefreshTime = System.currentTimeMillis() + ThreadLocalRandom.current().nextLong(ttl / 2, ttl + 1);
return describeSecretResult;
}
use of com.amazonaws.services.secretsmanager.model.DescribeSecretRequest in project fernet-java8 by l0s.
the class SecretsManagerTest method verifyDescribeSecretPassesThrough.
@Test
public final void verifyDescribeSecretPassesThrough() {
// given
final DescribeSecretRequest request = new DescribeSecretRequest();
request.setSecretId("secret");
final DescribeSecretResult sampleResult = new DescribeSecretResult();
sampleResult.setRotationEnabled(true);
sampleResult.addVersionIdsToStagesEntry("version", singletonList("AWSPREVIOUS"));
given(delegate.describeSecret(eq(request))).willReturn(sampleResult);
// when
final DescribeSecretResult result = manager.describeSecret("secret");
// then
assertTrue(result.isRotationEnabled());
assertTrue(result.getVersionIdsToStages().get("version").contains("AWSPREVIOUS"));
}
use of com.amazonaws.services.secretsmanager.model.DescribeSecretRequest in project fernet-java8 by l0s.
the class SecretsManager method describeSecret.
/**
* Obtain a secret's metadata. This requires the permission <code>secretsmanager:DescribeSecret</code>
*
* @param secretId the ARN of the secret
* @return the secret's metadata
*/
public DescribeSecretResult describeSecret(final String secretId) {
final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest();
describeSecretRequest.setSecretId(secretId);
return getDelegate().describeSecret(describeSecretRequest);
}
Aggregations