@Override protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { for (CloudRoute route : routes) { client.deleteRoute(route.getHost(), route.getDomain().getName()); } return null; } }.run(monitor);
public static boolean routeMatchesUri(CloudRoute route, String uri, boolean isPortBasedRouting) { Pair<String, String> hostAndDomain; if (isPortBasedRouting) { hostAndDomain = UriUtil.getHostAndDomain(uri); } else { hostAndDomain = UriUtil.getHostAndDomain(UriUtil.removePort(uri)); } String host = hostAndDomain._1; String domain = hostAndDomain._2; return route.getHost() .equals(host) && route.getDomain() .getName() .equals(domain); }
/** * Delete routes that do not have any application which is assigned to them. * * @return deleted routes or an empty list if no routes have been found */ @Override public List<CloudRoute> deleteOrphanedRoutes() { List<CloudRoute> orphanRoutes = new ArrayList<>(); for (CloudDomain cloudDomain : getDomainsForOrg()) { orphanRoutes.addAll(fetchOrphanRoutes(cloudDomain.getName())); } List<CloudRoute> deletedCloudRoutes = new ArrayList<>(); for (CloudRoute orphanRoute : orphanRoutes) { deleteRoute(orphanRoute.getHost(), orphanRoute.getDomain().getName()); deletedCloudRoutes.add(orphanRoute); } return deletedCloudRoutes; }
/** * Delete routes that do not have any application which is assigned to them. * * @return deleted routes or an empty list if no routes have been found */ @Override public List<CloudRoute> deleteOrphanedRoutes() { List<CloudRoute> orphanRoutes = new ArrayList<>(); for (CloudDomain cloudDomain : getDomainsForOrg()) { orphanRoutes.addAll(fetchOrphanRoutes(cloudDomain.getName())); } List<CloudRoute> deletedCloudRoutes = new ArrayList<>(); for (CloudRoute orphanRoute : orphanRoutes) { deleteRoute(orphanRoute.getHost(), orphanRoute.getDomain() .getName()); deletedCloudRoutes.add(orphanRoute); } return deletedCloudRoutes; }