diff options
author | Øyvind Grønnesby <oyving@verizonmedia.com> | 2019-05-29 15:47:09 +0200 |
---|---|---|
committer | Øyvind Grønnesby <oyving@verizonmedia.com> | 2019-05-29 15:47:09 +0200 |
commit | 0875cb2e7f31396a42a2543b3c54ba07cde0ef6a (patch) | |
tree | 0d568c4e44f888cf1264a4cc481bbf3af1729e3c /config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java | |
parent | c0a5ffd1ca99b92eeabfcd96c561ec1317ee797d (diff) |
Add endpoints to deployment specification
Endpoints are now part of the DeploymentSpec and understood by the
DeploymentSpecXmlReader classes.
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java b/config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java new file mode 100644 index 00000000000..b505bf72faf --- /dev/null +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/Endpoint.java @@ -0,0 +1,51 @@ +package com.yahoo.config.application.api; + +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +/** + * Represents a (global) endpoint in 'deployments.xml'. It contains the name of the + * endpoint (endpointId) and the name of the container cluster that the endpoint + * should point to. + * + * If the endpointId is not set, it will default to the same as the containerId. + */ +public class Endpoint { + private final Optional<String> endpointId; + private final String containerId; + private final Set<String> regions; + + public Endpoint(Optional<String> endpointId, String containerId, Set<String> regions) { + this.endpointId = endpointId; + this.containerId = containerId; + this.regions = Set.copyOf(regions); + } + + public String endpointId() { + return endpointId.orElse(containerId); + } + + public String containerId() { + return containerId; + } + + public Set<String> regions() { + return regions; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Endpoint endpoint = (Endpoint) o; + return Objects.equals(endpointId, endpoint.endpointId) && + Objects.equals(containerId, endpoint.containerId) && + Objects.equals(regions, endpoint.regions); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, containerId, regions); + } +} |