Search in sources :

Example 1 with AWSSecretsManager

use of com.amazonaws.services.secretsmanager.AWSSecretsManager in project kork by spinnaker.

the class SecretsManagerSecretEngine method getSecretValue.

protected GetSecretValueResult getSecretValue(String secretRegion, String secretName) {
    AWSSecretsManager client = AWSSecretsManagerClientBuilder.standard().withRegion(secretRegion).build();
    GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest().withSecretId(secretName);
    try {
        return client.getSecretValue(getSecretValueRequest);
    } catch (AWSSecretsManagerException e) {
        throw new SecretException(String.format("An error occurred when using AWS Secrets Manager to fetch: [secretName: %s, secretRegion: %s]", secretName, secretRegion), e);
    }
}
Also used : SecretException(com.netflix.spinnaker.kork.secrets.SecretException) AWSSecretsManagerException(com.amazonaws.services.secretsmanager.model.AWSSecretsManagerException) AWSSecretsManager(com.amazonaws.services.secretsmanager.AWSSecretsManager) GetSecretValueRequest(com.amazonaws.services.secretsmanager.model.GetSecretValueRequest)

Aggregations

AWSSecretsManager (com.amazonaws.services.secretsmanager.AWSSecretsManager)1 AWSSecretsManagerException (com.amazonaws.services.secretsmanager.model.AWSSecretsManagerException)1 GetSecretValueRequest (com.amazonaws.services.secretsmanager.model.GetSecretValueRequest)1 SecretException (com.netflix.spinnaker.kork.secrets.SecretException)1