diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-03 15:45:36 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-03 22:35:31 +0100 |
commit | ec3fadac88fd1e3705193003a684ab557e188b2d (patch) | |
tree | 2f97382c37e1f13a64a7c712c75eaf436e459a56 /hosted-zone-api | |
parent | 7e8c84f97d8bd41dbafd9c8305d1d2479fb38b09 (diff) |
Add a provider for cluster information.
Diffstat (limited to 'hosted-zone-api')
4 files changed, 13 insertions, 2 deletions
diff --git a/hosted-zone-api/abi-spec.json b/hosted-zone-api/abi-spec.json index 6a79a5aecf4..b7c2b5b4455 100644 --- a/hosted-zone-api/abi-spec.json +++ b/hosted-zone-api/abi-spec.json @@ -97,6 +97,7 @@ "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()" ], "fields" : [ ] diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java index ce278848f29..bb96423af01 100644 --- a/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.cloud; -import java.util.Collections; import java.util.List; import java.util.Objects; 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 325f62cd7f8..2ace2e7872b 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 @@ -42,9 +42,18 @@ public class SystemInfo { return cloud; } - /** Returns the cluster this is part of */ + /** + * 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(); } + /** 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 d97bba51c71..c3f8624b456 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 @@ -14,6 +14,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class SystemInfoTest { @Test + @SuppressWarnings("removal") void testSystemInfo() { ApplicationId application = new ApplicationId("tenant1", "application1", "instance1"); Zone zone = new Zone(Environment.dev, "us-west-1"); @@ -26,6 +27,7 @@ public class SystemInfoTest { assertEquals(zone, info.zone()); assertEquals(cloud, info.cloud()); assertEquals(cluster, info.cluster()); + assertEquals(cluster.id(), info.clusterName()); assertEquals(node, info.node()); } |