Package io.micronaut.aws.secretsmanager
Class SecretsManagerKeyValueFetcher
java.lang.Object
io.micronaut.aws.secretsmanager.SecretsManagerKeyValueFetcher
- All Implemented Interfaces:
KeyValueFetcher
,SecretsKeyValueFetcher
- Direct Known Subclasses:
SecretsManagerGroupNameAwareKeyValueFetcher
@Requires(beans=software.amazon.awssdk.services.secretsmanager.SecretsManagerClient.class)
@Singleton
public class SecretsManagerKeyValueFetcher
extends Object
implements SecretsKeyValueFetcher
SecretsKeyValueFetcher
implementations for AWS Secrets Manager.- Since:
- 2.8.0
- Author:
- Sergio del Amo, Adrian Chlebosz
-
Field Summary
Modifier and TypeFieldDescriptionprotected final io.micronaut.json.JsonMapper
protected final software.amazon.awssdk.services.secretsmanager.SecretsManagerClient
-
Constructor Summary
ConstructorDescriptionSecretsManagerKeyValueFetcher
(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsClient, io.micronaut.json.JsonMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addSecretDetailsToResults
(software.amazon.awssdk.services.secretsmanager.model.SecretListEntry secret, Map result) Add secret details to the result map.fetchSecretValue
(@NonNull software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsClient, @NonNull String secretName) Fetches secret value.keyValuesByPrefix
(@NonNull String prefix)
-
Field Details
-
secretsClient
protected final software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsClient -
objectMapper
protected final io.micronaut.json.JsonMapper objectMapper
-
-
Constructor Details
-
SecretsManagerKeyValueFetcher
public SecretsManagerKeyValueFetcher(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsClient, io.micronaut.json.JsonMapper objectMapper) - Parameters:
secretsClient
- Secrets ClientobjectMapper
- Object Mapper
-
-
Method Details
-
keyValuesByPrefix
- Specified by:
keyValuesByPrefix
in interfaceKeyValueFetcher
- Parameters:
prefix
- AWS Distributed Configuration Resource's name prefix. E.g. /config/application_dev/- Returns:
- A Map of configuration properties
-
addSecretDetailsToResults
@NonNull protected void addSecretDetailsToResults(software.amazon.awssdk.services.secretsmanager.model.SecretListEntry secret, Map result) Add secret details to the result map.- Parameters:
secret
- a secret list entryresult
- a map that collects the results
-
fetchSecretValue
@NonNull protected @NonNull Optional<String> fetchSecretValue(@NonNull @NonNull software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsClient, @NonNull @NonNull String secretName) Fetches secret value.- Parameters:
secretsClient
- a secret manager cleintsecretName
- a secret name- Returns:
- secret value optional
-