diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-10 14:44:16 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-10 15:06:09 +0200 |
commit | e0f58988817a64aa549e36bff2b4c89f191e20ee (patch) | |
tree | 3273e6f23866911ee8e2492b06fd02b9db6ca7c0 /container-core/src/main | |
parent | 3d1b445b10f70771cf7a4bce1ba2d285c553f930 (diff) |
Move Zone API to separate bundle
Diffstat (limited to 'container-core/src/main')
4 files changed, 0 insertions, 115 deletions
diff --git a/container-core/src/main/java/ai/vespa/cloud/Environment.java b/container-core/src/main/java/ai/vespa/cloud/Environment.java deleted file mode 100644 index 8f1d9fc962a..00000000000 --- a/container-core/src/main/java/ai/vespa/cloud/Environment.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.cloud; - -/** - * The environments of a Vespa cloud instance - * - * @author bratseth - */ -public enum Environment { - - dev, perf, test, staging, prod - -} diff --git a/container-core/src/main/java/ai/vespa/cloud/SystemInfo.java b/container-core/src/main/java/ai/vespa/cloud/SystemInfo.java deleted file mode 100644 index 0524ae072cd..00000000000 --- a/container-core/src/main/java/ai/vespa/cloud/SystemInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.cloud; - -import com.google.inject.Inject; -import com.yahoo.cloud.config.ConfigserverConfig; - -/** - * Provides information about the system in which this container is running. - * This is available and can be injected when running in a cloud environment. - * - * @author bratseth - */ -public class SystemInfo { - - private final Zone zone; - - /** Do not use */ - @Inject - public SystemInfo(ConfigserverConfig config) { - this.zone = new Zone(Environment.valueOf(config.environment()), config.region()); - } - - /** Create an instance for testing */ - public SystemInfo(Zone zone) { - this.zone = zone; - } - - /** Returns the zone this is running in */ - public Zone zone() { return zone; } - -} diff --git a/container-core/src/main/java/ai/vespa/cloud/Zone.java b/container-core/src/main/java/ai/vespa/cloud/Zone.java deleted file mode 100644 index 48293aa7908..00000000000 --- a/container-core/src/main/java/ai/vespa/cloud/Zone.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.cloud; - -import java.util.Objects; - -/** - * The zone in which a cloud deployment may be running. - * A zone is a combination of an environment and a region. - * - * @author bratseth - */ -public class Zone { - - private final Environment environment; - - private final String region; - - public Zone(Environment environment, String region) { - this.environment = environment; - this.region = region; - } - - public Environment environment() { return environment; } - public String region() { return region; } - - /** Returns the string environment.region */ - @Override - public String toString() { return environment + "." + region; } - - @Override - public int hashCode() { return Objects.hash(environment, region); } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if ( ! (o instanceof Zone)) return false; - Zone other = (Zone)o; - return this.environment.equals(other.environment) && this.region.equals(other.region); - } - - /** - * Creates a zone from a string on the form environment.region - * - * @throws IllegalArgumentException if the given string is not a valid zone - */ - public static Zone from(String zoneString) { - String[] parts = zoneString.split("\\."); - if (parts.length != 2) - throw new IllegalArgumentException("A zone string must be on the form [environment].[region], but was '" + zoneString + "'"); - - Environment environment; - try { - environment = Environment.valueOf(parts[0]); - } - catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Invalid zone '" + zoneString + "': No environment named '" + parts[0] + "'"); - } - return new Zone(environment, parts[1]); - } - -} diff --git a/container-core/src/main/java/ai/vespa/cloud/package-info.java b/container-core/src/main/java/ai/vespa/cloud/package-info.java deleted file mode 100644 index 259a2bda258..00000000000 --- a/container-core/src/main/java/ai/vespa/cloud/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Public API to the Vespa cloud, available when this container runs in a cloud. - */ -@ExportPackage -@PublicApi -package ai.vespa.cloud; - -import com.yahoo.api.annotations.PublicApi; -import com.yahoo.osgi.annotation.ExportPackage; |