From 6b8433eab2f318c98467118b9b5406a3f0a24c9d Mon Sep 17 00:00:00 2001 From: Dan Karp Date: Tue, 11 Feb 2020 14:26:55 -0800 Subject: [PATCH] issue-179 fix path for latest-version v2 kv delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current code attempts a DELETE on the metadta path, but Vault expects a DELETE on the data path. From the Vault API docs (https://www.vaultproject.io/api/secret/kv/kv-v2.html#delete-latest-version-of-secret): »Delete Latest Version of Secret This endpoint issues a soft delete of the secret's latest version at the specified location. This marks the version as deleted and will stop it from being returned from reads, but the underlying data will not be removed. A delete can be undone using the undelete path. Method Path DELETE /secret/data/:path --- src/main/java/com/bettercloud/vault/api/LogicalUtilities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bettercloud/vault/api/LogicalUtilities.java b/src/main/java/com/bettercloud/vault/api/LogicalUtilities.java index 1fbd7126..1fd90393 100644 --- a/src/main/java/com/bettercloud/vault/api/LogicalUtilities.java +++ b/src/main/java/com/bettercloud/vault/api/LogicalUtilities.java @@ -125,7 +125,7 @@ public static String adjustPathForDelete(final String path, final int prefixPath final List pathSegments = getPathSegments(path); if (operation.equals(Logical.logicalOperations.deleteV2)) { final StringBuilder adjustedPath = new StringBuilder( - addQualifierToPath(pathSegments, prefixPathDepth, "metadata")); + addQualifierToPath(pathSegments, prefixPathDepth, "data")); if (path.endsWith("/")) { adjustedPath.append("/"); }