summaryrefslogtreecommitdiffstats
path: root/hosted-zone-api/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-10-31 15:11:59 +0100
committerJon Bratseth <bratseth@gmail.com>2021-10-31 15:11:59 +0100
commite5c94e10a6edb9e1fd67898313dafb4020ee2a49 (patch)
tree04cfe47c85d4bfdba5e1a196b0197e0856142b1e /hosted-zone-api/src
parent728576fef4bd8ec18f4baf57f1d45bda4423b47e (diff)
Add ZoneInfo
Diffstat (limited to 'hosted-zone-api/src')
-rw-r--r--hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java
new file mode 100644
index 00000000000..d9af2421ab9
--- /dev/null
+++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/ZoneInfo.java
@@ -0,0 +1,27 @@
+// 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.Objects;
+
+/**
+ * Provides information about the zone in which this container is running.
+ * This is available and can be injected when running in a cloud environment.
+ * If you don't need any other information than the zone this should be preferred
+ * to SystemInfo as it will never change at runtime and therefore does not
+ * cause unnecessary reconstruction.
+ *
+ * @author bratseth
+ */
+public class ZoneInfo {
+
+ private final Zone zone;
+
+ public ZoneInfo(Zone zone) {
+ Objects.requireNonNull(zone, "Zone cannot be null!");
+ this.zone = zone;
+ }
+
+ /** Returns the zone this is running in */
+ public Zone zone() { return zone; }
+
+}