diff --git a/apis/ec2/src/main/clojure/org/jclouds/ec2/ami2.clj b/apis/ec2/src/main/clojure/org/jclouds/ec2/ami2.clj index 5d6f666a52..d58eb6bc80 100644 --- a/apis/ec2/src/main/clojure/org/jclouds/ec2/ami2.clj +++ b/apis/ec2/src/main/clojure/org/jclouds/ec2/ami2.clj @@ -21,12 +21,12 @@ org.jclouds.ec2.ami2 (:use org.jclouds.compute2) (:import org.jclouds.aws.domain.Region - org.jclouds.ec2.services.AMIClient + org.jclouds.ec2.features.AMIApi org.jclouds.ec2.options.CreateImageOptions org.jclouds.compute.domain.NodeMetadata (org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo))) -(defn ^org.jclouds.ec2.services.AMIClient +(defn ^org.jclouds.ec2.features.AMIApi ami-service "" [compute] @@ -34,7 +34,7 @@ .getContext .getProviderSpecificContext .getApi - .getAMIServices)) + .getAMIApi().get)) (defn get-region "Coerces the first parameter into a Region string; strings, keywords, and diff --git a/apis/ec2/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj b/apis/ec2/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj index a5daf1510c..68c372f831 100644 --- a/apis/ec2/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj +++ b/apis/ec2/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj @@ -24,12 +24,12 @@ (:import org.jclouds.compute.domain.NodeMetadata (org.jclouds.ec2.domain PublicIpInstanceIdPair))) -(defn ^org.jclouds.ec2.services.ElasticIPAddressClient +(defn ^org.jclouds.ec2.features.ElasticIPAddressApi eip-service - "Returns an ElasticIPAddressClient for the given ComputeService" + "Returns an ElasticIPAddressApi for the given ComputeService" [compute] (-> compute - .getContext .getProviderSpecificContext .getApi .getElasticIPAddressServices)) + .getContext .getProviderSpecificContext .getApi .getElasticIPAddressApi().get)) (defn allocate "Claims a new elastic IP address within the (optionally) specified region for your account. diff --git a/apis/ec2/src/main/clojure/org/jclouds/ec2/security_group2.clj b/apis/ec2/src/main/clojure/org/jclouds/ec2/security_group2.clj index a6bc49cabe..a4f33cfd6c 100644 --- a/apis/ec2/src/main/clojure/org/jclouds/ec2/security_group2.clj +++ b/apis/ec2/src/main/clojure/org/jclouds/ec2/security_group2.clj @@ -22,14 +22,14 @@ (:require (org.jclouds [compute2 :as compute]) [org.jclouds.ec2.ebs2 :as ebs]) (:import org.jclouds.ec2.domain.SecurityGroup - org.jclouds.ec2.services.SecurityGroupClient + org.jclouds.ec2.features.SecurityGroupApi org.jclouds.net.domain.IpProtocol)) -(defn #^SecurityGroupClient +(defn #^SecurityGroupApi sg-service - "Returns the SecurityGroup Client associated with the specified compute service." + "Returns the SecurityGroup Api associated with the specified compute service." [compute] - (-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupServices)) + (-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupApi().get)) (defn create-group "Creates a new security group. diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java index 26cf10ec2b..d8637e8487 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java @@ -21,6 +21,13 @@ import java.util.Set; import org.jclouds.ec2.features.SubnetApi; import org.jclouds.ec2.features.TagApi; import org.jclouds.ec2.features.WindowsApi; +import org.jclouds.ec2.features.AMIApi; +import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi; +import org.jclouds.ec2.features.ElasticBlockStoreApi; +import org.jclouds.ec2.features.ElasticIPAddressApi; +import org.jclouds.ec2.features.InstanceApi; +import org.jclouds.ec2.features.KeyPairApi; +import org.jclouds.ec2.features.SecurityGroupApi; import org.jclouds.javax.annotation.Nullable; import org.jclouds.location.Region; import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; @@ -42,12 +49,11 @@ import com.google.inject.Provides; * Example * *
- * Optional<? extends WindowsApi> windowsOption = ec2Client.getWindowsApi(); + * Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApi(); * checkState(windowsOption.isPresent(), "windows feature required, but not present"); ** * @author Adrian Cole - * @see EC2AsyncApi */ public interface EC2Api extends Closeable { /** @@ -87,4 +93,75 @@ public interface EC2Api extends Closeable { @Delegate Optional extends SubnetApi> getSubnetApiForRegion( @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to AMI services. + */ + @Delegate + Optional extends AMIApi> getAMIApi(); + + @Delegate + Optional extends AMIApi> getAMIApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + + /** + * Provides synchronous access to Elastic IP Address services. + */ + @Delegate + Optional extends ElasticIPAddressApi> getElasticIPAddressApi(); + + @Delegate + Optional extends ElasticIPAddressApi> getElasticIPAddressApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Instance services. + */ + @Delegate + Optional extends InstanceApi> getInstanceApi(); + + @Delegate + Optional extends InstanceApi> getInstanceApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to KeyPair services. + */ + @Delegate + Optional extends KeyPairApi> getKeyPairApi(); + + @Delegate + Optional extends KeyPairApi> getKeyPairApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to SecurityGroup services. + */ + @Delegate + Optional extends SecurityGroupApi> getSecurityGroupApi(); + + @Delegate + Optional extends SecurityGroupApi> getSecurityGroupApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Availability Zones and Regions services. + */ + @Delegate + Optional extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApi(); + + @Delegate + Optional extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); + + /** + * Provides synchronous access to Elastic Block Store services. + */ + @Delegate + Optional extends ElasticBlockStoreApi> getElasticBlockStoreApi(); + + @Delegate + Optional extends ElasticBlockStoreApi> getElasticBlockStoreApiForRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region); } diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java index f380d464b3..47fc54ba18 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java @@ -31,8 +31,8 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.ec2.compute.EC2ComputeServiceContext; import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule; import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; -import org.jclouds.ec2.config.EC2RestClientModule; -import org.jclouds.rest.internal.BaseRestApiMetadata; +import org.jclouds.ec2.config.EC2HttpApiModule; +import org.jclouds.rest.internal.BaseHttpApiMetadata; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -55,16 +55,8 @@ import com.google.inject.Module; * * @author Adrian Cole */ -public class EC2ApiMetadata extends BaseRestApiMetadata { +public class EC2ApiMetadata extends BaseHttpApiMetadata
+ * {"expiration": "2008-08-30T08:49:09Z","conditions": ["bucket": "my-bucket"},["starts-with", "$key", "my-new-image"]]} + *+ * + * @param options + * if the bucket isn't owned by you, use this to set the bucket's + * accesskeyid + * @return status of the work + * + * @see #cancelBundleTaskInRegion + * @see #describeBundleTasksInRegion + * + * @see + */ + @Named("BundleInstance") + @POST + @Path("/") + @FormParams(keys = ACTION, values = "BundleInstance") + @XMLResponseParser(BundleTaskHandler.class) + BundleTask bundleInstanceInRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, + @FormParam("InstanceId") String instanceId, @FormParam("Storage.S3.Prefix") String prefix, + @FormParam("Storage.S3.Bucket") String bucket, + @BinderParam(BindS3UploadPolicyAndSignature.class) String uploadPolicy, + BundleInstanceS3StorageOptions... options); + + /** + * Cancels an Amazon EC2 bundling operation. + * + * @param region + * The bundleTask ID is tied to the Region. + * @param bundleId + * The ID of the bundle task to cancel. + * @return task for the cancel. + * + * @see #bundleInstanceInRegion + * @see #describeBundleTasksInRegion + * + * @see + */ + @Named("CancelBundleTask") + @POST + @Path("/") + @FormParams(keys = ACTION, values = "CancelBundleTask") + @XMLResponseParser(BundleTaskHandler.class) + BundleTask cancelBundleTaskInRegion( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, + @FormParam("BundleId") String bundleId); + + /** + * + * Describes current bundling tasks. + * + * @param region + * The bundleTask ID is tied to the Region. + * + * @see #cancelBundleTaskInRegion + * @see #bundleInstanceInRegion + * @see + */ + @Named("DescribeBundleTasks") + @POST + @Path("/") + @FormParams(keys = ACTION, values = "DescribeBundleTasks") + @XMLResponseParser(DescribeBundleTasksResponseHandler.class) + @Fallback(EmptySetOnNotFoundOr404.class) + Set
* import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.*
*
- * EC2Client connection = // get connection
+ * EC2Api connection = // get connection
* String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey));
*
*
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java
index e6665cca6f..8c604d5143 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateImageOptions.java
@@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.CreateImageOptions.Builder.*
*
- * EC2Client connection = // get connection
- * Future> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
+ * EC2Api connection = // get connection
+ * Future> images = connection.getAMIApi().get().createImage(withDescription("123125").noReboot());
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java
index 83dcd19b7d..2c05a27783 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateSnapshotOptions.java
@@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.*
*
- * EC2Client connection = // get connection
- * Snapshot snapshot = connection.getElasticBlockStoreServices().createSnapshotInRegion(volumeId, withDescription("123125"));
+ * EC2Api connection = // get connection
+ * Snapshot snapshot = connection.getElasticBlockStoreApi().get().createSnapshotInRegion(volumeId, withDescription("123125"));
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java
index c18e5e4747..5b3f6936c9 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeAvailabilityZonesOptions.java
@@ -30,8 +30,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.*
*
- * EC2Client connection = // get connection
- * Future> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
+ * EC2Api connection = // get connection
+ * Future> images = connection.getAvailabilityZoneAndRegionApi().get().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java
index ffcf3e60f5..d81ba887d0 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeImagesOptions.java
@@ -31,8 +31,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.*
*
- * EC2Client connection = // get connection
- * Future> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
+ * EC2Api connection = // get connection
+ * Future> images = connection.getAMIApi().get().describeImages(executableBy("123125").imageIds(1000, 1004));
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java
index d589e9d43e..594194d628 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeRegionsOptions.java
@@ -30,7 +30,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.*
*
- * EC2Client connection = // get connection
+ * EC2Api connection = // get connection
* Future> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
*
*
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java
index d64e01ed7f..8dfe3cb7e0 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/DescribeSnapshotsOptions.java
@@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.*
*
- * EC2Client connection = // get connection
- * Set snapshots = connection.getElasticBlockStoreServices().describeSnapshots(restorableBy("123125").snapshotIds(1000, 1004));
+ * EC2Api connection = // get connection
+ * Set snapshots = connection.getElasticBlockStoreApi().get().describeSnapshots(restorableBy("123125").snapshotIds(1000, 1004));
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java
index 8d957920ae..0b9fc89e02 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/DetachVolumeOptions.java
@@ -29,8 +29,8 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.*
*
- * EC2Client client = // get connection
- * client.getElasticBlockStoreServices().detachVolumeInRegion(null, id, fromDevice("123125").force());
+ * EC2Api client = // get connection
+ * client.getElasticBlockStoreApi().get().detachVolumeInRegion(null, id, fromDevice("123125").force());
*
*
* @author Adrian Cole
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java
index 51e3024314..1da21c0ede 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptions.java
@@ -31,7 +31,7 @@ import org.jclouds.javax.annotation.Nullable;
*
* import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.*
*
- * EC2Client connection = // get connection
+ * EC2Api connection = // get connection
* String imageId = connection.getImageServices().registerImageBackedByEbs(...addEphemeralBlockDeviceFromSnapshot("/dev/sda2","virtual-1","snapshot-id"));
*
*
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageOptions.java
index da4c0eb9d3..76c2a01f85 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/RegisterImageOptions.java
@@ -30,7 +30,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.ec2.options.RegisterImageOptions.Builder.*
*
- * EC2Client connection = // get connection
+ * EC2Api connection = // get connection
* String imageId = connection.getImageServices().registerImageFromManifest(...withArchitecture(Architecture.I386).withDescription("description"));
*
*
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/RunInstancesOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/RunInstancesOptions.java
index 87d26861eb..25d4e7be9b 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/RunInstancesOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/RunInstancesOptions.java
@@ -35,7 +35,7 @@ import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
*
* import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.*
*
- * EC2Client connection = // get connection
+ * EC2Api connection = // get connection
* Future instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
*
*
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
index 4908b3cc15..57d576d962 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
@@ -20,7 +20,7 @@ import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.aws.AWSResponseException;
-import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.EC2Api;
import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.logging.Logger;
@@ -37,13 +37,13 @@ import com.google.inject.Inject;
@Singleton
public class InstanceHasIpAddress implements Predicate {
- private final EC2Client client;
+ private final EC2Api client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public InstanceHasIpAddress(EC2Client client) {
+ public InstanceHasIpAddress(EC2Api client) {
this.client = client;
}
@@ -60,7 +60,7 @@ public class InstanceHasIpAddress implements Predicate {
}
private RunningInstance refresh(RunningInstance instance) {
- return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceServices()
+ return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
}
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
index 7239a3991e..893e6898f5 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
@@ -19,7 +19,7 @@ package org.jclouds.ec2.predicates;
import javax.annotation.Resource;
import javax.inject.Singleton;
-import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.EC2Api;
import org.jclouds.ec2.domain.InstanceState;
import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.logging.Logger;
@@ -38,13 +38,13 @@ import com.google.inject.Inject;
@Singleton
public class InstanceStateRunning implements Predicate {
- private final EC2Client client;
+ private final EC2Api client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public InstanceStateRunning(EC2Client client) {
+ public InstanceStateRunning(EC2Api client) {
this.client = client;
}
@@ -63,7 +63,7 @@ public class InstanceStateRunning implements Predicate {
private RunningInstance refresh(RunningInstance instance) {
return Iterables.getOnlyElement(Iterables.getOnlyElement(client
- .getInstanceServices().describeInstancesInRegion(
+ .getInstanceApi().get().describeInstancesInRegion(
instance.getRegion(), instance.getId())));
}
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
index 9619c785c3..644d858124 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
@@ -21,7 +21,7 @@ import javax.inject.Singleton;
import org.jclouds.ec2.domain.InstanceState;
import org.jclouds.ec2.domain.RunningInstance;
-import org.jclouds.ec2.services.InstanceClient;
+import org.jclouds.ec2.features.InstanceApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -37,13 +37,13 @@ import com.google.inject.Inject;
@Singleton
public class InstanceStateStopped implements Predicate {
- private final InstanceClient client;
+ private final InstanceApi client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public InstanceStateStopped(InstanceClient client) {
+ public InstanceStateStopped(InstanceApi client) {
this.client = client;
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
index 7796e24e1c..8c9a3fdb10 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
@@ -21,7 +21,7 @@ import java.util.NoSuchElementException;
import javax.annotation.Resource;
import javax.inject.Singleton;
-import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.EC2Api;
import org.jclouds.ec2.domain.InstanceState;
import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.logging.Logger;
@@ -39,13 +39,13 @@ import com.google.inject.Inject;
@Singleton
public class InstanceStateTerminated implements Predicate {
- private final EC2Client client;
+ private final EC2Api client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public InstanceStateTerminated(EC2Client client) {
+ public InstanceStateTerminated(EC2Api client) {
this.client = client;
}
@@ -62,7 +62,7 @@ public class InstanceStateTerminated implements Predicate {
}
private RunningInstance refresh(RunningInstance instance) {
- return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceServices()
+ return Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
.describeInstancesInRegion(instance.getRegion(), instance.getId())));
}
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/SnapshotCompleted.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/SnapshotCompleted.java
index 658b144d25..ef5281a888 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/SnapshotCompleted.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/SnapshotCompleted.java
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.ec2.domain.Snapshot;
-import org.jclouds.ec2.services.ElasticBlockStoreClient;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -38,12 +38,12 @@ import com.google.inject.Inject;
@Singleton
public class SnapshotCompleted implements Predicate {
- private final ElasticBlockStoreClient client;
+ private final ElasticBlockStoreApi client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public SnapshotCompleted(ElasticBlockStoreClient client) {
+ public SnapshotCompleted(ElasticBlockStoreApi client) {
this.client = client;
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAttached.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAttached.java
index 2ce17e63a5..f3ebfaf2b2 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAttached.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAttached.java
@@ -21,7 +21,7 @@ import javax.inject.Singleton;
import org.jclouds.ec2.domain.Attachment;
import org.jclouds.ec2.domain.Volume;
-import org.jclouds.ec2.services.ElasticBlockStoreClient;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -38,12 +38,12 @@ import com.google.inject.Inject;
@Singleton
public class VolumeAttached implements Predicate {
- private final ElasticBlockStoreClient client;
+ private final ElasticBlockStoreApi client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public VolumeAttached(ElasticBlockStoreClient client) {
+ public VolumeAttached(ElasticBlockStoreApi client) {
this.client = client;
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAvailable.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAvailable.java
index ae394dcbb0..9688add7b3 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAvailable.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeAvailable.java
@@ -20,7 +20,7 @@ import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.ec2.domain.Volume;
-import org.jclouds.ec2.services.ElasticBlockStoreClient;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -36,12 +36,12 @@ import com.google.inject.Inject;
@Singleton
public class VolumeAvailable implements Predicate {
- private final ElasticBlockStoreClient client;
+ private final ElasticBlockStoreApi client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public VolumeAvailable(ElasticBlockStoreClient client) {
+ public VolumeAvailable(ElasticBlockStoreApi client) {
this.client = client;
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeDetached.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeDetached.java
index 6415eb0f76..accabe8284 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeDetached.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/VolumeDetached.java
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
import org.jclouds.ec2.domain.Attachment;
import org.jclouds.ec2.domain.Volume;
-import org.jclouds.ec2.services.ElasticBlockStoreClient;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -38,12 +38,12 @@ import com.google.inject.Singleton;
@Singleton
public class VolumeDetached implements Predicate {
- private final ElasticBlockStoreClient client;
+ private final ElasticBlockStoreApi client;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public VolumeDetached(ElasticBlockStoreClient client) {
+ public VolumeDetached(ElasticBlockStoreApi client) {
this.client = client;
}
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/services/AMIAsyncClient.java b/apis/ec2/src/main/java/org/jclouds/ec2/services/AMIAsyncClient.java
deleted file mode 100644
index cf079f0ac3..0000000000
--- a/apis/ec2/src/main/java/org/jclouds/ec2/services/AMIAsyncClient.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.ec2.services;
-
-import static org.jclouds.aws.reference.FormParameters.ACTION;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
-import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
-import org.jclouds.ec2.domain.Image;
-import org.jclouds.ec2.domain.Image.EbsBlockDevice;
-import org.jclouds.ec2.domain.Permission;
-import org.jclouds.ec2.options.CreateImageOptions;
-import org.jclouds.ec2.options.DescribeImagesOptions;
-import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
-import org.jclouds.ec2.options.RegisterImageOptions;
-import org.jclouds.ec2.xml.BlockDeviceMappingHandler;
-import org.jclouds.ec2.xml.DescribeImagesResponseHandler;
-import org.jclouds.ec2.xml.ImageIdHandler;
-import org.jclouds.ec2.xml.PermissionHandler;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.FormParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.rest.annotations.XMLResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to AMI Services.
- *
- *
- * @author Adrian Cole
- */
-@RequestFilters(FormSigner.class)
-@VirtualHost
-public interface AMIAsyncClient {
-
- /**
- * @see AMIClient#describeImagesInRegion
- */
- @Named("DescribeImages")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DescribeImages")
- @XMLResponseParser(DescribeImagesResponseHandler.class)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture> describeImagesInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- DescribeImagesOptions... options);
-
- /**
- * @see AMIClient#createImageInRegion
- */
- @Named("CreateImage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "CreateImage")
- @XMLResponseParser(ImageIdHandler.class)
- ListenableFuture createImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options);
-
- /**
- * @see AMIClient#deregisterImageInRegion
- */
- @Named("DeregisterImage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DeregisterImage")
- ListenableFuture deregisterImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("ImageId") String imageId);
-
- /**
- * @see AMIClient#registerImageFromManifestInRegion
- */
- @Named("RegisterImage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "RegisterImage")
- @XMLResponseParser(ImageIdHandler.class)
- ListenableFuture registerImageFromManifestInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest,
- RegisterImageOptions... options);
-
- /**
- * @see AMIClient#registerUnixImageBackedByEbsInRegion
- */
- @Named("RegisterImage")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "RootDeviceName", "BlockDeviceMapping.0.DeviceName" }, values = { "RegisterImage",
- "/dev/sda1", "/dev/sda1" })
- @XMLResponseParser(ImageIdHandler.class)
- ListenableFuture registerUnixImageBackedByEbsInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("Name") String imageName,
- @FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId,
- RegisterImageBackedByEbsOptions... options);
-
- /**
- * @see AMIClient#resetLaunchPermissionsOnImageInRegion
- */
- @Named("ResetImageAttribute")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" })
- ListenableFuture resetLaunchPermissionsOnImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("ImageId") String imageId);
-
- /**
- * @see AMIClient#addLaunchPermissionsToImageInRegion
- */
- @Named("ModifyImageAttribute")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "add",
- "launchPermission" })
- ListenableFuture addLaunchPermissionsToImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds,
- @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups,
- @FormParam("ImageId") String imageId);
-
- /**
- * @see AMIClient#removeLaunchPermissionsToImageInRegion
- */
- @Named("ModifyImageAttribute")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute", "remove",
- "launchPermission" })
- ListenableFuture removeLaunchPermissionsFromImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @BinderParam(BindUserIdsToIndexedFormParams.class) Iterable userIds,
- @BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable userGroups,
- @FormParam("ImageId") String imageId);
-
- /**
- * @see AMIClient#getLaunchPermissionForImageInRegion
- */
- @Named("DescribeImageAttribute")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "launchPermission" })
- @XMLResponseParser(PermissionHandler.class)
- ListenableFuture getLaunchPermissionForImageInRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
- @FormParam("ImageId") String imageId);
-
- /**
- * @see AMIClient#getBlockDeviceMappingsForImageInRegion
- */
- @Named("DescribeImageAttribute")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "blockDeviceMapping" })
- @XMLResponseParser(BlockDeviceMappingHandler.class)
- ListenableFuture