Skip to content

Commit c5f733f

Browse files
Bumps version to 4.1.0. Fixes recent mounts-support PR, since Lombok was removed
1 parent e3dd3a6 commit c5f733f

File tree

9 files changed

+109
-36
lines changed

9 files changed

+109
-36
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'signing'
44

55
group 'com.bettercloud'
66
archivesBaseName = 'vault-java-driver'
7-
version '4.0.0'
7+
version '4.1.0'
88
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')
99

1010
compileJava {

src/main/java/com/bettercloud/vault/VaultConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ public VaultConfig secretsEnginePathMap(final Map<String, String> secretEngineVe
151151
* <p>Sets the secrets Engine version be used by Vault for the provided path.</p>
152152
*
153153
* @param path the path to use for accessing Vault secrets.
154-
* Example "/secret/foo"
154+
* Example "/secret/foo"
155+
* @param version The key-value engine version used for this path.
155156
* @return This object, with a new entry in the secrets paths map, ready for additional builder-pattern method calls or else finalization with
156157
* the build() method
157158
*/

src/main/java/com/bettercloud/vault/api/Logical.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Logical {
3131

3232
private String nameSpace;
3333

34-
public enum logicalOperations {authentication, deleteV1, deleteV2, destroy, listV1, listV2, readV1, readV2, writeV1, writeV2, unDelete}
34+
public enum logicalOperations {authentication, deleteV1, deleteV2, destroy, listV1, listV2, readV1, readV2, writeV1, writeV2, unDelete, mount}
3535

3636
public Logical(final VaultConfig config) {
3737
this.config = config;

src/main/java/com/bettercloud/vault/api/mounts/Mount.java

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import java.io.Serializable;
44

5-
import lombok.Getter;
6-
75
/**
86
* <p>A container for options returned by mounts endpoints on the Secret Engine backend. This class is
97
* meant for use with a builder pattern style. Example usage:</p>
@@ -17,13 +15,14 @@
1715
* </blockquote>
1816
*/
1917
public class Mount implements Serializable {
18+
2019
private static final long serialVersionUID = 45748211702309181L;
2120

22-
@Getter private MountType type;
23-
@Getter private String description;
24-
@Getter private MountConfig config;
25-
@Getter private Boolean local;
26-
@Getter private Boolean sealWrap;
21+
private MountType type;
22+
private String description;
23+
private MountConfig config;
24+
private Boolean local;
25+
private Boolean sealWrap;
2726

2827
public Mount type(final MountType type) {
2928
this.type = type;
@@ -49,4 +48,25 @@ public Mount sealWrap(final Boolean sealWrap) {
4948
this.sealWrap = sealWrap;
5049
return this;
5150
}
51+
52+
public MountType getType() {
53+
return type;
54+
}
55+
56+
public String getDescription() {
57+
return description;
58+
}
59+
60+
public MountConfig getConfig() {
61+
return config;
62+
}
63+
64+
public Boolean getLocal() {
65+
return local;
66+
}
67+
68+
public Boolean getSealWrap() {
69+
return sealWrap;
70+
}
71+
5272
}

src/main/java/com/bettercloud/vault/api/mounts/MountConfig.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import java.util.ArrayList;
55
import java.util.List;
66

7-
import lombok.Getter;
8-
97
/**
108
* <p>A container for options returned by mounts endpoints on the Secret Engine backend. This class is
119
* meant for use with a builder pattern style. Example usage:</p>
@@ -25,11 +23,11 @@
2523
public class MountConfig implements Serializable {
2624
private static final long serialVersionUID = 839595627039704093L;
2725

28-
@Getter private Integer defaultLeaseTtl;
29-
@Getter private Integer maxLeaseTtl;
30-
@Getter private String description;
31-
@Getter private Boolean forceNoCache;
32-
@Getter private String pluginName;
26+
private Integer defaultLeaseTtl;
27+
private Integer maxLeaseTtl;
28+
private String description;
29+
private Boolean forceNoCache;
30+
private String pluginName;
3331
private List<String> auditNonHmacRequestKeys;
3432
private List<String> auditNonHmacResponseKeys;
3533

@@ -93,4 +91,25 @@ public List<String> getAuditNonHmacResponseKeys() {
9391
return clone;
9492
}
9593
}
94+
95+
public Integer getDefaultLeaseTtl() {
96+
return defaultLeaseTtl;
97+
}
98+
99+
public Integer getMaxLeaseTtl() {
100+
return maxLeaseTtl;
101+
}
102+
103+
public String getDescription() {
104+
return description;
105+
}
106+
107+
public Boolean getForceNoCache() {
108+
return forceNoCache;
109+
}
110+
111+
public String getPluginName() {
112+
return pluginName;
113+
}
114+
96115
}

src/main/java/com/bettercloud/vault/api/mounts/MountPayload.java

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import com.bettercloud.vault.json.Json;
99
import com.bettercloud.vault.json.JsonObject;
1010

11-
import lombok.Getter;
12-
1311
/**
1412
* <p>A container for options sent to mounts endpoints on the Secret Engine backend as REST payload. This class is
1513
* meant for use with a builder pattern style. Example usage:</p>
@@ -26,13 +24,13 @@
2624
public class MountPayload implements Serializable {
2725
private static final long serialVersionUID = 839595627039704093L;
2826

29-
@Getter private TimeToLive defaultLeaseTtl;
30-
@Getter private TimeToLive maxLeaseTtl;
31-
@Getter private String description;
32-
@Getter private Boolean forceNoCache;
33-
@Getter private String pluginName;
34-
@Getter private Boolean local;
35-
@Getter private Boolean sealWrap;
27+
private TimeToLive defaultLeaseTtl;
28+
private TimeToLive maxLeaseTtl;
29+
private String description;
30+
private Boolean forceNoCache;
31+
private String pluginName;
32+
private Boolean local;
33+
private Boolean sealWrap;
3634
private List<String> auditNonHmacRequestKeys;
3735
private List<String> auditNonHmacResponseKeys;
3836

@@ -156,4 +154,33 @@ private JsonObject toConfigJson() {
156154

157155
return jsonObject;
158156
}
157+
158+
public TimeToLive getDefaultLeaseTtl() {
159+
return defaultLeaseTtl;
160+
}
161+
162+
public TimeToLive getMaxLeaseTtl() {
163+
return maxLeaseTtl;
164+
}
165+
166+
public String getDescription() {
167+
return description;
168+
}
169+
170+
public Boolean getForceNoCache() {
171+
return forceNoCache;
172+
}
173+
174+
public String getPluginName() {
175+
return pluginName;
176+
}
177+
178+
public Boolean getLocal() {
179+
return local;
180+
}
181+
182+
public Boolean getSealWrap() {
183+
return sealWrap;
184+
}
185+
159186
}

src/main/java/com/bettercloud/vault/api/mounts/TimeToLive.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
import java.util.concurrent.TimeUnit;
44

5-
import lombok.Getter;
6-
import lombok.NonNull;
7-
import lombok.RequiredArgsConstructor;
8-
95
/**
106
* <p>A container for Time To Live information sent to mounts endpoints on the Secret Engine backend as REST payload.
117
* This class is meant for use with a static <code>TimeToLive.of(int, TimeUnit)</code> method pattern style. Example
@@ -25,10 +21,19 @@
2521
* <li><code>TimeUnit.HOURS</code></li>
2622
* </ul>
2723
*/
28-
@RequiredArgsConstructor(staticName = "of")
2924
public class TimeToLive {
30-
@Getter private final int ttl;
31-
@Getter @NonNull private final TimeUnit unit;
25+
private final int ttl;
26+
private final TimeUnit unit;
27+
28+
public static TimeToLive of(final int ttl, final TimeUnit unit) {
29+
return new TimeToLive(ttl, unit);
30+
}
31+
32+
private TimeToLive(final int ttl, final TimeUnit unit) {
33+
if (unit == null) throw new NullPointerException("unit is null");
34+
this.ttl = ttl;
35+
this.unit = unit;
36+
}
3237

3338
public String toString() {
3439
return new StringBuilder()

src/main/java/com/bettercloud/vault/response/MountResponse.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.stream.Collectors;
77
import java.util.stream.StreamSupport;
88

9+
import com.bettercloud.vault.api.Logical;
910
import com.bettercloud.vault.api.mounts.Mount;
1011
import com.bettercloud.vault.api.mounts.MountConfig;
1112
import com.bettercloud.vault.api.mounts.MountType;
@@ -30,7 +31,7 @@ public class MountResponse extends LogicalResponse {
3031
* @param isList the flag to indicate if we're expecting a list of Mounts from Vault or not
3132
*/
3233
public MountResponse(final RestResponse restResponse, final int retries, final boolean isList) {
33-
super(restResponse, retries);
34+
super(restResponse, retries, Logical.logicalOperations.mount);
3435

3536
mount = isList ? null : buildMount(this.getDataObject());
3637
mounts = isList ? buildMountsMap() : null;

src/test/java/com/bettercloud/vault/VaultConfigTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.Map;
1616
import java.util.UUID;
1717

18-
import static junit.framework.Assert.assertSame;
1918
import static junit.framework.TestCase.assertEquals;
2019
import static junit.framework.TestCase.assertTrue;
2120

@@ -128,6 +127,7 @@ public void testConfigConstructor_FailToLoad() throws VaultException {
128127
@Test
129128
public void testConfigBuilder() throws VaultException {
130129
Map<String, String> testMap = new HashMap<>();
130+
testMap.put("foo", "bar");
131131
final VaultConfig config =
132132
new VaultConfig()
133133
.address("address")
@@ -138,7 +138,7 @@ public void testConfigBuilder() throws VaultException {
138138
assertEquals("address", config.getAddress());
139139
assertEquals("token", config.getToken());
140140
assertEquals("1", config.getGlobalEngineVersion().toString());
141-
assertSame(testMap, config.getSecretsEnginePathMap());
141+
assertEquals("bar", config.getSecretsEnginePathMap().get("foo"));
142142
}
143143

144144
/**

0 commit comments

Comments
 (0)