Search in sources :

Example 1 with DeleteSecretRequest

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

the class DeleteSecret method deleteSpecificSecret.

// snippet-start:[secretsmanager.java2.delete_secret.main]
public static void deleteSpecificSecret(SecretsManagerClient secretsClient, String secretName) {
    try {
        DeleteSecretRequest secretRequest = DeleteSecretRequest.builder().secretId(secretName).build();
        secretsClient.deleteSecret(secretRequest);
        System.out.println(secretName + " is deleted.");
    } catch (SecretsManagerException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : SecretsManagerException(software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException) DeleteSecretRequest(software.amazon.awssdk.services.secretsmanager.model.DeleteSecretRequest)

Example 2 with DeleteSecretRequest

use of software.amazon.awssdk.services.secretsmanager.model.DeleteSecretRequest in project web3signer by ConsenSys.

the class AwsSecretsManagerUtil method deleteSecret.

public void deleteSecret() {
    final DeleteSecretRequest secretRequest = DeleteSecretRequest.builder().secretId(secretName).build();
    secretsManagerClient.deleteSecret(secretRequest);
}
Also used : DeleteSecretRequest(software.amazon.awssdk.services.secretsmanager.model.DeleteSecretRequest)

Aggregations

DeleteSecretRequest (software.amazon.awssdk.services.secretsmanager.model.DeleteSecretRequest)2 SecretsManagerException (software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException)1