diff --git a/aws/core/src/main/clojure/org/jclouds/aws/ebs.clj b/aws/core/src/main/clojure/org/jclouds/aws/ebs.clj index 53555bba6b..91a7e04993 100644 --- a/aws/core/src/main/clojure/org/jclouds/aws/ebs.clj +++ b/aws/core/src/main/clojure/org/jclouds/aws/ebs.clj @@ -53,13 +53,13 @@ ([v] (get-region v nil)) ([v default-region] (cond - (keyword? v) (Region/fromValue (name v)) + (keyword? v) (name v) (instance? Region v) v (instance? NodeMetadata v) (let [zone (.getLocationId v)] ; no easier way to go from zone -> region? - (Region/fromValue (if (> (.indexOf zone "-") -1) + (if (> (.indexOf zone "-") -1) (subs zone 0 (-> zone count dec)) - zone))) + zone)) :else default-region))) (defn get-volume-id diff --git a/aws/core/src/main/java/org/jclouds/aws/domain/Region.java b/aws/core/src/main/java/org/jclouds/aws/domain/Region.java index 879a05767e..b6187090cd 100644 --- a/aws/core/src/main/java/org/jclouds/aws/domain/Region.java +++ b/aws/core/src/main/java/org/jclouds/aws/domain/Region.java @@ -31,12 +31,7 @@ import com.google.common.base.CaseFormat; * "http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?LocationSelection.html" /> * */ -public enum Region { - - /** - * Region returned is unknown. - */ - UNKNOWN, +public class Region { /** * EU (Ireland) @@ -46,7 +41,7 @@ public enum Region { * In Amazon S3, the EU (Ireland) Region provides read-after-write consistency for PUTS of new * objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS and DELETES. */ - EU_WEST_1, + public static final String EU_WEST_1 = "eu-west-1"; /** * @@ -60,12 +55,12 @@ public enum Region { * with the lowest latency. To use this region, do not set the LocationConstraint bucket * parameter. The US Standard Region provides eventual consistency for all requests. */ - US_STANDARD, + public static final String US_STANDARD = "us-standard"; /** * */ - US_EAST_1, + public static final String US_EAST_1 = "us-east-1"; /** * US-West (Northern California)

S3

Uses Amazon S3 servers in Northern California @@ -78,21 +73,11 @@ public enum Region { * for PUTS of new objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS * and DELETES. */ - US_WEST_1, - - AP_SOUTHEAST_1; + public static final String US_WEST_1 = "us-west-1"; - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - @Override - public String toString() { - return value(); - } - - public static Region fromValue(String region) { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(region, - "region"))); - } + /** + * Region in Singapore, launched April 28, 2010. + * This region improves latency for Asia-based users + */ + public static final String AP_SOUTHEAST_1 = "ap-southeast-1"; } \ No newline at end of file diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/EC2ComputeService.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/EC2ComputeService.java index 35a2be6fbf..ea2962d7c9 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/EC2ComputeService.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/EC2ComputeService.java @@ -86,7 +86,7 @@ public class EC2ComputeService extends BaseComputeService { this.instanceStateTerminated = instanceStateTerminated; } - private void deleteSecurityGroup(Region region, String tag) { + private void deleteSecurityGroup(String region, String tag) { if (ec2Client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, tag).size() > 0) { logger.debug(">> deleting securityGroup(%s)", tag); ec2Client.getSecurityGroupServices().deleteSecurityGroupInRegion(region, tag); @@ -96,7 +96,7 @@ public class EC2ComputeService extends BaseComputeService { } } - private void deleteKeyPair(Region region, String tag) { + private void deleteKeyPair(String region, String tag) { for (KeyPair keyPair : ec2Client.getKeyPairServices().describeKeyPairsInRegion(region)) { if (keyPair.getKeyName().matches(tag + "-[0-9]+")) { logger.debug(">> deleting keyPair(%s)", tag); @@ -119,7 +119,7 @@ public class EC2ComputeService extends BaseComputeService { } }); if (Iterables.size(nodes) > 0) { - Region region = getRegionFromNodeOrDefault.apply(Iterables.get(nodes, 0)); + String region = getRegionFromNodeOrDefault.apply(Iterables.get(nodes, 0)); deleteKeyPair(region, tag); deleteSecurityGroup(region, tag); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java index 99f7b3f1f4..c70e0aac99 100755 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java @@ -134,7 +134,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { @Override public Iterable execute(GetNodesOptions options) { Set nodes = Sets.newHashSet(); - for (Region region : ImmutableSet.of(Region.US_EAST_1, Region.US_WEST_1, Region.EU_WEST_1)) { + for (String region : ImmutableSet.of(Region.US_EAST_1, Region.US_WEST_1, Region.EU_WEST_1)) { Iterables.addAll(nodes, Iterables.transform(Iterables.concat(client .describeInstancesInRegion(region)), runningInstanceToNodeMetadata)); } @@ -144,11 +144,11 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { } @Singleton - public static class GetRegionFromNodeOrDefault implements Function { - public Region apply(ComputeMetadata node) { + public static class GetRegionFromNodeOrDefault implements Function { + public String apply(ComputeMetadata node) { Location location = node.getLocation(); - Region region = location.getScope() == LocationScope.REGION ? Region.fromValue(location - .getId()) : Region.fromValue(location.getParent()); + String region = location.getScope() == LocationScope.REGION ? location + .getId() : location.getParent(); return region; } } @@ -171,7 +171,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { @Override public NodeMetadata execute(ComputeMetadata node) { - Region region = getRegionFromNodeOrDefault.apply(node); + String region = getRegionFromNodeOrDefault.apply(node); RunningInstance runningInstance = Iterables.getOnlyElement(getAllRunningInstancesInRegion( client, region, node.getId())); return runningInstanceToNodeMetadata.apply(runningInstance); @@ -180,7 +180,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { } public static Iterable getAllRunningInstancesInRegion(InstanceClient client, - Region region, String id) { + String region, String id) { return Iterables.concat(client.describeInstancesInRegion(region, id)); } @@ -198,7 +198,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { @Override public boolean execute(ComputeMetadata node) { - Region region = getRegionFromNodeOrDefault.apply(node); + String region = getRegionFromNodeOrDefault.apply(node); client.rebootInstancesInRegion(region, node.getId()); return true; } @@ -257,23 +257,23 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { @Provides @Singleton - Map provideLocations(Map map) { + Map provideLocations(Map availabilityZoneToRegionMap) { Map locations = Maps.newLinkedHashMap(); - for (AvailabilityZone zone : map.keySet()) { + for (AvailabilityZone zone : availabilityZoneToRegionMap.keySet()) { locations.put(zone.toString(), new LocationImpl(LocationScope.ZONE, zone.toString(), zone - .toString(), map.get(zone).toString())); + .toString(), availabilityZoneToRegionMap.get(zone))); } - for (Region region : map.values()) { - locations.put(region.toString(), new LocationImpl(LocationScope.REGION, region.toString(), - region.toString(), null)); + for (String region : availabilityZoneToRegionMap.values()) { + locations.put(region, new LocationImpl(LocationScope.REGION, region, + region, null)); } return locations; } @Provides @Singleton - Location getDefaultLocation(@EC2 Region region, Map map) { - return map.get(region.toString()); + Location getDefaultLocation(@EC2 String region, Map map) { + return map.get(region); } private static class LogHolder { @@ -292,14 +292,14 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule { @Provides @Singleton protected Map provideImages(final EC2Client sync, - @EC2 Map regionMap, LogHolder holder, + @EC2 Map regionMap, LogHolder holder, Function indexer, @Named(PROPERTY_EC2_AMI_OWNERS) String[] amiOwners, ImageParser parser) throws InterruptedException, ExecutionException, TimeoutException { final Set images = Sets.newHashSet(); holder.logger.debug(">> providing images"); - for (final Region region : regionMap.keySet()) { + for (final String region : regionMap.keySet()) { for (final org.jclouds.aws.ec2.domain.Image from : sync.getAMIServices() .describeImagesInRegion(region, ownedBy(amiOwners))) { Image image = parser.apply(from); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/PortsRegionTag.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/PortsRegionTag.java index 45ba345d05..0eaa665410 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/PortsRegionTag.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/PortsRegionTag.java @@ -19,8 +19,6 @@ package org.jclouds.aws.ec2.compute.domain; -import org.jclouds.aws.domain.Region; - /** * * @author Adrian Cole @@ -28,7 +26,7 @@ import org.jclouds.aws.domain.Region; public class PortsRegionTag extends RegionTag { private final int[] ports; - public PortsRegionTag(Region region, String tag, int[] ports) { + public PortsRegionTag(String region, String tag, int[] ports) { super(region, tag); this.ports = ports; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/RegionTag.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/RegionTag.java index 885ab27e5b..67b6291ad1 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/RegionTag.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/RegionTag.java @@ -18,17 +18,15 @@ */ package org.jclouds.aws.ec2.compute.domain; -import org.jclouds.aws.domain.Region; - /** * * @author Adrian Cole */ public class RegionTag { - protected final Region region; + protected final String region; protected final String tag; - public RegionTag(Region region, String tag) { + public RegionTag(String region, String tag) { this.region = region; this.tag = tag; } @@ -64,7 +62,7 @@ public class RegionTag { return true; } - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateNewKeyPair.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateNewKeyPair.java index 38f88c0ff2..a5a6979e15 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateNewKeyPair.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateNewKeyPair.java @@ -59,7 +59,7 @@ public class CreateNewKeyPair implements Function { return createNewKeyPairInRegion(from.getRegion(), from.getTag()); } - private KeyPair createNewKeyPairInRegion(Region region, String tag) { + private KeyPair createNewKeyPairInRegion(String region, String tag) { checkNotNull(region, "region"); checkNotNull(tag, "tag"); logger.debug(">> creating keyPair region(%s) tag(%s)", region, tag); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateSecurityGroupIfNeeded.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateSecurityGroupIfNeeded.java index 0b616b3e85..2978d49577 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateSecurityGroupIfNeeded.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/CreateSecurityGroupIfNeeded.java @@ -37,7 +37,7 @@ public class CreateSecurityGroupIfNeeded implements Function> creating securityGroup region(%s) name(%s)", region, name); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java index 9ae8fd3c50..f648ae7831 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java @@ -105,7 +105,7 @@ public class ImageParser implements Function of("owner", from.getImageOwnerId()), description, diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java index 7a673aa5a0..02161ad709 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2DestroyNodeStrategy.java @@ -67,7 +67,7 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy { public boolean execute(ComputeMetadata metadata) { NodeMetadata node = metadata instanceof NodeMetadata ? NodeMetadata.class.cast(metadata) : getNodeMetadataStrategy.execute(metadata); - Region region = getRegionFromNodeOrDefault.apply(node); + String region = getRegionFromNodeOrDefault.apply(node); ec2Client.getInstanceServices().terminateInstancesInRegion(region, node.getId()); return instanceStateTerminated.apply(Iterables.getOnlyElement(Iterables.concat(ec2Client diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java index e6ab741f12..432d6f5aa2 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java @@ -127,8 +127,8 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate : null; // if the location has a parent, it must be an availability zone. - Region region = zone == null ? Region.fromValue(template.getLocation().getId()) : Region - .fromValue(template.getLocation().getParent()); + String region = zone == null ? template.getLocation().getId() : + template.getLocation().getParent(); // get or create incidental resources // TODO race condition. we were using MapMaker, but it doesn't seem to refresh properly when @@ -188,7 +188,7 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate return responses; } - private Iterable getInstances(Region region, Iterable ids) { + private Iterable getInstances(String region, Iterable ids) { return Iterables.concat(ec2Client.getInstanceServices().describeInstancesInRegion(region, Iterables.toArray(ids, String.class))); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/config/EC2RestClientModule.java b/aws/core/src/main/java/org/jclouds/aws/ec2/config/EC2RestClientModule.java index b2d1a11b8c..fb38c9b2b3 100755 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/config/EC2RestClientModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/config/EC2RestClientModule.java @@ -115,10 +115,10 @@ public class EC2RestClientModule extends AbstractModule { @Provides @Singleton @EC2 - Region provideCurrentRegion(@EC2 Map regionMap, @EC2 URI currentUri) { - ImmutableBiMap map = ImmutableBiMap. builder().putAll(regionMap) + String provideCurrentRegion(@EC2 Map regionMap, @EC2 URI currentUri) { + ImmutableBiMap map = ImmutableBiMap. builder().putAll(regionMap) .build().inverse(); - Region region = map.get(currentUri); + String region = map.get(currentUri); assert region != null : currentUri + " not in " + map; return region; } @@ -126,16 +126,16 @@ public class EC2RestClientModule extends AbstractModule { @Provides @Singleton @EC2 - Map provideRegions(AvailabilityZoneAndRegionClient client) { + Map provideRegions(AvailabilityZoneAndRegionClient client) { return client.describeRegions(); } @Provides @Singleton - Map provideAvailabilityZoneToRegions( - AvailabilityZoneAndRegionClient client, @EC2 Map regions) { - Map map = Maps.newHashMap(); - for (Region region : regions.keySet()) { + Map provideAvailabilityZoneToRegions( + AvailabilityZoneAndRegionClient client, @EC2 Map regions) { + Map map = Maps.newHashMap(); + for (String region : regions.keySet()) { for (AvailabilityZoneInfo zoneInfo : client.describeAvailabilityZonesInRegion(region)) { map.put(zoneInfo.getZone(), region); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Attachment.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Attachment.java index 83e24b5ea0..eeb3e98a68 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Attachment.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Attachment.java @@ -48,14 +48,14 @@ public class Attachment implements Comparable { } } - private final Region region; + private final String region; private final String volumeId; private final String instanceId; private final String device; private final Status status; private final Date attachTime; - public Attachment(Region region, String volumeId, String instanceId, String device, + public Attachment(String region, String volumeId, String instanceId, String device, Status status, Date attachTime) { this.region = checkNotNull(region, "region"); this.volumeId = volumeId; @@ -69,7 +69,7 @@ public class Attachment implements Comparable { * Snapshots are tied to Regions and can only be used for volumes within the same Region. * */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/AvailabilityZoneInfo.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/AvailabilityZoneInfo.java index 95cec11ad5..2cfaa18dcb 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/AvailabilityZoneInfo.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/AvailabilityZoneInfo.java @@ -54,11 +54,11 @@ public class AvailabilityZoneInfo implements Comparable{ private final String zoneName; private final AvailabilityZone zone; private final State state; - private final Region region; + private final String region; private final Set messages = Sets.newHashSet(); public AvailabilityZoneInfo(String zoneName, AvailabilityZone zone, State zoneState, - Region region, Iterable messages) { + String region, Iterable messages) { this.zoneName = checkNotNull(zoneName, "zoneName"); this.zone = checkNotNull(zone, "zone"); this.state = checkNotNull(zoneState, "zoneState"); @@ -90,7 +90,7 @@ public class AvailabilityZoneInfo implements Comparable{ /** * Name of the Region. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Image.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Image.java index a754931df9..137a762238 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Image.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Image.java @@ -38,7 +38,7 @@ import com.google.inject.internal.Nullable; */ public class Image implements Comparable { - private final Region region; + private final String region; private final Architecture architecture; @Nullable private final String name; @@ -62,7 +62,7 @@ public class Image implements Comparable { private final String rootDeviceName; private final Map ebsBlockDevices = Maps.newHashMap(); - public Image(Region region, Architecture architecture, @Nullable String name, + public Image(String region, Architecture architecture, @Nullable String name, @Nullable String description, String imageId, String imageLocation, String imageOwnerId, ImageState imageState, ImageType imageType, boolean isPublic, Iterable productCodes, @Nullable String kernelId, @Nullable String platform, @@ -200,7 +200,7 @@ public class Image implements Comparable { * AMIs are tied to the Region where its files are located within Amazon S3. * */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceStateChange.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceStateChange.java index 79034ee7c9..a010eb2d66 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceStateChange.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceStateChange.java @@ -31,7 +31,7 @@ import org.jclouds.aws.domain.Region; */ public class InstanceStateChange implements Comparable { - private final Region region; + private final String region; private final String instanceId; private final InstanceState currentState; private final InstanceState previousState; @@ -40,7 +40,7 @@ public class InstanceStateChange implements Comparable { return (this == o) ? 0 : getInstanceId().compareTo(o.getInstanceId()); } - public InstanceStateChange(Region region, String instanceId, InstanceState currentState, + public InstanceStateChange(String region, String instanceId, InstanceState currentState, InstanceState previousState) { this.region = checkNotNull(region, "region"); this.instanceId = instanceId; @@ -51,7 +51,7 @@ public class InstanceStateChange implements Comparable { /** * Instances are tied to Availability Zones. However, the instance ID is tied to the Region. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/KeyPair.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/KeyPair.java index ab00e81c54..e9833f494c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/KeyPair.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/KeyPair.java @@ -32,13 +32,13 @@ import com.google.inject.internal.Nullable; * @author Adrian Cole */ public class KeyPair implements Comparable { - private final Region region; + private final String region; private final String keyName; private final String keyFingerprint; @Nullable private final String keyMaterial; - public KeyPair(Region region, String keyName, String keyFingerprint, @Nullable String keyMaterial) { + public KeyPair(String region, String keyName, String keyFingerprint, @Nullable String keyMaterial) { this.region = checkNotNull(region, "region"); this.keyName = checkNotNull(keyName, "keyName"); this.keyFingerprint = checkNotNull(keyFingerprint, "keyFingerprint"); @@ -48,7 +48,7 @@ public class KeyPair implements Comparable { /** * Key pairs (to connect to instances) are Region-specific. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/PublicIpInstanceIdPair.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/PublicIpInstanceIdPair.java index 51811900b8..272d037f93 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/PublicIpInstanceIdPair.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/PublicIpInstanceIdPair.java @@ -34,12 +34,12 @@ import com.google.inject.internal.Nullable; */ public class PublicIpInstanceIdPair implements Comparable { - private final Region region; + private final String region; @Nullable private final String instanceId; private final InetAddress publicIp; - public PublicIpInstanceIdPair(Region region, InetAddress publicIp, @Nullable String instanceId) { + public PublicIpInstanceIdPair(String region, InetAddress publicIp, @Nullable String instanceId) { this.region = checkNotNull(region, "region"); this.instanceId = instanceId; this.publicIp = checkNotNull(publicIp, "publicIp"); @@ -48,7 +48,7 @@ public class PublicIpInstanceIdPair implements Comparable implements Compa /** The serialVersionUID */ private static final long serialVersionUID = -9051777593518861395L; - private final Region region; + private final String region; private final Set groupIds = Sets.newLinkedHashSet(); private final @Nullable String ownerId; @@ -49,7 +49,7 @@ public class Reservation extends LinkedHashSet implements Compa private final @Nullable String reservationId; - public Reservation(Region region, Iterable groupIds, + public Reservation(String region, Iterable groupIds, Iterable instances, @Nullable String ownerId, @Nullable String requesterId, @Nullable String reservationId) { this.region = checkNotNull(region, "region"); @@ -63,7 +63,7 @@ public class Reservation extends LinkedHashSet implements Compa /** * Instances are tied to Availability Zones. However, the instance ID is tied to the Region. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RunningInstance.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RunningInstance.java index 6a0ba53f7a..49aa27b89c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RunningInstance.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RunningInstance.java @@ -116,7 +116,7 @@ public class RunningInstance implements Comparable { } - private final Region region; + private final String region; private final String amiLaunchIndex; @Nullable private final String dnsName; @@ -157,7 +157,7 @@ public class RunningInstance implements Comparable { return (this == o) ? 0 : getId().compareTo(o.getId()); } - public RunningInstance(Region region, @Nullable String amiLaunchIndex, @Nullable String dnsName, + public RunningInstance(String region, @Nullable String amiLaunchIndex, @Nullable String dnsName, String imageId, String instanceId, InstanceState instanceState, String instanceType, @Nullable InetAddress ipAddress, @Nullable String kernelId, @Nullable String keyName, Date launchTime, boolean monitoring, @@ -195,7 +195,7 @@ public class RunningInstance implements Comparable { /** * Instance Ids are scoped to the region. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/SecurityGroup.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/SecurityGroup.java index aad0236d73..c419d0e6fa 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/SecurityGroup.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/SecurityGroup.java @@ -32,13 +32,13 @@ import org.jclouds.aws.domain.Region; */ public class SecurityGroup implements Comparable { - private final Region region; + private final String region; private final String name; private final String ownerId; private final String description; private final Set ipPermissions; - public SecurityGroup(Region region, String name, String ownerId, String description, + public SecurityGroup(String region, String name, String ownerId, String description, Set ipPermissions) { this.region = checkNotNull(region, "region"); this.name = name; @@ -52,7 +52,7 @@ public class SecurityGroup implements Comparable { * with instances outside the Region using group-based firewall rules. Traffic from instances in * another Region is seen as WAN bandwidth. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Snapshot.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Snapshot.java index 98032c8581..987c9e0972 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Snapshot.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Snapshot.java @@ -47,7 +47,7 @@ public class Snapshot implements Comparable { } } - private final Region region; + private final String region; private final String id; private final String volumeId; private final int volumeSize; @@ -58,7 +58,7 @@ public class Snapshot implements Comparable { private final String description; private final String ownerAlias; - public Snapshot(Region region, String id, String volumeId, int volumeSize, Status status, + public Snapshot(String region, String id, String volumeId, int volumeSize, Status status, Date startTime, int progress, String ownerId, String description, String ownerAlias) { this.region = checkNotNull(region, "region"); this.id = id; @@ -75,7 +75,7 @@ public class Snapshot implements Comparable { /** * Snapshots are tied to Regions and can only be used for volumes within the same Region. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Volume.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Volume.java index 7e3d288d96..51a80f119e 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Volume.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Volume.java @@ -79,7 +79,7 @@ public class Volume implements Comparable { } } - private final Region region; + private final String region; private final String id; private final int size; @Nullable @@ -89,7 +89,7 @@ public class Volume implements Comparable { private final Date createTime; private final Set attachments = Sets.newLinkedHashSet(); - public Volume(Region region, String id, int size, String snapshotId, + public Volume(String region, String id, int size, String snapshotId, AvailabilityZone availabilityZone, Volume.Status status, Date createTime, Iterable attachments) { this.region = checkNotNull(region, "region"); @@ -106,7 +106,7 @@ public class Volume implements Comparable { * An Amazon EBS volume must be located within the same Availability Zone as the instance to * which it attaches. */ - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/functions/AvailabilityZoneToEndpoint.java b/aws/core/src/main/java/org/jclouds/aws/ec2/functions/AvailabilityZoneToEndpoint.java index 55a73eeef7..e90ecd0ffc 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/functions/AvailabilityZoneToEndpoint.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/functions/AvailabilityZoneToEndpoint.java @@ -36,12 +36,12 @@ import com.google.common.base.Function; */ @Singleton public class AvailabilityZoneToEndpoint implements Function { - private final Map availabilityZoneToRegion; - private final Map regionToEndpoint; + private final Map availabilityZoneToRegion; + private final Map regionToEndpoint; @Inject - public AvailabilityZoneToEndpoint(@EC2 Map regionToEndpoint, - Map availabilityZoneToRegion) { + public AvailabilityZoneToEndpoint(@EC2 Map regionToEndpoint, + Map availabilityZoneToRegion) { this.regionToEndpoint = regionToEndpoint; this.availabilityZoneToRegion = availabilityZoneToRegion; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/functions/RegionToEndpoint.java b/aws/core/src/main/java/org/jclouds/aws/ec2/functions/RegionToEndpoint.java index 37356a49d8..773b499a73 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/functions/RegionToEndpoint.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/functions/RegionToEndpoint.java @@ -35,11 +35,11 @@ import com.google.common.base.Function; */ @Singleton public class RegionToEndpoint implements Function { - private final Map regionToEndpoint; + private final Map regionToEndpoint; private final URI defaultUri; @Inject - public RegionToEndpoint(@EC2 Map regionToEndpoint, @EC2 URI defaultUri) { + public RegionToEndpoint(@EC2 Map regionToEndpoint, @EC2 URI defaultUri) { this.regionToEndpoint = regionToEndpoint; this.defaultUri = defaultUri; } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java index e456bf8ea9..675d458fcd 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java @@ -18,6 +18,7 @@ */ package org.jclouds.aws.ec2.options; +import java.util.Arrays; import java.util.Set; import org.jclouds.aws.domain.Region; @@ -46,10 +47,8 @@ public class DescribeRegionsOptions extends BaseEC2RequestOptions { /** * Name of a Region. */ - public DescribeRegionsOptions regions(Region... regions) { - String[] regionStrings = new String[regions.length]; - for (int i = 0; i < regionStrings.length; i++) - regionStrings[i] = regions[i].value(); + public DescribeRegionsOptions regions(String... regions) { + String[] regionStrings = Arrays.copyOf(regions, regions.length, String[].class); indexFormValuesWithPrefix("RegionName", regionStrings); return this; } @@ -63,7 +62,7 @@ public class DescribeRegionsOptions extends BaseEC2RequestOptions { /** * @see DescribeRegionsOptions#regions(Region[] ) */ - public static DescribeRegionsOptions regions(Region... regions) { + public static DescribeRegionsOptions regions(String... regions) { DescribeRegionsOptions options = new DescribeRegionsOptions(); return options.regions(regions); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java index 777cbc82d3..69434a9b4b 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java @@ -29,7 +29,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.binders.BindProductCodesToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindUserGroupsToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindUserIdsToIndexedFormParams; @@ -75,7 +74,7 @@ public interface AMIAsyncClient { @FormParams(keys = ACTION, values = "DescribeImages") @XMLResponseParser(DescribeImagesResponseHandler.class) ListenableFuture> describeImagesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, DescribeImagesOptions... options); /** @@ -86,7 +85,7 @@ public interface AMIAsyncClient { @FormParams(keys = ACTION, values = "CreateImage") @XMLResponseParser(ImageIdHandler.class) ListenableFuture createImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options); @@ -97,7 +96,7 @@ public interface AMIAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DeregisterImage") ListenableFuture deregisterImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("ImageId") String imageId); /** @@ -108,7 +107,7 @@ public interface AMIAsyncClient { @FormParams(keys = ACTION, values = "RegisterImage") @XMLResponseParser(ImageIdHandler.class) ListenableFuture registerImageFromManifestInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest, RegisterImageOptions... options); @@ -121,7 +120,7 @@ public interface AMIAsyncClient { "RegisterImage", "/dev/sda1", "/dev/sda1" }) @XMLResponseParser(ImageIdHandler.class) ListenableFuture registerUnixImageBackedByEbsInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("Name") String imageName, @FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId, RegisterImageBackedByEbsOptions... options); @@ -133,7 +132,7 @@ public interface AMIAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" }) ListenableFuture resetLaunchPermissionsOnImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("ImageId") String imageId); /** @@ -144,7 +143,7 @@ public interface AMIAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add", "launchPermission" }) ListenableFuture addLaunchPermissionsToImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups, @FormParam("ImageId") String imageId); @@ -157,7 +156,7 @@ public interface AMIAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove", "launchPermission" }) ListenableFuture removeLaunchPermissionsFromImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups, @FormParam("ImageId") String imageId); @@ -171,7 +170,7 @@ public interface AMIAsyncClient { "launchPermission" }) @XMLResponseParser(PermissionHandler.class) ListenableFuture getLaunchPermissionForImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("ImageId") String imageId); /** @@ -182,7 +181,7 @@ public interface AMIAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "productCodes" }) @XMLResponseParser(ProductCodesHandler.class) ListenableFuture> getProductCodesForImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("ImageId") String imageId); /** @@ -194,7 +193,7 @@ public interface AMIAsyncClient { "blockDeviceMapping" }) @XMLResponseParser(BlockDeviceMappingHandler.class) ListenableFuture> getBlockDeviceMappingsForImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("ImageId") String imageId); /** @@ -205,7 +204,7 @@ public interface AMIAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add", "productCodes" }) ListenableFuture addProductCodesToImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindProductCodesToIndexedFormParams.class) Iterable productCodes, @FormParam("ImageId") String imageId); @@ -217,7 +216,7 @@ public interface AMIAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove", "productCodes" }) ListenableFuture removeProductCodesFromImageInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindProductCodesToIndexedFormParams.class) Iterable productCodes, @FormParam("ImageId") String imageId); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIClient.java index 66d739213f..7f1eec4f6e 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIClient.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.domain.Image; import org.jclouds.aws.ec2.domain.Permission; import org.jclouds.aws.ec2.domain.Image.EbsBlockDevice; @@ -58,7 +57,7 @@ public interface AMIClient { * @see DescribeImagesOptions */ @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS) - Set describeImagesInRegion(@Nullable Region region, DescribeImagesOptions... options); + Set describeImagesInRegion(@Nullable String region, DescribeImagesOptions... options); /** * Returns the Product Codes of an image. @@ -74,7 +73,7 @@ public interface AMIClient { * /> * @see DescribeImagesOptions */ - Set getProductCodesForImageInRegion(@Nullable Region region, String imageId); + Set getProductCodesForImageInRegion(@Nullable String region, String imageId); /** * Returns a map of device name to block device for the image. @@ -90,7 +89,7 @@ public interface AMIClient { * /> * @see DescribeImagesOptions */ - Map getBlockDeviceMappingsForImageInRegion(@Nullable Region region, String imageId); + Map getBlockDeviceMappingsForImageInRegion(@Nullable String region, String imageId); /** * Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance. @@ -114,7 +113,7 @@ public interface AMIClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateImage.html" * /> */ - String createImageInRegion(@Nullable Region region, String name, String instanceId, + String createImageInRegion(@Nullable String region, String name, String instanceId, CreateImageOptions... options); /** @@ -134,7 +133,7 @@ public interface AMIClient { * @see */ - void deregisterImageInRegion(@Nullable Region region, String imageId); + void deregisterImageInRegion(@Nullable String region, String imageId); /** * Registers an AMI with Amazon EC2. Images must be registered before they can be launched. To @@ -164,7 +163,7 @@ public interface AMIClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html" * /> */ - String registerImageFromManifestInRegion(@Nullable Region region, String name, String pathToManifest, + String registerImageFromManifestInRegion(@Nullable String region, String name, String pathToManifest, RegisterImageOptions... options); /** @@ -199,7 +198,7 @@ public interface AMIClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html" * /> */ - String registerUnixImageBackedByEbsInRegion(@Nullable Region region, String name, String ebsSnapshotId, + String registerUnixImageBackedByEbsInRegion(@Nullable String region, String name, String ebsSnapshotId, RegisterImageBackedByEbsOptions... options); /** @@ -216,7 +215,7 @@ public interface AMIClient { * /> * @see DescribeImagesOptions */ - Permission getLaunchPermissionForImageInRegion(@Nullable Region region, String imageId); + Permission getLaunchPermissionForImageInRegion(@Nullable String region, String imageId); /** * Adds {@code launchPermission}s to an AMI. @@ -236,7 +235,7 @@ public interface AMIClient { * @see */ - void addLaunchPermissionsToImageInRegion(@Nullable Region region, Iterable userIds, + void addLaunchPermissionsToImageInRegion(@Nullable String region, Iterable userIds, Iterable userGroups, String imageId); /** @@ -253,7 +252,7 @@ public interface AMIClient { * @see */ - void resetLaunchPermissionsOnImageInRegion(@Nullable Region region, String imageId); + void resetLaunchPermissionsOnImageInRegion(@Nullable String region, String imageId); /** * Removes {@code launchPermission}s from an AMI. @@ -273,7 +272,7 @@ public interface AMIClient { * @see */ - void removeLaunchPermissionsFromImageInRegion(@Nullable Region region, Iterable userIds, + void removeLaunchPermissionsFromImageInRegion(@Nullable String region, Iterable userIds, Iterable userGroups, String imageId); /** @@ -292,7 +291,7 @@ public interface AMIClient { * @see */ - void addProductCodesToImageInRegion(@Nullable Region region, Iterable productCodes, String imageId); + void addProductCodesToImageInRegion(@Nullable String region, Iterable productCodes, String imageId); /** * Removes {@code productCode}s from an AMI. @@ -310,6 +309,6 @@ public interface AMIClient { * @see */ - void removeProductCodesFromImageInRegion(@Nullable Region region, Iterable productCodes, + void removeProductCodesFromImageInRegion(@Nullable String region, Iterable productCodes, String imageId); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClient.java index a52956e6fa..e040ce719c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClient.java @@ -66,7 +66,7 @@ public interface AvailabilityZoneAndRegionAsyncClient { @FormParams(keys = ACTION, values = "DescribeAvailabilityZones") @XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class) ListenableFuture> describeAvailabilityZonesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, DescribeAvailabilityZonesOptions... options); /** @@ -77,6 +77,6 @@ public interface AvailabilityZoneAndRegionAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DescribeRegions") @XMLResponseParser(DescribeRegionsResponseHandler.class) - ListenableFuture> describeRegions(DescribeRegionsOptions... options); + ListenableFuture> describeRegions(DescribeRegionsOptions... options); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClient.java index 6324116a75..e325c20385 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClient.java @@ -49,7 +49,7 @@ public interface AvailabilityZoneAndRegionClient { * @see */ - Set describeAvailabilityZonesInRegion(@Nullable Region region, + Set describeAvailabilityZonesInRegion(@Nullable String region, DescribeAvailabilityZonesOptions... options); /** @@ -62,5 +62,5 @@ public interface AvailabilityZoneAndRegionClient { * /> */ @Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) - Map describeRegions(DescribeRegionsOptions... options); + Map describeRegions(DescribeRegionsOptions... options); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClient.java index c73d116aaf..c92a788a67 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClient.java @@ -112,7 +112,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = ACTION, values = "DescribeVolumes") @XMLResponseParser(DescribeVolumesResponseHandler.class) ListenableFuture> describeVolumesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds); /** @@ -122,7 +122,7 @@ public interface ElasticBlockStoreAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DeleteVolume") ListenableFuture deleteVolumeInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("VolumeId") String volumeId); /** @@ -133,7 +133,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = ACTION, values = "DetachVolume") @ExceptionParser(ReturnVoidOnVolumeAvailable.class) ListenableFuture detachVolumeInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force, DetachVolumeOptions... options); @@ -145,7 +145,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = ACTION, values = "AttachVolume") @XMLResponseParser(AttachmentHandler.class) ListenableFuture attachVolumeInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId, @FormParam("Device") String device); @@ -157,7 +157,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = ACTION, values = "CreateSnapshot") @XMLResponseParser(SnapshotHandler.class) ListenableFuture createSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options); /** @@ -168,7 +168,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = ACTION, values = "DescribeSnapshots") @XMLResponseParser(DescribeSnapshotsResponseHandler.class) ListenableFuture> describeSnapshotsInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, DescribeSnapshotsOptions... options); /** @@ -178,7 +178,7 @@ public interface ElasticBlockStoreAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DeleteSnapshot") ListenableFuture deleteSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("SnapshotId") String snapshotId); /** @@ -189,7 +189,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "add", "createVolumePermission" }) ListenableFuture addCreateVolumePermissionsToSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups, @FormParam("SnapshotId") String snapshotId); @@ -202,7 +202,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifySnapshotAttribute", "remove", "createVolumePermission" }) ListenableFuture removeCreateVolumePermissionsFromSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups, @FormParam("SnapshotId") String snapshotId); @@ -216,7 +216,7 @@ public interface ElasticBlockStoreAsyncClient { "createVolumePermission" }) @XMLResponseParser(PermissionHandler.class) ListenableFuture getCreateVolumePermissionForSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("SnapshotId") String snapshotId); /** @@ -227,7 +227,7 @@ public interface ElasticBlockStoreAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute", "createVolumePermission" }) ListenableFuture resetCreateVolumePermissionsOnSnapshotInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("SnapshotId") String snapshotId); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClient.java index bf205d0228..4d6687297a 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClient.java @@ -138,7 +138,7 @@ public interface ElasticBlockStoreClient { * @see */ - Set describeVolumesInRegion(@Nullable Region region, String... volumeIds); + Set describeVolumesInRegion(@Nullable String region, String... volumeIds); /** * Deletes an Amazon EBS volume that you own. For more information about Amazon EBS, go to the @@ -159,7 +159,7 @@ public interface ElasticBlockStoreClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteVolume.html" * /> */ - void deleteVolumeInRegion(@Nullable Region region, String volumeId); + void deleteVolumeInRegion(@Nullable String region, String volumeId); /** * Attaches an Amazon EBS volume to a running instance and exposes it as the specified device. @@ -199,7 +199,7 @@ public interface ElasticBlockStoreClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DetachVolume.html" * /> */ - void detachVolumeInRegion(@Nullable Region region, String volumeId, boolean force, + void detachVolumeInRegion(@Nullable String region, String volumeId, boolean force, DetachVolumeOptions... options); /** @@ -232,7 +232,7 @@ public interface ElasticBlockStoreClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AttachVolume.html" * /> */ - Attachment attachVolumeInRegion(@Nullable Region region, String volumeId, String instanceId, String device); + Attachment attachVolumeInRegion(@Nullable String region, String volumeId, String instanceId, String device); /** * Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots @@ -269,7 +269,7 @@ public interface ElasticBlockStoreClient { * @see */ - Snapshot createSnapshotInRegion(@Nullable Region region, String volumeId, CreateSnapshotOptions... options); + Snapshot createSnapshotInRegion(@Nullable String region, String volumeId, CreateSnapshotOptions... options); /** * Returns information about Amazon EBS snapshots available to the user. Information returned @@ -330,7 +330,7 @@ public interface ElasticBlockStoreClient { * @see */ - Set describeSnapshotsInRegion(@Nullable Region region, DescribeSnapshotsOptions... options); + Set describeSnapshotsInRegion(@Nullable String region, DescribeSnapshotsOptions... options); /** * Deletes a snapshot of an Amazon EBS volume that you own. For more information, go to the @@ -347,7 +347,7 @@ public interface ElasticBlockStoreClient { * @see */ - void deleteSnapshotInRegion(@Nullable Region region, String snapshotId); + void deleteSnapshotInRegion(@Nullable String region, String snapshotId); /** * Returns the {@link Permission}s of an snapshot. @@ -363,7 +363,7 @@ public interface ElasticBlockStoreClient { * /> * @see DescribeSnapshotsOptions */ - Permission getCreateVolumePermissionForSnapshotInRegion(@Nullable Region region, String snapshotId); + Permission getCreateVolumePermissionForSnapshotInRegion(@Nullable String region, String snapshotId); /** * Adds {@code createVolumePermission}s to an EBS snapshot. @@ -384,7 +384,7 @@ public interface ElasticBlockStoreClient { * @see */ - void addCreateVolumePermissionsToSnapshotInRegion(@Nullable Region region, Iterable userIds, + void addCreateVolumePermissionsToSnapshotInRegion(@Nullable String region, Iterable userIds, Iterable userGroups, String snapshotId); /** @@ -402,7 +402,7 @@ public interface ElasticBlockStoreClient { * @see */ - void resetCreateVolumePermissionsOnSnapshotInRegion(@Nullable Region region, String snapshotId); + void resetCreateVolumePermissionsOnSnapshotInRegion(@Nullable String region, String snapshotId); /** * Removes {@code createVolumePermission}s from an EBS snapshot. @@ -423,6 +423,6 @@ public interface ElasticBlockStoreClient { * @see */ - void removeCreateVolumePermissionsFromSnapshotInRegion(@Nullable Region region, Iterable userIds, + void removeCreateVolumePermissionsFromSnapshotInRegion(@Nullable String region, Iterable userIds, Iterable userGroups, String snapshotId); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClient.java index 5c0a9e796a..fd322b3159 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClient.java @@ -66,7 +66,7 @@ public interface ElasticIPAddressAsyncClient { @XMLResponseParser(AllocateAddressResponseHandler.class) @FormParams(keys = ACTION, values = "AllocateAddress") ListenableFuture allocateAddressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region); + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region); /** * @see BaseEC2Client#associateAddressInRegion @@ -75,7 +75,7 @@ public interface ElasticIPAddressAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "AssociateAddress") ListenableFuture associateAddressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp, @FormParam("InstanceId") String instanceId); @@ -86,7 +86,7 @@ public interface ElasticIPAddressAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DisassociateAddress") ListenableFuture disassociateAddressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp); /** @@ -96,7 +96,7 @@ public interface ElasticIPAddressAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "ReleaseAddress") ListenableFuture releaseAddressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp); /** @@ -107,7 +107,7 @@ public interface ElasticIPAddressAsyncClient { @FormParams(keys = ACTION, values = "DescribeAddresses") @XMLResponseParser(DescribeAddressesResponseHandler.class) ListenableFuture> describeAddressesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindInetAddressesToIndexedFormParams.class) InetAddress... publicIps); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressClient.java index 06e09744db..b6886c210c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/ElasticIPAddressClient.java @@ -49,7 +49,7 @@ public interface ElasticIPAddressClient { * @see #disassociateAddress * @see */ - Set describeAddressesInRegion(@Nullable Region region, + Set describeAddressesInRegion(@Nullable String region, InetAddress... publicIps); } \ No newline at end of file diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceAsyncClient.java index fa8ef61333..2f75345c66 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceAsyncClient.java @@ -29,7 +29,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.binders.BindBlockDeviceMappingToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindInstanceIdsToIndexedFormParams; import org.jclouds.aws.ec2.binders.IfNotNullBindAvailabilityZoneToFormParam; @@ -77,7 +76,7 @@ public interface InstanceAsyncClient { @FormParams(keys = ACTION, values = "DescribeInstances") @XMLResponseParser(DescribeInstancesResponseHandler.class) ListenableFuture> describeInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); /** @@ -88,7 +87,7 @@ public interface InstanceAsyncClient { @FormParams(keys = ACTION, values = "RunInstances") @XMLResponseParser(RunInstancesResponseHandler.class) ListenableFuture runInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) AvailabilityZone nullableAvailabilityZone, @FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount, @FormParam("MaxCount") int maxCount, RunInstancesOptions... options); @@ -100,7 +99,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "RebootInstances") ListenableFuture rebootInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); /** @@ -111,7 +110,7 @@ public interface InstanceAsyncClient { @FormParams(keys = ACTION, values = "TerminateInstances") @XMLResponseParser(InstanceStateChangeHandler.class) ListenableFuture> terminateInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); /** @@ -122,7 +121,7 @@ public interface InstanceAsyncClient { @FormParams(keys = ACTION, values = "StopInstances") @XMLResponseParser(InstanceStateChangeHandler.class) ListenableFuture> stopInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("Force") boolean force, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @@ -134,7 +133,7 @@ public interface InstanceAsyncClient { @FormParams(keys = ACTION, values = "StartInstances") @XMLResponseParser(InstanceStateChangeHandler.class) ListenableFuture> startInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); /** @@ -145,7 +144,7 @@ public interface InstanceAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" }) @XMLResponseParser(UnencodeStringValueHandler.class) ListenableFuture getUserDataForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -157,7 +156,7 @@ public interface InstanceAsyncClient { "rootDeviceName" }) @XMLResponseParser(StringValueHandler.class) ListenableFuture getRootDeviceNameForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -168,7 +167,7 @@ public interface InstanceAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" }) @XMLResponseParser(StringValueHandler.class) ListenableFuture getRamdiskForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -179,7 +178,7 @@ public interface InstanceAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" }) @XMLResponseParser(StringValueHandler.class) ListenableFuture getKernelForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -191,7 +190,7 @@ public interface InstanceAsyncClient { "disableApiTermination" }) @XMLResponseParser(BooleanValueHandler.class) ListenableFuture isApiTerminationDisabledForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -203,7 +202,7 @@ public interface InstanceAsyncClient { "instanceType" }) @XMLResponseParser(InstanceTypeHandler.class) ListenableFuture getInstanceTypeForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -215,7 +214,7 @@ public interface InstanceAsyncClient { "instanceInitiatedShutdownBehavior" }) @XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class) ListenableFuture getInstanceInitiatedShutdownBehaviorForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -227,7 +226,7 @@ public interface InstanceAsyncClient { "blockDeviceMapping" }) @XMLResponseParser(BlockDeviceMappingHandler.class) ListenableFuture> getBlockDeviceMappingForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -237,7 +236,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" }) ListenableFuture resetRamdiskForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -247,7 +246,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" }) ListenableFuture resetKernelForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId); /** @@ -257,7 +256,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" }) ListenableFuture setUserDataForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData); @@ -268,7 +267,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" }) ListenableFuture setRamdiskForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk); /** @@ -278,7 +277,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" }) ListenableFuture setKernelForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel); /** @@ -289,7 +288,7 @@ public interface InstanceAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "disableApiTermination" }) ListenableFuture setApiTerminationDisabledForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") boolean apiTerminationDisabled); @@ -300,7 +299,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" }) ListenableFuture setInstanceTypeForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") String instanceType); @@ -312,7 +311,7 @@ public interface InstanceAsyncClient { @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceInitiatedShutdownBehavior" }) ListenableFuture setInstanceInitiatedShutdownBehaviorForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior); @@ -323,7 +322,7 @@ public interface InstanceAsyncClient { @Path("/") @FormParams(keys = { ACTION }, values = { "ModifyInstanceAttribute" }) ListenableFuture setBlockDeviceMappingForInstanceInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId") String instanceId, @BinderParam(BindBlockDeviceMappingToIndexedFormParams.class) BlockDeviceMapping blockDeviceMapping); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceClient.java index e34461a572..f6892dce6e 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/InstanceClient.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.domain.*; import org.jclouds.aws.ec2.domain.RunningInstance.EbsBlockDevice; import org.jclouds.aws.ec2.domain.Volume.InstanceInitiatedShutdownBehavior; @@ -61,7 +60,7 @@ public interface InstanceClient { * @see */ - Set describeInstancesInRegion(@Nullable Region region, String... instanceIds); + Set describeInstancesInRegion(@Nullable String region, String... instanceIds); /** * Launches a specified number of instances of an AMI for which you have permissions. @@ -134,7 +133,7 @@ public interface InstanceClient { * /> * @see RunInstancesOptions */ - Reservation runInstancesInRegion(@Nullable Region region, + Reservation runInstancesInRegion(@Nullable String region, @Nullable AvailabilityZone nullableAvailabilityZone, String imageId, int minCount, int maxCount, RunInstancesOptions... options); @@ -153,7 +152,7 @@ public interface InstanceClient { * @see */ - Set terminateInstancesInRegion(@Nullable Region region, String... instanceIds); + Set terminateInstancesInRegion(@Nullable String region, String... instanceIds); /** * Stops an instance that uses an Amazon EBS volume as its root device. @@ -189,7 +188,7 @@ public interface InstanceClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html" * /> */ - Set stopInstancesInRegion(@Nullable Region region, boolean force, + Set stopInstancesInRegion(@Nullable String region, boolean force, String... instanceIds); /** @@ -214,7 +213,7 @@ public interface InstanceClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html" * /> */ - void rebootInstancesInRegion(@Nullable Region region, String... instanceIds); + void rebootInstancesInRegion(@Nullable String region, String... instanceIds); /** * Starts an instance that uses an Amazon EBS volume as its root device. @@ -244,7 +243,7 @@ public interface InstanceClient { * @see */ - Set startInstancesInRegion(@Nullable Region region, String... instanceIds); + Set startInstancesInRegion(@Nullable String region, String... instanceIds); /** * @@ -255,7 +254,7 @@ public interface InstanceClient { * which instance to describe the attribute of * @return unencoded user data */ - String getUserDataForInstanceInRegion(@Nullable Region region, String instanceId); + String getUserDataForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -266,7 +265,7 @@ public interface InstanceClient { * which instance to describe the attribute of * @return The root device name (e.g., /dev/sda1). */ - String getRootDeviceNameForInstanceInRegion(@Nullable Region region, String instanceId); + String getRootDeviceNameForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -277,7 +276,7 @@ public interface InstanceClient { * which instance to describe the attribute of * @return the ID of the RAM disk associated with the AMI. */ - String getRamdiskForInstanceInRegion(@Nullable Region region, String instanceId); + String getRamdiskForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -288,7 +287,7 @@ public interface InstanceClient { * which instance to describe the attribute of * @return the ID of the kernel associated with the AMI. */ - String getKernelForInstanceInRegion(@Nullable Region region, String instanceId); + String getKernelForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -300,7 +299,7 @@ public interface InstanceClient { * @return Specifies whether the instance can be terminated using the APIs. You must modify this * attribute before you can terminate any "locked" instances from the APIs. */ - boolean isApiTerminationDisabledForInstanceInRegion(@Nullable Region region, String instanceId); + boolean isApiTerminationDisabledForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -311,7 +310,7 @@ public interface InstanceClient { * which instance to describe the attribute of * @return The instance type of the instance. */ - String getInstanceTypeForInstanceInRegion(@Nullable Region region, String instanceId); + String getInstanceTypeForInstanceInRegion(@Nullable String region, String instanceId); /** * @@ -324,7 +323,7 @@ public interface InstanceClient { * is shut down. */ InstanceInitiatedShutdownBehavior getInstanceInitiatedShutdownBehaviorForInstanceInRegion( - Region region, String instanceId); + String region, String instanceId); /** * @@ -336,7 +335,7 @@ public interface InstanceClient { * @return Describes the mapping that defines native device names to use when exposing virtual * devices. */ - Map getBlockDeviceMappingForInstanceInRegion(@Nullable Region region, + Map getBlockDeviceMappingForInstanceInRegion(@Nullable String region, String instanceId); /** @@ -349,7 +348,7 @@ public interface InstanceClient { * which instance to reset the attribute of * @return the ID of the RAM disk associated with the AMI. */ - String resetRamdiskForInstanceInRegion(@Nullable Region region, String instanceId); + String resetRamdiskForInstanceInRegion(@Nullable String region, String instanceId); /** * Resets an attribute of an instance to its default value. @@ -361,7 +360,7 @@ public interface InstanceClient { * which instance to reset the attribute of * @return the ID of the kernel associated with the AMI. */ - String resetKernelForInstanceInRegion(@Nullable Region region, String instanceId); + String resetKernelForInstanceInRegion(@Nullable String region, String instanceId); /** * Sets the userData used for starting the instance. @@ -383,7 +382,7 @@ public interface InstanceClient { * @see */ - void setUserDataForInstanceInRegion(@Nullable Region region, String instanceId, byte[] unencodedData); + void setUserDataForInstanceInRegion(@Nullable String region, String instanceId, byte[] unencodedData); /** * Sets the ramdisk used for starting the instance. @@ -405,7 +404,7 @@ public interface InstanceClient { * @see */ - void setRamdiskForInstanceInRegion(@Nullable Region region, String instanceId, String ramdisk); + void setRamdiskForInstanceInRegion(@Nullable String region, String instanceId, String ramdisk); /** * Sets the kernelId used for starting the instance. @@ -427,7 +426,7 @@ public interface InstanceClient { * @see */ - void setKernelForInstanceInRegion(@Nullable Region region, String instanceId, String kernel); + void setKernelForInstanceInRegion(@Nullable String region, String instanceId, String kernel); /** * This command works while the instance is running and controls whether or not the api can be @@ -443,7 +442,7 @@ public interface InstanceClient { * @see */ - void setApiTerminationDisabledForInstanceInRegion(@Nullable Region region, String instanceId, + void setApiTerminationDisabledForInstanceInRegion(@Nullable String region, String instanceId, boolean apiTerminationDisabled); /** @@ -466,7 +465,7 @@ public interface InstanceClient { * @see */ - void setInstanceTypeForInstanceInRegion(@Nullable Region region, String instanceId, + void setInstanceTypeForInstanceInRegion(@Nullable String region, String instanceId, String instanceType); /** @@ -491,7 +490,7 @@ public interface InstanceClient { * @see */ - void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(@Nullable Region region, String instanceId, + void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(@Nullable String region, String instanceId, InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior); /** @@ -538,6 +537,6 @@ public interface InstanceClient { * @see */ - void setBlockDeviceMappingForInstanceInRegion(@Nullable Region region, String instanceId, + void setBlockDeviceMappingForInstanceInRegion(@Nullable String region, String instanceId, BlockDeviceMapping blockDeviceMapping); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairAsyncClient.java index 6be667ee20..6289bd8b91 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairAsyncClient.java @@ -63,7 +63,7 @@ public interface KeyPairAsyncClient { @FormParams(keys = ACTION, values = "CreateKeyPair") @XMLResponseParser(KeyPairResponseHandler.class) ListenableFuture createKeyPairInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("KeyName") String keyName); // map resourcenotfoundexception to empty set @@ -75,7 +75,7 @@ public interface KeyPairAsyncClient { @FormParams(keys = ACTION, values = "DescribeKeyPairs") @XMLResponseParser(DescribeKeyPairsResponseHandler.class) ListenableFuture> describeKeyPairsInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindKeyNameToIndexedFormParams.class) String... keyPairNames); /** @@ -85,7 +85,7 @@ public interface KeyPairAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "DeleteKeyPair") ListenableFuture deleteKeyPairInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("KeyName") String keyName); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairClient.java index e03d98bdde..c82db16787 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/KeyPairClient.java @@ -55,7 +55,7 @@ public interface KeyPairClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateKeyPair.html" * /> */ - KeyPair createKeyPairInRegion(@Nullable Region region, String keyName); + KeyPair createKeyPairInRegion(@Nullable String region, String keyName); /** * Returns information about key pairs available to you. If you specify key pairs, information @@ -72,7 +72,7 @@ public interface KeyPairClient { * @see */ - Set describeKeyPairsInRegion(@Nullable Region region, String... keyPairNames); + Set describeKeyPairsInRegion(@Nullable String region, String... keyPairNames); /** * Deletes the specified key pair, by removing the public key from Amazon EC2. You must own the @@ -90,6 +90,6 @@ public interface KeyPairClient { * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteKeyPair.html" * /> */ - void deleteKeyPairInRegion(@Nullable Region region, String keyName); + void deleteKeyPairInRegion(@Nullable String region, String keyName); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java index a42e575457..4de651cd47 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java @@ -62,7 +62,7 @@ public interface MonitoringAsyncClient { @FormParams(keys = ACTION, values = "MonitorInstances") @XMLResponseParser(MonitoringStateHandler.class) ListenableFuture> monitorInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId.0") String instanceId, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @@ -74,7 +74,7 @@ public interface MonitoringAsyncClient { @FormParams(keys = ACTION, values = "UnmonitorInstances") @XMLResponseParser(MonitoringStateHandler.class) ListenableFuture> unmonitorInstancesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("InstanceId.0") String instanceId, @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringClient.java index 5956153679..e9b6b72b1b 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/MonitoringClient.java @@ -50,7 +50,7 @@ public interface MonitoringClient { * @see */ - Map monitorInstancesInRegion(@Nullable Region region, String instanceId, + Map monitorInstancesInRegion(@Nullable String region, String instanceId, String... instanceIds); /** @@ -67,6 +67,6 @@ public interface MonitoringClient { * @see */ - Map unmonitorInstancesInRegion(@Nullable Region region, String instanceId, + Map unmonitorInstancesInRegion(@Nullable String region, String instanceId, String... instanceIds); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClient.java index cadeda470e..c68fd12544 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClient.java @@ -66,7 +66,7 @@ public interface SecurityGroupAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "CreateSecurityGroup") ListenableFuture createSecurityGroupInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String name, @FormParam("GroupDescription") String description); /** @@ -77,7 +77,7 @@ public interface SecurityGroupAsyncClient { @FormParams(keys = ACTION, values = "DeleteSecurityGroup") @ExceptionParser(ReturnVoidOnGroupNotFound.class) ListenableFuture deleteSecurityGroupInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String name); /** @@ -88,7 +88,7 @@ public interface SecurityGroupAsyncClient { @FormParams(keys = ACTION, values = "DescribeSecurityGroups") @XMLResponseParser(DescribeSecurityGroupsResponseHandler.class) ListenableFuture> describeSecurityGroupsInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @BinderParam(BindGroupNameToIndexedFormParams.class) String... securityGroupNames); /** @@ -98,7 +98,7 @@ public interface SecurityGroupAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") ListenableFuture authorizeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String groupName, @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); @@ -110,7 +110,7 @@ public interface SecurityGroupAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") ListenableFuture authorizeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); @@ -122,7 +122,7 @@ public interface SecurityGroupAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") ListenableFuture revokeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String groupName, @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); @@ -134,7 +134,7 @@ public interface SecurityGroupAsyncClient { @Path("/") @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") ListenableFuture revokeSecurityGroupIngressInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("GroupName") String groupName, @FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort, @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupClient.java index b28541a3fc..1e2d34ad32 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/SecurityGroupClient.java @@ -61,7 +61,7 @@ public interface SecurityGroupClient { * @see */ - void createSecurityGroupInRegion(@Nullable Region region, String name, String description); + void createSecurityGroupInRegion(@Nullable String region, String name, String description); /** * Deletes a security group that you own. @@ -81,7 +81,7 @@ public interface SecurityGroupClient { * @see */ - void deleteSecurityGroupInRegion(@Nullable Region region, String name); + void deleteSecurityGroupInRegion(@Nullable String region, String name); /** * Returns information about security groups that you own. @@ -101,7 +101,7 @@ public interface SecurityGroupClient { * @see */ - SortedSet describeSecurityGroupsInRegion(@Nullable Region region, + SortedSet describeSecurityGroupsInRegion(@Nullable String region, String... securityGroupNames); /** @@ -125,7 +125,7 @@ public interface SecurityGroupClient { * @see gRequest) { + public static String findRegionInArgsOrNull(GeneratedHttpRequest gRequest) { for (Object arg : gRequest.getArgs()) { - if (arg instanceof Region) { - return (Region) arg; + if (arg instanceof String) { + String regionName = (String) arg; + if(Region.EU_WEST_1.equals(regionName) || + Region.US_WEST_1.equals(regionName) || + Region.US_EAST_1.equals(regionName) || + Region.US_STANDARD.equals(regionName) || + Region.AP_SOUTHEAST_1.equals(regionName) + ) return regionName; } } return null; diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/AttachmentHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/AttachmentHandler.java index 39e47032b7..fc90b8387f 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/AttachmentHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/AttachmentHandler.java @@ -44,7 +44,7 @@ public class AttachmentHandler extends ParseSax.HandlerWithResult { protected DateService dateService; @Inject @EC2 - Region defaultRegion; + String defaultRegion; private String volumeId; private String instanceId; private String device; @@ -52,7 +52,7 @@ public class AttachmentHandler extends ParseSax.HandlerWithResult { private Date attachTime; public Attachment getResult() { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; return new Attachment(region, volumeId, instanceId, device, attachmentStatus, attachTime); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/BaseReservationHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/BaseReservationHandler.java index 45a31c8c2c..52ff00ae2b 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/BaseReservationHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/BaseReservationHandler.java @@ -54,10 +54,10 @@ public abstract class BaseReservationHandler extends HandlerWithResult { protected final DateService dateService; - protected final Region defaultRegion; + protected final String defaultRegion; @Inject - public BaseReservationHandler(DateService dateService, @EC2 Region defaultRegion) { + public BaseReservationHandler(DateService dateService, @EC2 String defaultRegion) { this.dateService = dateService; this.defaultRegion = defaultRegion; } @@ -208,7 +208,7 @@ public abstract class BaseReservationHandler extends HandlerWithResult { this.attachTime = null; this.deleteOnTermination = true; } else if (inInstances && !inProductCodes && !inBlockDeviceMapping) { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; instances.add(new RunningInstance(region, amiLaunchIndex, dnsName, imageId, instanceId, @@ -261,7 +261,7 @@ public abstract class BaseReservationHandler extends HandlerWithResult { } protected Reservation newReservation() { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; Reservation info = new Reservation(region, groupIds, instances, ownerId, requesterId, diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/CreateVolumeResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/CreateVolumeResponseHandler.java index 18d85feff9..5b926cecbf 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/CreateVolumeResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/CreateVolumeResponseHandler.java @@ -54,9 +54,9 @@ public class CreateVolumeResponseHandler extends ParseSax.HandlerWithResult availabilityZoneToRegion; + protected Map availabilityZoneToRegion; private String id; private int size; @@ -74,7 +74,7 @@ public class CreateVolumeResponseHandler extends ParseSax.HandlerWithResult contents = Sets.newLinkedHashSet(); private StringBuilder currentText = new StringBuilder(); @@ -147,7 +147,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerWithResult reservations = Sets.newTreeSet(); @Inject - DescribeInstancesResponseHandler(DateService dateService, @EC2 Region defaultRegion) { + DescribeInstancesResponseHandler(DateService dateService, @EC2 String defaultRegion) { super(dateService, defaultRegion); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeKeyPairsResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeKeyPairsResponseHandler.java index a6d42e93a8..d126ce653c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeKeyPairsResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeKeyPairsResponseHandler.java @@ -40,7 +40,7 @@ import com.google.common.collect.Sets; public class DescribeKeyPairsResponseHandler extends ParseSax.HandlerWithResult> { @Inject @EC2 - Region defaultRegion; + String defaultRegion; private StringBuilder currentText = new StringBuilder(); private Set keyPairs = Sets.newLinkedHashSet(); @@ -56,7 +56,7 @@ public class DescribeKeyPairsResponseHandler extends ParseSax.HandlerWithResult< if (qName.equals("keyFingerprint")) { this.keyFingerprint = currentText.toString().trim(); } else if (qName.equals("item")) { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; keyPairs.add(new KeyPair(region, keyName, keyFingerprint, null)); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java index af2ce8b873..687e902d22 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java @@ -33,27 +33,22 @@ import com.google.common.collect.Maps; * * @author Adrian Cole */ -public class DescribeRegionsResponseHandler extends ParseSax.HandlerWithResult> { +public class DescribeRegionsResponseHandler extends ParseSax.HandlerWithResult> { private StringBuilder currentText = new StringBuilder(); - private Map regionEndpoints = Maps.newHashMap(); - private Region region; + private Map regionEndpoints = Maps.newHashMap(); + private String region; private URI regionEndpoint; @Resource protected Logger logger = Logger.NULL; - public Map getResult() { + public Map getResult() { return regionEndpoints; } public void endElement(String uri, String name, String qName) { if (qName.equals("regionName")) { - try { - region = Region.fromValue(currentText.toString().trim()); - } catch (IllegalArgumentException e) { - logger.warn(e, "unsupported region: %s", currentText.toString().trim()); - region = Region.UNKNOWN; - } + region = currentText.toString().trim(); } else if (qName.equals("regionEndpoint")) { regionEndpoint = URI.create(String.format("https://%s", currentText.toString().trim())); } else if (qName.equals("item")) { diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeSecurityGroupsResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeSecurityGroupsResponseHandler.java index 8a59c54f77..131c7d382d 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeSecurityGroupsResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeSecurityGroupsResponseHandler.java @@ -45,7 +45,7 @@ public class DescribeSecurityGroupsResponseHandler extends ParseSax.HandlerWithResult> { @Inject @EC2 - Region defaultRegion; + String defaultRegion; private StringBuilder currentText = new StringBuilder(); private SortedSet securtyGroups = Sets.newTreeSet(); @@ -118,7 +118,7 @@ public class DescribeSecurityGroupsResponseHandler extends this.userId = null; this.userIdGroupName = null; } else if (!inIpPermissions && !inIpRanges && !inGroups) { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; securtyGroups.add(new SecurityGroup(region, groupName, ownerId, groupDescription, diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/InstanceStateChangeHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/InstanceStateChangeHandler.java index cbf3178273..3a4482f336 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/InstanceStateChangeHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/InstanceStateChangeHandler.java @@ -51,7 +51,7 @@ public class InstanceStateChangeHandler extends HandlerWithResult instances = Sets.newTreeSet(); private InstanceState shutdownState; @@ -90,7 +90,7 @@ public class InstanceStateChangeHandler extends HandlerWithResult { @Inject @EC2 - Region defaultRegion; + String defaultRegion; private StringBuilder currentText = new StringBuilder(); private String keyFingerprint; private String keyMaterial; private String keyName; public KeyPair getResult() { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; return new KeyPair(region, keyName, keyFingerprint, keyMaterial); diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/RunInstancesResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/RunInstancesResponseHandler.java index 1657b3909e..7df9a35175 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/RunInstancesResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/RunInstancesResponseHandler.java @@ -36,7 +36,7 @@ import org.jclouds.date.DateService; public class RunInstancesResponseHandler extends BaseReservationHandler { @Inject - RunInstancesResponseHandler(DateService dateService, @EC2 Region defaultRegion) { + RunInstancesResponseHandler(DateService dateService, @EC2 String defaultRegion) { super(dateService, defaultRegion); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/SnapshotHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/SnapshotHandler.java index efcd430f50..51cfa697b6 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/SnapshotHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/SnapshotHandler.java @@ -38,7 +38,7 @@ public class SnapshotHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); protected final DateService dateService; - protected final Region defaultRegion; + protected final String defaultRegion; private String id; private String volumeId; @@ -51,13 +51,13 @@ public class SnapshotHandler extends ParseSax.HandlerWithResult { private String ownerAlias; @Inject - public SnapshotHandler(DateService dateService, @EC2 Region defaultRegion) { + public SnapshotHandler(DateService dateService, @EC2 String defaultRegion) { this.dateService = dateService; this.defaultRegion = defaultRegion; } public Snapshot getResult() { - Region region = EC2Utils.findRegionInArgsOrNull(request); + String region = EC2Utils.findRegionInArgsOrNull(request); if (region == null) region = defaultRegion; Snapshot snapshot = new Snapshot(region, id, volumeId, volumeSize, status, startTime, diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/S3AsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/s3/S3AsyncClient.java index 1e72dd84f3..17cd8ab31d 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/S3AsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/S3AsyncClient.java @@ -31,7 +31,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.s3.binders.BindACLToXMLPayload; import org.jclouds.aws.s3.binders.BindBucketLoggingToXmlPayload; import org.jclouds.aws.s3.binders.BindNoBucketLoggingToXmlPayload; @@ -167,7 +166,7 @@ public interface S3AsyncClient { @ExceptionParser(ReturnFalseIfBucketAlreadyOwnedByYou.class) ListenableFuture putBucketInRegion( // TODO endpoint based on region - @BinderParam(BindRegionToXmlPayload.class) @Nullable Region region, + @BinderParam(BindRegionToXmlPayload.class) @Nullable String region, @HostPrefixParam String bucketName, PutBucketOptions... options); /** @@ -194,7 +193,7 @@ public interface S3AsyncClient { @QueryParams(keys = "location") @Path("/") @XMLResponseParser(LocationConstraintHandler.class) - ListenableFuture getBucketLocation(@HostPrefixParam String bucketName); + ListenableFuture getBucketLocation(@HostPrefixParam String bucketName); /** * @see S3Client#getBucketPayer diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/S3Client.java b/aws/core/src/main/java/org/jclouds/aws/s3/S3Client.java index 4ea36a2c32..a885e634bc 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/S3Client.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/S3Client.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.s3.domain.AccessControlList; import org.jclouds.aws.s3.domain.BucketLogging; import org.jclouds.aws.s3.domain.BucketMetadata; @@ -196,7 +195,7 @@ public interface S3Client { * */ @Timeout(duration = 90, timeUnit = TimeUnit.SECONDS) - boolean putBucketInRegion(@Nullable Region region, String bucketName, PutBucketOptions... options); + boolean putBucketInRegion(@Nullable String region, String bucketName, PutBucketOptions... options); /** * Deletes the bucket, if it is empty. @@ -359,7 +358,7 @@ public interface S3Client { * "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTBucketLocationGET.html" * /> */ - Region getBucketLocation(String bucketName); + String getBucketLocation(String bucketName); /** * A GET request operation on a requestPayment resource returns the request payment configuration diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3AsyncBlobStore.java b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3AsyncBlobStore.java index d891b23d4d..0f08ee2bf7 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3AsyncBlobStore.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3AsyncBlobStore.java @@ -137,14 +137,14 @@ public class S3AsyncBlobStore extends BaseAsyncBlobStore { * This implementation invokes {@link S3AsyncClient#putBucketInRegion} * * @param location - * corresponds to {@link Region#fromValue} + * corresponds to {@link Region} * @param container * bucket name */ @Override public ListenableFuture createContainerInLocation(Location location, String container) { location = location != null ? location : defaultLocation; - return async.putBucketInRegion(Region.fromValue(location.getId()), container); + return async.putBucketInRegion(location.getId(), container); } /** diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3BlobStore.java b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3BlobStore.java index de810a00ec..235bb89cb3 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3BlobStore.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/S3BlobStore.java @@ -132,7 +132,7 @@ public class S3BlobStore extends BaseBlobStore { @Override public boolean createContainerInLocation(Location location, String container) { location = location != null ? location : defaultLocation; - return sync.putBucketInRegion(Region.fromValue(location.getId()), container); + return sync.putBucketInRegion(location.getId(), container); } /** diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/config/S3BlobStoreContextModule.java b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/config/S3BlobStoreContextModule.java index 4bdce1b32a..af386549ca 100755 --- a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/config/S3BlobStoreContextModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/config/S3BlobStoreContextModule.java @@ -68,15 +68,15 @@ public class S3BlobStoreContextModule extends S3ContextModule { @Provides @Singleton - Location getDefaultLocation(@S3 Region region, Map locations) { + Location getDefaultLocation(@S3 String region, Map locations) { return locations.get(region.toString()); } @Provides @Singleton - Map provideLocations(@S3 Set regions) { + Map provideLocations(@S3 Set regions) { Set locations = Sets.newHashSet(); - for (Region zone : regions) { + for (String zone : regions) { locations .add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), null)); } diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/functions/BucketToResourceMetadata.java b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/functions/BucketToResourceMetadata.java index 5b3a5a23f6..c1d49ba685 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/functions/BucketToResourceMetadata.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/blobstore/functions/BucketToResourceMetadata.java @@ -59,7 +59,7 @@ public class BucketToResourceMetadata implements Function provideRegions( + Map provideRegions( @Named(S3Constants.PROPERTY_S3_ENDPOINT_US_STANDARD) String usstandard, @Named(S3Constants.PROPERTY_S3_ENDPOINT_US_WEST_1) String uswest, @Named(S3Constants.PROPERTY_S3_ENDPOINT_EU_WEST_1) String euwest) { - return ImmutableMap. of(Region.US_STANDARD, URI.create(usstandard), + return ImmutableMap. of(Region.US_STANDARD, URI.create(usstandard), Region.US_WEST_1, URI.create(uswest), Region.EU_WEST_1, URI.create(euwest)); } @Provides @Singleton @S3 - Set provideRegions(@S3 Map map) { + Set provideRegions(@S3 Map map) { return map.keySet(); } @@ -127,8 +127,8 @@ public class S3RestClientModule extends AbstractModule { @Provides @Singleton @S3 - Region getDefaultRegion(@S3 URI uri, @S3 Map map) { - return ImmutableBiMap. builder().putAll(map).build().inverse().get(uri); + String getDefaultRegion(@S3 URI uri, @S3 Map map) { + return ImmutableBiMap. builder().putAll(map).build().inverse().get(uri); } @Provides diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/functions/BindRegionToXmlPayload.java b/aws/core/src/main/java/org/jclouds/aws/s3/functions/BindRegionToXmlPayload.java index 4d5d976985..55205d62fe 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/functions/BindRegionToXmlPayload.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/functions/BindRegionToXmlPayload.java @@ -40,31 +40,25 @@ import org.jclouds.rest.binders.BindToStringPayload; @Singleton public class BindRegionToXmlPayload extends BindToStringPayload { - private final Region defaultRegion; + private final String defaultRegion; @Inject - BindRegionToXmlPayload(@S3 Region defaultRegion) { + BindRegionToXmlPayload(@S3 String defaultRegion) { this.defaultRegion = defaultRegion; } @Override public void bindToRequest(HttpRequest request, Object input) { input = input == null ? defaultRegion : input; - checkArgument(input instanceof Region, "this binder is only valid for Region!"); - Region constraint = (Region) input; + checkArgument(input instanceof String, "this binder is only valid for Region!"); + String constraint = (String) input; String value = null; - switch (constraint) { - case US_STANDARD: - case US_EAST_1: - // nothing to bind as this is default. - return; - case EU_WEST_1: - value = "EU"; - break; - case US_WEST_1: - value = "us-west-1"; - break; - default: + if(Region.US_STANDARD.equals(constraint) || Region.US_EAST_1.equals(constraint)) { + // nothing to bind as this is default. + return; + } else if(Region.EU_WEST_1.equals(constraint)) value = "EU"; + else if(Region.US_WEST_1.equals(constraint)) value = "us-west-1"; + else { throw new IllegalStateException("unimplemented location: " + this); } String payload = String diff --git a/aws/core/src/main/java/org/jclouds/aws/s3/xml/LocationConstraintHandler.java b/aws/core/src/main/java/org/jclouds/aws/s3/xml/LocationConstraintHandler.java index 286b542d44..21d3e5fa59 100644 --- a/aws/core/src/main/java/org/jclouds/aws/s3/xml/LocationConstraintHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/s3/xml/LocationConstraintHandler.java @@ -29,11 +29,11 @@ import org.jclouds.http.functions.ParseSax; * @see * @author Adrian Cole */ -public class LocationConstraintHandler extends ParseSax.HandlerWithResult { +public class LocationConstraintHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); - private Region region; + private String region; - public Region getResult() { + public String getResult() { return region; } @@ -46,7 +46,7 @@ public class LocationConstraintHandler extends ParseSax.HandlerWithResult * {@code US_STANDARD} is returned as "" xml documents. */ - public static Region fromValue(String v) { + public static String fromValue(String v) { if (v.equals("")) return Region.US_STANDARD; if (v.equals("EU")) diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/SQSAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/sqs/SQSAsyncClient.java index b3d779e489..bf1efa99ee 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/SQSAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/SQSAsyncClient.java @@ -65,7 +65,7 @@ public interface SQSAsyncClient { @FormParams(keys = ACTION, values = "ListQueues") @ResponseParser(RegexListQueuesResponseHandler.class) ListenableFuture> listQueuesInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, ListQueuesOptions... options); /** @@ -76,7 +76,7 @@ public interface SQSAsyncClient { @FormParams(keys = ACTION, values = "CreateQueue") @ResponseParser(RegexQueueHandler.class) ListenableFuture createQueueInRegion( - @EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, + @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("QueueName") String queueName, CreateQueueOptions... options); /** diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/SQSClient.java b/aws/core/src/main/java/org/jclouds/aws/sqs/SQSClient.java index cadbc92ec0..05d883aa4a 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/SQSClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/SQSClient.java @@ -51,7 +51,7 @@ public interface SQSClient { * @see */ - Set listQueuesInRegion(@Nullable Region region, ListQueuesOptions... options); + Set listQueuesInRegion(@Nullable String region, ListQueuesOptions... options); /** * @@ -81,7 +81,7 @@ public interface SQSClient { * @param options * like the visibility timeout (in seconds) to use for this queue. */ - Queue createQueueInRegion(@Nullable Region region, String queueName, CreateQueueOptions... options); + Queue createQueueInRegion(@Nullable String region, String queueName, CreateQueueOptions... options); /** * The DeleteQueue action deletes the queue specified by the queue URL, regardless of whether the diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/config/SQSRestClientModule.java b/aws/core/src/main/java/org/jclouds/aws/sqs/config/SQSRestClientModule.java index e35d82037c..47157615e1 100755 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/config/SQSRestClientModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/config/SQSRestClientModule.java @@ -91,11 +91,11 @@ public class SQSRestClientModule extends AbstractModule { @Provides @Singleton @SQS - Map provideRegions( + Map provideRegions( @Named(SQSConstants.PROPERTY_SQS_ENDPOINT_US_EAST_1) String useast, @Named(SQSConstants.PROPERTY_SQS_ENDPOINT_US_WEST_1) String uswest, @Named(SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1) String euwest) { - return ImmutableMap. of(Region.US_EAST_1, URI.create(useast), Region.US_WEST_1, + return ImmutableMap. of(Region.US_EAST_1, URI.create(useast), Region.US_WEST_1, URI.create(uswest), Region.EU_WEST_1, URI.create(euwest)); } @@ -109,8 +109,8 @@ public class SQSRestClientModule extends AbstractModule { @Provides @Singleton @SQS - Region getDefaultRegion(@SQS URI uri, @SQS Map map) { - return ImmutableBiMap. builder().putAll(map).build().inverse().get(uri); + String getDefaultRegion(@SQS URI uri, @SQS Map map) { + return ImmutableBiMap. builder().putAll(map).build().inverse().get(uri); } @Provides diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/domain/Queue.java b/aws/core/src/main/java/org/jclouds/aws/sqs/domain/Queue.java index a7fa1a4df1..b86573040d 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/domain/Queue.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/domain/Queue.java @@ -31,11 +31,11 @@ import org.jclouds.aws.domain.Region; * @author Adrian Cole */ public class Queue implements Comparable { - private final Region region; + private final String region; private final String name; private final URI location; - public Queue(Region region, String name, URI location) { + public Queue(String region, String name, URI location) { this.region = checkNotNull(region,"region"); this.location = checkNotNull(location, "location"); this.name = checkNotNull(name, "name"); @@ -46,7 +46,7 @@ public class Queue implements Comparable { return location.toASCIIString().compareTo(o.location.toASCIIString()); } - public Region getRegion() { + public String getRegion() { return region; } diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/functions/RegionToEndpoint.java b/aws/core/src/main/java/org/jclouds/aws/sqs/functions/RegionToEndpoint.java index 64d395662a..fd9702cf59 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/functions/RegionToEndpoint.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/functions/RegionToEndpoint.java @@ -35,11 +35,11 @@ import com.google.common.base.Function; */ @Singleton public class RegionToEndpoint implements Function { - private final Map regionToEndpoint; + private final Map regionToEndpoint; private final URI defaultUri; @Inject - public RegionToEndpoint(@SQS Map regionToEndpoint, @SQS URI defaultUri) { + public RegionToEndpoint(@SQS Map regionToEndpoint, @SQS URI defaultUri) { this.regionToEndpoint = regionToEndpoint; this.defaultUri = defaultUri; } diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/QueueHandler.java b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/QueueHandler.java index 5a00c87db6..c5c56bd334 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/QueueHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/QueueHandler.java @@ -43,13 +43,13 @@ public class QueueHandler extends ParseSax.HandlerWithResult { private StringBuilder currentText = new StringBuilder(); Queue queue; - private final ImmutableBiMap regionBiMap; + private final ImmutableBiMap regionBiMap; private final Provider uriBuilderProvider; @Inject - QueueHandler(Provider uriBuilderProvider, @SQS Map regionMap) { + QueueHandler(Provider uriBuilderProvider, @SQS Map regionMap) { this.uriBuilderProvider = uriBuilderProvider; - this.regionBiMap = ImmutableBiMap. builder().putAll(regionMap).build(); + this.regionBiMap = ImmutableBiMap. builder().putAll(regionMap).build(); } public Queue getResult() { @@ -63,7 +63,7 @@ public class QueueHandler extends ParseSax.HandlerWithResult { String queueName = uriText.substring(uriText.lastIndexOf('/') + 1); URI location = URI.create(uriText); URI regionURI = uriBuilderProvider.get().uri(location).replacePath("").build(); - Region region = regionBiMap.inverse().get(regionURI); + String region = regionBiMap.inverse().get(regionURI); this.queue = new Queue(region, queueName, location); } currentText = new StringBuilder(); diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexListQueuesResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexListQueuesResponseHandler.java index 9da4ff577f..8e2f95fe9a 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexListQueuesResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexListQueuesResponseHandler.java @@ -46,7 +46,7 @@ import com.google.common.base.Throwables; public class RegexListQueuesResponseHandler extends BaseRegexQueueHandler implements Function> { @Inject - RegexListQueuesResponseHandler(@SQS Map regionMap) { + RegexListQueuesResponseHandler(@SQS Map regionMap) { super(regionMap); } diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexQueueHandler.java b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexQueueHandler.java index 67f60c6695..acf66cced5 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexQueueHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/RegexQueueHandler.java @@ -46,7 +46,7 @@ import com.google.inject.internal.Iterables; public class RegexQueueHandler extends BaseRegexQueueHandler implements Function { @Inject - RegexQueueHandler(@SQS Map regionMap) { + RegexQueueHandler(@SQS Map regionMap) { super(regionMap); } diff --git a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/internal/BaseRegexQueueHandler.java b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/internal/BaseRegexQueueHandler.java index d55b1fd5f7..89e37b4520 100644 --- a/aws/core/src/main/java/org/jclouds/aws/sqs/xml/internal/BaseRegexQueueHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/sqs/xml/internal/BaseRegexQueueHandler.java @@ -41,12 +41,12 @@ import com.google.common.collect.Sets; */ @Singleton public class BaseRegexQueueHandler { - private final ImmutableBiMap uriToRegion; + private final ImmutableBiMap uriToRegion; Pattern pattern = Pattern.compile("(https://[\\S&&[^<]]+)"); @Inject - protected BaseRegexQueueHandler(Map regionMap) { - this.uriToRegion = ImmutableBiMap. builder().putAll(regionMap).build().inverse(); + protected BaseRegexQueueHandler(Map regionMap) { + this.uriToRegion = ImmutableBiMap. builder().putAll(regionMap).build().inverse(); } public Set parse(String in) { @@ -58,7 +58,7 @@ public class BaseRegexQueueHandler { URI location = URI.create(uriText); String regionString = uriText.substring(0, uriText.indexOf(".com/") + 4); URI regionURI = URI.create(regionString); - Region region = uriToRegion.get(regionURI); + String region = uriToRegion.get(regionURI); queues.add(new Queue(region, queueName, location)); } return queues; diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIAsyncClientTest.java index 421d7d85dd..096020d653 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIAsyncClientTest.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.lang.reflect.Array; import java.lang.reflect.Method; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.options.CreateImageOptions; import org.jclouds.aws.ec2.options.DescribeImagesOptions; import org.jclouds.aws.ec2.options.RegisterImageBackedByEbsOptions; @@ -52,7 +51,7 @@ import com.google.inject.TypeLiteral; public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException { - Method method = AMIAsyncClient.class.getMethod("createImageInRegion", Region.class, + Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class, Array.newInstance(CreateImageOptions.class, 0) .getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, @@ -72,7 +71,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = AMIAsyncClient.class.getMethod("createImageInRegion", Region.class, + Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class, Array.newInstance(CreateImageOptions.class, 0) .getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, @@ -94,10 +93,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { } public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException { - Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", Region.class, Array + Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array .newInstance(DescribeImagesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, - (Region) null); + (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -117,7 +116,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", Region.class, Array + Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array .newInstance(DescribeImagesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, executableBy("me").ownedBy("fred", "nancy").imageIds("1", "2")); @@ -137,7 +136,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { } public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException { - Method method = AMIAsyncClient.class.getMethod("deregisterImageInRegion", Region.class, + Method method = AMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageId"); @@ -157,7 +156,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", - Region.class, String.class, String.class, Array.newInstance( + String.class, String.class, String.class, Array.newInstance( RegisterImageOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "name", "pathToManifest"); @@ -177,7 +176,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", - Region.class, String.class, String.class, Array.newInstance( + String.class, String.class, String.class, Array.newInstance( RegisterImageOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "name", "pathToManifest", new RegisterImageOptions().withDescription("description")); @@ -199,7 +198,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", - Region.class, String.class, String.class, Array.newInstance( + String.class, String.class, String.class, Array.newInstance( RegisterImageBackedByEbsOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageName", "snapshotId"); @@ -220,7 +219,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", - Region.class, String.class, String.class, Array.newInstance( + String.class, String.class, String.class, Array.newInstance( RegisterImageBackedByEbsOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageName", "snapshotId", new RegisterImageBackedByEbsOptions().withDescription( @@ -244,7 +243,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("getProductCodesForImageInRegion", - Region.class, String.class); + String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageId"); @@ -264,7 +263,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", - Region.class, String.class); + String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageId"); @@ -284,7 +283,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", - Region.class, String.class); + String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageId"); @@ -304,7 +303,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", - Region.class, Iterable.class, Iterable.class, String.class); + String.class, Iterable.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId"); @@ -329,7 +328,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", - Region.class, Iterable.class, Iterable.class, String.class); + String.class, Iterable.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId"); @@ -349,7 +348,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", - Region.class, String.class); + String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "imageId"); @@ -368,7 +367,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("addProductCodesToImageInRegion", - Region.class, Iterable.class, String.class); + String.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, ImmutableList.of("code1", "code2"), "imageId"); @@ -389,7 +388,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { public void testRemoveProductCodesFromImage() throws SecurityException, NoSuchMethodException, IOException { Method method = AMIAsyncClient.class.getMethod("removeProductCodesFromImageInRegion", - Region.class, Iterable.class, String.class); + String.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, ImmutableList.of("code1", "code2"), "imageId"); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java index 8521831bbe..bc07e9f54c 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AMIClientLiveTest.java @@ -75,7 +75,7 @@ public class AMIClientLiveTest { } public void testDescribeImages() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client.describeImagesInRegion(region)); assertNotNull(allResults); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java index c80618d6fb..11fce2f903 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java @@ -50,7 +50,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, IOException { Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod( - "describeAvailabilityZonesInRegion", Region.class, Array.newInstance( + "describeAvailabilityZonesInRegion", String.class, Array.newInstance( DescribeAvailabilityZonesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor .createRequest(method, Region.US_WEST_1); @@ -71,7 +71,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends public void testDescribeAvailabilityZonesOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod( - "describeAvailabilityZonesInRegion", Region.class, Array.newInstance( + "describeAvailabilityZonesInRegion", String.class, Array.newInstance( DescribeAvailabilityZonesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor .createRequest(method, Region.US_EAST_1, availabilityZones( diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClientLiveTest.java index e6fb93e85b..2b157b894c 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/AvailabilityZoneAndRegionClientLiveTest.java @@ -68,7 +68,7 @@ public class AvailabilityZoneAndRegionClientLiveTest { } public void testDescribeAvailabilityZones() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client .describeAvailabilityZonesInRegion(region)); @@ -88,14 +88,14 @@ public class AvailabilityZoneAndRegionClientLiveTest { } public void testDescribeRegions() { - SortedMap allResults = Maps.newTreeMap(); + SortedMap allResults = Maps.newTreeMap(); allResults.putAll(client.describeRegions()); assertNotNull(allResults); assert allResults.size() >= 2 : allResults.size(); - Iterator> iterator = allResults.entrySet().iterator(); - Region r1 = iterator.next().getKey(); - Region r2 = iterator.next().getKey(); - SortedMap twoResults = Maps.newTreeMap(); + Iterator> iterator = allResults.entrySet().iterator(); + String r1 = iterator.next().getKey(); + String r2 = iterator.next().getKey(); + SortedMap twoResults = Maps.newTreeMap(); twoResults.putAll(client.describeRegions(regions(r1, r2))); assertNotNull(twoResults); assertEquals(twoResults.size(), 2); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/BaseEC2AsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/BaseEC2AsyncClientTest.java index e5b4dcb716..e934237421 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/BaseEC2AsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/BaseEC2AsyncClientTest.java @@ -79,7 +79,7 @@ public abstract class BaseEC2AsyncClientTest extends RestClientTest { .build(), "properties")); bind(URI.class).annotatedWith(EC2.class).toInstance( URI.create("https://ec2.amazonaws.com")); - bind(Region.class).annotatedWith(EC2.class).toInstance(Region.US_EAST_1); + bind(String.class).annotatedWith(EC2.class).toInstance(Region.US_EAST_1); bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() { public Logger getLogger(String category) { return Logger.NULL; @@ -98,8 +98,8 @@ public abstract class BaseEC2AsyncClientTest extends RestClientTest { @Singleton @Provides @EC2 - Map provideMap() { - return ImmutableMap. of(Region.EU_WEST_1, URI + Map provideMap() { + return ImmutableMap. of(Region.EU_WEST_1, URI .create("https://ec2.eu-west-1.amazonaws.com"), Region.US_EAST_1, URI .create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1, URI .create("https://ec2.us-west-1.amazonaws.com")); @@ -108,8 +108,8 @@ public abstract class BaseEC2AsyncClientTest extends RestClientTest { @SuppressWarnings("unused") @Singleton @Provides - Map provideAvailabilityZoneRegionMap() { - return ImmutableMap. of(AvailabilityZone.US_EAST_1A, + Map provideAvailabilityZoneRegionMap() { + return ImmutableMap. of(AvailabilityZone.US_EAST_1A, Region.US_EAST_1); } }; diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClientTest.java index df8d8f293c..026cb599e9 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreAsyncClientTest.java @@ -117,7 +117,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("deleteVolumeInRegion", - Region.class, String.class); + String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "id"); @@ -135,9 +135,9 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", - Region.class, Array.newInstance(String.class, 0).getClass()); + String.class, Array.newInstance(String.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( - method, (Region) null); + method, (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -154,7 +154,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", - Region.class, Array.newInstance(String.class, 0).getClass()); + String.class, Array.newInstance(String.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "1", "2"); @@ -173,7 +173,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", - Region.class, String.class, String.class, String.class); + String.class, String.class, String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "id", "instanceId", "/device"); @@ -192,7 +192,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", - Region.class, String.class, boolean.class, Array.newInstance( + String.class, String.class, boolean.class, Array.newInstance( DetachVolumeOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "id", false); @@ -213,7 +213,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", - Region.class, String.class, boolean.class, Array.newInstance( + String.class, String.class, boolean.class, Array.newInstance( DetachVolumeOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "id", true, fromInstance("instanceId").fromDevice("/device")); @@ -234,7 +234,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", - Region.class, String.class, Array.newInstance(CreateSnapshotOptions.class, 0) + String.class, String.class, Array.newInstance(CreateSnapshotOptions.class, 0) .getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "volumeId"); @@ -254,7 +254,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", - Region.class, String.class, Array.newInstance(CreateSnapshotOptions.class, 0) + String.class, String.class, Array.newInstance(CreateSnapshotOptions.class, 0) .getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "volumeId", CreateSnapshotOptions.Builder @@ -275,9 +275,9 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", - Region.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); + String.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( - method, (Region) null); + method, (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -294,7 +294,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", - Region.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); + String.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, ownedBy("o1", "o2").restorableBy("r1", "r2").snapshotIds("s1", "s2")); @@ -315,7 +315,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testGetCreateVolumePermissionForSnapshot() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod( - "getCreateVolumePermissionForSnapshotInRegion", Region.class, String.class); + "getCreateVolumePermissionForSnapshotInRegion", String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "snapshotId"); @@ -336,7 +336,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod( - "addCreateVolumePermissionsToSnapshotInRegion", Region.class, Iterable.class, + "addCreateVolumePermissionsToSnapshotInRegion", String.class, Iterable.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId"); @@ -358,7 +358,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod( - "removeCreateVolumePermissionsFromSnapshotInRegion", Region.class, Iterable.class, + "removeCreateVolumePermissionsFromSnapshotInRegion", String.class, Iterable.class, Iterable.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId"); @@ -379,7 +379,7 @@ public class ElasticBlockStoreAsyncClientTest extends public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticBlockStoreAsyncClient.class.getMethod( - "resetCreateVolumePermissionsOnSnapshotInRegion", Region.class, String.class); + "resetCreateVolumePermissionsOnSnapshotInRegion", String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, "snapshotId"); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClientLiveTest.java index a19deafae9..87b1071788 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticBlockStoreClientLiveTest.java @@ -72,7 +72,7 @@ public class ElasticBlockStoreClientLiveTest { @Test void testDescribeVolumes() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client.describeVolumesInRegion(region)); assertNotNull(allResults); @@ -171,7 +171,7 @@ public class ElasticBlockStoreClientLiveTest { @Test void testDescribeSnapshots() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region)); assertNotNull(allResults); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClientTest.java index 4bcf840dce..35b5affe30 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressAsyncClientTest.java @@ -23,7 +23,6 @@ import java.lang.reflect.Array; import java.lang.reflect.Method; import java.net.InetAddress; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.xml.AllocateAddressResponseHandler; import org.jclouds.aws.ec2.xml.DescribeAddressesResponseHandler; import org.jclouds.http.functions.CloseContentAndReturn; @@ -46,7 +45,7 @@ public class ElasticIPAddressAsyncClientTest extends public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticIPAddressAsyncClient.class.getMethod("disassociateAddressInRegion", - Region.class, InetAddress.class); + String.class, InetAddress.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); @@ -65,7 +64,7 @@ public class ElasticIPAddressAsyncClientTest extends public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", - Region.class, InetAddress.class, String.class); + String.class, InetAddress.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }), "me"); @@ -84,7 +83,7 @@ public class ElasticIPAddressAsyncClientTest extends public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticIPAddressAsyncClient.class.getMethod("releaseAddressInRegion", - Region.class, InetAddress.class); + String.class, InetAddress.class); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); @@ -102,7 +101,7 @@ public class ElasticIPAddressAsyncClientTest extends public void testDescribeAddresses() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticIPAddressAsyncClient.class.getMethod("describeAddressesInRegion", - Region.class, Array.newInstance(InetAddress.class, 0).getClass()); + String.class, Array.newInstance(InetAddress.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest( method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); @@ -121,9 +120,9 @@ public class ElasticIPAddressAsyncClientTest extends public void testAllocateAddress() throws SecurityException, NoSuchMethodException, IOException { Method method = ElasticIPAddressAsyncClient.class.getMethod("allocateAddressInRegion", - Region.class); + String.class); GeneratedHttpRequest httpMethod = processor.createRequest( - method, (Region) null); + method, (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressClientLiveTest.java index a59a3e5394..4cee355872 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/ElasticIPAddressClientLiveTest.java @@ -61,7 +61,7 @@ public class ElasticIPAddressClientLiveTest { @Test void testDescribeAddresses() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client .describeAddressesInRegion(region)); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/InstanceAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/InstanceAsyncClientTest.java index 97d3936592..6cb31c5286 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/InstanceAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/InstanceAsyncClientTest.java @@ -55,9 +55,9 @@ import com.google.inject.TypeLiteral; public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest { public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException { Method method = InstanceAsyncClient.class.getMethod("describeInstancesInRegion", - Region.class, Array.newInstance(String.class, 0).getClass()); + String.class, Array.newInstance(String.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, - (Region) null); + (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -74,7 +74,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); @@ -94,7 +94,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); @@ -112,7 +112,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, @@ -133,7 +133,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, @@ -157,7 +157,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, true, "1", "2"); @@ -176,7 +176,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); @@ -195,7 +195,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); @@ -216,7 +216,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -236,7 +236,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -256,7 +256,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -276,7 +276,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -296,7 +296,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -316,7 +316,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -336,7 +336,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -358,7 +358,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1"); @@ -378,7 +378,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "test".getBytes()); @@ -403,7 +403,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "test"); @@ -422,7 +422,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "test"); @@ -441,7 +441,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", true); @@ -463,7 +463,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", InstanceType.C1_MEDIUM); @@ -484,7 +484,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", InstanceInitiatedShutdownBehavior.TERMINATE); @@ -506,7 +506,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest allResults = client.describeInstancesInRegion(region); assertNotNull(allResults); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairAsyncClientTest.java index 8c863d03c8..34fe2b85b0 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairAsyncClientTest.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.lang.reflect.Array; import java.lang.reflect.Method; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.xml.DescribeKeyPairsResponseHandler; import org.jclouds.http.functions.CloseContentAndReturn; import org.jclouds.http.functions.ParseSax; @@ -41,7 +40,7 @@ import com.google.inject.TypeLiteral; public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest { public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException { - Method method = KeyPairAsyncClient.class.getMethod("deleteKeyPairInRegion", Region.class, + Method method = KeyPairAsyncClient.class.getMethod("deleteKeyPairInRegion", String.class, String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "mykey"); @@ -59,10 +58,10 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, - (Region) null); + (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -78,7 +77,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairClientLiveTest.java index 08355280d1..3e5836a809 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/KeyPairClientLiveTest.java @@ -61,7 +61,7 @@ public class KeyPairClientLiveTest { @Test void testDescribeKeyPairs() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client.describeKeyPairsInRegion(region)); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java index eb50f8e803..8330306d45 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java @@ -42,7 +42,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "instance1", "instance2"); @@ -61,7 +61,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "instance1", "instance2"); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClientTest.java index 9ba0c02a53..2a2def6c8c 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupAsyncClientTest.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.lang.reflect.Array; import java.lang.reflect.Method; -import org.jclouds.aws.domain.Region; import org.jclouds.aws.ec2.domain.IpProtocol; import org.jclouds.aws.ec2.domain.UserIdGroupPair; import org.jclouds.aws.ec2.functions.ReturnVoidOnGroupNotFound; @@ -46,7 +45,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "name"); @@ -66,7 +65,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "name", "description"); @@ -86,9 +85,9 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, - (Region) null); + (String) null); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -105,7 +104,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "1", "2"); @@ -125,7 +124,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "group", new UserIdGroupPair("sourceUser", "sourceGroup")); @@ -147,7 +146,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"); @@ -169,7 +168,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "group", new UserIdGroupPair("sourceUser", "sourceGroup")); @@ -191,7 +190,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest httpMethod = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupClientLiveTest.java index f61879e155..f83bcf93c6 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/services/SecurityGroupClientLiveTest.java @@ -69,7 +69,7 @@ public class SecurityGroupClientLiveTest { @Test void testDescribe() { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client .describeSecurityGroupsInRegion(region)); assertNotNull(allResults); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/BaseEC2HandlerTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/BaseEC2HandlerTest.java index dfaf03dda2..3a929bebd3 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/BaseEC2HandlerTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/BaseEC2HandlerTest.java @@ -40,7 +40,7 @@ import com.google.inject.Provides; * @author Adrian Cole */ public class BaseEC2HandlerTest extends BaseHandlerTest { - protected Region defaultRegion = Region.US_EAST_1; + protected String defaultRegion = Region.US_EAST_1; public BaseEC2HandlerTest() { super(); @@ -60,15 +60,15 @@ public class BaseEC2HandlerTest extends BaseHandlerTest { @Singleton @Provides @EC2 - Region provideDefaultRegion() { + String provideDefaultRegion() { return defaultRegion; } @SuppressWarnings("unused") @Singleton @Provides - Map provideAvailabilityZoneRegionMap() { - return ImmutableMap. of(AvailabilityZone.US_EAST_1A, + Map provideAvailabilityZoneRegionMap() { + return ImmutableMap. of(AvailabilityZone.US_EAST_1A, Region.US_EAST_1); } }); diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java index 9948c8b8b8..8e770c9699 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java @@ -62,12 +62,12 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest { InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints.xml"); - Map expected = ImmutableMap. of(Region.EU_WEST_1, URI + Map expected = ImmutableMap. of(Region.EU_WEST_1, URI .create("https://ec2.eu-west-1.amazonaws.com"), Region.US_EAST_1, URI .create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1, URI .create("https://ec2.us-west-1.amazonaws.com")); - Map result = factory.create( + Map result = factory.create( injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is); assertEquals(result, expected); @@ -77,13 +77,13 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest { InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints-additional.xml"); - Map expected = ImmutableMap. of(Region.UNKNOWN, URI + Map expected = ImmutableMap. of("jp-west-1", URI .create("https://ec2.jp-west-1.amazonaws.com"), Region.EU_WEST_1, URI .create("https://ec2.eu-west-1.amazonaws.com"), Region.US_EAST_1, URI .create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1, URI .create("https://ec2.us-west-1.amazonaws.com")); - Map result = factory.create( + Map result = factory.create( injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is); assertEquals(result, expected); diff --git a/aws/core/src/test/java/org/jclouds/aws/s3/S3AsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/s3/S3AsyncClientTest.java index b152613321..78f16f7e76 100644 --- a/aws/core/src/test/java/org/jclouds/aws/s3/S3AsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/s3/S3AsyncClientTest.java @@ -380,10 +380,10 @@ public class S3AsyncClientTest extends RestClientTest { public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException, NoSuchMethodException, IOException { - Method method = S3AsyncClient.class.getMethod("putBucketInRegion", Region.class, + Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class, Array.newInstance(PutBucketOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, - (Region) null, "bucket"); + (String) null, "bucket"); assertRequestLineEquals(httpMethod, "PUT http://bucket.stub:8080/ HTTP/1.1"); assertHeadersEqual(httpMethod, "Content-Length: 0\nHost: bucket.stub\n"); @@ -398,7 +398,7 @@ public class S3AsyncClientTest extends RestClientTest { public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException, NoSuchMethodException, IOException { - Method method = S3AsyncClient.class.getMethod("putBucketInRegion", Region.class, + Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class, Array.newInstance(PutBucketOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, Region.EU_WEST_1, "bucket"); @@ -547,7 +547,7 @@ public class S3AsyncClientTest extends RestClientTest { Jsr330.bindProperties(binder(), checkNotNull(new S3PropertiesBuilder("user", "key") .build(), "properties")); bind(URI.class).annotatedWith(S3.class).toInstance(URI.create("http://stub:8080")); - bind(Region.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD); + bind(String.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD); bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() { public Logger getLogger(String category) { return Logger.NULL; diff --git a/aws/core/src/test/java/org/jclouds/aws/s3/config/S3StubClientModule.java b/aws/core/src/test/java/org/jclouds/aws/s3/config/S3StubClientModule.java index e927e19ab7..046752480e 100755 --- a/aws/core/src/test/java/org/jclouds/aws/s3/config/S3StubClientModule.java +++ b/aws/core/src/test/java/org/jclouds/aws/s3/config/S3StubClientModule.java @@ -51,8 +51,8 @@ public class S3StubClientModule extends AbstractModule { install(new TransientBlobStoreModule()); bind(S3AsyncClient.class).to(StubS3AsyncClient.class).asEagerSingleton(); bind(URI.class).annotatedWith(S3.class).toInstance(URI.create("https://localhost/s3stub")); - bind(Region.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD); - bind(new TypeLiteral>() { + bind(String.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD); + bind(new TypeLiteral>() { }).annotatedWith(S3.class).toInstance( ImmutableSet.of(Region.US_STANDARD, Region.US_WEST_1, Region.EU_WEST_1)); } diff --git a/aws/core/src/test/java/org/jclouds/aws/s3/internal/StubS3AsyncClient.java b/aws/core/src/test/java/org/jclouds/aws/s3/internal/StubS3AsyncClient.java index 41787d4a2f..579b8361c1 100755 --- a/aws/core/src/test/java/org/jclouds/aws/s3/internal/StubS3AsyncClient.java +++ b/aws/core/src/test/java/org/jclouds/aws/s3/internal/StubS3AsyncClient.java @@ -136,14 +136,14 @@ public class StubS3AsyncClient implements S3AsyncClient { public static final String DEFAULT_OWNER_ID = "abc123"; @Override - public ListenableFuture putBucketInRegion(@Nullable Region region, String name, + public ListenableFuture putBucketInRegion(@Nullable String region, String name, PutBucketOptions... optionsList) { region = region == null ? Region.US_STANDARD : region; final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions() : optionsList[0]; keyToAcl.put(name, options.getAcl()); - return blobStore.createContainerInLocation(new LocationImpl(LocationScope.REGION, region - .value(), region.value(), null), name); + return blobStore.createContainerInLocation(new LocationImpl(LocationScope.REGION, region, + region, null), name); } public ListenableFuture listBucket(final String name, @@ -315,9 +315,9 @@ public class StubS3AsyncClient implements S3AsyncClient { } @Override - public ListenableFuture getBucketLocation(String bucketName) { + public ListenableFuture getBucketLocation(String bucketName) { Location location = containerToLocation.get(bucketName); - return immediateFuture(Region.fromValue(location.getId())); + return immediateFuture(location.getId()); } @Override diff --git a/aws/core/src/test/java/org/jclouds/aws/s3/services/BucketsLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/s3/services/BucketsLiveTest.java index 93b1fbd976..ec3f41acab 100644 --- a/aws/core/src/test/java/org/jclouds/aws/s3/services/BucketsLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/s3/services/BucketsLiveTest.java @@ -179,7 +179,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest { String bucketName = getContainerName(); try { - Region location = getApi().getBucketLocation(bucketName); + String location = getApi().getBucketLocation(bucketName); assert location.equals(Region.US_STANDARD) : "bucket: " + bucketName + " location: " + location; } finally { diff --git a/aws/core/src/test/java/org/jclouds/aws/sqs/SQSAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/sqs/SQSAsyncClientTest.java index e0fb3fe2de..ddabd70b6a 100644 --- a/aws/core/src/test/java/org/jclouds/aws/sqs/SQSAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/sqs/SQSAsyncClientTest.java @@ -61,10 +61,10 @@ import com.google.inject.TypeLiteral; public class SQSAsyncClientTest extends RestClientTest { public void testListQueuesInRegion() throws SecurityException, NoSuchMethodException, IOException { - Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", Region.class, Array + Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", String.class, Array .newInstance(ListQueuesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, - (Region) null); + (String) null); assertRequestLineEquals(httpMethod, "POST https://default/ HTTP/1.1"); assertHeadersEqual(httpMethod, @@ -80,7 +80,7 @@ public class SQSAsyncClientTest extends RestClientTest { public void testListQueuesInRegionOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", Region.class, Array + Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", String.class, Array .newInstance(ListQueuesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, ListQueuesOptions.Builder.queuePrefix("prefix")); @@ -99,7 +99,7 @@ public class SQSAsyncClientTest extends RestClientTest { public void testCreateQueueInRegion() throws SecurityException, NoSuchMethodException, IOException { - Method method = SQSAsyncClient.class.getMethod("createQueueInRegion", Region.class, + Method method = SQSAsyncClient.class.getMethod("createQueueInRegion", String.class, String.class, Array.newInstance(CreateQueueOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "queueName"); @@ -118,7 +118,7 @@ public class SQSAsyncClientTest extends RestClientTest { public void testCreateQueueInRegionOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = SQSAsyncClient.class.getMethod("createQueueInRegion", Region.class, + Method method = SQSAsyncClient.class.getMethod("createQueueInRegion", String.class, String.class, Array.newInstance(CreateQueueOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, null, "queueName", CreateQueueOptions.Builder.defaultVisibilityTimeout(45)); @@ -178,8 +178,8 @@ public class SQSAsyncClientTest extends RestClientTest { @Singleton @Provides @SQS - Map provideMap() { - return ImmutableMap. of(Region.EU_WEST_1, URI + Map provideMap() { + return ImmutableMap. of(Region.EU_WEST_1, URI .create("https://sqs.eu-west-1.amazonaws.com"), Region.US_EAST_1, URI .create("https://sqs.us-east-1.amazonaws.com"), Region.US_WEST_1, URI .create("https://sqs.us-west-1.amazonaws.com")); diff --git a/aws/core/src/test/java/org/jclouds/aws/sqs/SQSClientLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/sqs/SQSClientLiveTest.java index 9ad4eb8483..5bc0333a9f 100644 --- a/aws/core/src/test/java/org/jclouds/aws/sqs/SQSClientLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/sqs/SQSClientLiveTest.java @@ -66,7 +66,7 @@ public class SQSClientLiveTest { @Test void testListQueuesInRegion() throws InterruptedException { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { SortedSet allResults = Sets.newTreeSet(client.listQueuesInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { @@ -82,7 +82,7 @@ public class SQSClientLiveTest { void testCreateQueue() throws InterruptedException { String queueName = PREFIX + "1"; - for (final Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, + for (final String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { try { SortedSet result = Sets.newTreeSet(client.listQueuesInRegion(region, @@ -125,7 +125,7 @@ public class SQSClientLiveTest { } } - private void assertQueueInList(final Region region, Queue queue) throws InterruptedException { + private void assertQueueInList(final String region, Queue queue) throws InterruptedException { final Queue finalQ = queue; assertEventually(new Runnable() { public void run() { diff --git a/aws/core/src/test/java/org/jclouds/aws/sqs/config/SQSRestClientModuleTest.java b/aws/core/src/test/java/org/jclouds/aws/sqs/config/SQSRestClientModuleTest.java index 9d6d821162..6356fd8d16 100644 --- a/aws/core/src/test/java/org/jclouds/aws/sqs/config/SQSRestClientModuleTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/sqs/config/SQSRestClientModuleTest.java @@ -75,9 +75,9 @@ public class SQSRestClientModuleTest { @Test void testRegions() { - Map regionMap = createInjector().getInstance(new Key>(SQS.class) { + Map regionMap = createInjector().getInstance(new Key>(SQS.class) { }); - assertEquals(regionMap, ImmutableMap. of(Region.US_EAST_1, URI + assertEquals(regionMap, ImmutableMap. of(Region.US_EAST_1, URI .create("https://queue.amazonaws.com"), Region.US_WEST_1, URI .create("https://us-west-1.queue.amazonaws.com"), Region.EU_WEST_1, URI .create("https://eu-west-1.queue.amazonaws.com"))); diff --git a/aws/core/src/test/java/org/jclouds/aws/sqs/xml/ListQueuesResponseHandlerTest.java b/aws/core/src/test/java/org/jclouds/aws/sqs/xml/ListQueuesResponseHandlerTest.java index 5f48809f76..b995ae41c3 100644 --- a/aws/core/src/test/java/org/jclouds/aws/sqs/xml/ListQueuesResponseHandlerTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/sqs/xml/ListQueuesResponseHandlerTest.java @@ -87,8 +87,8 @@ public class ListQueuesResponseHandlerTest extends PerformanceTest { @Provides @Singleton @SQS - Map provideRegions() { - return ImmutableMap. of(Region.EU_WEST_1, URI + Map provideRegions() { + return ImmutableMap. of(Region.EU_WEST_1, URI .create("https://eu-west-1.queue.amazonaws.com")); } diff --git a/aws/demos/speedtest-sqs/src/main/java/org/jclouds/aws/sqs/SpeedTest.java b/aws/demos/speedtest-sqs/src/main/java/org/jclouds/aws/sqs/SpeedTest.java index 21bce90de4..8fadbc08b6 100755 --- a/aws/demos/speedtest-sqs/src/main/java/org/jclouds/aws/sqs/SpeedTest.java +++ b/aws/demos/speedtest-sqs/src/main/java/org/jclouds/aws/sqs/SpeedTest.java @@ -130,7 +130,7 @@ public class SpeedTest { private static void createQueues(String queueName, RestContext nullLoggingDefaultContext, Set queues) { - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { System.out.printf("creating queue: %s in region %s%n", queueName, region); queues.add(nullLoggingDefaultContext.getApi().createQueueInRegion(region, queueName)); } @@ -139,7 +139,7 @@ public class SpeedTest { private static boolean purgeQueues(String queueName, RestContext nullLoggingDefaultContext) { boolean deleted = false; - for (Region region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { + for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) { try { SortedSet result = Sets.newTreeSet(nullLoggingDefaultContext.getApi() .listQueuesInRegion(region, queuePrefix(queueName)));