Example usage for com.amazonaws.services.secretsmanager.model GetSecretValueRequest getSecretId

List of usage examples for com.amazonaws.services.secretsmanager.model GetSecretValueRequest getSecretId

Introduction

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

Prototype


public String getSecretId() 

Source Link

Document

Specifies the secret containing the version that you want to retrieve.

Usage

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

License:Apache License

private void readSecretValue(GetSecretValueRequest secretValueRequest) {
    try {//from   w  ww . j a va  2s.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);
    }
}