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 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 Client
      objectMapper - Object Mapper
  • Method Details

    • keyValuesByPrefix

      @NonNull public @NonNull Optional<Map> keyValuesByPrefix(@NonNull @NonNull String prefix)
      Specified by:
      keyValuesByPrefix in interface KeyValueFetcher
      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 entry
      result - 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 cleint
      secretName - a secret name
      Returns:
      secret value optional