aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-04-26 16:40:20 +0200
committerJon Bratseth <bratseth@gmail.com>2021-04-26 16:40:20 +0200
commitddeaf20ad65c4c10bd9e7089eb10559058d5c2f5 (patch)
treea7b1d38502559b1121b5578c45ea47b728714321 /controller-api
parent75880a3716c3c34951811f0d8515cda4c6a2bf23 (diff)
Add completion to scaling events in rest API's
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java5
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java12
2 files changed, 15 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java
index d356f5eb89f..07de259be2f 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Cluster.java
@@ -107,16 +107,19 @@ public class Cluster {
private final ClusterResources from, to;
private final Instant at;
+ private final Optional<Instant> completion;
- public ScalingEvent(ClusterResources from, ClusterResources to, Instant at) {
+ public ScalingEvent(ClusterResources from, ClusterResources to, Instant at, Optional<Instant> completion) {
this.from = from;
this.to = to;
this.at = at;
+ this.completion = completion;
}
public ClusterResources from() { return from; }
public ClusterResources to() { return to; }
public Instant at() { return at; }
+ public Optional<Instant> completion() { return completion; }
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java
index b33a7436522..1ac24695afe 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ScalingEventData.java
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
import java.time.Instant;
+import java.util.Optional;
/**
* @author bratseth
@@ -24,8 +25,17 @@ public class ScalingEventData {
@JsonProperty("at")
public Long at;
+ @JsonProperty("completion")
+ public Long completion;
+
public Cluster.ScalingEvent toScalingEvent() {
- return new Cluster.ScalingEvent(from.toClusterResources(), to.toClusterResources(), Instant.ofEpochMilli(at));
+ return new Cluster.ScalingEvent(from.toClusterResources(), to.toClusterResources(), Instant.ofEpochMilli(at),
+ toOptionalInstant(completion));
+ }
+
+ private Optional<Instant> toOptionalInstant(Long epochMillis) {
+ if (epochMillis == null) return Optional.empty();
+ return Optional.of(Instant.ofEpochMilli(epochMillis));
}
}