diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2021-11-11 09:57:12 +0100 |
---|---|---|
committer | Morten Tokle <mortent@verizonmedia.com> | 2021-11-11 09:57:12 +0100 |
commit | a82e358062c9f5f60b45f52fe35a23b31358f139 (patch) | |
tree | b3ae4a5b405dde20236d3e0415ff27b1b1cd0b72 /config-model-api/src/main/java/com | |
parent | f60df260aab56636101988591a516827f7030a73 (diff) |
Support application level endpoints
Diffstat (limited to 'config-model-api/src/main/java/com')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationClusterEndpoint.java | 29 | ||||
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/model/api/ContainerEndpoint.java | 13 |
2 files changed, 22 insertions, 20 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationClusterEndpoint.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationClusterEndpoint.java index 7593969ab61..a91f95d71b1 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationClusterEndpoint.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationClusterEndpoint.java @@ -17,22 +17,22 @@ import java.util.stream.Stream; * @author mortent */ public class ApplicationClusterEndpoint { - public enum Scope {APPLICATION, GLOBAL, ZONE} + public enum Scope {application, global, zone} - public enum RoutingMethod {SHARED, SHAREDLAYER4} + public enum RoutingMethod {shared, sharedLayer4} private final DnsName dnsName; private final Scope scope; private final RoutingMethod routingMethod; private final int weight; - private final List<String> hosts; + private final List<String> hostNames; - public ApplicationClusterEndpoint(DnsName dnsName, Scope scope, RoutingMethod routingMethod, int weight, List<String> hosts) { + public ApplicationClusterEndpoint(DnsName dnsName, Scope scope, RoutingMethod routingMethod, int weight, List<String> hostNames) { this.dnsName = dnsName; this.scope = scope; this.routingMethod = routingMethod; this.weight = weight; - this.hosts = List.copyOf(hosts); + this.hostNames = List.copyOf(hostNames); } public DnsName dnsName() { @@ -51,8 +51,8 @@ public class ApplicationClusterEndpoint { return weight; } - public List<String> hosts() { - return hosts; + public List<String> hostNames() { + return hostNames; } public static Builder builder() { @@ -73,27 +73,22 @@ public class ApplicationClusterEndpoint { } public Builder zoneScope() { - this.scope = Scope.ZONE; + this.scope = Scope.zone; return this; } - public Builder applicationScope() { - this.scope = Scope.APPLICATION; - return this; - } - - public Builder globalScope() { - this.scope = Scope.GLOBAL; + public Builder scope(Scope scope) { + this.scope = scope; return this; } public Builder sharedRouting() { - this.routingMethod = RoutingMethod.SHARED; + this.routingMethod = RoutingMethod.shared; return this; } public Builder sharedL4Routing() { - this.routingMethod = RoutingMethod.SHAREDLAYER4; + this.routingMethod = RoutingMethod.sharedLayer4; return this; } diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ContainerEndpoint.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ContainerEndpoint.java index 2b2b5e2c404..a114f9d40ef 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ContainerEndpoint.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ContainerEndpoint.java @@ -14,10 +14,12 @@ import java.util.Objects; public class ContainerEndpoint { private final String clusterId; + private final ApplicationClusterEndpoint.Scope scope; private final List<String> names; - public ContainerEndpoint(String clusterId, List<String> names) { + public ContainerEndpoint(String clusterId, ApplicationClusterEndpoint.Scope scope, List<String> names) { this.clusterId = Objects.requireNonNull(clusterId); + this.scope = Objects.requireNonNull(scope); this.names = List.copyOf(Objects.requireNonNull(names)); } @@ -29,23 +31,28 @@ public class ContainerEndpoint { return names; } + public ApplicationClusterEndpoint.Scope scope() { + return scope; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ContainerEndpoint that = (ContainerEndpoint) o; return Objects.equals(clusterId, that.clusterId) && + Objects.equals(scope, that.scope) && Objects.equals(names, that.names); } @Override public int hashCode() { - return Objects.hash(clusterId, names); + return Objects.hash(clusterId, names, scope); } @Override public String toString() { - return String.format("container endpoint %s -> %s", clusterId, names); + return String.format("container endpoint %s -> %s [scope=%s]", clusterId, names, scope); } } |