summaryrefslogtreecommitdiffstats
path: root/hosted-zone-api
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-03 15:35:27 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-11-04 15:25:28 +0100
commitd0e5af97a5d4c09e2a3eed92a366bcaa76db040a (patch)
treea9a43be6ba77e746acc47dfe2580e49a2e97cbc7 /hosted-zone-api
parent3aca43e7f71c54bb2ab61bc495f85e535d4cd3fd (diff)
- Remove cluster() from SystemInfo to only keep static information there.
- Instead provide only the cluster name. - If you need cluster information have Cluster injected directly.
Diffstat (limited to 'hosted-zone-api')
-rw-r--r--hosted-zone-api/abi-spec.json4
-rw-r--r--hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java23
-rw-r--r--hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java5
3 files changed, 13 insertions, 19 deletions
diff --git a/hosted-zone-api/abi-spec.json b/hosted-zone-api/abi-spec.json
index b7c2b5b4455..6986c85ad29 100644
--- a/hosted-zone-api/abi-spec.json
+++ b/hosted-zone-api/abi-spec.json
@@ -93,10 +93,10 @@
"methods" : [
"public void <init>(ai.vespa.cloud.ApplicationId, ai.vespa.cloud.Zone, ai.vespa.cloud.Cluster, ai.vespa.cloud.Node)",
"public void <init>(ai.vespa.cloud.ApplicationId, ai.vespa.cloud.Zone, ai.vespa.cloud.Cloud, ai.vespa.cloud.Cluster, ai.vespa.cloud.Node)",
+ "public void <init>(ai.vespa.cloud.ApplicationId, ai.vespa.cloud.Zone, ai.vespa.cloud.Cloud, java.lang.String, ai.vespa.cloud.Node)",
"public ai.vespa.cloud.ApplicationId application()",
"public ai.vespa.cloud.Zone zone()",
"public ai.vespa.cloud.Cloud cloud()",
- "public ai.vespa.cloud.Cluster cluster()",
"public java.lang.String clusterName()",
"public ai.vespa.cloud.Node node()"
],
@@ -133,4 +133,4 @@
],
"fields" : [ ]
}
-} \ No newline at end of file
+}
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
index 2ace2e7872b..5741f59422d 100644
--- a/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
+++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
@@ -14,20 +14,24 @@ public class SystemInfo {
private final ApplicationId application;
private final Zone zone;
private final Cloud cloud;
- private final Cluster cluster;
+ private final String clusterName;
private final Node node;
// TODO: Remove on Vespa 9
@Deprecated(forRemoval = true)
public SystemInfo(ApplicationId application, Zone zone, Cluster cluster, Node node) {
- this(application, zone, new Cloud(""), cluster, node);
+ this(application, zone, new Cloud(""), cluster.id(), node);
}
-
+ @Deprecated(forRemoval = true)
public SystemInfo(ApplicationId application, Zone zone, Cloud cloud, Cluster cluster, Node node) {
+ this(application, zone, cloud, cluster.id(), node);
+ }
+
+ public SystemInfo(ApplicationId application, Zone zone, Cloud cloud, String clusterName, Node node) {
this.application = Objects.requireNonNull(application, "Application cannot be null");
this.zone = Objects.requireNonNull(zone, "Zone cannot be null");
this.cloud = Objects.requireNonNull(cloud, "Cloud cannot be null");
- this.cluster = Objects.requireNonNull(cluster, "Cluster cannot be null");
+ this.clusterName = Objects.requireNonNull(clusterName, "ClusterName cannot be null");
this.node = Objects.requireNonNull(node, "Node cannot be null");
}
@@ -42,17 +46,8 @@ public class SystemInfo {
return cloud;
}
- /**
- * Returns the cluster this is part of
- * @deprecated This will shortly be removed as it breaks the intention of SystemInfo
- * Use clusterName() as replacement for cluster().id().
- * If you need cluster size or node indices you should have Cluster injected directly.
- */
- @Deprecated(forRemoval = true)
- public Cluster cluster() { return cluster; }
-
/** Returns the name of the cluster it is running in */
- public String clusterName() { return cluster.id(); }
+ public String clusterName() { return clusterName; }
/** Returns the node this is running on */
public Node node() { return node; }
diff --git a/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
index c3f8624b456..df34aa1e92f 100644
--- a/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
+++ b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
@@ -19,15 +19,14 @@ public class SystemInfoTest {
ApplicationId application = new ApplicationId("tenant1", "application1", "instance1");
Zone zone = new Zone(Environment.dev, "us-west-1");
Cloud cloud = new Cloud("aws");
- Cluster cluster = new Cluster("clusterId", 1, List.of());
+ String cluster = "clusterName";
Node node = new Node(0);
SystemInfo info = new SystemInfo(application, zone, cloud, cluster, node);
assertEquals(application, info.application());
assertEquals(zone, info.zone());
assertEquals(cloud, info.cloud());
- assertEquals(cluster, info.cluster());
- assertEquals(cluster.id(), info.clusterName());
+ assertEquals(cluster, info.clusterName());
assertEquals(node, info.node());
}