summaryrefslogtreecommitdiffstats
path: root/hosted-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2019-05-13 15:25:31 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2019-05-13 15:25:31 +0200
commitd68ae3836e28735d5f7a3bfb2775ee38fc526c00 (patch)
tree495f804cd70ef546c6d0d37bdbf4822669b2750d /hosted-api
parent03770824cee298626766df71f19af998da71b810 (diff)
Add the darned class
Diffstat (limited to 'hosted-api')
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
new file mode 100644
index 00000000000..07d93a3519b
--- /dev/null
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
@@ -0,0 +1,65 @@
+package ai.vespa.hosted.api;
+
+import java.time.Instant;
+import java.util.List;
+
+import static java.util.Comparator.comparing;
+import static java.util.stream.Collectors.toUnmodifiableList;
+
+/**
+ * A list of {@link Entry} items from a deployment job.
+ *
+ * @author jonmv
+ */
+public class DeploymentLog {
+
+ private final List<Entry> entries;
+ private final boolean active;
+ private final long last;
+
+ public DeploymentLog(List<Entry> entries, boolean active, long last) {
+ this.entries = entries.stream().sorted(comparing(Entry::at)).collect(toUnmodifiableList());
+ this.active = active;
+ this.last = last;
+ }
+
+ public List<Entry> entries() {
+ return entries;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public long last() {
+ return last;
+ }
+
+
+ public static class Entry {
+
+ private final Instant at;
+ private final String level;
+ private final String message;
+
+ public Entry(Instant at, String level, String message) {
+ this.at = at;
+ this.level = level;
+ this.message = message;
+ }
+
+ public Instant at() {
+ return at;
+ }
+
+ public String level() {
+ return level;
+ }
+
+ public String message() {
+ return message;
+ }
+
+ }
+
+}