Search in sources :

Example 1 with UpdateSecretRequest

use of software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest in project aws-doc-sdk-examples by awsdocs.

the class UpdateSecret method updateMySecret.

// snippet-start:[secretsmanager.java2.update_secret.main]
public static void updateMySecret(SecretsManagerClient secretsClient, String secretName, String secretValue) {
    try {
        UpdateSecretRequest secretRequest = UpdateSecretRequest.builder().secretId(secretName).secretString(secretValue).build();
        secretsClient.updateSecret(secretRequest);
    } catch (SecretsManagerException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : SecretsManagerException(software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException) UpdateSecretRequest(software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest)

Example 2 with UpdateSecretRequest

use of software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest 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();
    }
}
Also used : SecretsManagerException(software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException) SecretsManagerClient(software.amazon.awssdk.services.secretsmanager.SecretsManagerClient) UpdateSecretRequest(software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest)

Example 3 with UpdateSecretRequest

use of software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest in project radixdlt by radixdlt.

the class AWSSecretManager method updateMySecret.

private static void updateMySecret(SecretsManagerClient secretsClient, String secretName, String secretValue) {
    UpdateSecretRequest secretRequest = UpdateSecretRequest.builder().secretId(secretName).secretString(secretValue).build();
    secretsClient.updateSecret(secretRequest);
}
Also used : UpdateSecretRequest(software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest)

Example 4 with UpdateSecretRequest

use of software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest in project radixdlt by radixdlt.

the class AWSSecretManager method updateMyBinarySecret.

private static void updateMyBinarySecret(SecretsManagerClient secretsClient, String secretName, SdkBytes secretValue) {
    UpdateSecretRequest secretRequest = UpdateSecretRequest.builder().secretId(secretName).secretBinary(secretValue).build();
    secretsClient.updateSecret(secretRequest);
}
Also used : UpdateSecretRequest(software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest)

Aggregations

UpdateSecretRequest (software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest)4 SecretsManagerException (software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException)2 SecretsManagerClient (software.amazon.awssdk.services.secretsmanager.SecretsManagerClient)1