diff options
author | Harald Musum <musum@yahooinc.com> | 2022-05-03 08:21:31 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-05-03 08:21:31 +0200 |
commit | ebe63f5fcfef7bbaa93874d28a9fb6b6211a1906 (patch) | |
tree | 1adf92916da95514d8b2c822a3faaba3643c108e /config-provisioning | |
parent | a6dd1c95ebeb29db3efbda886c7b81840a4fe23e (diff) |
Simplify and cleanup, no functional changes
Diffstat (limited to 'config-provisioning')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java b/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java index 2f07c78e06b..776c92aa0af 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/HostFilter.java @@ -27,10 +27,10 @@ public class HostFilter { Set<String> flavors, Set<ClusterSpec.Type> clusterTypes, Set<ClusterSpec.Id> clusterIds) { - this.hostnames = Objects.requireNonNull(hostnames, "Hostnames cannot be null, use an empty list"); - this.flavors = Objects.requireNonNull(flavors, "Flavors cannot be null, use an empty list"); - this.clusterTypes = Objects.requireNonNull(clusterTypes, "clusterTypes cannot be null, use an empty list"); - this.clusterIds = Objects.requireNonNull(clusterIds, "clusterIds cannot be null, use an empty list"); + this.hostnames = Objects.requireNonNull(hostnames, "Hostnames cannot be null, use an empty set"); + this.flavors = Objects.requireNonNull(flavors, "Flavors cannot be null, use an empty set"); + this.clusterTypes = Objects.requireNonNull(clusterTypes, "clusterTypes cannot be null, use an empty set"); + this.clusterIds = Objects.requireNonNull(clusterIds, "clusterIds cannot be null, use an empty set"); } /** Returns true if this filter matches the given host properties */ @@ -87,6 +87,11 @@ public class HostFilter { StringUtilities.split(clusterIds).stream().map(ClusterSpec.Id::from).collect(Collectors.toSet())); } + /** Returns a host filter filtering only on hostnames */ + public static HostFilter from(Collection<String> hostNames) { + return HostFilter.from(hostNames, Set.of(), Set.of(), Set.of()); + } + @Override public boolean equals(Object o) { if (this == o) return true; |