Skip to content

Commit 6f2bcd2

Browse files
authored
Adds performanceStandByCode (#54)
1 parent be413f6 commit 6f2bcd2

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/main/java/io/github/jopenlibs/vault/api/Debug.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public Debug withNameSpace(final String nameSpace) {
5858
* </blockquote>
5959
*/
6060
public HealthResponse health() throws VaultException {
61-
return health(null, null, null, null);
61+
return health(null, null, null, null, null);
6262
}
6363

6464
/**
@@ -81,14 +81,17 @@ public HealthResponse health() throws VaultException {
8181
* node instead of the default of 429
8282
* @param sealedCode (optional) Indicates the status code that should be returned for a sealed
8383
* node instead of the default of 500
84+
* @param performanceStandbyCode (optional) Indicates the status code that should be
85+
* returned for a performanceStandbyCode node instead of the default of 473
8486
* @return The response information returned from Vault
8587
* @throws VaultException If an error occurs or unexpected response received from Vault
8688
*/
8789
public HealthResponse health(
8890
final Boolean standbyOk,
8991
final Integer activeCode,
9092
final Integer standbyCode,
91-
final Integer sealedCode
93+
final Integer sealedCode,
94+
final Integer performanceStandbyCode
9295
) throws VaultException {
9396
final String path = "sys/health";
9497

@@ -116,6 +119,8 @@ public HealthResponse health(
116119
if (sealedCode != null) {
117120
rest.parameter("sealedcode", sealedCode.toString());
118121
}
122+
if (performanceStandbyCode != null) rest.parameter("performancestandbycode",
123+
performanceStandbyCode.toString());
119124
// Execute request
120125
final RestResponse restResponse = rest.get();
121126

@@ -124,6 +129,7 @@ public HealthResponse health(
124129
validCodes.add(200);
125130
validCodes.add(429);
126131
validCodes.add(500);
132+
validCodes.add(473);
127133
if (activeCode != null) {
128134
validCodes.add(activeCode);
129135
}
@@ -133,6 +139,9 @@ public HealthResponse health(
133139
if (sealedCode != null) {
134140
validCodes.add(sealedCode);
135141
}
142+
if (performanceStandbyCode != null) {
143+
validCodes.add(performanceStandbyCode);
144+
}
136145

137146
if (!validCodes.contains(restResponse.getStatus())) {
138147
throw new VaultException(

src/test-integration/java/io/github/jopenlibs/vault/api/DebugTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testHealth_Plain() throws VaultException {
4949

5050
@Test
5151
public void testHealth_WithParams() throws VaultException {
52-
final HealthResponse response = vault.debug().health(null, 212, null, null);
52+
final HealthResponse response = vault.debug().health(null, 212, null, null, null);
5353
assertTrue(response.getInitialized());
5454
assertFalse(response.getSealed());
5555
assertFalse(response.getStandby());
@@ -67,7 +67,7 @@ public void testHealth_WithParams() throws VaultException {
6767
@Test
6868
public void testHealth_WonkyActiveCode() throws VaultException {
6969
final HealthResponse response = vault.debug().health(null, 204, null,
70-
null);
70+
null, null);
7171
assertNull(response.getInitialized());
7272
assertNull(response.getSealed());
7373
assertNull(response.getStandby());

0 commit comments

Comments
 (0)