for amazon web services, changed the Region to String format (from enum). clojure code for aws needs verification

This commit is contained in:
Alex Yarmula 2010-04-30 12:27:55 -07:00
parent 3b4551b995
commit 6660228b55
102 changed files with 459 additions and 494 deletions

View File

@ -53,13 +53,13 @@
([v] (get-region v nil)) ([v] (get-region v nil))
([v default-region] ([v default-region]
(cond (cond
(keyword? v) (Region/fromValue (name v)) (keyword? v) (name v)
(instance? Region v) v (instance? Region v) v
(instance? NodeMetadata v) (let [zone (.getLocationId v)] (instance? NodeMetadata v) (let [zone (.getLocationId v)]
; no easier way to go from zone -> region? ; no easier way to go from zone -> region?
(Region/fromValue (if (> (.indexOf zone "-") -1) (if (> (.indexOf zone "-") -1)
(subs zone 0 (-> zone count dec)) (subs zone 0 (-> zone count dec))
zone))) zone))
:else default-region))) :else default-region)))
(defn get-volume-id (defn get-volume-id

View File

@ -31,12 +31,7 @@ import com.google.common.base.CaseFormat;
* "http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?LocationSelection.html" /> * "http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?LocationSelection.html" />
* *
*/ */
public enum Region { public class Region {
/**
* Region returned is unknown.
*/
UNKNOWN,
/** /**
* EU (Ireland) * 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 * 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. * 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 * 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. * 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) <h3>S3</h3> Uses Amazon S3 servers in Northern California * US-West (Northern California) <h3>S3</h3> 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 * for PUTS of new objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS
* and DELETES. * and DELETES.
*/ */
US_WEST_1, public static final String US_WEST_1 = "us-west-1";
AP_SOUTHEAST_1;
public String value() { /**
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); * Region in Singapore, launched April 28, 2010.
} * This region improves latency for Asia-based users
*/
@Override public static final String AP_SOUTHEAST_1 = "ap-southeast-1";
public String toString() {
return value();
}
public static Region fromValue(String region) {
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(region,
"region")));
}
} }

View File

@ -86,7 +86,7 @@ public class EC2ComputeService extends BaseComputeService {
this.instanceStateTerminated = instanceStateTerminated; 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) { if (ec2Client.getSecurityGroupServices().describeSecurityGroupsInRegion(region, tag).size() > 0) {
logger.debug(">> deleting securityGroup(%s)", tag); logger.debug(">> deleting securityGroup(%s)", tag);
ec2Client.getSecurityGroupServices().deleteSecurityGroupInRegion(region, 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)) { for (KeyPair keyPair : ec2Client.getKeyPairServices().describeKeyPairsInRegion(region)) {
if (keyPair.getKeyName().matches(tag + "-[0-9]+")) { if (keyPair.getKeyName().matches(tag + "-[0-9]+")) {
logger.debug(">> deleting keyPair(%s)", tag); logger.debug(">> deleting keyPair(%s)", tag);
@ -119,7 +119,7 @@ public class EC2ComputeService extends BaseComputeService {
} }
}); });
if (Iterables.size(nodes) > 0) { if (Iterables.size(nodes) > 0) {
Region region = getRegionFromNodeOrDefault.apply(Iterables.get(nodes, 0)); String region = getRegionFromNodeOrDefault.apply(Iterables.get(nodes, 0));
deleteKeyPair(region, tag); deleteKeyPair(region, tag);
deleteSecurityGroup(region, tag); deleteSecurityGroup(region, tag);
} }

View File

@ -134,7 +134,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Override @Override
public Iterable<? extends ComputeMetadata> execute(GetNodesOptions options) { public Iterable<? extends ComputeMetadata> execute(GetNodesOptions options) {
Set<NodeMetadata> nodes = Sets.newHashSet(); Set<NodeMetadata> 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 Iterables.addAll(nodes, Iterables.transform(Iterables.concat(client
.describeInstancesInRegion(region)), runningInstanceToNodeMetadata)); .describeInstancesInRegion(region)), runningInstanceToNodeMetadata));
} }
@ -144,11 +144,11 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
} }
@Singleton @Singleton
public static class GetRegionFromNodeOrDefault implements Function<ComputeMetadata, Region> { public static class GetRegionFromNodeOrDefault implements Function<ComputeMetadata, String> {
public Region apply(ComputeMetadata node) { public String apply(ComputeMetadata node) {
Location location = node.getLocation(); Location location = node.getLocation();
Region region = location.getScope() == LocationScope.REGION ? Region.fromValue(location String region = location.getScope() == LocationScope.REGION ? location
.getId()) : Region.fromValue(location.getParent()); .getId() : location.getParent();
return region; return region;
} }
} }
@ -171,7 +171,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Override @Override
public NodeMetadata execute(ComputeMetadata node) { public NodeMetadata execute(ComputeMetadata node) {
Region region = getRegionFromNodeOrDefault.apply(node); String region = getRegionFromNodeOrDefault.apply(node);
RunningInstance runningInstance = Iterables.getOnlyElement(getAllRunningInstancesInRegion( RunningInstance runningInstance = Iterables.getOnlyElement(getAllRunningInstancesInRegion(
client, region, node.getId())); client, region, node.getId()));
return runningInstanceToNodeMetadata.apply(runningInstance); return runningInstanceToNodeMetadata.apply(runningInstance);
@ -180,7 +180,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
} }
public static Iterable<RunningInstance> getAllRunningInstancesInRegion(InstanceClient client, public static Iterable<RunningInstance> getAllRunningInstancesInRegion(InstanceClient client,
Region region, String id) { String region, String id) {
return Iterables.concat(client.describeInstancesInRegion(region, id)); return Iterables.concat(client.describeInstancesInRegion(region, id));
} }
@ -198,7 +198,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Override @Override
public boolean execute(ComputeMetadata node) { public boolean execute(ComputeMetadata node) {
Region region = getRegionFromNodeOrDefault.apply(node); String region = getRegionFromNodeOrDefault.apply(node);
client.rebootInstancesInRegion(region, node.getId()); client.rebootInstancesInRegion(region, node.getId());
return true; return true;
} }
@ -257,23 +257,23 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Provides @Provides
@Singleton @Singleton
Map<String, ? extends Location> provideLocations(Map<AvailabilityZone, Region> map) { Map<String, ? extends Location> provideLocations(Map<AvailabilityZone, String> availabilityZoneToRegionMap) {
Map<String, Location> locations = Maps.newLinkedHashMap(); Map<String, Location> locations = Maps.newLinkedHashMap();
for (AvailabilityZone zone : map.keySet()) { for (AvailabilityZone zone : availabilityZoneToRegionMap.keySet()) {
locations.put(zone.toString(), new LocationImpl(LocationScope.ZONE, zone.toString(), zone 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()) { for (String region : availabilityZoneToRegionMap.values()) {
locations.put(region.toString(), new LocationImpl(LocationScope.REGION, region.toString(), locations.put(region, new LocationImpl(LocationScope.REGION, region,
region.toString(), null)); region, null));
} }
return locations; return locations;
} }
@Provides @Provides
@Singleton @Singleton
Location getDefaultLocation(@EC2 Region region, Map<String, ? extends Location> map) { Location getDefaultLocation(@EC2 String region, Map<String, ? extends Location> map) {
return map.get(region.toString()); return map.get(region);
} }
private static class LogHolder { private static class LogHolder {
@ -292,14 +292,14 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Provides @Provides
@Singleton @Singleton
protected Map<String, ? extends Image> provideImages(final EC2Client sync, protected Map<String, ? extends Image> provideImages(final EC2Client sync,
@EC2 Map<Region, URI> regionMap, LogHolder holder, @EC2 Map<String, URI> regionMap, LogHolder holder,
Function<ComputeMetadata, String> indexer, Function<ComputeMetadata, String> indexer,
@Named(PROPERTY_EC2_AMI_OWNERS) String[] amiOwners, ImageParser parser) @Named(PROPERTY_EC2_AMI_OWNERS) String[] amiOwners, ImageParser parser)
throws InterruptedException, ExecutionException, TimeoutException { throws InterruptedException, ExecutionException, TimeoutException {
final Set<Image> images = Sets.newHashSet(); final Set<Image> images = Sets.newHashSet();
holder.logger.debug(">> providing images"); 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() for (final org.jclouds.aws.ec2.domain.Image from : sync.getAMIServices()
.describeImagesInRegion(region, ownedBy(amiOwners))) { .describeImagesInRegion(region, ownedBy(amiOwners))) {
Image image = parser.apply(from); Image image = parser.apply(from);

View File

@ -19,8 +19,6 @@
package org.jclouds.aws.ec2.compute.domain; package org.jclouds.aws.ec2.compute.domain;
import org.jclouds.aws.domain.Region;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
@ -28,7 +26,7 @@ import org.jclouds.aws.domain.Region;
public class PortsRegionTag extends RegionTag { public class PortsRegionTag extends RegionTag {
private final int[] ports; private final int[] ports;
public PortsRegionTag(Region region, String tag, int[] ports) { public PortsRegionTag(String region, String tag, int[] ports) {
super(region, tag); super(region, tag);
this.ports = ports; this.ports = ports;
} }

View File

@ -18,17 +18,15 @@
*/ */
package org.jclouds.aws.ec2.compute.domain; package org.jclouds.aws.ec2.compute.domain;
import org.jclouds.aws.domain.Region;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class RegionTag { public class RegionTag {
protected final Region region; protected final String region;
protected final String tag; protected final String tag;
public RegionTag(Region region, String tag) { public RegionTag(String region, String tag) {
this.region = region; this.region = region;
this.tag = tag; this.tag = tag;
} }
@ -64,7 +62,7 @@ public class RegionTag {
return true; return true;
} }
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -59,7 +59,7 @@ public class CreateNewKeyPair implements Function<RegionTag, KeyPair> {
return createNewKeyPairInRegion(from.getRegion(), from.getTag()); return createNewKeyPairInRegion(from.getRegion(), from.getTag());
} }
private KeyPair createNewKeyPairInRegion(Region region, String tag) { private KeyPair createNewKeyPairInRegion(String region, String tag) {
checkNotNull(region, "region"); checkNotNull(region, "region");
checkNotNull(tag, "tag"); checkNotNull(tag, "tag");
logger.debug(">> creating keyPair region(%s) tag(%s)", region, tag); logger.debug(">> creating keyPair region(%s) tag(%s)", region, tag);

View File

@ -37,7 +37,7 @@ public class CreateSecurityGroupIfNeeded implements Function<PortsRegionTag, Str
return from.getTag(); return from.getTag();
} }
private void createSecurityGroupInRegion(Region region, String name, int... ports) { private void createSecurityGroupInRegion(String region, String name, int... ports) {
checkNotNull(region, "region"); checkNotNull(region, "region");
checkNotNull(name, "name"); checkNotNull(name, "name");
logger.debug(">> creating securityGroup region(%s) name(%s)", region, name); logger.debug(">> creating securityGroup region(%s) name(%s)", region, name);

View File

@ -105,7 +105,7 @@ public class ImageParser implements Function<org.jclouds.aws.ec2.domain.Image, I
return new ImageImpl( return new ImageImpl(
from.getId(), from.getId(),
name, name,
locations.get(from.getRegion().toString()), locations.get(from.getRegion()),
null, null,
ImmutableMap.<String, String> of("owner", from.getImageOwnerId()), ImmutableMap.<String, String> of("owner", from.getImageOwnerId()),
description, description,

View File

@ -67,7 +67,7 @@ public class EC2DestroyNodeStrategy implements DestroyNodeStrategy {
public boolean execute(ComputeMetadata metadata) { public boolean execute(ComputeMetadata metadata) {
NodeMetadata node = metadata instanceof NodeMetadata ? NodeMetadata.class.cast(metadata) NodeMetadata node = metadata instanceof NodeMetadata ? NodeMetadata.class.cast(metadata)
: getNodeMetadataStrategy.execute(metadata); : getNodeMetadataStrategy.execute(metadata);
Region region = getRegionFromNodeOrDefault.apply(node); String region = getRegionFromNodeOrDefault.apply(node);
ec2Client.getInstanceServices().terminateInstancesInRegion(region, node.getId()); ec2Client.getInstanceServices().terminateInstancesInRegion(region, node.getId());
return instanceStateTerminated.apply(Iterables.getOnlyElement(Iterables.concat(ec2Client return instanceStateTerminated.apply(Iterables.getOnlyElement(Iterables.concat(ec2Client

View File

@ -127,8 +127,8 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate
: null; : null;
// if the location has a parent, it must be an availability zone. // if the location has a parent, it must be an availability zone.
Region region = zone == null ? Region.fromValue(template.getLocation().getId()) : Region String region = zone == null ? template.getLocation().getId() :
.fromValue(template.getLocation().getParent()); template.getLocation().getParent();
// get or create incidental resources // get or create incidental resources
// TODO race condition. we were using MapMaker, but it doesn't seem to refresh properly when // 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; return responses;
} }
private Iterable<RunningInstance> getInstances(Region region, Iterable<String> ids) { private Iterable<RunningInstance> getInstances(String region, Iterable<String> ids) {
return Iterables.concat(ec2Client.getInstanceServices().describeInstancesInRegion(region, return Iterables.concat(ec2Client.getInstanceServices().describeInstancesInRegion(region,
Iterables.toArray(ids, String.class))); Iterables.toArray(ids, String.class)));
} }

View File

@ -115,10 +115,10 @@ public class EC2RestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@EC2 @EC2
Region provideCurrentRegion(@EC2 Map<Region, URI> regionMap, @EC2 URI currentUri) { String provideCurrentRegion(@EC2 Map<String, URI> regionMap, @EC2 URI currentUri) {
ImmutableBiMap<URI, Region> map = ImmutableBiMap.<Region, URI> builder().putAll(regionMap) ImmutableBiMap<URI, String> map = ImmutableBiMap.<String, URI> builder().putAll(regionMap)
.build().inverse(); .build().inverse();
Region region = map.get(currentUri); String region = map.get(currentUri);
assert region != null : currentUri + " not in " + map; assert region != null : currentUri + " not in " + map;
return region; return region;
} }
@ -126,16 +126,16 @@ public class EC2RestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@EC2 @EC2
Map<Region, URI> provideRegions(AvailabilityZoneAndRegionClient client) { Map<String, URI> provideRegions(AvailabilityZoneAndRegionClient client) {
return client.describeRegions(); return client.describeRegions();
} }
@Provides @Provides
@Singleton @Singleton
Map<AvailabilityZone, Region> provideAvailabilityZoneToRegions( Map<AvailabilityZone, String> provideAvailabilityZoneToRegions(
AvailabilityZoneAndRegionClient client, @EC2 Map<Region, URI> regions) { AvailabilityZoneAndRegionClient client, @EC2 Map<String, URI> regions) {
Map<AvailabilityZone, Region> map = Maps.newHashMap(); Map<AvailabilityZone, String> map = Maps.newHashMap();
for (Region region : regions.keySet()) { for (String region : regions.keySet()) {
for (AvailabilityZoneInfo zoneInfo : client.describeAvailabilityZonesInRegion(region)) { for (AvailabilityZoneInfo zoneInfo : client.describeAvailabilityZonesInRegion(region)) {
map.put(zoneInfo.getZone(), region); map.put(zoneInfo.getZone(), region);
} }

View File

@ -48,14 +48,14 @@ public class Attachment implements Comparable<Attachment> {
} }
} }
private final Region region; private final String region;
private final String volumeId; private final String volumeId;
private final String instanceId; private final String instanceId;
private final String device; private final String device;
private final Status status; private final Status status;
private final Date attachTime; 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) { Status status, Date attachTime) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
this.volumeId = volumeId; this.volumeId = volumeId;
@ -69,7 +69,7 @@ public class Attachment implements Comparable<Attachment> {
* Snapshots are tied to Regions and can only be used for volumes within the same Region. * Snapshots are tied to Regions and can only be used for volumes within the same Region.
* *
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -54,11 +54,11 @@ public class AvailabilityZoneInfo implements Comparable<AvailabilityZoneInfo>{
private final String zoneName; private final String zoneName;
private final AvailabilityZone zone; private final AvailabilityZone zone;
private final State state; private final State state;
private final Region region; private final String region;
private final Set<String> messages = Sets.newHashSet(); private final Set<String> messages = Sets.newHashSet();
public AvailabilityZoneInfo(String zoneName, AvailabilityZone zone, State zoneState, public AvailabilityZoneInfo(String zoneName, AvailabilityZone zone, State zoneState,
Region region, Iterable<String> messages) { String region, Iterable<String> messages) {
this.zoneName = checkNotNull(zoneName, "zoneName"); this.zoneName = checkNotNull(zoneName, "zoneName");
this.zone = checkNotNull(zone, "zone"); this.zone = checkNotNull(zone, "zone");
this.state = checkNotNull(zoneState, "zoneState"); this.state = checkNotNull(zoneState, "zoneState");
@ -90,7 +90,7 @@ public class AvailabilityZoneInfo implements Comparable<AvailabilityZoneInfo>{
/** /**
* Name of the Region. * Name of the Region.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -38,7 +38,7 @@ import com.google.inject.internal.Nullable;
*/ */
public class Image implements Comparable<Image> { public class Image implements Comparable<Image> {
private final Region region; private final String region;
private final Architecture architecture; private final Architecture architecture;
@Nullable @Nullable
private final String name; private final String name;
@ -62,7 +62,7 @@ public class Image implements Comparable<Image> {
private final String rootDeviceName; private final String rootDeviceName;
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap(); private final Map<String, EbsBlockDevice> 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, @Nullable String description, String imageId, String imageLocation,
String imageOwnerId, ImageState imageState, ImageType imageType, boolean isPublic, String imageOwnerId, ImageState imageState, ImageType imageType, boolean isPublic,
Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform, Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform,
@ -200,7 +200,7 @@ public class Image implements Comparable<Image> {
* AMIs are tied to the Region where its files are located within Amazon S3. * AMIs are tied to the Region where its files are located within Amazon S3.
* *
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -31,7 +31,7 @@ import org.jclouds.aws.domain.Region;
*/ */
public class InstanceStateChange implements Comparable<InstanceStateChange> { public class InstanceStateChange implements Comparable<InstanceStateChange> {
private final Region region; private final String region;
private final String instanceId; private final String instanceId;
private final InstanceState currentState; private final InstanceState currentState;
private final InstanceState previousState; private final InstanceState previousState;
@ -40,7 +40,7 @@ public class InstanceStateChange implements Comparable<InstanceStateChange> {
return (this == o) ? 0 : getInstanceId().compareTo(o.getInstanceId()); 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) { InstanceState previousState) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
this.instanceId = instanceId; this.instanceId = instanceId;
@ -51,7 +51,7 @@ public class InstanceStateChange implements Comparable<InstanceStateChange> {
/** /**
* Instances are tied to Availability Zones. However, the instance ID is tied to the Region. * Instances are tied to Availability Zones. However, the instance ID is tied to the Region.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -32,13 +32,13 @@ import com.google.inject.internal.Nullable;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class KeyPair implements Comparable<KeyPair> { public class KeyPair implements Comparable<KeyPair> {
private final Region region; private final String region;
private final String keyName; private final String keyName;
private final String keyFingerprint; private final String keyFingerprint;
@Nullable @Nullable
private final String keyMaterial; 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.region = checkNotNull(region, "region");
this.keyName = checkNotNull(keyName, "keyName"); this.keyName = checkNotNull(keyName, "keyName");
this.keyFingerprint = checkNotNull(keyFingerprint, "keyFingerprint"); this.keyFingerprint = checkNotNull(keyFingerprint, "keyFingerprint");
@ -48,7 +48,7 @@ public class KeyPair implements Comparable<KeyPair> {
/** /**
* Key pairs (to connect to instances) are Region-specific. * Key pairs (to connect to instances) are Region-specific.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -34,12 +34,12 @@ import com.google.inject.internal.Nullable;
*/ */
public class PublicIpInstanceIdPair implements Comparable<PublicIpInstanceIdPair> { public class PublicIpInstanceIdPair implements Comparable<PublicIpInstanceIdPair> {
private final Region region; private final String region;
@Nullable @Nullable
private final String instanceId; private final String instanceId;
private final InetAddress publicIp; 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.region = checkNotNull(region, "region");
this.instanceId = instanceId; this.instanceId = instanceId;
this.publicIp = checkNotNull(publicIp, "publicIp"); this.publicIp = checkNotNull(publicIp, "publicIp");
@ -48,7 +48,7 @@ public class PublicIpInstanceIdPair implements Comparable<PublicIpInstanceIdPair
/** /**
* Elastic IP addresses are tied to a Region and cannot be mapped across Regions. * Elastic IP addresses are tied to a Region and cannot be mapped across Regions.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -40,7 +40,7 @@ public class Reservation extends LinkedHashSet<RunningInstance> implements Compa
/** The serialVersionUID */ /** The serialVersionUID */
private static final long serialVersionUID = -9051777593518861395L; private static final long serialVersionUID = -9051777593518861395L;
private final Region region; private final String region;
private final Set<String> groupIds = Sets.newLinkedHashSet(); private final Set<String> groupIds = Sets.newLinkedHashSet();
private final @Nullable private final @Nullable
String ownerId; String ownerId;
@ -49,7 +49,7 @@ public class Reservation extends LinkedHashSet<RunningInstance> implements Compa
private final @Nullable private final @Nullable
String reservationId; String reservationId;
public Reservation(Region region, Iterable<String> groupIds, public Reservation(String region, Iterable<String> groupIds,
Iterable<RunningInstance> instances, @Nullable String ownerId, Iterable<RunningInstance> instances, @Nullable String ownerId,
@Nullable String requesterId, @Nullable String reservationId) { @Nullable String requesterId, @Nullable String reservationId) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
@ -63,7 +63,7 @@ public class Reservation extends LinkedHashSet<RunningInstance> implements Compa
/** /**
* Instances are tied to Availability Zones. However, the instance ID is tied to the Region. * Instances are tied to Availability Zones. However, the instance ID is tied to the Region.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -116,7 +116,7 @@ public class RunningInstance implements Comparable<RunningInstance> {
} }
private final Region region; private final String region;
private final String amiLaunchIndex; private final String amiLaunchIndex;
@Nullable @Nullable
private final String dnsName; private final String dnsName;
@ -157,7 +157,7 @@ public class RunningInstance implements Comparable<RunningInstance> {
return (this == o) ? 0 : getId().compareTo(o.getId()); 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 imageId, String instanceId, InstanceState instanceState,
String instanceType, @Nullable InetAddress ipAddress, @Nullable String kernelId, String instanceType, @Nullable InetAddress ipAddress, @Nullable String kernelId,
@Nullable String keyName, Date launchTime, boolean monitoring, @Nullable String keyName, Date launchTime, boolean monitoring,
@ -195,7 +195,7 @@ public class RunningInstance implements Comparable<RunningInstance> {
/** /**
* Instance Ids are scoped to the region. * Instance Ids are scoped to the region.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -32,13 +32,13 @@ import org.jclouds.aws.domain.Region;
*/ */
public class SecurityGroup implements Comparable<SecurityGroup> { public class SecurityGroup implements Comparable<SecurityGroup> {
private final Region region; private final String region;
private final String name; private final String name;
private final String ownerId; private final String ownerId;
private final String description; private final String description;
private final Set<IpPermission> ipPermissions; private final Set<IpPermission> ipPermissions;
public SecurityGroup(Region region, String name, String ownerId, String description, public SecurityGroup(String region, String name, String ownerId, String description,
Set<IpPermission> ipPermissions) { Set<IpPermission> ipPermissions) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
this.name = name; this.name = name;
@ -52,7 +52,7 @@ public class SecurityGroup implements Comparable<SecurityGroup> {
* with instances outside the Region using group-based firewall rules. Traffic from instances in * with instances outside the Region using group-based firewall rules. Traffic from instances in
* another Region is seen as WAN bandwidth. * another Region is seen as WAN bandwidth.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -47,7 +47,7 @@ public class Snapshot implements Comparable<Snapshot> {
} }
} }
private final Region region; private final String region;
private final String id; private final String id;
private final String volumeId; private final String volumeId;
private final int volumeSize; private final int volumeSize;
@ -58,7 +58,7 @@ public class Snapshot implements Comparable<Snapshot> {
private final String description; private final String description;
private final String ownerAlias; 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) { Date startTime, int progress, String ownerId, String description, String ownerAlias) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
this.id = id; this.id = id;
@ -75,7 +75,7 @@ public class Snapshot implements Comparable<Snapshot> {
/** /**
* Snapshots are tied to Regions and can only be used for volumes within the same Region. * Snapshots are tied to Regions and can only be used for volumes within the same Region.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -79,7 +79,7 @@ public class Volume implements Comparable<Volume> {
} }
} }
private final Region region; private final String region;
private final String id; private final String id;
private final int size; private final int size;
@Nullable @Nullable
@ -89,7 +89,7 @@ public class Volume implements Comparable<Volume> {
private final Date createTime; private final Date createTime;
private final Set<Attachment> attachments = Sets.newLinkedHashSet(); private final Set<Attachment> 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, AvailabilityZone availabilityZone, Volume.Status status, Date createTime,
Iterable<Attachment> attachments) { Iterable<Attachment> attachments) {
this.region = checkNotNull(region, "region"); this.region = checkNotNull(region, "region");
@ -106,7 +106,7 @@ public class Volume implements Comparable<Volume> {
* An Amazon EBS volume must be located within the same Availability Zone as the instance to * An Amazon EBS volume must be located within the same Availability Zone as the instance to
* which it attaches. * which it attaches.
*/ */
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -36,12 +36,12 @@ import com.google.common.base.Function;
*/ */
@Singleton @Singleton
public class AvailabilityZoneToEndpoint implements Function<Object, URI> { public class AvailabilityZoneToEndpoint implements Function<Object, URI> {
private final Map<AvailabilityZone, Region> availabilityZoneToRegion; private final Map<AvailabilityZone, String> availabilityZoneToRegion;
private final Map<Region, URI> regionToEndpoint; private final Map<String, URI> regionToEndpoint;
@Inject @Inject
public AvailabilityZoneToEndpoint(@EC2 Map<Region, URI> regionToEndpoint, public AvailabilityZoneToEndpoint(@EC2 Map<String, URI> regionToEndpoint,
Map<AvailabilityZone, Region> availabilityZoneToRegion) { Map<AvailabilityZone, String> availabilityZoneToRegion) {
this.regionToEndpoint = regionToEndpoint; this.regionToEndpoint = regionToEndpoint;
this.availabilityZoneToRegion = availabilityZoneToRegion; this.availabilityZoneToRegion = availabilityZoneToRegion;
} }

View File

@ -35,11 +35,11 @@ import com.google.common.base.Function;
*/ */
@Singleton @Singleton
public class RegionToEndpoint implements Function<Object, URI> { public class RegionToEndpoint implements Function<Object, URI> {
private final Map<Region, URI> regionToEndpoint; private final Map<String, URI> regionToEndpoint;
private final URI defaultUri; private final URI defaultUri;
@Inject @Inject
public RegionToEndpoint(@EC2 Map<Region, URI> regionToEndpoint, @EC2 URI defaultUri) { public RegionToEndpoint(@EC2 Map<String, URI> regionToEndpoint, @EC2 URI defaultUri) {
this.regionToEndpoint = regionToEndpoint; this.regionToEndpoint = regionToEndpoint;
this.defaultUri = defaultUri; this.defaultUri = defaultUri;
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.aws.ec2.options; package org.jclouds.aws.ec2.options;
import java.util.Arrays;
import java.util.Set; import java.util.Set;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
@ -46,10 +47,8 @@ public class DescribeRegionsOptions extends BaseEC2RequestOptions {
/** /**
* Name of a Region. * Name of a Region.
*/ */
public DescribeRegionsOptions regions(Region... regions) { public DescribeRegionsOptions regions(String... regions) {
String[] regionStrings = new String[regions.length]; String[] regionStrings = Arrays.copyOf(regions, regions.length, String[].class);
for (int i = 0; i < regionStrings.length; i++)
regionStrings[i] = regions[i].value();
indexFormValuesWithPrefix("RegionName", regionStrings); indexFormValuesWithPrefix("RegionName", regionStrings);
return this; return this;
} }
@ -63,7 +62,7 @@ public class DescribeRegionsOptions extends BaseEC2RequestOptions {
/** /**
* @see DescribeRegionsOptions#regions(Region[] ) * @see DescribeRegionsOptions#regions(Region[] )
*/ */
public static DescribeRegionsOptions regions(Region... regions) { public static DescribeRegionsOptions regions(String... regions) {
DescribeRegionsOptions options = new DescribeRegionsOptions(); DescribeRegionsOptions options = new DescribeRegionsOptions();
return options.regions(regions); return options.regions(regions);
} }

View File

@ -29,7 +29,6 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.binders.BindProductCodesToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindProductCodesToIndexedFormParams;
import org.jclouds.aws.ec2.binders.BindUserGroupsToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindUserGroupsToIndexedFormParams;
import org.jclouds.aws.ec2.binders.BindUserIdsToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindUserIdsToIndexedFormParams;
@ -75,7 +74,7 @@ public interface AMIAsyncClient {
@FormParams(keys = ACTION, values = "DescribeImages") @FormParams(keys = ACTION, values = "DescribeImages")
@XMLResponseParser(DescribeImagesResponseHandler.class) @XMLResponseParser(DescribeImagesResponseHandler.class)
ListenableFuture<? extends Set<Image>> describeImagesInRegion( ListenableFuture<? extends Set<Image>> describeImagesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
DescribeImagesOptions... options); DescribeImagesOptions... options);
/** /**
@ -86,7 +85,7 @@ public interface AMIAsyncClient {
@FormParams(keys = ACTION, values = "CreateImage") @FormParams(keys = ACTION, values = "CreateImage")
@XMLResponseParser(ImageIdHandler.class) @XMLResponseParser(ImageIdHandler.class)
ListenableFuture<String> createImageInRegion( ListenableFuture<String> createImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("Name") String name, @FormParam("InstanceId") String instanceId, @FormParam("Name") String name, @FormParam("InstanceId") String instanceId,
CreateImageOptions... options); CreateImageOptions... options);
@ -97,7 +96,7 @@ public interface AMIAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DeregisterImage") @FormParams(keys = ACTION, values = "DeregisterImage")
ListenableFuture<Void> deregisterImageInRegion( ListenableFuture<Void> deregisterImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
/** /**
@ -108,7 +107,7 @@ public interface AMIAsyncClient {
@FormParams(keys = ACTION, values = "RegisterImage") @FormParams(keys = ACTION, values = "RegisterImage")
@XMLResponseParser(ImageIdHandler.class) @XMLResponseParser(ImageIdHandler.class)
ListenableFuture<String> registerImageFromManifestInRegion( ListenableFuture<String> registerImageFromManifestInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest, @FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest,
RegisterImageOptions... options); RegisterImageOptions... options);
@ -121,7 +120,7 @@ public interface AMIAsyncClient {
"RegisterImage", "/dev/sda1", "/dev/sda1" }) "RegisterImage", "/dev/sda1", "/dev/sda1" })
@XMLResponseParser(ImageIdHandler.class) @XMLResponseParser(ImageIdHandler.class)
ListenableFuture<String> registerUnixImageBackedByEbsInRegion( ListenableFuture<String> registerUnixImageBackedByEbsInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("Name") String imageName, @FormParam("Name") String imageName,
@FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId, @FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId,
RegisterImageBackedByEbsOptions... options); RegisterImageBackedByEbsOptions... options);
@ -133,7 +132,7 @@ public interface AMIAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" })
ListenableFuture<Void> resetLaunchPermissionsOnImageInRegion( ListenableFuture<Void> resetLaunchPermissionsOnImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
/** /**
@ -144,7 +143,7 @@ public interface AMIAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
"add", "launchPermission" }) "add", "launchPermission" })
ListenableFuture<Void> addLaunchPermissionsToImageInRegion( ListenableFuture<Void> addLaunchPermissionsToImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
@ -157,7 +156,7 @@ public interface AMIAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
"remove", "launchPermission" }) "remove", "launchPermission" })
ListenableFuture<Void> removeLaunchPermissionsFromImageInRegion( ListenableFuture<Void> removeLaunchPermissionsFromImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
@ -171,7 +170,7 @@ public interface AMIAsyncClient {
"launchPermission" }) "launchPermission" })
@XMLResponseParser(PermissionHandler.class) @XMLResponseParser(PermissionHandler.class)
ListenableFuture<Permission> getLaunchPermissionForImageInRegion( ListenableFuture<Permission> getLaunchPermissionForImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
/** /**
@ -182,7 +181,7 @@ public interface AMIAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "productCodes" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "productCodes" })
@XMLResponseParser(ProductCodesHandler.class) @XMLResponseParser(ProductCodesHandler.class)
ListenableFuture<? extends Set<String>> getProductCodesForImageInRegion( ListenableFuture<? extends Set<String>> getProductCodesForImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
/** /**
@ -194,7 +193,7 @@ public interface AMIAsyncClient {
"blockDeviceMapping" }) "blockDeviceMapping" })
@XMLResponseParser(BlockDeviceMappingHandler.class) @XMLResponseParser(BlockDeviceMappingHandler.class)
ListenableFuture<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingsForImageInRegion( ListenableFuture<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingsForImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
/** /**
@ -205,7 +204,7 @@ public interface AMIAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
"add", "productCodes" }) "add", "productCodes" })
ListenableFuture<Void> addProductCodesToImageInRegion( ListenableFuture<Void> addProductCodesToImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes, @BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
@ -217,7 +216,7 @@ public interface AMIAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
"remove", "productCodes" }) "remove", "productCodes" })
ListenableFuture<Void> removeProductCodesFromImageInRegion( ListenableFuture<Void> removeProductCodesFromImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes, @BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes,
@FormParam("ImageId") String imageId); @FormParam("ImageId") String imageId);
} }

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.domain.Image; import org.jclouds.aws.ec2.domain.Image;
import org.jclouds.aws.ec2.domain.Permission; import org.jclouds.aws.ec2.domain.Permission;
import org.jclouds.aws.ec2.domain.Image.EbsBlockDevice; import org.jclouds.aws.ec2.domain.Image.EbsBlockDevice;
@ -58,7 +57,7 @@ public interface AMIClient {
* @see DescribeImagesOptions * @see DescribeImagesOptions
*/ */
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
Set<Image> describeImagesInRegion(@Nullable Region region, DescribeImagesOptions... options); Set<Image> describeImagesInRegion(@Nullable String region, DescribeImagesOptions... options);
/** /**
* Returns the Product Codes of an image. * Returns the Product Codes of an image.
@ -74,7 +73,7 @@ public interface AMIClient {
* /> * />
* @see DescribeImagesOptions * @see DescribeImagesOptions
*/ */
Set<String> getProductCodesForImageInRegion(@Nullable Region region, String imageId); Set<String> getProductCodesForImageInRegion(@Nullable String region, String imageId);
/** /**
* Returns a map of device name to block device for the image. * Returns a map of device name to block device for the image.
@ -90,7 +89,7 @@ public interface AMIClient {
* /> * />
* @see DescribeImagesOptions * @see DescribeImagesOptions
*/ */
Map<String, EbsBlockDevice> getBlockDeviceMappingsForImageInRegion(@Nullable Region region, String imageId); Map<String, EbsBlockDevice> getBlockDeviceMappingsForImageInRegion(@Nullable String region, String imageId);
/** /**
* Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance. * 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" * "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); CreateImageOptions... options);
/** /**
@ -134,7 +133,7 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html"
* /> * />
*/ */
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 * 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" * "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); RegisterImageOptions... options);
/** /**
@ -199,7 +198,7 @@ public interface AMIClient {
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html" * "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); RegisterImageBackedByEbsOptions... options);
/** /**
@ -216,7 +215,7 @@ public interface AMIClient {
* /> * />
* @see DescribeImagesOptions * @see DescribeImagesOptions
*/ */
Permission getLaunchPermissionForImageInRegion(@Nullable Region region, String imageId); Permission getLaunchPermissionForImageInRegion(@Nullable String region, String imageId);
/** /**
* Adds {@code launchPermission}s to an AMI. * Adds {@code launchPermission}s to an AMI.
@ -236,7 +235,7 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
* /> * />
*/ */
void addLaunchPermissionsToImageInRegion(@Nullable Region region, Iterable<String> userIds, void addLaunchPermissionsToImageInRegion(@Nullable String region, Iterable<String> userIds,
Iterable<String> userGroups, String imageId); Iterable<String> userGroups, String imageId);
/** /**
@ -253,7 +252,7 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetImageAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetImageAttribute.html"
* /> * />
*/ */
void resetLaunchPermissionsOnImageInRegion(@Nullable Region region, String imageId); void resetLaunchPermissionsOnImageInRegion(@Nullable String region, String imageId);
/** /**
* Removes {@code launchPermission}s from an AMI. * Removes {@code launchPermission}s from an AMI.
@ -273,7 +272,7 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
* /> * />
*/ */
void removeLaunchPermissionsFromImageInRegion(@Nullable Region region, Iterable<String> userIds, void removeLaunchPermissionsFromImageInRegion(@Nullable String region, Iterable<String> userIds,
Iterable<String> userGroups, String imageId); Iterable<String> userGroups, String imageId);
/** /**
@ -292,7 +291,7 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
* /> * />
*/ */
void addProductCodesToImageInRegion(@Nullable Region region, Iterable<String> productCodes, String imageId); void addProductCodesToImageInRegion(@Nullable String region, Iterable<String> productCodes, String imageId);
/** /**
* Removes {@code productCode}s from an AMI. * Removes {@code productCode}s from an AMI.
@ -310,6 +309,6 @@ public interface AMIClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html"
* /> * />
*/ */
void removeProductCodesFromImageInRegion(@Nullable Region region, Iterable<String> productCodes, void removeProductCodesFromImageInRegion(@Nullable String region, Iterable<String> productCodes,
String imageId); String imageId);
} }

View File

@ -66,7 +66,7 @@ public interface AvailabilityZoneAndRegionAsyncClient {
@FormParams(keys = ACTION, values = "DescribeAvailabilityZones") @FormParams(keys = ACTION, values = "DescribeAvailabilityZones")
@XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class) @XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class)
ListenableFuture<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion( ListenableFuture<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
DescribeAvailabilityZonesOptions... options); DescribeAvailabilityZonesOptions... options);
/** /**
@ -77,6 +77,6 @@ public interface AvailabilityZoneAndRegionAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeRegions") @FormParams(keys = ACTION, values = "DescribeRegions")
@XMLResponseParser(DescribeRegionsResponseHandler.class) @XMLResponseParser(DescribeRegionsResponseHandler.class)
ListenableFuture<? extends Map<Region, URI>> describeRegions(DescribeRegionsOptions... options); ListenableFuture<? extends Map<String, URI>> describeRegions(DescribeRegionsOptions... options);
} }

View File

@ -49,7 +49,7 @@ public interface AvailabilityZoneAndRegionClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAvailabilityZones.html"
* /> * />
*/ */
Set<AvailabilityZoneInfo> describeAvailabilityZonesInRegion(@Nullable Region region, Set<AvailabilityZoneInfo> describeAvailabilityZonesInRegion(@Nullable String region,
DescribeAvailabilityZonesOptions... options); DescribeAvailabilityZonesOptions... options);
/** /**
@ -62,5 +62,5 @@ public interface AvailabilityZoneAndRegionClient {
* /> * />
*/ */
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
Map<Region, URI> describeRegions(DescribeRegionsOptions... options); Map<String, URI> describeRegions(DescribeRegionsOptions... options);
} }

View File

@ -112,7 +112,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = ACTION, values = "DescribeVolumes") @FormParams(keys = ACTION, values = "DescribeVolumes")
@XMLResponseParser(DescribeVolumesResponseHandler.class) @XMLResponseParser(DescribeVolumesResponseHandler.class)
ListenableFuture<? extends Set<Volume>> describeVolumesInRegion( ListenableFuture<? extends Set<Volume>> describeVolumesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds); @BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds);
/** /**
@ -122,7 +122,7 @@ public interface ElasticBlockStoreAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DeleteVolume") @FormParams(keys = ACTION, values = "DeleteVolume")
ListenableFuture<Void> deleteVolumeInRegion( ListenableFuture<Void> deleteVolumeInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("VolumeId") String volumeId); @FormParam("VolumeId") String volumeId);
/** /**
@ -133,7 +133,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = ACTION, values = "DetachVolume") @FormParams(keys = ACTION, values = "DetachVolume")
@ExceptionParser(ReturnVoidOnVolumeAvailable.class) @ExceptionParser(ReturnVoidOnVolumeAvailable.class)
ListenableFuture<Void> detachVolumeInRegion( ListenableFuture<Void> detachVolumeInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force, @FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force,
DetachVolumeOptions... options); DetachVolumeOptions... options);
@ -145,7 +145,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = ACTION, values = "AttachVolume") @FormParams(keys = ACTION, values = "AttachVolume")
@XMLResponseParser(AttachmentHandler.class) @XMLResponseParser(AttachmentHandler.class)
ListenableFuture<Attachment> attachVolumeInRegion( ListenableFuture<Attachment> attachVolumeInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId, @FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId,
@FormParam("Device") String device); @FormParam("Device") String device);
@ -157,7 +157,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = ACTION, values = "CreateSnapshot") @FormParams(keys = ACTION, values = "CreateSnapshot")
@XMLResponseParser(SnapshotHandler.class) @XMLResponseParser(SnapshotHandler.class)
ListenableFuture<Snapshot> createSnapshotInRegion( ListenableFuture<Snapshot> createSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options); @FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options);
/** /**
@ -168,7 +168,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = ACTION, values = "DescribeSnapshots") @FormParams(keys = ACTION, values = "DescribeSnapshots")
@XMLResponseParser(DescribeSnapshotsResponseHandler.class) @XMLResponseParser(DescribeSnapshotsResponseHandler.class)
ListenableFuture<? extends Set<Snapshot>> describeSnapshotsInRegion( ListenableFuture<? extends Set<Snapshot>> describeSnapshotsInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
DescribeSnapshotsOptions... options); DescribeSnapshotsOptions... options);
/** /**
@ -178,7 +178,7 @@ public interface ElasticBlockStoreAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DeleteSnapshot") @FormParams(keys = ACTION, values = "DeleteSnapshot")
ListenableFuture<Void> deleteSnapshotInRegion( ListenableFuture<Void> deleteSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("SnapshotId") String snapshotId); @FormParam("SnapshotId") String snapshotId);
/** /**
@ -189,7 +189,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = {
"ModifySnapshotAttribute", "add", "createVolumePermission" }) "ModifySnapshotAttribute", "add", "createVolumePermission" })
ListenableFuture<Void> addCreateVolumePermissionsToSnapshotInRegion( ListenableFuture<Void> addCreateVolumePermissionsToSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
@FormParam("SnapshotId") String snapshotId); @FormParam("SnapshotId") String snapshotId);
@ -202,7 +202,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = {
"ModifySnapshotAttribute", "remove", "createVolumePermission" }) "ModifySnapshotAttribute", "remove", "createVolumePermission" })
ListenableFuture<Void> removeCreateVolumePermissionsFromSnapshotInRegion( ListenableFuture<Void> removeCreateVolumePermissionsFromSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds, @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups, @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
@FormParam("SnapshotId") String snapshotId); @FormParam("SnapshotId") String snapshotId);
@ -216,7 +216,7 @@ public interface ElasticBlockStoreAsyncClient {
"createVolumePermission" }) "createVolumePermission" })
@XMLResponseParser(PermissionHandler.class) @XMLResponseParser(PermissionHandler.class)
ListenableFuture<Permission> getCreateVolumePermissionForSnapshotInRegion( ListenableFuture<Permission> getCreateVolumePermissionForSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("SnapshotId") String snapshotId); @FormParam("SnapshotId") String snapshotId);
/** /**
@ -227,7 +227,7 @@ public interface ElasticBlockStoreAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute", @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute",
"createVolumePermission" }) "createVolumePermission" })
ListenableFuture<Void> resetCreateVolumePermissionsOnSnapshotInRegion( ListenableFuture<Void> resetCreateVolumePermissionsOnSnapshotInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("SnapshotId") String snapshotId); @FormParam("SnapshotId") String snapshotId);
} }

View File

@ -138,7 +138,7 @@ public interface ElasticBlockStoreClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVolumes.html"
* /> * />
*/ */
Set<Volume> describeVolumesInRegion(@Nullable Region region, String... volumeIds); Set<Volume> describeVolumesInRegion(@Nullable String region, String... volumeIds);
/** /**
* Deletes an Amazon EBS volume that you own. For more information about Amazon EBS, go to the * 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" * "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. * 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" * "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); DetachVolumeOptions... options);
/** /**
@ -232,7 +232,7 @@ public interface ElasticBlockStoreClient {
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AttachVolume.html" * "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 * 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 <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html"
* /> * />
*/ */
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 * Returns information about Amazon EBS snapshots available to the user. Information returned
@ -330,7 +330,7 @@ public interface ElasticBlockStoreClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html"
* /> * />
*/ */
Set<Snapshot> describeSnapshotsInRegion(@Nullable Region region, DescribeSnapshotsOptions... options); Set<Snapshot> describeSnapshotsInRegion(@Nullable String region, DescribeSnapshotsOptions... options);
/** /**
* Deletes a snapshot of an Amazon EBS volume that you own. For more information, go to the * 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 <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSnapshot.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSnapshot.html"
* /> * />
*/ */
void deleteSnapshotInRegion(@Nullable Region region, String snapshotId); void deleteSnapshotInRegion(@Nullable String region, String snapshotId);
/** /**
* Returns the {@link Permission}s of an snapshot. * Returns the {@link Permission}s of an snapshot.
@ -363,7 +363,7 @@ public interface ElasticBlockStoreClient {
* /> * />
* @see DescribeSnapshotsOptions * @see DescribeSnapshotsOptions
*/ */
Permission getCreateVolumePermissionForSnapshotInRegion(@Nullable Region region, String snapshotId); Permission getCreateVolumePermissionForSnapshotInRegion(@Nullable String region, String snapshotId);
/** /**
* Adds {@code createVolumePermission}s to an EBS snapshot. * Adds {@code createVolumePermission}s to an EBS snapshot.
@ -384,7 +384,7 @@ public interface ElasticBlockStoreClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
* /> * />
*/ */
void addCreateVolumePermissionsToSnapshotInRegion(@Nullable Region region, Iterable<String> userIds, void addCreateVolumePermissionsToSnapshotInRegion(@Nullable String region, Iterable<String> userIds,
Iterable<String> userGroups, String snapshotId); Iterable<String> userGroups, String snapshotId);
/** /**
@ -402,7 +402,7 @@ public interface ElasticBlockStoreClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetSnapshotAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ResetSnapshotAttribute.html"
* /> * />
*/ */
void resetCreateVolumePermissionsOnSnapshotInRegion(@Nullable Region region, String snapshotId); void resetCreateVolumePermissionsOnSnapshotInRegion(@Nullable String region, String snapshotId);
/** /**
* Removes {@code createVolumePermission}s from an EBS snapshot. * Removes {@code createVolumePermission}s from an EBS snapshot.
@ -423,6 +423,6 @@ public interface ElasticBlockStoreClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySnapshotAttribute.html"
* /> * />
*/ */
void removeCreateVolumePermissionsFromSnapshotInRegion(@Nullable Region region, Iterable<String> userIds, void removeCreateVolumePermissionsFromSnapshotInRegion(@Nullable String region, Iterable<String> userIds,
Iterable<String> userGroups, String snapshotId); Iterable<String> userGroups, String snapshotId);
} }

View File

@ -66,7 +66,7 @@ public interface ElasticIPAddressAsyncClient {
@XMLResponseParser(AllocateAddressResponseHandler.class) @XMLResponseParser(AllocateAddressResponseHandler.class)
@FormParams(keys = ACTION, values = "AllocateAddress") @FormParams(keys = ACTION, values = "AllocateAddress")
ListenableFuture<InetAddress> allocateAddressInRegion( ListenableFuture<InetAddress> allocateAddressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region); @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region);
/** /**
* @see BaseEC2Client#associateAddressInRegion * @see BaseEC2Client#associateAddressInRegion
@ -75,7 +75,7 @@ public interface ElasticIPAddressAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "AssociateAddress") @FormParams(keys = ACTION, values = "AssociateAddress")
ListenableFuture<Void> associateAddressInRegion( ListenableFuture<Void> associateAddressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp, @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
@ -86,7 +86,7 @@ public interface ElasticIPAddressAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DisassociateAddress") @FormParams(keys = ACTION, values = "DisassociateAddress")
ListenableFuture<Void> disassociateAddressInRegion( ListenableFuture<Void> disassociateAddressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp); @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp);
/** /**
@ -96,7 +96,7 @@ public interface ElasticIPAddressAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "ReleaseAddress") @FormParams(keys = ACTION, values = "ReleaseAddress")
ListenableFuture<Void> releaseAddressInRegion( ListenableFuture<Void> releaseAddressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp); @FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp);
/** /**
@ -107,7 +107,7 @@ public interface ElasticIPAddressAsyncClient {
@FormParams(keys = ACTION, values = "DescribeAddresses") @FormParams(keys = ACTION, values = "DescribeAddresses")
@XMLResponseParser(DescribeAddressesResponseHandler.class) @XMLResponseParser(DescribeAddressesResponseHandler.class)
ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion( ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindInetAddressesToIndexedFormParams.class) InetAddress... publicIps); @BinderParam(BindInetAddressesToIndexedFormParams.class) InetAddress... publicIps);
} }

View File

@ -49,7 +49,7 @@ public interface ElasticIPAddressClient {
* @see #disassociateAddress * @see #disassociateAddress
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html"
*/ */
InetAddress allocateAddressInRegion(@Nullable Region region); InetAddress allocateAddressInRegion(@Nullable String region);
/** /**
* Associates an elastic IP address with an instance. If the IP address is currently assigned to * Associates an elastic IP address with an instance. If the IP address is currently assigned to
@ -69,7 +69,7 @@ public interface ElasticIPAddressClient {
* @see #disassociateAddress * @see #disassociateAddress
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-AssociateAddress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-AssociateAddress.html"
*/ */
void associateAddressInRegion(@Nullable Region region, InetAddress publicIp, String instanceId); void associateAddressInRegion(@Nullable String region, InetAddress publicIp, String instanceId);
/** /**
* Disassociates the specified elastic IP address from the instance to which it is assigned. This * Disassociates the specified elastic IP address from the instance to which it is assigned. This
@ -87,7 +87,7 @@ public interface ElasticIPAddressClient {
* @see #associateAddress * @see #associateAddress
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DisdisassociateAddress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DisdisassociateAddress.html"
*/ */
void disassociateAddressInRegion(@Nullable Region region, InetAddress publicIp); void disassociateAddressInRegion(@Nullable String region, InetAddress publicIp);
/** /**
* Releases an elastic IP address associated with your account. * Releases an elastic IP address associated with your account.
@ -103,7 +103,7 @@ public interface ElasticIPAddressClient {
* @see #disassociateAddress * @see #disassociateAddress
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-ReleaseAddress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-ReleaseAddress.html"
*/ */
void releaseAddressInRegion(@Nullable Region region, InetAddress publicIp); void releaseAddressInRegion(@Nullable String region, InetAddress publicIp);
/** /**
* Lists elastic IP addresses assigned to your account or provides information about a specific * Lists elastic IP addresses assigned to your account or provides information about a specific
@ -121,7 +121,7 @@ public interface ElasticIPAddressClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAddresses.html"
* /> * />
*/ */
Set<PublicIpInstanceIdPair> describeAddressesInRegion(@Nullable Region region, Set<PublicIpInstanceIdPair> describeAddressesInRegion(@Nullable String region,
InetAddress... publicIps); InetAddress... publicIps);
} }

View File

@ -29,7 +29,6 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.binders.BindBlockDeviceMappingToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindBlockDeviceMappingToIndexedFormParams;
import org.jclouds.aws.ec2.binders.BindInstanceIdsToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindInstanceIdsToIndexedFormParams;
import org.jclouds.aws.ec2.binders.IfNotNullBindAvailabilityZoneToFormParam; import org.jclouds.aws.ec2.binders.IfNotNullBindAvailabilityZoneToFormParam;
@ -77,7 +76,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = ACTION, values = "DescribeInstances") @FormParams(keys = ACTION, values = "DescribeInstances")
@XMLResponseParser(DescribeInstancesResponseHandler.class) @XMLResponseParser(DescribeInstancesResponseHandler.class)
ListenableFuture<? extends Set<Reservation>> describeInstancesInRegion( ListenableFuture<? extends Set<Reservation>> describeInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
/** /**
@ -88,7 +87,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = ACTION, values = "RunInstances") @FormParams(keys = ACTION, values = "RunInstances")
@XMLResponseParser(RunInstancesResponseHandler.class) @XMLResponseParser(RunInstancesResponseHandler.class)
ListenableFuture<Reservation> runInstancesInRegion( ListenableFuture<Reservation> runInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) AvailabilityZone nullableAvailabilityZone, @Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) AvailabilityZone nullableAvailabilityZone,
@FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount, @FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount,
@FormParam("MaxCount") int maxCount, RunInstancesOptions... options); @FormParam("MaxCount") int maxCount, RunInstancesOptions... options);
@ -100,7 +99,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "RebootInstances") @FormParams(keys = ACTION, values = "RebootInstances")
ListenableFuture<Void> rebootInstancesInRegion( ListenableFuture<Void> rebootInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
/** /**
@ -111,7 +110,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = ACTION, values = "TerminateInstances") @FormParams(keys = ACTION, values = "TerminateInstances")
@XMLResponseParser(InstanceStateChangeHandler.class) @XMLResponseParser(InstanceStateChangeHandler.class)
ListenableFuture<? extends Set<InstanceStateChange>> terminateInstancesInRegion( ListenableFuture<? extends Set<InstanceStateChange>> terminateInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
/** /**
@ -122,7 +121,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = ACTION, values = "StopInstances") @FormParams(keys = ACTION, values = "StopInstances")
@XMLResponseParser(InstanceStateChangeHandler.class) @XMLResponseParser(InstanceStateChangeHandler.class)
ListenableFuture<? extends Set<InstanceStateChange>> stopInstancesInRegion( ListenableFuture<? extends Set<InstanceStateChange>> stopInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("Force") boolean force, @FormParam("Force") boolean force,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
@ -134,7 +133,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = ACTION, values = "StartInstances") @FormParams(keys = ACTION, values = "StartInstances")
@XMLResponseParser(InstanceStateChangeHandler.class) @XMLResponseParser(InstanceStateChangeHandler.class)
ListenableFuture<? extends Set<InstanceStateChange>> startInstancesInRegion( ListenableFuture<? extends Set<InstanceStateChange>> startInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
/** /**
@ -145,7 +144,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" })
@XMLResponseParser(UnencodeStringValueHandler.class) @XMLResponseParser(UnencodeStringValueHandler.class)
ListenableFuture<String> getUserDataForInstanceInRegion( ListenableFuture<String> getUserDataForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -157,7 +156,7 @@ public interface InstanceAsyncClient {
"rootDeviceName" }) "rootDeviceName" })
@XMLResponseParser(StringValueHandler.class) @XMLResponseParser(StringValueHandler.class)
ListenableFuture<String> getRootDeviceNameForInstanceInRegion( ListenableFuture<String> getRootDeviceNameForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -168,7 +167,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" })
@XMLResponseParser(StringValueHandler.class) @XMLResponseParser(StringValueHandler.class)
ListenableFuture<String> getRamdiskForInstanceInRegion( ListenableFuture<String> getRamdiskForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -179,7 +178,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" })
@XMLResponseParser(StringValueHandler.class) @XMLResponseParser(StringValueHandler.class)
ListenableFuture<String> getKernelForInstanceInRegion( ListenableFuture<String> getKernelForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -191,7 +190,7 @@ public interface InstanceAsyncClient {
"disableApiTermination" }) "disableApiTermination" })
@XMLResponseParser(BooleanValueHandler.class) @XMLResponseParser(BooleanValueHandler.class)
ListenableFuture<Boolean> isApiTerminationDisabledForInstanceInRegion( ListenableFuture<Boolean> isApiTerminationDisabledForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -203,7 +202,7 @@ public interface InstanceAsyncClient {
"instanceType" }) "instanceType" })
@XMLResponseParser(InstanceTypeHandler.class) @XMLResponseParser(InstanceTypeHandler.class)
ListenableFuture<String> getInstanceTypeForInstanceInRegion( ListenableFuture<String> getInstanceTypeForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -215,7 +214,7 @@ public interface InstanceAsyncClient {
"instanceInitiatedShutdownBehavior" }) "instanceInitiatedShutdownBehavior" })
@XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class) @XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class)
ListenableFuture<InstanceInitiatedShutdownBehavior> getInstanceInitiatedShutdownBehaviorForInstanceInRegion( ListenableFuture<InstanceInitiatedShutdownBehavior> getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -227,7 +226,7 @@ public interface InstanceAsyncClient {
"blockDeviceMapping" }) "blockDeviceMapping" })
@XMLResponseParser(BlockDeviceMappingHandler.class) @XMLResponseParser(BlockDeviceMappingHandler.class)
ListenableFuture<? extends Map<String, RunningInstance.EbsBlockDevice>> getBlockDeviceMappingForInstanceInRegion( ListenableFuture<? extends Map<String, RunningInstance.EbsBlockDevice>> getBlockDeviceMappingForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -237,7 +236,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" })
ListenableFuture<Void> resetRamdiskForInstanceInRegion( ListenableFuture<Void> resetRamdiskForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -247,7 +246,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" })
ListenableFuture<Void> resetKernelForInstanceInRegion( ListenableFuture<Void> resetKernelForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId); @FormParam("InstanceId") String instanceId);
/** /**
@ -257,7 +256,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" })
ListenableFuture<Void> setUserDataForInstanceInRegion( ListenableFuture<Void> setUserDataForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("InstanceId") String instanceId,
@FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData); @FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData);
@ -268,7 +267,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" })
ListenableFuture<Void> setRamdiskForInstanceInRegion( ListenableFuture<Void> setRamdiskForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk); @FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk);
/** /**
@ -278,7 +277,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" })
ListenableFuture<Void> setKernelForInstanceInRegion( ListenableFuture<Void> setKernelForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel); @FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel);
/** /**
@ -289,7 +288,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
"disableApiTermination" }) "disableApiTermination" })
ListenableFuture<Void> setApiTerminationDisabledForInstanceInRegion( ListenableFuture<Void> setApiTerminationDisabledForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("InstanceId") String instanceId,
@FormParam("Value") boolean apiTerminationDisabled); @FormParam("Value") boolean apiTerminationDisabled);
@ -300,7 +299,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" }) @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" })
ListenableFuture<Void> setInstanceTypeForInstanceInRegion( ListenableFuture<Void> setInstanceTypeForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("InstanceId") String instanceId,
@FormParam("Value") String instanceType); @FormParam("Value") String instanceType);
@ -312,7 +311,7 @@ public interface InstanceAsyncClient {
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", @FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
"instanceInitiatedShutdownBehavior" }) "instanceInitiatedShutdownBehavior" })
ListenableFuture<Void> setInstanceInitiatedShutdownBehaviorForInstanceInRegion( ListenableFuture<Void> setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("InstanceId") String instanceId,
@FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior); @FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
@ -323,7 +322,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = { ACTION }, values = { "ModifyInstanceAttribute" }) @FormParams(keys = { ACTION }, values = { "ModifyInstanceAttribute" })
ListenableFuture<Void> setBlockDeviceMappingForInstanceInRegion( ListenableFuture<Void> setBlockDeviceMappingForInstanceInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId") String instanceId, @FormParam("InstanceId") String instanceId,
@BinderParam(BindBlockDeviceMappingToIndexedFormParams.class) BlockDeviceMapping blockDeviceMapping); @BinderParam(BindBlockDeviceMappingToIndexedFormParams.class) BlockDeviceMapping blockDeviceMapping);

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.domain.*; import org.jclouds.aws.ec2.domain.*;
import org.jclouds.aws.ec2.domain.RunningInstance.EbsBlockDevice; import org.jclouds.aws.ec2.domain.RunningInstance.EbsBlockDevice;
import org.jclouds.aws.ec2.domain.Volume.InstanceInitiatedShutdownBehavior; import org.jclouds.aws.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
@ -61,7 +60,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html"
* /> * />
*/ */
Set<Reservation> describeInstancesInRegion(@Nullable Region region, String... instanceIds); Set<Reservation> describeInstancesInRegion(@Nullable String region, String... instanceIds);
/** /**
* Launches a specified number of instances of an AMI for which you have permissions. * Launches a specified number of instances of an AMI for which you have permissions.
@ -134,7 +133,7 @@ public interface InstanceClient {
* /> * />
* @see RunInstancesOptions * @see RunInstancesOptions
*/ */
Reservation runInstancesInRegion(@Nullable Region region, Reservation runInstancesInRegion(@Nullable String region,
@Nullable AvailabilityZone nullableAvailabilityZone, String imageId, int minCount, @Nullable AvailabilityZone nullableAvailabilityZone, String imageId, int minCount,
int maxCount, RunInstancesOptions... options); int maxCount, RunInstancesOptions... options);
@ -153,7 +152,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-TerminateInstances.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-TerminateInstances.html"
* /> * />
*/ */
Set<InstanceStateChange> terminateInstancesInRegion(@Nullable Region region, String... instanceIds); Set<InstanceStateChange> terminateInstancesInRegion(@Nullable String region, String... instanceIds);
/** /**
* Stops an instance that uses an Amazon EBS volume as its root device. * 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" * "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html"
* /> * />
*/ */
Set<InstanceStateChange> stopInstancesInRegion(@Nullable Region region, boolean force, Set<InstanceStateChange> stopInstancesInRegion(@Nullable String region, boolean force,
String... instanceIds); String... instanceIds);
/** /**
@ -214,7 +213,7 @@ public interface InstanceClient {
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html" * "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. * Starts an instance that uses an Amazon EBS volume as its root device.
@ -244,7 +243,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StartInstances.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StartInstances.html"
* /> * />
*/ */
Set<InstanceStateChange> startInstancesInRegion(@Nullable Region region, String... instanceIds); Set<InstanceStateChange> startInstancesInRegion(@Nullable String region, String... instanceIds);
/** /**
* *
@ -255,7 +254,7 @@ public interface InstanceClient {
* which instance to describe the attribute of * which instance to describe the attribute of
* @return unencoded user data * @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 * which instance to describe the attribute of
* @return The root device name (e.g., /dev/sda1). * @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 * which instance to describe the attribute of
* @return the ID of the RAM disk associated with the AMI. * @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 * which instance to describe the attribute of
* @return the ID of the kernel associated with the AMI. * @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 * @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. * 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 * which instance to describe the attribute of
* @return The instance type of the instance. * @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. * is shut down.
*/ */
InstanceInitiatedShutdownBehavior getInstanceInitiatedShutdownBehaviorForInstanceInRegion( 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 * @return Describes the mapping that defines native device names to use when exposing virtual
* devices. * devices.
*/ */
Map<String, EbsBlockDevice> getBlockDeviceMappingForInstanceInRegion(@Nullable Region region, Map<String, EbsBlockDevice> getBlockDeviceMappingForInstanceInRegion(@Nullable String region,
String instanceId); String instanceId);
/** /**
@ -349,7 +348,7 @@ public interface InstanceClient {
* which instance to reset the attribute of * which instance to reset the attribute of
* @return the ID of the RAM disk associated with the AMI. * @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. * Resets an attribute of an instance to its default value.
@ -361,7 +360,7 @@ public interface InstanceClient {
* which instance to reset the attribute of * which instance to reset the attribute of
* @return the ID of the kernel associated with the AMI. * @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. * Sets the userData used for starting the instance.
@ -383,7 +382,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
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. * Sets the ramdisk used for starting the instance.
@ -405,7 +404,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
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. * Sets the kernelId used for starting the instance.
@ -427,7 +426,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
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 * 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 <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
void setApiTerminationDisabledForInstanceInRegion(@Nullable Region region, String instanceId, void setApiTerminationDisabledForInstanceInRegion(@Nullable String region, String instanceId,
boolean apiTerminationDisabled); boolean apiTerminationDisabled);
/** /**
@ -466,7 +465,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
void setInstanceTypeForInstanceInRegion(@Nullable Region region, String instanceId, void setInstanceTypeForInstanceInRegion(@Nullable String region, String instanceId,
String instanceType); String instanceType);
/** /**
@ -491,7 +490,7 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(@Nullable Region region, String instanceId, void setInstanceInitiatedShutdownBehaviorForInstanceInRegion(@Nullable String region, String instanceId,
InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior); InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
/** /**
@ -538,6 +537,6 @@ public interface InstanceClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html"
* /> * />
*/ */
void setBlockDeviceMappingForInstanceInRegion(@Nullable Region region, String instanceId, void setBlockDeviceMappingForInstanceInRegion(@Nullable String region, String instanceId,
BlockDeviceMapping blockDeviceMapping); BlockDeviceMapping blockDeviceMapping);
} }

View File

@ -63,7 +63,7 @@ public interface KeyPairAsyncClient {
@FormParams(keys = ACTION, values = "CreateKeyPair") @FormParams(keys = ACTION, values = "CreateKeyPair")
@XMLResponseParser(KeyPairResponseHandler.class) @XMLResponseParser(KeyPairResponseHandler.class)
ListenableFuture<KeyPair> createKeyPairInRegion( ListenableFuture<KeyPair> createKeyPairInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("KeyName") String keyName); @FormParam("KeyName") String keyName);
// map resourcenotfoundexception to empty set // map resourcenotfoundexception to empty set
@ -75,7 +75,7 @@ public interface KeyPairAsyncClient {
@FormParams(keys = ACTION, values = "DescribeKeyPairs") @FormParams(keys = ACTION, values = "DescribeKeyPairs")
@XMLResponseParser(DescribeKeyPairsResponseHandler.class) @XMLResponseParser(DescribeKeyPairsResponseHandler.class)
ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion( ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindKeyNameToIndexedFormParams.class) String... keyPairNames); @BinderParam(BindKeyNameToIndexedFormParams.class) String... keyPairNames);
/** /**
@ -85,7 +85,7 @@ public interface KeyPairAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DeleteKeyPair") @FormParams(keys = ACTION, values = "DeleteKeyPair")
ListenableFuture<Void> deleteKeyPairInRegion( ListenableFuture<Void> deleteKeyPairInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("KeyName") String keyName); @FormParam("KeyName") String keyName);
} }

View File

@ -55,7 +55,7 @@ public interface KeyPairClient {
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateKeyPair.html" * "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 * Returns information about key pairs available to you. If you specify key pairs, information
@ -72,7 +72,7 @@ public interface KeyPairClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html"
* /> * />
*/ */
Set<KeyPair> describeKeyPairsInRegion(@Nullable Region region, String... keyPairNames); Set<KeyPair> describeKeyPairsInRegion(@Nullable String region, String... keyPairNames);
/** /**
* Deletes the specified key pair, by removing the public key from Amazon EC2. You must own the * 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" * "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);
} }

View File

@ -62,7 +62,7 @@ public interface MonitoringAsyncClient {
@FormParams(keys = ACTION, values = "MonitorInstances") @FormParams(keys = ACTION, values = "MonitorInstances")
@XMLResponseParser(MonitoringStateHandler.class) @XMLResponseParser(MonitoringStateHandler.class)
ListenableFuture<? extends Map<String, MonitoringState>> monitorInstancesInRegion( ListenableFuture<? extends Map<String, MonitoringState>> monitorInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId.0") String instanceId, @FormParam("InstanceId.0") String instanceId,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
@ -74,7 +74,7 @@ public interface MonitoringAsyncClient {
@FormParams(keys = ACTION, values = "UnmonitorInstances") @FormParams(keys = ACTION, values = "UnmonitorInstances")
@XMLResponseParser(MonitoringStateHandler.class) @XMLResponseParser(MonitoringStateHandler.class)
ListenableFuture<? extends Map<String, MonitoringState>> unmonitorInstancesInRegion( ListenableFuture<? extends Map<String, MonitoringState>> unmonitorInstancesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("InstanceId.0") String instanceId, @FormParam("InstanceId.0") String instanceId,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
} }

View File

@ -50,7 +50,7 @@ public interface MonitoringClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-MonitorInstances.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-MonitorInstances.html"
* /> * />
*/ */
Map<String, MonitoringState> monitorInstancesInRegion(@Nullable Region region, String instanceId, Map<String, MonitoringState> monitorInstancesInRegion(@Nullable String region, String instanceId,
String... instanceIds); String... instanceIds);
/** /**
@ -67,6 +67,6 @@ public interface MonitoringClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html"
* /> * />
*/ */
Map<String, MonitoringState> unmonitorInstancesInRegion(@Nullable Region region, String instanceId, Map<String, MonitoringState> unmonitorInstancesInRegion(@Nullable String region, String instanceId,
String... instanceIds); String... instanceIds);
} }

View File

@ -66,7 +66,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "CreateSecurityGroup") @FormParams(keys = ACTION, values = "CreateSecurityGroup")
ListenableFuture<Void> createSecurityGroupInRegion( ListenableFuture<Void> createSecurityGroupInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String name, @FormParam("GroupDescription") String description); @FormParam("GroupName") String name, @FormParam("GroupDescription") String description);
/** /**
@ -77,7 +77,7 @@ public interface SecurityGroupAsyncClient {
@FormParams(keys = ACTION, values = "DeleteSecurityGroup") @FormParams(keys = ACTION, values = "DeleteSecurityGroup")
@ExceptionParser(ReturnVoidOnGroupNotFound.class) @ExceptionParser(ReturnVoidOnGroupNotFound.class)
ListenableFuture<Void> deleteSecurityGroupInRegion( ListenableFuture<Void> deleteSecurityGroupInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String name); @FormParam("GroupName") String name);
/** /**
@ -88,7 +88,7 @@ public interface SecurityGroupAsyncClient {
@FormParams(keys = ACTION, values = "DescribeSecurityGroups") @FormParams(keys = ACTION, values = "DescribeSecurityGroups")
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class) @XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
ListenableFuture<? extends SortedSet<SecurityGroup>> describeSecurityGroupsInRegion( ListenableFuture<? extends SortedSet<SecurityGroup>> describeSecurityGroupsInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@BinderParam(BindGroupNameToIndexedFormParams.class) String... securityGroupNames); @BinderParam(BindGroupNameToIndexedFormParams.class) String... securityGroupNames);
/** /**
@ -98,7 +98,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion( ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String groupName, @FormParam("GroupName") String groupName,
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
@ -110,7 +110,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress") @FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion( ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String groupName, @FormParam("GroupName") String groupName,
@FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort, @FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort,
@FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);
@ -122,7 +122,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
ListenableFuture<Void> revokeSecurityGroupIngressInRegion( ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String groupName, @FormParam("GroupName") String groupName,
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup); @BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
@ -134,7 +134,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress") @FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
ListenableFuture<Void> revokeSecurityGroupIngressInRegion( ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("GroupName") String groupName, @FormParam("GroupName") String groupName,
@FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort, @FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort,
@FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp); @FormParam("ToPort") int toPort, @FormParam("CidrIp") String cidrIp);

View File

@ -61,7 +61,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html"
* /> * />
*/ */
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. * Deletes a security group that you own.
@ -81,7 +81,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html"
* /> * />
*/ */
void deleteSecurityGroupInRegion(@Nullable Region region, String name); void deleteSecurityGroupInRegion(@Nullable String region, String name);
/** /**
* Returns information about security groups that you own. * Returns information about security groups that you own.
@ -101,7 +101,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html"
* /> * />
*/ */
SortedSet<SecurityGroup> describeSecurityGroupsInRegion(@Nullable Region region, SortedSet<SecurityGroup> describeSecurityGroupsInRegion(@Nullable String region,
String... securityGroupNames); String... securityGroupNames);
/** /**
@ -125,7 +125,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
* *
*/ */
void authorizeSecurityGroupIngressInRegion(@Nullable Region region, String groupName, void authorizeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
UserIdGroupPair sourceSecurityGroup); UserIdGroupPair sourceSecurityGroup);
/** /**
@ -164,7 +164,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-AuthorizeSecurityGroupIngress.html"
* *
*/ */
void authorizeSecurityGroupIngressInRegion(@Nullable Region region, String groupName, void authorizeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
IpProtocol ipProtocol, int fromPort, int toPort, String cidrIp); IpProtocol ipProtocol, int fromPort, int toPort, String cidrIp);
/** /**
@ -189,7 +189,7 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
* *
*/ */
void revokeSecurityGroupIngressInRegion(@Nullable Region region, String groupName, void revokeSecurityGroupIngressInRegion(@Nullable String region, String groupName,
UserIdGroupPair sourceSecurityGroup); UserIdGroupPair sourceSecurityGroup);
/** /**
@ -229,6 +229,6 @@ public interface SecurityGroupClient {
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html" * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RevokeSecurityGroupIngress.html"
* *
*/ */
void revokeSecurityGroupIngressInRegion(@Nullable Region region, String groupName, IpProtocol ipProtocol, void revokeSecurityGroupIngressInRegion(@Nullable String region, String groupName, IpProtocol ipProtocol,
int fromPort, int toPort, String cidrIp); int fromPort, int toPort, String cidrIp);
} }

View File

@ -55,10 +55,16 @@ public class EC2Utils {
} }
} }
public static Region findRegionInArgsOrNull(GeneratedHttpRequest<?> gRequest) { public static String findRegionInArgsOrNull(GeneratedHttpRequest<?> gRequest) {
for (Object arg : gRequest.getArgs()) { for (Object arg : gRequest.getArgs()) {
if (arg instanceof Region) { if (arg instanceof String) {
return (Region) arg; 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; return null;

View File

@ -44,7 +44,7 @@ public class AttachmentHandler extends ParseSax.HandlerWithResult<Attachment> {
protected DateService dateService; protected DateService dateService;
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private String volumeId; private String volumeId;
private String instanceId; private String instanceId;
private String device; private String device;
@ -52,7 +52,7 @@ public class AttachmentHandler extends ParseSax.HandlerWithResult<Attachment> {
private Date attachTime; private Date attachTime;
public Attachment getResult() { public Attachment getResult() {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
return new Attachment(region, volumeId, instanceId, device, attachmentStatus, attachTime); return new Attachment(region, volumeId, instanceId, device, attachmentStatus, attachTime);

View File

@ -54,10 +54,10 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
protected final DateService dateService; protected final DateService dateService;
protected final Region defaultRegion; protected final String defaultRegion;
@Inject @Inject
public BaseReservationHandler(DateService dateService, @EC2 Region defaultRegion) { public BaseReservationHandler(DateService dateService, @EC2 String defaultRegion) {
this.dateService = dateService; this.dateService = dateService;
this.defaultRegion = defaultRegion; this.defaultRegion = defaultRegion;
} }
@ -208,7 +208,7 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
this.attachTime = null; this.attachTime = null;
this.deleteOnTermination = true; this.deleteOnTermination = true;
} else if (inInstances && !inProductCodes && !inBlockDeviceMapping) { } else if (inInstances && !inProductCodes && !inBlockDeviceMapping) {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
instances.add(new RunningInstance(region, amiLaunchIndex, dnsName, imageId, instanceId, instances.add(new RunningInstance(region, amiLaunchIndex, dnsName, imageId, instanceId,
@ -261,7 +261,7 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
} }
protected Reservation newReservation() { protected Reservation newReservation() {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
Reservation info = new Reservation(region, groupIds, instances, ownerId, requesterId, Reservation info = new Reservation(region, groupIds, instances, ownerId, requesterId,

View File

@ -54,9 +54,9 @@ public class CreateVolumeResponseHandler extends ParseSax.HandlerWithResult<Volu
protected DateService dateService; protected DateService dateService;
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
@Inject @Inject
protected Map<AvailabilityZone, Region> availabilityZoneToRegion; protected Map<AvailabilityZone, String> availabilityZoneToRegion;
private String id; private String id;
private int size; private int size;
@ -74,7 +74,7 @@ public class CreateVolumeResponseHandler extends ParseSax.HandlerWithResult<Volu
private boolean inAttachmentSet; private boolean inAttachmentSet;
private Region region; private String region;
public Volume getResult() { public Volume getResult() {
return newVolume(); return newVolume();

View File

@ -48,7 +48,7 @@ public class DescribeAddressesResponseHandler extends
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private String instanceId; private String instanceId;
protected String currentOrNull() { protected String currentOrNull() {
@ -62,7 +62,7 @@ public class DescribeAddressesResponseHandler extends
} else if (qName.equals("instanceId")) { } else if (qName.equals("instanceId")) {
instanceId = currentOrNull(); instanceId = currentOrNull();
} else if (qName.equals("item")) { } else if (qName.equals("item")) {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
pairs.add(new PublicIpInstanceIdPair(region, ipAddress, instanceId)); pairs.add(new PublicIpInstanceIdPair(region, ipAddress, instanceId));

View File

@ -44,7 +44,7 @@ public class DescribeAvailabilityZonesResponseHandler extends
private AvailabilityZone zone; private AvailabilityZone zone;
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
private Region region; private String region;
private String zoneName; private String zoneName;
private State zoneState; private State zoneState;
private boolean inMessageSet; private boolean inMessageSet;
@ -71,10 +71,10 @@ public class DescribeAvailabilityZonesResponseHandler extends
} }
} else if (qName.equals("regionName")) { } else if (qName.equals("regionName")) {
try { try {
region = Region.fromValue(currentText.toString().trim()); region = currentText.toString().trim();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.warn(e, "unsupported region: %s", currentText.toString().trim()); logger.warn(e, "unsupported region: %s", currentText.toString().trim());
region = Region.UNKNOWN; region = "UNKNOWN";
} }
} else if (qName.equals("zoneState")) { } else if (qName.equals("zoneState")) {
try { try {

View File

@ -54,7 +54,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerWithResult<Se
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private Set<Image> contents = Sets.newLinkedHashSet(); private Set<Image> contents = Sets.newLinkedHashSet();
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
@ -147,7 +147,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerWithResult<Se
this.deleteOnTermination = true; this.deleteOnTermination = true;
} else if (!inProductCodes) { } else if (!inProductCodes) {
try { try {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
contents.add(new Image(region, architecture, contents.add(new Image(region, architecture,

View File

@ -42,7 +42,7 @@ public class DescribeInstancesResponseHandler extends
private SortedSet<Reservation> reservations = Sets.newTreeSet(); private SortedSet<Reservation> reservations = Sets.newTreeSet();
@Inject @Inject
DescribeInstancesResponseHandler(DateService dateService, @EC2 Region defaultRegion) { DescribeInstancesResponseHandler(DateService dateService, @EC2 String defaultRegion) {
super(dateService, defaultRegion); super(dateService, defaultRegion);
} }

View File

@ -40,7 +40,7 @@ import com.google.common.collect.Sets;
public class DescribeKeyPairsResponseHandler extends ParseSax.HandlerWithResult<Set<KeyPair>> { public class DescribeKeyPairsResponseHandler extends ParseSax.HandlerWithResult<Set<KeyPair>> {
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private Set<KeyPair> keyPairs = Sets.newLinkedHashSet(); private Set<KeyPair> keyPairs = Sets.newLinkedHashSet();
@ -56,7 +56,7 @@ public class DescribeKeyPairsResponseHandler extends ParseSax.HandlerWithResult<
if (qName.equals("keyFingerprint")) { if (qName.equals("keyFingerprint")) {
this.keyFingerprint = currentText.toString().trim(); this.keyFingerprint = currentText.toString().trim();
} else if (qName.equals("item")) { } else if (qName.equals("item")) {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
keyPairs.add(new KeyPair(region, keyName, keyFingerprint, null)); keyPairs.add(new KeyPair(region, keyName, keyFingerprint, null));

View File

@ -33,27 +33,22 @@ import com.google.common.collect.Maps;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DescribeRegionsResponseHandler extends ParseSax.HandlerWithResult<Map<Region, URI>> { public class DescribeRegionsResponseHandler extends ParseSax.HandlerWithResult<Map<String, URI>> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private Map<Region, URI> regionEndpoints = Maps.newHashMap(); private Map<String, URI> regionEndpoints = Maps.newHashMap();
private Region region; private String region;
private URI regionEndpoint; private URI regionEndpoint;
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
public Map<Region, URI> getResult() { public Map<String, URI> getResult() {
return regionEndpoints; return regionEndpoints;
} }
public void endElement(String uri, String name, String qName) { public void endElement(String uri, String name, String qName) {
if (qName.equals("regionName")) { if (qName.equals("regionName")) {
try { region = currentText.toString().trim();
region = Region.fromValue(currentText.toString().trim());
} catch (IllegalArgumentException e) {
logger.warn(e, "unsupported region: %s", currentText.toString().trim());
region = Region.UNKNOWN;
}
} else if (qName.equals("regionEndpoint")) { } else if (qName.equals("regionEndpoint")) {
regionEndpoint = URI.create(String.format("https://%s", currentText.toString().trim())); regionEndpoint = URI.create(String.format("https://%s", currentText.toString().trim()));
} else if (qName.equals("item")) { } else if (qName.equals("item")) {

View File

@ -45,7 +45,7 @@ public class DescribeSecurityGroupsResponseHandler extends
ParseSax.HandlerWithResult<SortedSet<SecurityGroup>> { ParseSax.HandlerWithResult<SortedSet<SecurityGroup>> {
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private SortedSet<SecurityGroup> securtyGroups = Sets.newTreeSet(); private SortedSet<SecurityGroup> securtyGroups = Sets.newTreeSet();
@ -118,7 +118,7 @@ public class DescribeSecurityGroupsResponseHandler extends
this.userId = null; this.userId = null;
this.userIdGroupName = null; this.userIdGroupName = null;
} else if (!inIpPermissions && !inIpRanges && !inGroups) { } else if (!inIpPermissions && !inIpRanges && !inGroups) {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
securtyGroups.add(new SecurityGroup(region, groupName, ownerId, groupDescription, securtyGroups.add(new SecurityGroup(region, groupName, ownerId, groupDescription,

View File

@ -51,7 +51,7 @@ public class InstanceStateChangeHandler extends HandlerWithResult<SortedSet<Inst
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
SortedSet<InstanceStateChange> instances = Sets.newTreeSet(); SortedSet<InstanceStateChange> instances = Sets.newTreeSet();
private InstanceState shutdownState; private InstanceState shutdownState;
@ -90,7 +90,7 @@ public class InstanceStateChangeHandler extends HandlerWithResult<SortedSet<Inst
previousState = InstanceState.fromValue(currentOrNull()); previousState = InstanceState.fromValue(currentOrNull());
} }
} else if (qName.equals("item")) { } else if (qName.equals("item")) {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
instances.add(new InstanceStateChange(region, instanceId, shutdownState, previousState)); instances.add(new InstanceStateChange(region, instanceId, shutdownState, previousState));

View File

@ -36,14 +36,14 @@ import org.jclouds.http.functions.ParseSax;
public class KeyPairResponseHandler extends ParseSax.HandlerWithResult<KeyPair> { public class KeyPairResponseHandler extends ParseSax.HandlerWithResult<KeyPair> {
@Inject @Inject
@EC2 @EC2
Region defaultRegion; String defaultRegion;
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private String keyFingerprint; private String keyFingerprint;
private String keyMaterial; private String keyMaterial;
private String keyName; private String keyName;
public KeyPair getResult() { public KeyPair getResult() {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
return new KeyPair(region, keyName, keyFingerprint, keyMaterial); return new KeyPair(region, keyName, keyFingerprint, keyMaterial);

View File

@ -36,7 +36,7 @@ import org.jclouds.date.DateService;
public class RunInstancesResponseHandler extends BaseReservationHandler<Reservation> { public class RunInstancesResponseHandler extends BaseReservationHandler<Reservation> {
@Inject @Inject
RunInstancesResponseHandler(DateService dateService, @EC2 Region defaultRegion) { RunInstancesResponseHandler(DateService dateService, @EC2 String defaultRegion) {
super(dateService, defaultRegion); super(dateService, defaultRegion);
} }

View File

@ -38,7 +38,7 @@ public class SnapshotHandler extends ParseSax.HandlerWithResult<Snapshot> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
protected final DateService dateService; protected final DateService dateService;
protected final Region defaultRegion; protected final String defaultRegion;
private String id; private String id;
private String volumeId; private String volumeId;
@ -51,13 +51,13 @@ public class SnapshotHandler extends ParseSax.HandlerWithResult<Snapshot> {
private String ownerAlias; private String ownerAlias;
@Inject @Inject
public SnapshotHandler(DateService dateService, @EC2 Region defaultRegion) { public SnapshotHandler(DateService dateService, @EC2 String defaultRegion) {
this.dateService = dateService; this.dateService = dateService;
this.defaultRegion = defaultRegion; this.defaultRegion = defaultRegion;
} }
public Snapshot getResult() { public Snapshot getResult() {
Region region = EC2Utils.findRegionInArgsOrNull(request); String region = EC2Utils.findRegionInArgsOrNull(request);
if (region == null) if (region == null)
region = defaultRegion; region = defaultRegion;
Snapshot snapshot = new Snapshot(region, id, volumeId, volumeSize, status, startTime, Snapshot snapshot = new Snapshot(region, id, volumeId, volumeSize, status, startTime,

View File

@ -31,7 +31,6 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.s3.binders.BindACLToXMLPayload; import org.jclouds.aws.s3.binders.BindACLToXMLPayload;
import org.jclouds.aws.s3.binders.BindBucketLoggingToXmlPayload; import org.jclouds.aws.s3.binders.BindBucketLoggingToXmlPayload;
import org.jclouds.aws.s3.binders.BindNoBucketLoggingToXmlPayload; import org.jclouds.aws.s3.binders.BindNoBucketLoggingToXmlPayload;
@ -167,7 +166,7 @@ public interface S3AsyncClient {
@ExceptionParser(ReturnFalseIfBucketAlreadyOwnedByYou.class) @ExceptionParser(ReturnFalseIfBucketAlreadyOwnedByYou.class)
ListenableFuture<Boolean> putBucketInRegion( ListenableFuture<Boolean> putBucketInRegion(
// TODO endpoint based on region // TODO endpoint based on region
@BinderParam(BindRegionToXmlPayload.class) @Nullable Region region, @BinderParam(BindRegionToXmlPayload.class) @Nullable String region,
@HostPrefixParam String bucketName, PutBucketOptions... options); @HostPrefixParam String bucketName, PutBucketOptions... options);
/** /**
@ -194,7 +193,7 @@ public interface S3AsyncClient {
@QueryParams(keys = "location") @QueryParams(keys = "location")
@Path("/") @Path("/")
@XMLResponseParser(LocationConstraintHandler.class) @XMLResponseParser(LocationConstraintHandler.class)
ListenableFuture<Region> getBucketLocation(@HostPrefixParam String bucketName); ListenableFuture<String> getBucketLocation(@HostPrefixParam String bucketName);
/** /**
* @see S3Client#getBucketPayer * @see S3Client#getBucketPayer

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.s3.domain.AccessControlList; import org.jclouds.aws.s3.domain.AccessControlList;
import org.jclouds.aws.s3.domain.BucketLogging; import org.jclouds.aws.s3.domain.BucketLogging;
import org.jclouds.aws.s3.domain.BucketMetadata; import org.jclouds.aws.s3.domain.BucketMetadata;
@ -196,7 +195,7 @@ public interface S3Client {
* *
*/ */
@Timeout(duration = 90, timeUnit = TimeUnit.SECONDS) @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. * Deletes the bucket, if it is empty.
@ -359,7 +358,7 @@ public interface S3Client {
* "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTBucketLocationGET.html" * "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 * A GET request operation on a requestPayment resource returns the request payment configuration

View File

@ -137,14 +137,14 @@ public class S3AsyncBlobStore extends BaseAsyncBlobStore {
* This implementation invokes {@link S3AsyncClient#putBucketInRegion} * This implementation invokes {@link S3AsyncClient#putBucketInRegion}
* *
* @param location * @param location
* corresponds to {@link Region#fromValue} * corresponds to {@link Region}
* @param container * @param container
* bucket name * bucket name
*/ */
@Override @Override
public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) { public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) {
location = location != null ? location : defaultLocation; location = location != null ? location : defaultLocation;
return async.putBucketInRegion(Region.fromValue(location.getId()), container); return async.putBucketInRegion(location.getId(), container);
} }
/** /**

View File

@ -132,7 +132,7 @@ public class S3BlobStore extends BaseBlobStore {
@Override @Override
public boolean createContainerInLocation(Location location, String container) { public boolean createContainerInLocation(Location location, String container) {
location = location != null ? location : defaultLocation; location = location != null ? location : defaultLocation;
return sync.putBucketInRegion(Region.fromValue(location.getId()), container); return sync.putBucketInRegion(location.getId(), container);
} }
/** /**

View File

@ -68,15 +68,15 @@ public class S3BlobStoreContextModule extends S3ContextModule {
@Provides @Provides
@Singleton @Singleton
Location getDefaultLocation(@S3 Region region, Map<String, ? extends Location> locations) { Location getDefaultLocation(@S3 String region, Map<String, ? extends Location> locations) {
return locations.get(region.toString()); return locations.get(region.toString());
} }
@Provides @Provides
@Singleton @Singleton
Map<String, ? extends Location> provideLocations(@S3 Set<Region> regions) { Map<String, ? extends Location> provideLocations(@S3 Set<String> regions) {
Set<Location> locations = Sets.newHashSet(); Set<Location> locations = Sets.newHashSet();
for (Region zone : regions) { for (String zone : regions) {
locations locations
.add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), null)); .add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), null));
} }

View File

@ -59,7 +59,7 @@ public class BucketToResourceMetadata implements Function<BucketMetadata, Storag
to.setName(from.getName()); to.setName(from.getName());
to.setType(StorageType.CONTAINER); to.setType(StorageType.CONTAINER);
try { try {
Region region = client.getBucketLocation(from.getName()); String region = client.getBucketLocation(from.getName());
if (region != null) { if (region != null) {
Location location = locations.get(region.toString()); Location location = locations.get(region.toString());
if (location == null) if (location == null)

View File

@ -102,18 +102,18 @@ public class S3RestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@S3 @S3
Map<Region, URI> provideRegions( Map<String, URI> provideRegions(
@Named(S3Constants.PROPERTY_S3_ENDPOINT_US_STANDARD) String usstandard, @Named(S3Constants.PROPERTY_S3_ENDPOINT_US_STANDARD) String usstandard,
@Named(S3Constants.PROPERTY_S3_ENDPOINT_US_WEST_1) String uswest, @Named(S3Constants.PROPERTY_S3_ENDPOINT_US_WEST_1) String uswest,
@Named(S3Constants.PROPERTY_S3_ENDPOINT_EU_WEST_1) String euwest) { @Named(S3Constants.PROPERTY_S3_ENDPOINT_EU_WEST_1) String euwest) {
return ImmutableMap.<Region, URI> of(Region.US_STANDARD, URI.create(usstandard), return ImmutableMap.<String, URI> of(Region.US_STANDARD, URI.create(usstandard),
Region.US_WEST_1, URI.create(uswest), Region.EU_WEST_1, URI.create(euwest)); Region.US_WEST_1, URI.create(uswest), Region.EU_WEST_1, URI.create(euwest));
} }
@Provides @Provides
@Singleton @Singleton
@S3 @S3
Set<Region> provideRegions(@S3 Map<Region, URI> map) { Set<String> provideRegions(@S3 Map<String, URI> map) {
return map.keySet(); return map.keySet();
} }
@ -127,8 +127,8 @@ public class S3RestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@S3 @S3
Region getDefaultRegion(@S3 URI uri, @S3 Map<Region, URI> map) { String getDefaultRegion(@S3 URI uri, @S3 Map<String, URI> map) {
return ImmutableBiMap.<Region, URI> builder().putAll(map).build().inverse().get(uri); return ImmutableBiMap.<String, URI> builder().putAll(map).build().inverse().get(uri);
} }
@Provides @Provides

View File

@ -40,31 +40,25 @@ import org.jclouds.rest.binders.BindToStringPayload;
@Singleton @Singleton
public class BindRegionToXmlPayload extends BindToStringPayload { public class BindRegionToXmlPayload extends BindToStringPayload {
private final Region defaultRegion; private final String defaultRegion;
@Inject @Inject
BindRegionToXmlPayload(@S3 Region defaultRegion) { BindRegionToXmlPayload(@S3 String defaultRegion) {
this.defaultRegion = defaultRegion; this.defaultRegion = defaultRegion;
} }
@Override @Override
public void bindToRequest(HttpRequest request, Object input) { public void bindToRequest(HttpRequest request, Object input) {
input = input == null ? defaultRegion : input; input = input == null ? defaultRegion : input;
checkArgument(input instanceof Region, "this binder is only valid for Region!"); checkArgument(input instanceof String, "this binder is only valid for Region!");
Region constraint = (Region) input; String constraint = (String) input;
String value = null; String value = null;
switch (constraint) { if(Region.US_STANDARD.equals(constraint) || Region.US_EAST_1.equals(constraint)) {
case US_STANDARD: // nothing to bind as this is default.
case US_EAST_1: return;
// nothing to bind as this is default. } else if(Region.EU_WEST_1.equals(constraint)) value = "EU";
return; else if(Region.US_WEST_1.equals(constraint)) value = "us-west-1";
case EU_WEST_1: else {
value = "EU";
break;
case US_WEST_1:
value = "us-west-1";
break;
default:
throw new IllegalStateException("unimplemented location: " + this); throw new IllegalStateException("unimplemented location: " + this);
} }
String payload = String String payload = String

View File

@ -29,11 +29,11 @@ import org.jclouds.http.functions.ParseSax;
* @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/RESTBucketLocationGET.html" /> * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/RESTBucketLocationGET.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class LocationConstraintHandler extends ParseSax.HandlerWithResult<Region> { public class LocationConstraintHandler extends ParseSax.HandlerWithResult<String> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private Region region; private String region;
public Region getResult() { public String getResult() {
return region; return region;
} }
@ -46,7 +46,7 @@ public class LocationConstraintHandler extends ParseSax.HandlerWithResult<Region
* <p/> * <p/>
* {@code US_STANDARD} is returned as "" xml documents. * {@code US_STANDARD} is returned as "" xml documents.
*/ */
public static Region fromValue(String v) { public static String fromValue(String v) {
if (v.equals("")) if (v.equals(""))
return Region.US_STANDARD; return Region.US_STANDARD;
if (v.equals("EU")) if (v.equals("EU"))

View File

@ -65,7 +65,7 @@ public interface SQSAsyncClient {
@FormParams(keys = ACTION, values = "ListQueues") @FormParams(keys = ACTION, values = "ListQueues")
@ResponseParser(RegexListQueuesResponseHandler.class) @ResponseParser(RegexListQueuesResponseHandler.class)
ListenableFuture<? extends Set<Queue>> listQueuesInRegion( ListenableFuture<? extends Set<Queue>> listQueuesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
ListQueuesOptions... options); ListQueuesOptions... options);
/** /**
@ -76,7 +76,7 @@ public interface SQSAsyncClient {
@FormParams(keys = ACTION, values = "CreateQueue") @FormParams(keys = ACTION, values = "CreateQueue")
@ResponseParser(RegexQueueHandler.class) @ResponseParser(RegexQueueHandler.class)
ListenableFuture<Queue> createQueueInRegion( ListenableFuture<Queue> createQueueInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable Region region, @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("QueueName") String queueName, CreateQueueOptions... options); @FormParam("QueueName") String queueName, CreateQueueOptions... options);
/** /**

View File

@ -51,7 +51,7 @@ public interface SQSClient {
* @see <a href="http://docs.amazonwebservices.com/AWSSimpleQueueService/2009-02-01/APIReference/Query_QueryListQueues.html" * @see <a href="http://docs.amazonwebservices.com/AWSSimpleQueueService/2009-02-01/APIReference/Query_QueryListQueues.html"
* /> * />
*/ */
Set<Queue> listQueuesInRegion(@Nullable Region region, ListQueuesOptions... options); Set<Queue> listQueuesInRegion(@Nullable String region, ListQueuesOptions... options);
/** /**
* *
@ -81,7 +81,7 @@ public interface SQSClient {
* @param options * @param options
* like the visibility timeout (in seconds) to use for this queue. * 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 * The DeleteQueue action deletes the queue specified by the queue URL, regardless of whether the

View File

@ -91,11 +91,11 @@ public class SQSRestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@SQS @SQS
Map<Region, URI> provideRegions( Map<String, URI> provideRegions(
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_US_EAST_1) String useast, @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_US_WEST_1) String uswest,
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1) String euwest) { @Named(SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1) String euwest) {
return ImmutableMap.<Region, URI> of(Region.US_EAST_1, URI.create(useast), Region.US_WEST_1, return ImmutableMap.<String, URI> of(Region.US_EAST_1, URI.create(useast), Region.US_WEST_1,
URI.create(uswest), Region.EU_WEST_1, URI.create(euwest)); URI.create(uswest), Region.EU_WEST_1, URI.create(euwest));
} }
@ -109,8 +109,8 @@ public class SQSRestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
@SQS @SQS
Region getDefaultRegion(@SQS URI uri, @SQS Map<Region, URI> map) { String getDefaultRegion(@SQS URI uri, @SQS Map<String, URI> map) {
return ImmutableBiMap.<Region, URI> builder().putAll(map).build().inverse().get(uri); return ImmutableBiMap.<String, URI> builder().putAll(map).build().inverse().get(uri);
} }
@Provides @Provides

View File

@ -31,11 +31,11 @@ import org.jclouds.aws.domain.Region;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Queue implements Comparable<Queue> { public class Queue implements Comparable<Queue> {
private final Region region; private final String region;
private final String name; private final String name;
private final URI location; 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.region = checkNotNull(region,"region");
this.location = checkNotNull(location, "location"); this.location = checkNotNull(location, "location");
this.name = checkNotNull(name, "name"); this.name = checkNotNull(name, "name");
@ -46,7 +46,7 @@ public class Queue implements Comparable<Queue> {
return location.toASCIIString().compareTo(o.location.toASCIIString()); return location.toASCIIString().compareTo(o.location.toASCIIString());
} }
public Region getRegion() { public String getRegion() {
return region; return region;
} }

View File

@ -35,11 +35,11 @@ import com.google.common.base.Function;
*/ */
@Singleton @Singleton
public class RegionToEndpoint implements Function<Object, URI> { public class RegionToEndpoint implements Function<Object, URI> {
private final Map<Region, URI> regionToEndpoint; private final Map<String, URI> regionToEndpoint;
private final URI defaultUri; private final URI defaultUri;
@Inject @Inject
public RegionToEndpoint(@SQS Map<Region, URI> regionToEndpoint, @SQS URI defaultUri) { public RegionToEndpoint(@SQS Map<String, URI> regionToEndpoint, @SQS URI defaultUri) {
this.regionToEndpoint = regionToEndpoint; this.regionToEndpoint = regionToEndpoint;
this.defaultUri = defaultUri; this.defaultUri = defaultUri;
} }

View File

@ -43,13 +43,13 @@ public class QueueHandler extends ParseSax.HandlerWithResult<Queue> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
Queue queue; Queue queue;
private final ImmutableBiMap<Region, URI> regionBiMap; private final ImmutableBiMap<String, URI> regionBiMap;
private final Provider<UriBuilder> uriBuilderProvider; private final Provider<UriBuilder> uriBuilderProvider;
@Inject @Inject
QueueHandler(Provider<UriBuilder> uriBuilderProvider, @SQS Map<Region, URI> regionMap) { QueueHandler(Provider<UriBuilder> uriBuilderProvider, @SQS Map<String, URI> regionMap) {
this.uriBuilderProvider = uriBuilderProvider; this.uriBuilderProvider = uriBuilderProvider;
this.regionBiMap = ImmutableBiMap.<Region, URI> builder().putAll(regionMap).build(); this.regionBiMap = ImmutableBiMap.<String, URI> builder().putAll(regionMap).build();
} }
public Queue getResult() { public Queue getResult() {
@ -63,7 +63,7 @@ public class QueueHandler extends ParseSax.HandlerWithResult<Queue> {
String queueName = uriText.substring(uriText.lastIndexOf('/') + 1); String queueName = uriText.substring(uriText.lastIndexOf('/') + 1);
URI location = URI.create(uriText); URI location = URI.create(uriText);
URI regionURI = uriBuilderProvider.get().uri(location).replacePath("").build(); 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); this.queue = new Queue(region, queueName, location);
} }
currentText = new StringBuilder(); currentText = new StringBuilder();

View File

@ -46,7 +46,7 @@ import com.google.common.base.Throwables;
public class RegexListQueuesResponseHandler extends BaseRegexQueueHandler implements public class RegexListQueuesResponseHandler extends BaseRegexQueueHandler implements
Function<HttpResponse, Set<Queue>> { Function<HttpResponse, Set<Queue>> {
@Inject @Inject
RegexListQueuesResponseHandler(@SQS Map<Region, URI> regionMap) { RegexListQueuesResponseHandler(@SQS Map<String, URI> regionMap) {
super(regionMap); super(regionMap);
} }

View File

@ -46,7 +46,7 @@ import com.google.inject.internal.Iterables;
public class RegexQueueHandler extends BaseRegexQueueHandler implements public class RegexQueueHandler extends BaseRegexQueueHandler implements
Function<HttpResponse, Queue> { Function<HttpResponse, Queue> {
@Inject @Inject
RegexQueueHandler(@SQS Map<Region, URI> regionMap) { RegexQueueHandler(@SQS Map<String, URI> regionMap) {
super(regionMap); super(regionMap);
} }

View File

@ -41,12 +41,12 @@ import com.google.common.collect.Sets;
*/ */
@Singleton @Singleton
public class BaseRegexQueueHandler { public class BaseRegexQueueHandler {
private final ImmutableBiMap<URI, Region> uriToRegion; private final ImmutableBiMap<URI, String> uriToRegion;
Pattern pattern = Pattern.compile("<QueueUrl>(https://[\\S&&[^<]]+)</QueueUrl>"); Pattern pattern = Pattern.compile("<QueueUrl>(https://[\\S&&[^<]]+)</QueueUrl>");
@Inject @Inject
protected BaseRegexQueueHandler(Map<Region, URI> regionMap) { protected BaseRegexQueueHandler(Map<String, URI> regionMap) {
this.uriToRegion = ImmutableBiMap.<Region, URI> builder().putAll(regionMap).build().inverse(); this.uriToRegion = ImmutableBiMap.<String, URI> builder().putAll(regionMap).build().inverse();
} }
public Set<Queue> parse(String in) { public Set<Queue> parse(String in) {
@ -58,7 +58,7 @@ public class BaseRegexQueueHandler {
URI location = URI.create(uriText); URI location = URI.create(uriText);
String regionString = uriText.substring(0, uriText.indexOf(".com/") + 4); String regionString = uriText.substring(0, uriText.indexOf(".com/") + 4);
URI regionURI = URI.create(regionString); URI regionURI = URI.create(regionString);
Region region = uriToRegion.get(regionURI); String region = uriToRegion.get(regionURI);
queues.add(new Queue(region, queueName, location)); queues.add(new Queue(region, queueName, location));
} }
return queues; return queues;

View File

@ -24,7 +24,6 @@ import java.io.IOException;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.options.CreateImageOptions; import org.jclouds.aws.ec2.options.CreateImageOptions;
import org.jclouds.aws.ec2.options.DescribeImagesOptions; import org.jclouds.aws.ec2.options.DescribeImagesOptions;
import org.jclouds.aws.ec2.options.RegisterImageBackedByEbsOptions; import org.jclouds.aws.ec2.options.RegisterImageBackedByEbsOptions;
@ -52,7 +51,7 @@ import com.google.inject.TypeLiteral;
public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> { public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException { 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) String.class, String.class, Array.newInstance(CreateImageOptions.class, 0)
.getClass()); .getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
@ -72,7 +71,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, public void testCreateImageOptions() throws SecurityException, NoSuchMethodException,
IOException { 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) String.class, String.class, Array.newInstance(CreateImageOptions.class, 0)
.getClass()); .getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
@ -94,10 +93,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
} }
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException { 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()); .newInstance(DescribeImagesOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method,
(Region) null); (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -117,7 +116,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", Region.class, Array Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array
.newInstance(DescribeImagesOptions.class, 0).getClass()); .newInstance(DescribeImagesOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
executableBy("me").ownedBy("fred", "nancy").imageIds("1", "2")); executableBy("me").ownedBy("fred", "nancy").imageIds("1", "2"));
@ -137,7 +136,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
} }
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException { 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); String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageId"); "imageId");
@ -157,7 +156,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", 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()); RegisterImageOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"name", "pathToManifest"); "name", "pathToManifest");
@ -177,7 +176,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRegisterImageFromManifestOptions() throws SecurityException, public void testRegisterImageFromManifestOptions() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", 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()); RegisterImageOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"name", "pathToManifest", new RegisterImageOptions().withDescription("description")); "name", "pathToManifest", new RegisterImageOptions().withDescription("description"));
@ -199,7 +198,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", 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()); RegisterImageBackedByEbsOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageName", "snapshotId"); "imageName", "snapshotId");
@ -220,7 +219,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRegisterImageBackedByEBSOptions() throws SecurityException, public void testRegisterImageBackedByEBSOptions() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", 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()); RegisterImageBackedByEbsOptions.class, 0).getClass());
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageName", "snapshotId", new RegisterImageBackedByEbsOptions().withDescription( "imageName", "snapshotId", new RegisterImageBackedByEbsOptions().withDescription(
@ -244,7 +243,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException, public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("getProductCodesForImageInRegion", Method method = AMIAsyncClient.class.getMethod("getProductCodesForImageInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageId"); "imageId");
@ -264,7 +263,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testGetBlockDeviceMappingsForImage() throws SecurityException, public void testGetBlockDeviceMappingsForImage() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", Method method = AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageId"); "imageId");
@ -284,7 +283,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", Method method = AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageId"); "imageId");
@ -304,7 +303,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", Method method = AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion",
Region.class, Iterable.class, Iterable.class, String.class); String.class, Iterable.class, Iterable.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId"); ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId");
@ -329,7 +328,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, public void testRemoveLaunchPermissionsFromImage() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", Method method = AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion",
Region.class, Iterable.class, Iterable.class, String.class); String.class, Iterable.class, Iterable.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId"); ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "imageId");
@ -349,7 +348,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", Method method = AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
"imageId"); "imageId");
@ -368,7 +367,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException, public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("addProductCodesToImageInRegion", Method method = AMIAsyncClient.class.getMethod("addProductCodesToImageInRegion",
Region.class, Iterable.class, String.class); String.class, Iterable.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
ImmutableList.of("code1", "code2"), "imageId"); ImmutableList.of("code1", "code2"), "imageId");
@ -389,7 +388,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
public void testRemoveProductCodesFromImage() throws SecurityException, NoSuchMethodException, public void testRemoveProductCodesFromImage() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AMIAsyncClient.class.getMethod("removeProductCodesFromImageInRegion", Method method = AMIAsyncClient.class.getMethod("removeProductCodesFromImageInRegion",
Region.class, Iterable.class, String.class); String.class, Iterable.class, String.class);
GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<AMIAsyncClient> httpMethod = processor.createRequest(method, null,
ImmutableList.of("code1", "code2"), "imageId"); ImmutableList.of("code1", "code2"), "imageId");

View File

@ -75,7 +75,7 @@ public class AMIClientLiveTest {
} }
public void testDescribeImages() { 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)) { Region.US_WEST_1)) {
SortedSet<Image> allResults = Sets.newTreeSet(client.describeImagesInRegion(region)); SortedSet<Image> allResults = Sets.newTreeSet(client.describeImagesInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);

View File

@ -50,7 +50,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod( Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod(
"describeAvailabilityZonesInRegion", Region.class, Array.newInstance( "describeAvailabilityZonesInRegion", String.class, Array.newInstance(
DescribeAvailabilityZonesOptions.class, 0).getClass()); DescribeAvailabilityZonesOptions.class, 0).getClass());
GeneratedHttpRequest<AvailabilityZoneAndRegionAsyncClient> httpMethod = processor GeneratedHttpRequest<AvailabilityZoneAndRegionAsyncClient> httpMethod = processor
.createRequest(method, Region.US_WEST_1); .createRequest(method, Region.US_WEST_1);
@ -71,7 +71,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
public void testDescribeAvailabilityZonesOptions() throws SecurityException, public void testDescribeAvailabilityZonesOptions() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod( Method method = AvailabilityZoneAndRegionAsyncClient.class.getMethod(
"describeAvailabilityZonesInRegion", Region.class, Array.newInstance( "describeAvailabilityZonesInRegion", String.class, Array.newInstance(
DescribeAvailabilityZonesOptions.class, 0).getClass()); DescribeAvailabilityZonesOptions.class, 0).getClass());
GeneratedHttpRequest<AvailabilityZoneAndRegionAsyncClient> httpMethod = processor GeneratedHttpRequest<AvailabilityZoneAndRegionAsyncClient> httpMethod = processor
.createRequest(method, Region.US_EAST_1, availabilityZones( .createRequest(method, Region.US_EAST_1, availabilityZones(

View File

@ -68,7 +68,7 @@ public class AvailabilityZoneAndRegionClientLiveTest {
} }
public void testDescribeAvailabilityZones() { 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)) { Region.US_WEST_1)) {
SortedSet<AvailabilityZoneInfo> allResults = Sets.newTreeSet(client SortedSet<AvailabilityZoneInfo> allResults = Sets.newTreeSet(client
.describeAvailabilityZonesInRegion(region)); .describeAvailabilityZonesInRegion(region));
@ -88,14 +88,14 @@ public class AvailabilityZoneAndRegionClientLiveTest {
} }
public void testDescribeRegions() { public void testDescribeRegions() {
SortedMap<Region, URI> allResults = Maps.newTreeMap(); SortedMap<String, URI> allResults = Maps.newTreeMap();
allResults.putAll(client.describeRegions()); allResults.putAll(client.describeRegions());
assertNotNull(allResults); assertNotNull(allResults);
assert allResults.size() >= 2 : allResults.size(); assert allResults.size() >= 2 : allResults.size();
Iterator<Entry<Region, URI>> iterator = allResults.entrySet().iterator(); Iterator<Entry<String, URI>> iterator = allResults.entrySet().iterator();
Region r1 = iterator.next().getKey(); String r1 = iterator.next().getKey();
Region r2 = iterator.next().getKey(); String r2 = iterator.next().getKey();
SortedMap<Region, URI> twoResults = Maps.newTreeMap(); SortedMap<String, URI> twoResults = Maps.newTreeMap();
twoResults.putAll(client.describeRegions(regions(r1, r2))); twoResults.putAll(client.describeRegions(regions(r1, r2)));
assertNotNull(twoResults); assertNotNull(twoResults);
assertEquals(twoResults.size(), 2); assertEquals(twoResults.size(), 2);

View File

@ -79,7 +79,7 @@ public abstract class BaseEC2AsyncClientTest<T> extends RestClientTest<T> {
.build(), "properties")); .build(), "properties"));
bind(URI.class).annotatedWith(EC2.class).toInstance( bind(URI.class).annotatedWith(EC2.class).toInstance(
URI.create("https://ec2.amazonaws.com")); 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() { bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
public Logger getLogger(String category) { public Logger getLogger(String category) {
return Logger.NULL; return Logger.NULL;
@ -98,8 +98,8 @@ public abstract class BaseEC2AsyncClientTest<T> extends RestClientTest<T> {
@Singleton @Singleton
@Provides @Provides
@EC2 @EC2
Map<Region, URI> provideMap() { Map<String, URI> provideMap() {
return ImmutableMap.<Region, URI> of(Region.EU_WEST_1, URI return ImmutableMap.<String, URI> of(Region.EU_WEST_1, URI
.create("https://ec2.eu-west-1.amazonaws.com"), Region.US_EAST_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-east-1.amazonaws.com"), Region.US_WEST_1, URI
.create("https://ec2.us-west-1.amazonaws.com")); .create("https://ec2.us-west-1.amazonaws.com"));
@ -108,8 +108,8 @@ public abstract class BaseEC2AsyncClientTest<T> extends RestClientTest<T> {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Singleton @Singleton
@Provides @Provides
Map<AvailabilityZone, Region> provideAvailabilityZoneRegionMap() { Map<AvailabilityZone, String> provideAvailabilityZoneRegionMap() {
return ImmutableMap.<AvailabilityZone, Region> of(AvailabilityZone.US_EAST_1A, return ImmutableMap.<AvailabilityZone, String> of(AvailabilityZone.US_EAST_1A,
Region.US_EAST_1); Region.US_EAST_1);
} }
}; };

View File

@ -117,7 +117,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException { public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("deleteVolumeInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("deleteVolumeInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "id"); method, null, "id");
@ -135,9 +135,9 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException { public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, (Region) null); method, (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -154,7 +154,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException, public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "1", "2"); method, null, "1", "2");
@ -173,7 +173,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException { public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion",
Region.class, String.class, String.class, String.class); String.class, String.class, String.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "id", "instanceId", "/device"); method, null, "id", "instanceId", "/device");
@ -192,7 +192,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException { public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", 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()); DetachVolumeOptions.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "id", false); method, null, "id", false);
@ -213,7 +213,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", 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()); DetachVolumeOptions.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "id", true, fromInstance("instanceId").fromDevice("/device")); method, null, "id", true, fromInstance("instanceId").fromDevice("/device"));
@ -234,7 +234,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException { public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", 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()); .getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "volumeId"); method, null, "volumeId");
@ -254,7 +254,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException, public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", 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()); .getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "volumeId", CreateSnapshotOptions.Builder method, null, "volumeId", CreateSnapshotOptions.Builder
@ -275,9 +275,9 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException { public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion",
Region.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); String.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, (Region) null); method, (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -294,7 +294,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException, public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion",
Region.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass()); String.class, Array.newInstance(DescribeSnapshotsOptions.class, 0).getClass());
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, ownedBy("o1", "o2").restorableBy("r1", "r2").snapshotIds("s1", "s2")); method, null, ownedBy("o1", "o2").restorableBy("r1", "r2").snapshotIds("s1", "s2"));
@ -315,7 +315,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testGetCreateVolumePermissionForSnapshot() throws SecurityException, public void testGetCreateVolumePermissionForSnapshot() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod( Method method = ElasticBlockStoreAsyncClient.class.getMethod(
"getCreateVolumePermissionForSnapshotInRegion", Region.class, String.class); "getCreateVolumePermissionForSnapshotInRegion", String.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "snapshotId"); method, null, "snapshotId");
@ -336,7 +336,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod( Method method = ElasticBlockStoreAsyncClient.class.getMethod(
"addCreateVolumePermissionsToSnapshotInRegion", Region.class, Iterable.class, "addCreateVolumePermissionsToSnapshotInRegion", String.class, Iterable.class,
Iterable.class, String.class); Iterable.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId"); method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId");
@ -358,7 +358,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod( Method method = ElasticBlockStoreAsyncClient.class.getMethod(
"removeCreateVolumePermissionsFromSnapshotInRegion", Region.class, Iterable.class, "removeCreateVolumePermissionsFromSnapshotInRegion", String.class, Iterable.class,
Iterable.class, String.class); Iterable.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId"); method, null, ImmutableList.of("bob", "sue"), ImmutableList.of("all"), "snapshotId");
@ -379,7 +379,7 @@ public class ElasticBlockStoreAsyncClientTest extends
public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException, public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = ElasticBlockStoreAsyncClient.class.getMethod( Method method = ElasticBlockStoreAsyncClient.class.getMethod(
"resetCreateVolumePermissionsOnSnapshotInRegion", Region.class, String.class); "resetCreateVolumePermissionsOnSnapshotInRegion", String.class, String.class);
GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticBlockStoreAsyncClient> httpMethod = processor.createRequest(
method, null, "snapshotId"); method, null, "snapshotId");

View File

@ -72,7 +72,7 @@ public class ElasticBlockStoreClientLiveTest {
@Test @Test
void testDescribeVolumes() { 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)) { Region.US_WEST_1)) {
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region)); SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
@ -171,7 +171,7 @@ public class ElasticBlockStoreClientLiveTest {
@Test @Test
void testDescribeSnapshots() { 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)) { Region.US_WEST_1)) {
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region)); SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);

View File

@ -23,7 +23,6 @@ import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.InetAddress; import java.net.InetAddress;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.xml.AllocateAddressResponseHandler; import org.jclouds.aws.ec2.xml.AllocateAddressResponseHandler;
import org.jclouds.aws.ec2.xml.DescribeAddressesResponseHandler; import org.jclouds.aws.ec2.xml.DescribeAddressesResponseHandler;
import org.jclouds.http.functions.CloseContentAndReturn; import org.jclouds.http.functions.CloseContentAndReturn;
@ -46,7 +45,7 @@ public class ElasticIPAddressAsyncClientTest extends
public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, public void testDisassociateAddress() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = ElasticIPAddressAsyncClient.class.getMethod("disassociateAddressInRegion", Method method = ElasticIPAddressAsyncClient.class.getMethod("disassociateAddressInRegion",
Region.class, InetAddress.class); String.class, InetAddress.class);
GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest(
method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); 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 { public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", Method method = ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion",
Region.class, InetAddress.class, String.class); String.class, InetAddress.class, String.class);
GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest(
method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }), "me"); 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 { public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticIPAddressAsyncClient.class.getMethod("releaseAddressInRegion", Method method = ElasticIPAddressAsyncClient.class.getMethod("releaseAddressInRegion",
Region.class, InetAddress.class); String.class, InetAddress.class);
GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest(
method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); 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 { public void testDescribeAddresses() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticIPAddressAsyncClient.class.getMethod("describeAddressesInRegion", Method method = ElasticIPAddressAsyncClient.class.getMethod("describeAddressesInRegion",
Region.class, Array.newInstance(InetAddress.class, 0).getClass()); String.class, Array.newInstance(InetAddress.class, 0).getClass());
GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest(
method, null, InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 })); 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 { public void testAllocateAddress() throws SecurityException, NoSuchMethodException, IOException {
Method method = ElasticIPAddressAsyncClient.class.getMethod("allocateAddressInRegion", Method method = ElasticIPAddressAsyncClient.class.getMethod("allocateAddressInRegion",
Region.class); String.class);
GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest( GeneratedHttpRequest<ElasticIPAddressAsyncClient> httpMethod = processor.createRequest(
method, (Region) null); method, (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,

View File

@ -61,7 +61,7 @@ public class ElasticIPAddressClientLiveTest {
@Test @Test
void testDescribeAddresses() { 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)) { Region.US_WEST_1)) {
SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client
.describeAddressesInRegion(region)); .describeAddressesInRegion(region));

View File

@ -55,9 +55,9 @@ import com.google.inject.TypeLiteral;
public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyncClient> { public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyncClient> {
public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException { public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("describeInstancesInRegion", Method method = InstanceAsyncClient.class.getMethod("describeInstancesInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method,
(Region) null); (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -74,7 +74,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException, public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("describeInstancesInRegion", Method method = InstanceAsyncClient.class.getMethod("describeInstancesInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "2"); "1", "2");
@ -94,7 +94,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testTerminateInstances() throws SecurityException, NoSuchMethodException, public void testTerminateInstances() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("terminateInstancesInRegion", Method method = InstanceAsyncClient.class.getMethod("terminateInstancesInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "2"); "1", "2");
@ -112,7 +112,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
} }
public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException { public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("runInstancesInRegion", Region.class, Method method = InstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class,
AvailabilityZone.class, String.class, int.class, int.class, Array.newInstance( AvailabilityZone.class, String.class, int.class, int.class, Array.newInstance(
RunInstancesOptions.class, 0).getClass()); RunInstancesOptions.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
@ -133,7 +133,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException, public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("runInstancesInRegion", Region.class, Method method = InstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class,
AvailabilityZone.class, String.class, int.class, int.class, Array.newInstance( AvailabilityZone.class, String.class, int.class, int.class, Array.newInstance(
RunInstancesOptions.class, 0).getClass()); RunInstancesOptions.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method,
@ -157,7 +157,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
} }
public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException { public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("stopInstancesInRegion", Region.class, Method method = InstanceAsyncClient.class.getMethod("stopInstancesInRegion", String.class,
boolean.class, Array.newInstance(String.class, 0).getClass()); boolean.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
true, "1", "2"); true, "1", "2");
@ -176,7 +176,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
} }
public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException { public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("rebootInstancesInRegion", Region.class, Method method = InstanceAsyncClient.class.getMethod("rebootInstancesInRegion", String.class,
Array.newInstance(String.class, 0).getClass()); Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "2"); "1", "2");
@ -195,7 +195,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
} }
public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException { public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("startInstancesInRegion", Region.class, Method method = InstanceAsyncClient.class.getMethod("startInstancesInRegion", String.class,
Array.newInstance(String.class, 0).getClass()); Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "2"); "1", "2");
@ -216,7 +216,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetUserDataForInstanceInRegion() throws SecurityException, public void testGetUserDataForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("getUserDataForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("getUserDataForInstanceInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -236,7 +236,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException, public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("getRootDeviceNameForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("getRootDeviceNameForInstanceInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -256,7 +256,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("getRamdiskForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("getRamdiskForInstanceInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -276,7 +276,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetDisableApiTerminationForInstanceInRegion() throws SecurityException, public void testGetDisableApiTerminationForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"isApiTerminationDisabledForInstanceInRegion", Region.class, String.class); "isApiTerminationDisabledForInstanceInRegion", String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -296,7 +296,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("getKernelForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("getKernelForInstanceInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -316,7 +316,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetInstanceTypeForInstanceInRegion() throws SecurityException, public void testGetInstanceTypeForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("getInstanceTypeForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("getInstanceTypeForInstanceInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -336,7 +336,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetInstanceInitiatedShutdownBehaviorForInstanceInRegion() public void testGetInstanceInitiatedShutdownBehaviorForInstanceInRegion()
throws SecurityException, NoSuchMethodException, IOException { throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"getInstanceInitiatedShutdownBehaviorForInstanceInRegion", Region.class, "getInstanceInitiatedShutdownBehaviorForInstanceInRegion", String.class,
String.class); String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -358,7 +358,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testGetBlockDeviceMappingForInstanceInRegion() throws SecurityException, public void testGetBlockDeviceMappingForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"getBlockDeviceMappingForInstanceInRegion", Region.class, String.class); "getBlockDeviceMappingForInstanceInRegion", String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1"); "1");
@ -378,7 +378,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetUserDataForInstanceInRegion() throws SecurityException, public void testSetUserDataForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion",
Region.class, String.class, Array.newInstance(byte.class, 0).getClass()); String.class, String.class, Array.newInstance(byte.class, 0).getClass());
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "test".getBytes()); "1", "test".getBytes());
@ -403,7 +403,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion",
Region.class, String.class, String.class); String.class, String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "test"); "1", "test");
@ -422,7 +422,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion",
Region.class, String.class, String.class); String.class, String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "test"); "1", "test");
@ -441,7 +441,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"setApiTerminationDisabledForInstanceInRegion", Region.class, String.class, "setApiTerminationDisabledForInstanceInRegion", String.class, String.class,
boolean.class); boolean.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", true); "1", true);
@ -463,7 +463,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, public void testSetInstanceTypeForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", Method method = InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion",
Region.class, String.class, String.class); String.class, String.class, String.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", InstanceType.C1_MEDIUM); "1", InstanceType.C1_MEDIUM);
@ -484,7 +484,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion()
throws SecurityException, NoSuchMethodException, IOException { throws SecurityException, NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"setInstanceInitiatedShutdownBehaviorForInstanceInRegion", Region.class, "setInstanceInitiatedShutdownBehaviorForInstanceInRegion", String.class,
String.class, InstanceInitiatedShutdownBehavior.class); String.class, InstanceInitiatedShutdownBehavior.class);
GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<InstanceAsyncClient> httpMethod = processor.createRequest(method, null,
"1", InstanceInitiatedShutdownBehavior.TERMINATE); "1", InstanceInitiatedShutdownBehavior.TERMINATE);
@ -506,7 +506,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = InstanceAsyncClient.class.getMethod( Method method = InstanceAsyncClient.class.getMethod(
"setBlockDeviceMappingForInstanceInRegion", Region.class, String.class, "setBlockDeviceMappingForInstanceInRegion", String.class, String.class,
BlockDeviceMapping.class); BlockDeviceMapping.class);
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping(); BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();

View File

@ -61,7 +61,7 @@ public class InstanceClientLiveTest {
@Test @Test
void testDescribeInstances() { void testDescribeInstances() {
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)) { Region.US_WEST_1)) {
Set<Reservation> allResults = client.describeInstancesInRegion(region); Set<Reservation> allResults = client.describeInstancesInRegion(region);
assertNotNull(allResults); assertNotNull(allResults);

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.xml.DescribeKeyPairsResponseHandler; import org.jclouds.aws.ec2.xml.DescribeKeyPairsResponseHandler;
import org.jclouds.http.functions.CloseContentAndReturn; import org.jclouds.http.functions.CloseContentAndReturn;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
@ -41,7 +40,7 @@ import com.google.inject.TypeLiteral;
public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncClient> { public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncClient> {
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException { 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); String.class);
GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method, null,
"mykey"); "mykey");
@ -59,10 +58,10 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
} }
public void testDescribeKeyPairs() throws SecurityException, NoSuchMethodException, IOException { public void testDescribeKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
Method method = KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", Region.class, Method method = KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class,
Array.newInstance(String.class, 0).getClass()); Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method,
(Region) null); (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -78,7 +77,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
public void testDescribeKeyPairsArgs() throws SecurityException, NoSuchMethodException, public void testDescribeKeyPairsArgs() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", Region.class, Method method = KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class,
Array.newInstance(String.class, 0).getClass()); Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<KeyPairAsyncClient> httpMethod = processor.createRequest(method, null,
"1", "2"); "1", "2");

View File

@ -61,7 +61,7 @@ public class KeyPairClientLiveTest {
@Test @Test
void testDescribeKeyPairs() { 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)) { Region.US_WEST_1)) {
SortedSet<KeyPair> allResults = Sets.newTreeSet(client.describeKeyPairsInRegion(region)); SortedSet<KeyPair> allResults = Sets.newTreeSet(client.describeKeyPairsInRegion(region));

View File

@ -42,7 +42,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest<Monitoring
public void testUnmonitorInstances() throws SecurityException, NoSuchMethodException, public void testUnmonitorInstances() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = MonitoringAsyncClient.class.getMethod("unmonitorInstancesInRegion", Method method = MonitoringAsyncClient.class.getMethod("unmonitorInstancesInRegion",
Region.class, String.class, Array.newInstance(String.class, 0).getClass()); String.class, String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<MonitoringAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<MonitoringAsyncClient> httpMethod = processor.createRequest(method,
null, "instance1", "instance2"); null, "instance1", "instance2");
@ -61,7 +61,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest<Monitoring
public void testMonitorInstances() throws SecurityException, NoSuchMethodException, IOException { public void testMonitorInstances() throws SecurityException, NoSuchMethodException, IOException {
Method method = MonitoringAsyncClient.class.getMethod("monitorInstancesInRegion", Method method = MonitoringAsyncClient.class.getMethod("monitorInstancesInRegion",
Region.class, String.class, Array.newInstance(String.class, 0).getClass()); String.class, String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<MonitoringAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<MonitoringAsyncClient> httpMethod = processor.createRequest(method,
null, "instance1", "instance2"); null, "instance1", "instance2");

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.domain.IpProtocol; import org.jclouds.aws.ec2.domain.IpProtocol;
import org.jclouds.aws.ec2.domain.UserIdGroupPair; import org.jclouds.aws.ec2.domain.UserIdGroupPair;
import org.jclouds.aws.ec2.functions.ReturnVoidOnGroupNotFound; import org.jclouds.aws.ec2.functions.ReturnVoidOnGroupNotFound;
@ -46,7 +45,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException, public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("deleteSecurityGroupInRegion", Method method = SecurityGroupAsyncClient.class.getMethod("deleteSecurityGroupInRegion",
Region.class, String.class); String.class, String.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "name"); null, "name");
@ -66,7 +65,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", Method method = SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion",
Region.class, String.class, String.class); String.class, String.class, String.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "name", "description"); null, "name", "description");
@ -86,9 +85,9 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testDescribeSecurityGroups() throws SecurityException, NoSuchMethodException, public void testDescribeSecurityGroups() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion", Method method = SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
(Region) null); (String) null);
assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://ec2.amazonaws.com/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -105,7 +104,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testDescribeSecurityGroupsArgs() throws SecurityException, NoSuchMethodException, public void testDescribeSecurityGroupsArgs() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion", Method method = SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion",
Region.class, Array.newInstance(String.class, 0).getClass()); String.class, Array.newInstance(String.class, 0).getClass());
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "1", "2"); null, "1", "2");
@ -125,7 +124,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testAuthorizeSecurityGroupIngressGroup() throws SecurityException, public void testAuthorizeSecurityGroupIngressGroup() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod( Method method = SecurityGroupAsyncClient.class.getMethod(
"authorizeSecurityGroupIngressInRegion", Region.class, String.class, "authorizeSecurityGroupIngressInRegion", String.class, String.class,
UserIdGroupPair.class); UserIdGroupPair.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "group", new UserIdGroupPair("sourceUser", "sourceGroup")); null, "group", new UserIdGroupPair("sourceUser", "sourceGroup"));
@ -147,7 +146,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testAuthorizeSecurityGroupIngressCidr() throws SecurityException, public void testAuthorizeSecurityGroupIngressCidr() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod( Method method = SecurityGroupAsyncClient.class.getMethod(
"authorizeSecurityGroupIngressInRegion", Region.class, String.class, "authorizeSecurityGroupIngressInRegion", String.class, String.class,
IpProtocol.class, int.class, int.class, String.class); IpProtocol.class, int.class, int.class, String.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"); null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");
@ -169,7 +168,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testRevokeSecurityGroupIngressGroup() throws SecurityException, public void testRevokeSecurityGroupIngressGroup() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod( Method method = SecurityGroupAsyncClient.class.getMethod(
"revokeSecurityGroupIngressInRegion", Region.class, String.class, "revokeSecurityGroupIngressInRegion", String.class, String.class,
UserIdGroupPair.class); UserIdGroupPair.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "group", new UserIdGroupPair("sourceUser", "sourceGroup")); null, "group", new UserIdGroupPair("sourceUser", "sourceGroup"));
@ -191,7 +190,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
public void testRevokeSecurityGroupIngressCidr() throws SecurityException, public void testRevokeSecurityGroupIngressCidr() throws SecurityException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod( Method method = SecurityGroupAsyncClient.class.getMethod(
"revokeSecurityGroupIngressInRegion", Region.class, String.class, IpProtocol.class, "revokeSecurityGroupIngressInRegion", String.class, String.class, IpProtocol.class,
int.class, int.class, String.class); int.class, int.class, String.class);
GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SecurityGroupAsyncClient> httpMethod = processor.createRequest(method,
null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"); null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");

View File

@ -69,7 +69,7 @@ public class SecurityGroupClientLiveTest {
@Test @Test
void testDescribe() { 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<SecurityGroup> allResults = Sets.newTreeSet(client SortedSet<SecurityGroup> allResults = Sets.newTreeSet(client
.describeSecurityGroupsInRegion(region)); .describeSecurityGroupsInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);

View File

@ -40,7 +40,7 @@ import com.google.inject.Provides;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class BaseEC2HandlerTest extends BaseHandlerTest { public class BaseEC2HandlerTest extends BaseHandlerTest {
protected Region defaultRegion = Region.US_EAST_1; protected String defaultRegion = Region.US_EAST_1;
public BaseEC2HandlerTest() { public BaseEC2HandlerTest() {
super(); super();
@ -60,15 +60,15 @@ public class BaseEC2HandlerTest extends BaseHandlerTest {
@Singleton @Singleton
@Provides @Provides
@EC2 @EC2
Region provideDefaultRegion() { String provideDefaultRegion() {
return defaultRegion; return defaultRegion;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Singleton @Singleton
@Provides @Provides
Map<AvailabilityZone, Region> provideAvailabilityZoneRegionMap() { Map<AvailabilityZone, String> provideAvailabilityZoneRegionMap() {
return ImmutableMap.<AvailabilityZone, Region> of(AvailabilityZone.US_EAST_1A, return ImmutableMap.<AvailabilityZone, String> of(AvailabilityZone.US_EAST_1A,
Region.US_EAST_1); Region.US_EAST_1);
} }
}); });

View File

@ -62,12 +62,12 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest {
InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints.xml"); InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints.xml");
Map<Region, URI> expected = ImmutableMap.<Region, URI> of(Region.EU_WEST_1, URI Map<String, URI> expected = ImmutableMap.<String, URI> of(Region.EU_WEST_1, URI
.create("https://ec2.eu-west-1.amazonaws.com"), Region.US_EAST_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-east-1.amazonaws.com"), Region.US_WEST_1, URI
.create("https://ec2.us-west-1.amazonaws.com")); .create("https://ec2.us-west-1.amazonaws.com"));
Map<Region, URI> result = factory.create( Map<String, URI> result = factory.create(
injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is); injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is);
assertEquals(result, expected); assertEquals(result, expected);
@ -77,13 +77,13 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest {
InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints-additional.xml"); InputStream is = getClass().getResourceAsStream("/ec2/regionEndpoints-additional.xml");
Map<Region, URI> expected = ImmutableMap.<Region, URI> of(Region.UNKNOWN, URI Map<String, URI> expected = ImmutableMap.<String, URI> of("jp-west-1", URI
.create("https://ec2.jp-west-1.amazonaws.com"), Region.EU_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.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-east-1.amazonaws.com"), Region.US_WEST_1, URI
.create("https://ec2.us-west-1.amazonaws.com")); .create("https://ec2.us-west-1.amazonaws.com"));
Map<Region, URI> result = factory.create( Map<String, URI> result = factory.create(
injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is); injector.getInstance(DescribeRegionsResponseHandler.class)).parse(is);
assertEquals(result, expected); assertEquals(result, expected);

View File

@ -380,10 +380,10 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException, public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
IllegalArgumentException, NoSuchMethodException, IOException { 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()); String.class, Array.newInstance(PutBucketOptions.class, 0).getClass());
GeneratedHttpRequest<S3AsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<S3AsyncClient> httpMethod = processor.createRequest(method,
(Region) null, "bucket"); (String) null, "bucket");
assertRequestLineEquals(httpMethod, "PUT http://bucket.stub:8080/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "PUT http://bucket.stub:8080/ HTTP/1.1");
assertHeadersEqual(httpMethod, "Content-Length: 0\nHost: bucket.stub\n"); assertHeadersEqual(httpMethod, "Content-Length: 0\nHost: bucket.stub\n");
@ -398,7 +398,7 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException,
IllegalArgumentException, NoSuchMethodException, IOException { 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()); String.class, Array.newInstance(PutBucketOptions.class, 0).getClass());
GeneratedHttpRequest<S3AsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<S3AsyncClient> httpMethod = processor.createRequest(method,
Region.EU_WEST_1, "bucket"); Region.EU_WEST_1, "bucket");
@ -547,7 +547,7 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
Jsr330.bindProperties(binder(), checkNotNull(new S3PropertiesBuilder("user", "key") Jsr330.bindProperties(binder(), checkNotNull(new S3PropertiesBuilder("user", "key")
.build(), "properties")); .build(), "properties"));
bind(URI.class).annotatedWith(S3.class).toInstance(URI.create("http://stub:8080")); 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() { bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
public Logger getLogger(String category) { public Logger getLogger(String category) {
return Logger.NULL; return Logger.NULL;

View File

@ -51,8 +51,8 @@ public class S3StubClientModule extends AbstractModule {
install(new TransientBlobStoreModule()); install(new TransientBlobStoreModule());
bind(S3AsyncClient.class).to(StubS3AsyncClient.class).asEagerSingleton(); bind(S3AsyncClient.class).to(StubS3AsyncClient.class).asEagerSingleton();
bind(URI.class).annotatedWith(S3.class).toInstance(URI.create("https://localhost/s3stub")); bind(URI.class).annotatedWith(S3.class).toInstance(URI.create("https://localhost/s3stub"));
bind(Region.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD); bind(String.class).annotatedWith(S3.class).toInstance(Region.US_STANDARD);
bind(new TypeLiteral<Set<Region>>() { bind(new TypeLiteral<Set<String>>() {
}).annotatedWith(S3.class).toInstance( }).annotatedWith(S3.class).toInstance(
ImmutableSet.of(Region.US_STANDARD, Region.US_WEST_1, Region.EU_WEST_1)); ImmutableSet.of(Region.US_STANDARD, Region.US_WEST_1, Region.EU_WEST_1));
} }

View File

@ -136,14 +136,14 @@ public class StubS3AsyncClient implements S3AsyncClient {
public static final String DEFAULT_OWNER_ID = "abc123"; public static final String DEFAULT_OWNER_ID = "abc123";
@Override @Override
public ListenableFuture<Boolean> putBucketInRegion(@Nullable Region region, String name, public ListenableFuture<Boolean> putBucketInRegion(@Nullable String region, String name,
PutBucketOptions... optionsList) { PutBucketOptions... optionsList) {
region = region == null ? Region.US_STANDARD : region; region = region == null ? Region.US_STANDARD : region;
final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions() final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions()
: optionsList[0]; : optionsList[0];
keyToAcl.put(name, options.getAcl()); keyToAcl.put(name, options.getAcl());
return blobStore.createContainerInLocation(new LocationImpl(LocationScope.REGION, region return blobStore.createContainerInLocation(new LocationImpl(LocationScope.REGION, region,
.value(), region.value(), null), name); region, null), name);
} }
public ListenableFuture<ListBucketResponse> listBucket(final String name, public ListenableFuture<ListBucketResponse> listBucket(final String name,
@ -315,9 +315,9 @@ public class StubS3AsyncClient implements S3AsyncClient {
} }
@Override @Override
public ListenableFuture<Region> getBucketLocation(String bucketName) { public ListenableFuture<String> getBucketLocation(String bucketName) {
Location location = containerToLocation.get(bucketName); Location location = containerToLocation.get(bucketName);
return immediateFuture(Region.fromValue(location.getId())); return immediateFuture(location.getId());
} }
@Override @Override

View File

@ -179,7 +179,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
Region location = getApi().getBucketLocation(bucketName); String location = getApi().getBucketLocation(bucketName);
assert location.equals(Region.US_STANDARD) : "bucket: " + bucketName + " location: " assert location.equals(Region.US_STANDARD) : "bucket: " + bucketName + " location: "
+ location; + location;
} finally { } finally {

View File

@ -61,10 +61,10 @@ import com.google.inject.TypeLiteral;
public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> { public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> {
public void testListQueuesInRegion() throws SecurityException, NoSuchMethodException, public void testListQueuesInRegion() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", Region.class, Array Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", String.class, Array
.newInstance(ListQueuesOptions.class, 0).getClass()); .newInstance(ListQueuesOptions.class, 0).getClass());
GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method,
(Region) null); (String) null);
assertRequestLineEquals(httpMethod, "POST https://default/ HTTP/1.1"); assertRequestLineEquals(httpMethod, "POST https://default/ HTTP/1.1");
assertHeadersEqual(httpMethod, assertHeadersEqual(httpMethod,
@ -80,7 +80,7 @@ public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> {
public void testListQueuesInRegionOptions() throws SecurityException, NoSuchMethodException, public void testListQueuesInRegionOptions() throws SecurityException, NoSuchMethodException,
IOException { IOException {
Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", Region.class, Array Method method = SQSAsyncClient.class.getMethod("listQueuesInRegion", String.class, Array
.newInstance(ListQueuesOptions.class, 0).getClass()); .newInstance(ListQueuesOptions.class, 0).getClass());
GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null,
ListQueuesOptions.Builder.queuePrefix("prefix")); ListQueuesOptions.Builder.queuePrefix("prefix"));
@ -99,7 +99,7 @@ public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> {
public void testCreateQueueInRegion() throws SecurityException, NoSuchMethodException, public void testCreateQueueInRegion() throws SecurityException, NoSuchMethodException,
IOException { 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()); String.class, Array.newInstance(CreateQueueOptions.class, 0).getClass());
GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null,
"queueName"); "queueName");
@ -118,7 +118,7 @@ public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> {
public void testCreateQueueInRegionOptions() throws SecurityException, NoSuchMethodException, public void testCreateQueueInRegionOptions() throws SecurityException, NoSuchMethodException,
IOException { 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()); String.class, Array.newInstance(CreateQueueOptions.class, 0).getClass());
GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null, GeneratedHttpRequest<SQSAsyncClient> httpMethod = processor.createRequest(method, null,
"queueName", CreateQueueOptions.Builder.defaultVisibilityTimeout(45)); "queueName", CreateQueueOptions.Builder.defaultVisibilityTimeout(45));
@ -178,8 +178,8 @@ public class SQSAsyncClientTest extends RestClientTest<SQSAsyncClient> {
@Singleton @Singleton
@Provides @Provides
@SQS @SQS
Map<Region, URI> provideMap() { Map<String, URI> provideMap() {
return ImmutableMap.<Region, URI> of(Region.EU_WEST_1, URI return ImmutableMap.<String, URI> of(Region.EU_WEST_1, URI
.create("https://sqs.eu-west-1.amazonaws.com"), Region.US_EAST_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-east-1.amazonaws.com"), Region.US_WEST_1, URI
.create("https://sqs.us-west-1.amazonaws.com")); .create("https://sqs.us-west-1.amazonaws.com"));

View File

@ -66,7 +66,7 @@ public class SQSClientLiveTest {
@Test @Test
void testListQueuesInRegion() throws InterruptedException { 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<Queue> allResults = Sets.newTreeSet(client.listQueuesInRegion(region)); SortedSet<Queue> allResults = Sets.newTreeSet(client.listQueuesInRegion(region));
assertNotNull(allResults); assertNotNull(allResults);
if (allResults.size() >= 1) { if (allResults.size() >= 1) {
@ -82,7 +82,7 @@ public class SQSClientLiveTest {
void testCreateQueue() throws InterruptedException { void testCreateQueue() throws InterruptedException {
String queueName = PREFIX + "1"; 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)) { Region.US_WEST_1)) {
try { try {
SortedSet<Queue> result = Sets.newTreeSet(client.listQueuesInRegion(region, SortedSet<Queue> 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; final Queue finalQ = queue;
assertEventually(new Runnable() { assertEventually(new Runnable() {
public void run() { public void run() {

View File

@ -75,9 +75,9 @@ public class SQSRestClientModuleTest {
@Test @Test
void testRegions() { void testRegions() {
Map<Region, URI> regionMap = createInjector().getInstance(new Key<Map<Region, URI>>(SQS.class) { Map<String, URI> regionMap = createInjector().getInstance(new Key<Map<String, URI>>(SQS.class) {
}); });
assertEquals(regionMap, ImmutableMap.<Region, URI> of(Region.US_EAST_1, URI assertEquals(regionMap, ImmutableMap.<String, URI> of(Region.US_EAST_1, URI
.create("https://queue.amazonaws.com"), Region.US_WEST_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://us-west-1.queue.amazonaws.com"), Region.EU_WEST_1, URI
.create("https://eu-west-1.queue.amazonaws.com"))); .create("https://eu-west-1.queue.amazonaws.com")));

Some files were not shown because too many files have changed in this diff Show More