use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project radixdlt by radixdlt.
the class AWSSecretManager method getSecret.
public static String getSecret(String secretName, Region region) {
removeBouncyCastleSecurityProvider();
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
String secret = getValue(secretsClient, secretName);
secretsClient.close();
return secret;
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project secrets-manager by bancolombia.
the class AWSSecretManagerConnectorTest method prepareClient.
private void prepareClient(String data) {
SecretsManagerClientBuilder clientBuilderMock = Mockito.mock(SecretsManagerClientBuilder.class);
SecretsManagerClient clientMock = Mockito.mock(SecretsManagerClient.class);
GetSecretValueResponse responseMock = GetSecretValueResponse.builder().secretString(data).build();
PowerMockito.mockStatic(SecretsManagerClient.class);
when(SecretsManagerClient.builder()).thenReturn(clientBuilderMock);
when(clientBuilderMock.credentialsProvider(any())).thenReturn(clientBuilderMock);
when(clientBuilderMock.region(any())).thenReturn(clientBuilderMock);
when(clientBuilderMock.build()).thenReturn(clientMock);
when(clientMock.getSecretValue(any(GetSecretValueRequest.class))).thenReturn(responseMock);
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project signers by ConsenSys.
the class AwsSecretsManager method createAwsSecretsManager.
static AwsSecretsManager createAwsSecretsManager(final String accessKeyId, final String secretAccessKey, final String region) {
final AwsBasicCredentials awsBasicCredentials = AwsBasicCredentials.create(accessKeyId, secretAccessKey);
final StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(awsBasicCredentials);
final SecretsManagerClient secretsManagerClient = SecretsManagerClient.builder().credentialsProvider(credentialsProvider).region(Region.of(region)).build();
return new AwsSecretsManager(secretsManagerClient);
}
Aggregations