@Override public boolean apply(ComputeMetadata computeMetadata) { String region = null; String zone = null; Location location = computeMetadata.getLocation(); while (location != null) { switch (location.getScope()) { case ZONE: zone = location.getId(); break; case REGION: region = location.getId(); break; } location = location.getParent(); } if (regions != null && region != null && !regions.contains(region)) return false; if (zones != null && zone != null && !zones.contains(zone)) return false; return true; } };
@Override public boolean apply(Location input) { return input.getScope() == LocationScope.PROVIDER; }
@Override public boolean apply(Location input) { return input.getScope() == LocationScope.NETWORK; }
@Override public boolean apply(Location input) { ReferenceType defaultVDC = defaultVDCSupplier.get(); return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString()); }
@Override public boolean apply(Location input) { return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.get().getHref().toASCIIString()); }
private boolean acceptLocation(Location location, Set<String> names, LocationScope scope) { if (names.isEmpty()) { return true; } while (location != null) { if (location.getScope() == scope && names.contains(location.getId())) { return true; } location = location.getParent(); } return false; }
@Override public boolean apply(Location input) { switch (input.getScope()) { case ZONE: return input.getParent().getId().equals(region); case REGION: return input.getId().equals(region); default: return false; } }
@Override public boolean apply(Location input) { switch (input.getScope()) { case ZONE: return input.getParent().getId().equals(region); case REGION: return input.getId().equals(region); default: return false; } }
@Override public boolean apply(Location input) { switch (input.getScope()) { case ZONE: return input.getParent().getId().equals(region); case REGION: return input.getId().equals(region); default: return false; } }
@Override public boolean apply(Location input) { switch (input.getScope()) { case ZONE: return input.getParent().getId().equals(region); case REGION: return input.getId().equals(region); default: return false; } }
public String apply(Location location) { String region = location.getScope() == LocationScope.REGION ? location.getId() : location.getParent().getId(); return region; } }
public String apply(Location location) { String region = location.getScope() == LocationScope.REGION ? location.getId() : location.getParent().getId(); return region; } }
public String apply(Location location) { String region = location.getScope() == LocationScope.REGION ? location.getId() : location.getParent().getId(); return region; } }
@Override public boolean apply(Location arg0) { return arg0.getScope() == LocationScope.ZONE && arg0.getParent().getId().equals(template.getLocation().getId()); }
@Override public Map<?, ListenableFuture<Void>> execute(String tag, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { assert template.getLocation().getParent().getScope() == LocationScope.REGION : "template location should have a parent of org, which should be mapped to region: " + template.getLocation(); String orgId = template.getLocation().getParent().getId(); assert orgId.startsWith("http") : "parent id should be a rest url: " + template.getLocation().getParent(); createNewKeyPairUnlessUserSpecifiedOtherwise.execute(URI.create(orgId), tag, template.getImage() .getDefaultCredentials().identity, template.getOptions().as(TerremarkVCloudTemplateOptions.class)); return super.execute(tag, count, template, goodNodes, badNodes, customizationResponses); } }
@Override public ZoneAndName apply(NodeMetadata input) { String zoneId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation() .getParent().getId() : input.getLocation().getId(); return ZoneAndName.fromZoneAndName(zoneId, input.getGroup()); }
@Override public RegionAndName apply(NodeMetadata input) { String regionId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation() .getParent().getId() : input.getLocation().getId(); return RegionAndName.fromRegionAndName(regionId, input.getGroup()); }
@Override public ZoneAndName apply(NodeMetadata input) { String zoneId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation() .getParent().getId() : input.getLocation().getId(); return ZoneAndName.fromZoneAndName(zoneId, input.getGroup()); }
@Override public RegionAndName apply(NodeMetadata input) { String regionId = input.getLocation().getScope() == LocationScope.HOST ? input.getLocation() .getParent().getId() : input.getLocation().getId(); return RegionAndName.fromRegionAndName(regionId, input.getGroup()); }
@Override public Location apply(@Nullable org.jclouds.domain.Location input) { if (input == null) { return null; } return Location.builder().id(input.getId()).scope(input.getScope().name()) .parentId(input.getParent() != null ? input.getParent().getId() : null) .description(input.getDescription()) .iso3166Codes(input.getIso3166Codes()).build(); } }