diff options
2 files changed, 13 insertions, 1 deletions
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceStatusInfo.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceStatusInfo.java index e781195eb2a..36cf6f4101e 100644 --- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceStatusInfo.java +++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceStatusInfo.java @@ -1,6 +1,7 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.applicationmodel; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -37,6 +38,15 @@ public class ServiceStatusInfo { this.endpoint = endpoint; } + @JsonCreator + public ServiceStatusInfo(@JsonProperty("serviceStatus") ServiceStatus status, + @JsonProperty("since") Instant since, + @JsonProperty("lastChecked") Instant lastChecked, + @JsonProperty("error") String error, + @JsonProperty("endpoint") String endpoint) { + this(status, Optional.ofNullable(since), Optional.ofNullable(lastChecked), Optional.ofNullable(error), Optional.ofNullable(endpoint)); + } + @JsonProperty("endpoint") public String endpointOrNull() { return endpoint.orElse(null); diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/SlobrokEntryResponse.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/SlobrokEntryResponse.java index 062fa186cb6..672f391a4cd 100644 --- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/SlobrokEntryResponse.java +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/SlobrokEntryResponse.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.orchestrator.restapi.wire; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,7 +18,8 @@ public class SlobrokEntryResponse { @JsonProperty("spec") public final String spec; - public SlobrokEntryResponse(String name, String spec) { + @JsonCreator + public SlobrokEntryResponse(@JsonProperty("name") String name, @JsonProperty("spec") String spec) { this.name = name; this.spec = spec; } |