@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override public Location get() { Set<? extends Location> locations = locationsSupplier.get(); try { return find(locations, isRegion()); } catch (NoSuchElementException e) { throw new NoSuchElementException("none to of the locations are scope REGION: " + transform(locations, ToIdAndScope.INSTANCE)); } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
@Override @Singleton public Location get() { String region = regionSupplier.get(); Predicate<Location> locationPredicate = region == null ? Predicates.<Location>or(isZone(), isRegion()) : isZoneOrRegionWhereRegionIdEquals(region); Set<? extends Location> locations = locationsSupplier.get(); if (locationsSupplier.get().size() == 1) return getOnlyElement(locationsSupplier.get()); try { Location toReturn = Iterables.find(locations, locationPredicate); return toReturn.getScope() == LocationScope.REGION ? toReturn : toReturn.getParent(); } catch (NoSuchElementException e) { throw new NoSuchElementException(String.format("couldn't find region matching %s in %s", locationPredicate, transform(locations, ToIdAndScope.INSTANCE))); } } }
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
for (Location region : Iterables.filter(locations, LocationPredicates.isRegion())) { provider = region.getParent(); if (regionIdToZoneIds.containsKey(region.getId())) {
Set<String> regions = Sets.newHashSet(Iterables.transform(Iterables.filter(computeService.listAssignableLocations(), LocationPredicates.isRegion()), new Function<Location, String>() { @Override public String apply(@Nullable Location location) {