use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project aws-doc-sdk-examples by awsdocs.
the class UpdateSecret method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <secretName> <secretValue>\n\n" + "Where:\n" + " secretName - the name of the secret (for example, tutorials/MyFirstSecret). \n" + " secretValue - the secret value that is updated. \n";
if (args.length < 2) {
System.out.println(USAGE);
System.exit(1);
}
String secretName = args[0];
String secretValue = args[1];
Region region = Region.US_EAST_1;
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
updateMySecret(secretsClient, secretName, secretValue);
secretsClient.close();
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project spring-cloud-aws by awspring.
the class SecretsManagerConfigDataLoader method load.
@Override
@Nullable
public ConfigData load(ConfigDataLoaderContext context, SecretsManagerConfigDataResource resource) {
try {
SecretsManagerClient sm = context.getBootstrapContext().get(SecretsManagerClient.class);
SecretsManagerPropertySource propertySource = resource.getPropertySources().createPropertySource(resource.getContext(), resource.isOptional(), sm);
if (propertySource != null) {
return new ConfigData(Collections.singletonList(propertySource));
} else {
return null;
}
} catch (Exception e) {
throw new ConfigDataResourceNotFoundException(resource, e);
}
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project radixdlt by radixdlt.
the class AWSSecretManager method updateSecret.
public static void updateSecret(String secretName, String secretValue, Region region) {
removeBouncyCastleSecurityProvider();
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
updateMySecret(secretsClient, secretName, secretValue);
secretsClient.close();
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project radixdlt by radixdlt.
the class AWSSecretManager method updateBinarySecret.
public static void updateBinarySecret(String secretName, SdkBytes secretValue, Region region) {
removeBouncyCastleSecurityProvider();
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
updateMyBinarySecret(secretsClient, secretName, secretValue);
secretsClient.close();
}
use of software.amazon.awssdk.services.secretsmanager.SecretsManagerClient in project radixdlt by radixdlt.
the class AWSSecretManager method downloadPrivateKey.
public static void downloadPrivateKey(String secretName, String destFile, Region region) throws IOException {
System.out.format("About to download private key for %s %n", secretName);
removeBouncyCastleSecurityProvider();
SecretsManagerClient secretsClient = SecretsManagerClient.builder().region(region).build();
SdkBytes secret = getBinaryValue(secretsClient, secretName);
secretsClient.close();
uncompressData(secret, destFile);
}
Aggregations