summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2018-01-08 14:50:21 +0100
committerBjørn Christian Seime <bjorncs@oath.com>2018-01-08 14:51:08 +0100
commit68352cb9b78c9a471d4a63e75a1c270c83ff1406 (patch)
tree498853b45fa80ec1f3834a6b8448c72a7fa28d15 /controller-api
parentdd269359308af49ec4ffd73e7cd0fc4659e8a506 (diff)
Open-source NodeRepositoryClient and ProvisionResource
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobList.java17
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobName.java11
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeEnvironment.java11
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java37
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeList.java27
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java43
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java33
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryClientInterface.java52
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java386
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeState.java15
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeType.java22
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ProvisionResource.java80
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/package-info.java8
13 files changed, 742 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobList.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobList.java
new file mode 100644
index 00000000000..db5037af4d2
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobList.java
@@ -0,0 +1,17 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class MaintenanceJobList {
+ @JsonProperty("jobs")
+ public List<MaintenanceJobName> jobs = new ArrayList<>();
+ @JsonProperty("inactive")
+ public List<String> inactive = new ArrayList<>();
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobName.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobName.java
new file mode 100644
index 00000000000..ba54fed4cb1
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/MaintenanceJobName.java
@@ -0,0 +1,11 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class MaintenanceJobName {
+ @JsonProperty("name")
+ public String name;
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeEnvironment.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeEnvironment.java
new file mode 100644
index 00000000000..8510aacf3a8
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeEnvironment.java
@@ -0,0 +1,11 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+/**
+ * @author bjorncs
+ */
+public enum NodeEnvironment {
+ BARE_METAL,
+ VIRTUAL_MACHINE,
+ DOCKER_CONTAINER
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
new file mode 100644
index 00000000000..68696ac59df
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
@@ -0,0 +1,37 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Wire class for node-repository representation of the history of a node
+ *
+ * @author smorgrav
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NodeHistory {
+ @JsonProperty("at")
+ public Long at;
+ @JsonProperty("agent")
+ public Agent agent;
+ @JsonProperty("event")
+ public String event;
+
+ public Long getAt() {
+ return at;
+ }
+
+ public Agent getAgent() {
+ return agent;
+ }
+
+ public String getEvent() {
+ return event;
+ }
+
+ public enum Agent { system, application, operator, NodeRetirer }
+
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeList.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeList.java
new file mode 100644
index 00000000000..d707cdc5995
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeList.java
@@ -0,0 +1,27 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/**
+ * @author mortent
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NodeList {
+ @JsonProperty
+ List<NodeRepositoryNode> nodes;
+
+ public NodeList() {
+ }
+
+ public NodeList(List<NodeRepositoryNode> nodes) {
+ this.nodes = nodes;
+ }
+
+ public List<NodeRepositoryNode> nodes() {
+ return nodes;
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java
new file mode 100644
index 00000000000..f567e27bdea
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java
@@ -0,0 +1,43 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author mpolden
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NodeMembership {
+
+ @JsonProperty
+ public String clustertype;
+ @JsonProperty
+ public String clusterid;
+ @JsonProperty
+ public String group;
+ @JsonProperty
+ public Integer index;
+ @JsonProperty
+ public Boolean retired;
+
+ public String getClustertype() {
+ return clustertype;
+ }
+
+ public String getClusterid() {
+ return clusterid;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+
+ public Integer getIndex() {
+ return index;
+ }
+
+ public Boolean getRetired() {
+ return retired;
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java
new file mode 100644
index 00000000000..21c2c469077
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java
@@ -0,0 +1,33 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author mpolden
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NodeOwner {
+
+ @JsonProperty
+ public String tenant;
+ @JsonProperty
+ public String application;
+ @JsonProperty
+ public String instance;
+
+ public NodeOwner() {}
+
+ public String getTenant() {
+ return tenant;
+ }
+
+ public String getApplication() {
+ return application;
+ }
+
+ public String getInstance() {
+ return instance;
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryClientInterface.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryClientInterface.java
new file mode 100644
index 00000000000..346c77bd316
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryClientInterface.java
@@ -0,0 +1,52 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
+
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * @author smorgrav
+ * @author bjorncs
+ */
+public interface NodeRepositoryClientInterface {
+
+ enum WantTo {
+ Retire,
+ Deprovision
+ }
+
+ void addNodes(ZoneId zone, Collection<NodeRepositoryNode> nodes) throws IOException;
+
+ NodeRepositoryNode getNode(ZoneId zone, String hostname) throws IOException;
+
+ void deleteNode(ZoneId zone, String hostname) throws IOException;
+
+ NodeList listNodes(ZoneId zone, boolean recursive) throws IOException;
+
+ NodeList listNodes(ZoneId zone, String tenant, String applicationId, String instance) throws IOException;
+
+ String resetFailureInformation(ZoneId zone, String nodename) throws IOException;
+
+ String restart(ZoneId zone, String nodename) throws IOException;
+
+ String reboot(ZoneId zone, String nodename) throws IOException;
+
+ String cancelReboot(ZoneId zone, String nodename) throws IOException;
+
+ String wantTo(ZoneId zone, String nodename, WantTo... actions) throws IOException;
+
+ String cancelRestart(ZoneId zone, String nodename) throws IOException;
+
+ String setHardwareFailureDescription(ZoneId zone, String nodename, String hardwareFailureDescription) throws IOException;
+
+ void setState(ZoneId zone, NodeState nodeState, String nodename) throws IOException;
+
+ String enableMaintenanceJob(ZoneId zone, String jobName) throws IOException;
+
+ String disableMaintenanceJob(ZoneId zone, String jobName) throws IOException;
+
+ MaintenanceJobList listMaintenanceJobs(ZoneId zone) throws IOException;
+
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java
new file mode 100644
index 00000000000..7304daeee1d
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java
@@ -0,0 +1,386 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Set;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NodeRepositoryNode {
+
+ @JsonProperty("url")
+ private String url;
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("state")
+ private NodeState state;
+ @JsonProperty("hostname")
+ private String hostname;
+ @JsonProperty("ipAddresses")
+ private Set<String> ipAddresses;
+ @JsonProperty("additionalIpAddresses")
+ private Set<String> additionalIpAddresses;
+ @JsonProperty("openStackId")
+ private String openStackId;
+ @JsonProperty("flavor")
+ private String flavor;
+ @JsonProperty("canonicalFlavor")
+ private String canonicalFlavor;
+ @JsonProperty("membership")
+ private NodeMembership membership;
+ @JsonProperty("owner")
+ private NodeOwner owner;
+ @JsonProperty("restartGeneration")
+ private Integer restartGeneration;
+ @JsonProperty("rebootGeneration")
+ private Integer rebootGeneration;
+ @JsonProperty("currentRestartGeneration")
+ private Integer currentRestartGeneration;
+ @JsonProperty("currentRebootGeneration")
+ private Integer currentRebootGeneration;
+ @JsonProperty("vespaVersion")
+ private String vespaVersion;
+ @JsonProperty("wantedVespaVersion")
+ private String wantedVespaVersion;
+ @JsonProperty("failCount")
+ private Integer failCount;
+ @JsonProperty("hardwareFailure")
+ private Boolean hardwareFailure;
+ @JsonProperty("hardwareFailureDescription")
+ private String hardwareFailureDescription;
+ @JsonProperty("environment")
+ private NodeEnvironment environment;
+ @JsonProperty("type")
+ private NodeType type;
+ @JsonProperty("wantedDockerImage")
+ private String wantedDockerImage;
+ @JsonProperty("currentDockerImage")
+ private String currentDockerImage;
+ @JsonProperty("parentHostname")
+ private String parentHostname;
+ @JsonProperty("wantToRetire")
+ private Boolean wantToRetire;
+ @JsonProperty("wantToDeprovision")
+ private Boolean wantToDeprovision;
+ @JsonProperty("minDiskAvailableGb")
+ private Double minDiskAvailableGb;
+ @JsonProperty("minMainMemoryAvailableGb")
+ private Double minMainMemoryAvailableGb;
+ @JsonProperty("cost")
+ private Integer cost;
+ @JsonProperty("minCpuCores")
+ private Double minCpuCores;
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("history")
+ private NodeHistory[] history;
+ @JsonProperty("allowedToBeDown")
+ private Boolean allowedToBeDown;
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public NodeState getState() {
+ return state;
+ }
+
+ public void setState(NodeState state) {
+ this.state = state;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ public Set<String> getIpAddresses() {
+ return ipAddresses;
+ }
+
+ public Set<String> getAdditionalIpAddresses() {
+ return additionalIpAddresses;
+ }
+
+ public void setIpAddresses(Set<String> ipAddresses) {
+ this.ipAddresses = ipAddresses;
+ }
+
+ public void setAdditionalIpAddresses(Set<String> additionalIpAddresses) {
+ this.additionalIpAddresses = additionalIpAddresses;
+ }
+
+ public String getOpenStackId() {
+ return openStackId;
+ }
+
+ public void setOpenStackId(String openStackId) {
+ this.openStackId = openStackId;
+ }
+
+ public String getFlavor() {
+ return flavor;
+ }
+
+ public void setFlavor(String flavor) {
+ this.flavor = flavor;
+ }
+
+ public String getCanonicalFlavor() {
+ return canonicalFlavor;
+ }
+
+ public void setCanonicalFlavor(String canonicalFlavor) {
+ this.canonicalFlavor = canonicalFlavor;
+ }
+
+ public NodeMembership getMembership() {
+ return membership;
+ }
+
+ public void setMembership(NodeMembership membership) {
+ this.membership = membership;
+ }
+
+ public NodeOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(NodeOwner owner) {
+ this.owner = owner;
+ }
+
+ public Integer getRestartGeneration() {
+ return restartGeneration;
+ }
+
+ public void setRestartGeneration(Integer restartGeneration) {
+ this.restartGeneration = restartGeneration;
+ }
+
+ public Integer getRebootGeneration() {
+ return rebootGeneration;
+ }
+
+ public void setRebootGeneration(Integer rebootGeneration) {
+ this.rebootGeneration = rebootGeneration;
+ }
+
+ public Integer getCurrentRestartGeneration() {
+ return currentRestartGeneration;
+ }
+
+ public void setCurrentRestartGeneration(Integer currentRestartGeneration) {
+ this.currentRestartGeneration = currentRestartGeneration;
+ }
+
+ public Integer getCurrentRebootGeneration() {
+ return currentRebootGeneration;
+ }
+
+ public void setCurrentRebootGeneration(Integer currentRebootGeneration) {
+ this.currentRebootGeneration = currentRebootGeneration;
+ }
+
+ public String getVespaVersion() {
+ return vespaVersion;
+ }
+
+ public void setVespaVersion(String vespaVersion) {
+ this.vespaVersion = vespaVersion;
+ }
+
+ public String getWantedVespaVersion() {
+ return wantedVespaVersion;
+ }
+
+ public void setWantedVespaVersion(String wantedVespaVersion) {
+ this.wantedVespaVersion = wantedVespaVersion;
+ }
+
+ public Integer getFailCount() {
+ return failCount;
+ }
+
+ public void setFailCount(Integer failCount) {
+ this.failCount = failCount;
+ }
+
+ public Boolean getHardwareFailure() {
+ return hardwareFailure;
+ }
+
+ public void setHardwareFailure(Boolean hardwareFailure) {
+ this.hardwareFailure = hardwareFailure;
+ }
+
+ public String getHardwareFailureDescription() {
+ return hardwareFailureDescription;
+ }
+
+ public void setHardwareFailureDescription(String hardwareFailureDescription) {
+ this.hardwareFailureDescription = hardwareFailureDescription;
+ }
+
+ public NodeEnvironment getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(NodeEnvironment environment) {
+ this.environment = environment;
+ }
+
+ public NodeType getType() {
+ return type;
+ }
+
+ public void setType(NodeType type) {
+ this.type = type;
+ }
+
+ public String getWantedDockerImage() {
+ return wantedDockerImage;
+ }
+
+ public void setWantedDockerImage(String wantedDockerImage) {
+ this.wantedDockerImage = wantedDockerImage;
+ }
+
+ public String getCurrentDockerImage() {
+ return currentDockerImage;
+ }
+
+ public void setCurrentDockerImage(String currentDockerImage) {
+ this.currentDockerImage = currentDockerImage;
+ }
+
+ public String getParentHostname() {
+ return parentHostname;
+ }
+
+ public void setParentHostname(String parentHostname) {
+ this.parentHostname = parentHostname;
+ }
+
+ public Boolean getWantToRetire() {
+ return wantToRetire;
+ }
+
+ public Boolean getWantToDeprovision() { return wantToDeprovision; }
+
+ public void setWantToRetire(Boolean wantToRetire) {
+ this.wantToRetire = wantToRetire;
+ }
+
+ public void setWantToDeprovision(Boolean wantToDeprovision) {
+ this.wantToDeprovision = wantToDeprovision;
+ }
+
+ public Double getMinDiskAvailableGb() {
+ return minDiskAvailableGb;
+ }
+
+ public void setMinDiskAvailableGb(Double minDiskAvailableGb) {
+ this.minDiskAvailableGb = minDiskAvailableGb;
+ }
+
+ public Double getMinMainMemoryAvailableGb() {
+ return minMainMemoryAvailableGb;
+ }
+
+ public void setMinMainMemoryAvailableGb(Double minMainMemoryAvailableGb) {
+ this.minMainMemoryAvailableGb = minMainMemoryAvailableGb;
+ }
+
+ public Integer getCost() {
+ return cost;
+ }
+
+ public void setCost(Integer cost) {
+ this.cost = cost;
+ }
+
+ public Double getMinCpuCores() {
+ return minCpuCores;
+ }
+
+ public void setMinCpuCores(Double minCpuCores) {
+ this.minCpuCores = minCpuCores;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public NodeHistory[] getHistory() {
+ return history;
+ }
+
+ public void setHistory(NodeHistory[] history) {
+ this.history = history;
+ }
+
+ public Boolean getAllowedToBeDown() {
+ return allowedToBeDown;
+ }
+
+ @Override
+ public String toString() {
+ return "NodeRepositoryNode{" +
+ "url='" + url + '\'' +
+ ", id='" + id + '\'' +
+ ", state=" + state +
+ ", hostname='" + hostname + '\'' +
+ ", ipAddresses='" + ipAddresses + '\'' +
+ ", additionalIpAddresses='" + additionalIpAddresses + '\'' +
+ ", openStackId='" + openStackId + '\'' +
+ ", flavor='" + flavor + '\'' +
+ ", canonicalFlavor='" + canonicalFlavor + '\'' +
+ ", membership=" + membership +
+ ", owner=" + owner +
+ ", restartGeneration=" + restartGeneration +
+ ", rebootGeneration=" + rebootGeneration +
+ ", currentRestartGeneration=" + currentRestartGeneration +
+ ", currentRebootGeneration=" + currentRebootGeneration +
+ ", vespaVersion='" + vespaVersion + '\'' +
+ ", wantedVespaVersion='" + wantedVespaVersion + '\'' +
+ ", failCount=" + failCount +
+ ", hardwareFailure=" + hardwareFailure +
+ ", hardwareFailureDescription='" + hardwareFailureDescription + '\'' +
+ ", environment=" + environment +
+ ", type=" + type +
+ ", wantedDockerImage='" + wantedDockerImage + '\'' +
+ ", currentDockerImage='" + currentDockerImage + '\'' +
+ ", wantToRetire='" + wantToRetire + '\'' +
+ ", wantToDeprovision='" + wantToDeprovision + '\'' +
+ ", minDiskAvailableGb='" + minDiskAvailableGb + '\'' +
+ ", minMainMemoryAvailableGb='" + minMainMemoryAvailableGb + '\'' +
+ ", cost='" + cost + '\'' +
+ ", minCpuCores='" + minCpuCores + '\'' +
+ ", description='" + description + '\'' +
+ ", allowedToBeDown='" + allowedToBeDown + '\'' +
+ '}';
+ }
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeState.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeState.java
new file mode 100644
index 00000000000..6271671ca2d
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeState.java
@@ -0,0 +1,15 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+public enum NodeState {
+
+ provisioned,
+ ready,
+ reserved,
+ active,
+ inactive,
+ dirty,
+ failed,
+ parked;
+
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeType.java
new file mode 100644
index 00000000000..071cbe7100f
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeType.java
@@ -0,0 +1,22 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+/**
+ * The possible types of nodes in the node repository
+ *
+ * @author bjorncs
+ */
+public enum NodeType {
+
+ /** A host of a set of (docker) tenant nodes */
+ host,
+
+ /** Nodes running the shared proxy layer */
+ proxy,
+
+ /** A node to be assigned to a tenant to run application workloads */
+ tenant,
+
+ /** A config server */
+ config
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ProvisionResource.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ProvisionResource.java
new file mode 100644
index 00000000000..ee808399637
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/ProvisionResource.java
@@ -0,0 +1,80 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+
+/**
+ * @author mortent
+ * @author mpolden
+ * @author smorgrav
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+public interface ProvisionResource {
+
+ @POST
+ @Path("/node")
+ String addNodes(Collection<NodeRepositoryNode> node);
+
+ @DELETE
+ @Path("/node/{hostname}")
+ String deleteNode(@PathParam("hostname") String hostname);
+
+ @GET
+ @Path("/node/{hostname}")
+ NodeRepositoryNode getNode(@PathParam("hostname") String hostname);
+
+ @POST
+ @Path("/node/{hostname}")
+ String patchNode(@PathParam("hostname") String hostname,
+ NodeRepositoryNode patchValues,
+ @HeaderParam("X-HTTP-Method-Override") String patchOverride);
+
+ @GET
+ @Path("/node/")
+ NodeList listNodes(@QueryParam("recursive") boolean recursive);
+
+ @GET
+ @Path("/node/")
+ NodeList listNodes(@QueryParam("application") String applicationString,
+ @QueryParam("recursive") boolean recursive);
+
+ @GET
+ @Path("/node/")
+ NodeList listNodesWithParent(@QueryParam("recursive") boolean recursive,
+ @QueryParam("parentHost") String parentHostname);
+
+ @PUT
+ @Path("/state/{state}/{hostname}")
+ String setState(@PathParam("state") NodeState state, @PathParam("hostname") String hostname);
+
+ @POST
+ @Path("/command/reboot")
+ String reboot(@QueryParam("hostname") String hostname);
+
+ @POST
+ @Path("/command/restart")
+ String restart(@QueryParam("hostname") String hostname);
+
+ @GET
+ @Path("/maintenance/")
+ MaintenanceJobList listMaintenanceJobs();
+
+ @POST
+ @Path("/maintenance/inactive/{jobname}")
+ String disableMaintenanceJob(@PathParam("jobname") String jobname);
+
+ @DELETE
+ @Path("/maintenance/inactive/{jobname}")
+ String enableMaintenanceJob(@PathParam("jobname") String jobname);
+}
+
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/package-info.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/package-info.java
new file mode 100644
index 00000000000..08036880cd2
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/package-info.java
@@ -0,0 +1,8 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+/**
+ * @author bjorncs
+ */
+@ExportPackage
+package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
+
+import com.yahoo.osgi.annotation.ExportPackage; \ No newline at end of file