feat: add Vault 1.16 and 1.17 flags to HealthResponse
This commit is contained in:
parent
a75621d67e
commit
936928a4fb
14
CHANGELOG.md
14
CHANGELOG.md
@ -1,3 +1,17 @@
|
||||
* Simplify JSON parsing in error handler
|
||||
* Add new fields from Vault 1.16 and 1.17 to `HealthResponse`
|
||||
* `echo_duration_ms`
|
||||
* `clock_skew_ms`
|
||||
* `replication_primary_canary_age_ms`
|
||||
* `enterprise`
|
||||
|
||||
### Dependencies
|
||||
* Updated Jackson to 2.17.1
|
||||
|
||||
### Test
|
||||
* Tested against Vault 1.2 to 1.17
|
||||
|
||||
|
||||
## 1.2.0 (2023-12-11)
|
||||
|
||||
### Deprecations
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>de.stklcode.jvault</groupId>
|
||||
<artifactId>jvault-connector</artifactId>
|
||||
<version>1.2.1-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
@ -29,7 +29,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public final class HealthResponse implements VaultResponse {
|
||||
private static final long serialVersionUID = 6483840078694294401L;
|
||||
private static final long serialVersionUID = 8675155916902904516L;
|
||||
|
||||
@JsonProperty("cluster_id")
|
||||
private String clusterID;
|
||||
@ -61,6 +61,18 @@ public final class HealthResponse implements VaultResponse {
|
||||
@JsonProperty("performance_standby")
|
||||
private Boolean performanceStandby;
|
||||
|
||||
@JsonProperty("echo_duration_ms")
|
||||
private Long echoDurationMs;
|
||||
|
||||
@JsonProperty("clock_skew_ms")
|
||||
private Long clockSkewMs;
|
||||
|
||||
@JsonProperty("replication_primary_canary_age_ms")
|
||||
private Long replicationPrimaryCanaryAgeMs;
|
||||
|
||||
@JsonProperty("enterprise")
|
||||
private Boolean enterprise;
|
||||
|
||||
/**
|
||||
* @return The Cluster ID.
|
||||
*/
|
||||
@ -134,6 +146,38 @@ public final class HealthResponse implements VaultResponse {
|
||||
return performanceStandby;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Heartbeat echo duration in milliseconds (since Vault 1.16)
|
||||
* @since 1.3
|
||||
*/
|
||||
public Long getEchoDurationMs() {
|
||||
return echoDurationMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Clock skew in milliseconds (since Vault 1.16)
|
||||
* @since 1.3
|
||||
*/
|
||||
public Long getClockSkewMs() {
|
||||
return clockSkewMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Replication primary canary age in milliseconds (since Vault 1.17)
|
||||
* @since 1.3
|
||||
*/
|
||||
public Long getReplicationPrimaryCanaryAgeMs() {
|
||||
return replicationPrimaryCanaryAgeMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Enterprise instance? (since Vault 1.17)
|
||||
* @since 1.3
|
||||
*/
|
||||
public Boolean isEnterprise() {
|
||||
return enterprise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@ -151,12 +195,17 @@ public final class HealthResponse implements VaultResponse {
|
||||
Objects.equals(initialized, that.initialized) &&
|
||||
Objects.equals(replicationPerfMode, that.replicationPerfMode) &&
|
||||
Objects.equals(replicationDrMode, that.replicationDrMode) &&
|
||||
Objects.equals(performanceStandby, that.performanceStandby);
|
||||
Objects.equals(performanceStandby, that.performanceStandby) &&
|
||||
Objects.equals(echoDurationMs, that.echoDurationMs) &&
|
||||
Objects.equals(clockSkewMs, that.clockSkewMs) &&
|
||||
Objects.equals(replicationPrimaryCanaryAgeMs, that.replicationPrimaryCanaryAgeMs) &&
|
||||
Objects.equals(enterprise, that.enterprise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clusterID, clusterName, version, serverTimeUTC, standby, sealed, initialized,
|
||||
replicationPerfMode, replicationDrMode, performanceStandby);
|
||||
replicationPerfMode, replicationDrMode, performanceStandby, echoDurationMs, clockSkewMs,
|
||||
replicationPrimaryCanaryAgeMs, enterprise);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
class HealthResponseTest extends AbstractModelTest<HealthResponse> {
|
||||
private static final String CLUSTER_ID = "c9abceea-4f46-4dab-a688-5ce55f89e228";
|
||||
private static final String CLUSTER_NAME = "vault-cluster-5515c810";
|
||||
private static final String VERSION = "0.9.2";
|
||||
private static final String VERSION = "0.17.0";
|
||||
private static final Long SERVER_TIME_UTC = 1469555798L;
|
||||
private static final Boolean STANDBY = false;
|
||||
private static final Boolean SEALED = false;
|
||||
@ -39,6 +39,10 @@ class HealthResponseTest extends AbstractModelTest<HealthResponse> {
|
||||
private static final Boolean PERF_STANDBY = false;
|
||||
private static final String REPL_PERF_MODE = "disabled";
|
||||
private static final String REPL_DR_MODE = "disabled";
|
||||
private static final Long ECHO_DURATION = 1L;
|
||||
private static final Long CLOCK_SKEW = 0L;
|
||||
private static final Long REPL_PRIM_CANARY_AGE = 2L;
|
||||
private static final Boolean ENTERPRISE = false;
|
||||
|
||||
private static final String RES_JSON = "{\n" +
|
||||
" \"cluster_id\": \"" + CLUSTER_ID + "\",\n" +
|
||||
@ -50,7 +54,11 @@ class HealthResponseTest extends AbstractModelTest<HealthResponse> {
|
||||
" \"initialized\": " + INITIALIZED + ",\n" +
|
||||
" \"replication_performance_mode\": \"" + REPL_PERF_MODE + "\",\n" +
|
||||
" \"replication_dr_mode\": \"" + REPL_DR_MODE + "\",\n" +
|
||||
" \"performance_standby\": " + PERF_STANDBY + "\n" +
|
||||
" \"performance_standby\": " + PERF_STANDBY + ",\n" +
|
||||
" \"echo_duration_ms\": " + ECHO_DURATION + ",\n" +
|
||||
" \"clock_skew_ms\": " + CLOCK_SKEW + ",\n" +
|
||||
" \"replication_primary_canary_age_ms\": " + REPL_PRIM_CANARY_AGE + ",\n" +
|
||||
" \"enterprise\": " + ENTERPRISE + "\n" +
|
||||
"}";
|
||||
|
||||
HealthResponseTest() {
|
||||
@ -87,5 +95,9 @@ class HealthResponseTest extends AbstractModelTest<HealthResponse> {
|
||||
assertEquals(PERF_STANDBY, res.isPerformanceStandby(), "Incorrect performance standby state");
|
||||
assertEquals(REPL_PERF_MODE, res.getReplicationPerfMode(), "Incorrect replication perf mode");
|
||||
assertEquals(REPL_DR_MODE, res.getReplicationDrMode(), "Incorrect replication DR mode");
|
||||
assertEquals(ECHO_DURATION, res.getEchoDurationMs(), "Incorrect echo duration");
|
||||
assertEquals(CLOCK_SKEW, res.getClockSkewMs(), "Incorrect clock skew");
|
||||
assertEquals(REPL_PRIM_CANARY_AGE, res.getReplicationPrimaryCanaryAgeMs(), "Incorrect canary age");
|
||||
assertEquals(ENTERPRISE, res.isEnterprise(), "Incorrect enterprise flag");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user