use of software.amazon.awssdk.services.secretsmanager.model.ResourceNotFoundException in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class AWSVaultServiceImpl method get.
@Override
public Uni<EventBridgeSecret> get(String name) {
if (CACHE.containsKey(name)) {
LOGGER.debug("Secret '{}' found in the cache.", name);
return Uni.createFrom().item(CACHE.get(name));
}
return Uni.createFrom().future(asyncClient.getSecretValue(GetSecretValueRequest.builder().secretId(name).build())).onFailure(e -> !(e instanceof ResourceNotFoundException)).retry().withJitter(DEFAULT_JITTER).withBackOff(DEFAULT_BACKOFF).atMost(MAX_RETRIES).onFailure().transform(e -> new VaultException("Secret '%s' not found in AWS Vault", e)).flatMap(x -> {
LOGGER.debug("Secret '{}' found in AWS Vault", name);
EventBridgeSecret secret = new EventBridgeSecret().setId(name).setValues(Json.decodeValue(x.secretString(), Map.class));
CACHE.put(name, secret);
return Uni.createFrom().item(secret);
});
}
Aggregations