Example usage for com.amazonaws.services.secretsmanager.model GetSecretValueResult getSecretString

List of usage examples for com.amazonaws.services.secretsmanager.model GetSecretValueResult getSecretString

Introduction

In this page you can find the example usage for com.amazonaws.services.secretsmanager.model GetSecretValueResult getSecretString.

Prototype


public String getSecretString() 

Source Link

Document

The decrypted part of the protected secret information that was originally provided as a string.

Usage

From source file:org.springframework.cloud.aws.secretsmanager.AwsSecretsManagerPropertySource.java

License:Apache License

private void readSecretValue(GetSecretValueRequest secretValueRequest) {
    try {//from www  .j a v  a2  s.c om
        GetSecretValueResult secretValueResult = source.getSecretValue(secretValueRequest);
        Map<String, Object> secretMap = jsonMapper.readValue(secretValueResult.getSecretString(),
                new TypeReference<Map<String, Object>>() {
                });

        for (Map.Entry<String, Object> secretEntry : secretMap.entrySet()) {
            properties.put(secretEntry.getKey(), secretEntry.getValue());
        }
    } catch (ResourceNotFoundException e) {
        logger.debug("AWS secret not found from " + secretValueRequest.getSecretId());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}