use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project cu-kfs by CU-CommunityApps.
the class AwsSecretServiceImpl method buildSecretsManagerClient.
protected SecretsManagerClient buildSecretsManagerClient() {
Region region = Region.of(awsRegion);
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
return secretsClient;
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project cu-kfs by CU-CommunityApps.
the class AwsSecretServiceImpl method updateSecretValue.
@Override
public void updateSecretValue(String awsKeyName, boolean useKfsInstanceNamespace, String keyValue) {
createCacheIfNotPresent();
String fullAwsKey = buildFullAwsKeyName(awsKeyName, useKfsInstanceNamespace);
UpdateSecretRequest updateSecretRequest = UpdateSecretRequest.builder().secretId(fullAwsKey).secretString(keyValue).build();
SecretsManagerClient client = buildSecretsManagerClient();
try {
performUpdate(updateSecretRequest, client);
updateCacheValue(fullAwsKey, keyValue);
} catch (SecretsManagerException e) {
LOG.error("updateSecretValue, had an error setting value for secret " + fullAwsKey, e);
throw new RuntimeException(e);
} finally {
client.close();
}
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project cu-kfs by CU-CommunityApps.
the class AwsSecretServiceImpl method retrieveSecretFromAws.
protected String retrieveSecretFromAws(String fullAwsKey) {
SecretsManagerClient client = buildSecretsManagerClient();
try {
GetSecretValueRequest valueRequest = GetSecretValueRequest.builder().secretId(fullAwsKey).build();
GetSecretValueResponse valueResponse = client.getSecretValue(valueRequest);
return valueResponse.secretString();
} catch (SecretsManagerException e) {
LOG.error("retrieveSecretFromAws, had an error getting value for secret " + fullAwsKey, e);
throw new RuntimeException(e);
} finally {
client.close();
}
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project radixdlt by radixdlt.
the class AWSSecretManager method createSecret.
public static void createSecret(String secretName, Object secretValue, String network, Region region, boolean binarySecret) {
removeBouncyCastleSecurityProvider();
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
String secretARN = createNewSecret(secretsClient, secretName, secretValue, network, binarySecret);
System.out.println("Secret created with ARN " + secretARN);
secretsClient.close();
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project aws-doc-sdk-examples by awsdocs.
the class DescribeSecret method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <secretName> \n\n" + "Where:\n" + " secretName - the name of the secret (for example, tutorials/MyFirstSecret). \n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String secretName = args[0];
Region region = Region.US_EAST_1;
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
describeGivenSecret(secretsClient, secretName);
secretsClient.close();
}
Aggregations