From 75fbdd6125b74ead34b52d00360e02b2438ea4f0 Mon Sep 17 00:00:00 2001 From: Giulio Mecocci Date: Sun, 24 Feb 2019 01:28:15 -0500 Subject: [PATCH] secretsEnginePathMap -> public and copy map + helper methods Also consider switching to https://immutables.github.io/ for builders --- .../java/com/bettercloud/vault/VaultConfig.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bettercloud/vault/VaultConfig.java b/src/main/java/com/bettercloud/vault/VaultConfig.java index d34990c6..05d4dde7 100644 --- a/src/main/java/com/bettercloud/vault/VaultConfig.java +++ b/src/main/java/com/bettercloud/vault/VaultConfig.java @@ -151,8 +151,21 @@ public VaultConfig token(final String token) { * "/secret/bar", "2" * @return This object, with secrets paths populated, ready for additional builder-pattern method calls or else finalization with the build() method */ - VaultConfig secretsEnginePathMap(final Map secretEngineVersions) { - this.secretsEnginePathMap = secretEngineVersions; + public VaultConfig secretsEnginePathMap(final Map secretEngineVersions) { + this.secretsEnginePathMap = new ConcurrentHashMap<>(secretEngineVersions); + return this; + } + + /** + *

Sets the secrets Engine version be used by Vault for the provided path.

+ * + * @param path the path to use for accessing Vault secrets. + * Example "/secret/foo" + * @return This object, with a new entry in the secrets paths map, ready for additional builder-pattern method calls or else finalization with + * the build() method + */ + public VaultConfig putSecretsEngineVersionForPath(String path, String version) { + this.secretsEnginePathMap.put(path, version); return this; }