use of com.emc.vipr.client.core.filters.NameIgnoreCaseFilter in project coprhd-controller by CoprHD.
the class ComputeUtils method getHostNamesByName.
/**
* This method checks if the given host names already exist.
* @param list of host names to check
* @return list of host names in given list that already exist
*/
public static List<String> getHostNamesByName(ViPRCoreClient client, List<String> names) {
List<String> hostNames = Lists.newArrayList();
if (names == null) {
return Collections.emptyList();
}
for (String hostName : names) {
NameIgnoreCaseFilter<HostRestRep> filter = new NameIgnoreCaseFilter<HostRestRep>(hostName);
List<HostRestRep> resp = client.hosts().getByTenant(getOrderTenant(), filter);
for (HostRestRep hostRestRep : resp) {
hostNames.add(hostRestRep.getHostName());
}
}
return hostNames;
}
Aggregations