use of co.com.bancolombia.secretsmanager.api.exceptions.SecretException in project secrets-manager by bancolombia.
the class AWSParameterStoreConnector method getSecret.
private String getSecret(String secretName, SsmClient client) throws SecretException {
GetParameterRequest getParameterRequest = GetParameterRequest.builder().name(secretName).build();
GetParameterResponse getParameterResponse = client.getParameter(getParameterRequest);
if (getParameterResponse == null) {
throw new SecretException("Secret value is null");
} else {
if (getParameterResponse.parameter().value() != null) {
return getParameterResponse.parameter().value();
}
throw new SecretException("Secret value is not a String");
}
}
use of co.com.bancolombia.secretsmanager.api.exceptions.SecretException in project secrets-manager by bancolombia.
the class AWSSecretManagerConnector method getSecret.
private String getSecret(String secretName, SecretsManagerClient client) throws SecretException {
GetSecretValueRequest getSecretValueRequest = GetSecretValueRequest.builder().secretId(secretName).build();
GetSecretValueResponse getSecretValueResult = client.getSecretValue(getSecretValueRequest);
if (getSecretValueResult == null) {
throw new SecretException("Secret value is null");
} else {
if (getSecretValueResult.secretString() != null) {
return getSecretValueResult.secretString();
}
throw new SecretException("Secret value is not a String");
}
}
use of co.com.bancolombia.secretsmanager.api.exceptions.SecretException in project secrets-manager by bancolombia.
the class exceptionsTest method generateExpetion.
@Test
public void generateExpetion() {
SecretException ex = new SecretException("My error");
assertEquals("My error", ex.getMessage());
}
Aggregations