diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java index c5d36c8e6d..25b9978ba3 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java @@ -52,7 +52,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = "Version", values = CloudWatchAsyncClient.VERSION) @VirtualHost public interface CloudWatchAsyncClient { public static final String VERSION = "2010-08-01"; diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java index 33d405718b..2f4b4f2ce3 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java @@ -77,7 +77,7 @@ public class CloudWatchAsyncClientTest extends RestClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=CreateImage&InstanceId=instanceId&Name=name", + assertPayloadEquals(request, "Action=CreateImage&InstanceId=instanceId&Name=name", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); assertSaxResponseParserClassEquals(method, ImageIdHandler.class); @@ -77,7 +77,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true", + "Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -94,7 +94,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeImages", "application/x-www-form-urlencoded", + assertPayloadEquals(request, "Action=DescribeImages", "application/x-www-form-urlencoded", false); filter.filter(request); assertPayloadEquals( @@ -119,7 +119,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=DescribeImages&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2", + "Action=DescribeImages&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -135,7 +135,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=DeregisterImage&ImageId=imageId", + assertPayloadEquals(request, "Action=DeregisterImage&ImageId=imageId", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); @@ -152,7 +152,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=RegisterImage&ImageLocation=pathToManifest&Name=name", + assertPayloadEquals(request, "Action=RegisterImage&ImageLocation=pathToManifest&Name=name", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); assertSaxResponseParserClassEquals(method, ImageIdHandler.class); @@ -171,7 +171,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description", + "Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -190,7 +190,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName", + "Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); assertSaxResponseParserClassEquals(method, ImageIdHandler.class); @@ -210,7 +210,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fdevice&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=%2Fdev%2Fnewdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100", + "Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fdevice&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=%2Fdev%2Fnewdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -228,7 +228,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals(request, - "Version=2010-06-15&Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId", + "Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -245,7 +245,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals(request, - "Version=2010-06-15&Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId", + "Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -265,7 +265,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue", + "Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue", "application/x-www-form-urlencoded", false); filter.filter(request); assertPayloadEquals( @@ -290,7 +290,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - "Version=2010-06-15&Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue", + "Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); @@ -307,7 +307,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals(request, - "Version=2010-06-15&Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId", + "Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java index a828e1069a..452c66cf9b 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java @@ -55,7 +55,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends assertRequestLineEquals(request, "POST https://ec2.us-west-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-west-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeAvailabilityZones", + assertPayloadEquals(request, "Action=DescribeAvailabilityZones", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -73,7 +73,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals(request, - "Version=2010-06-15&Action=DescribeAvailabilityZones&ZoneName.1=us-east-1a&ZoneName.2=us-east-1b", + "Action=DescribeAvailabilityZones&ZoneName.1=us-east-1a&ZoneName.2=us-east-1b", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -90,7 +90,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeRegions", "application/x-www-form-urlencoded", + assertPayloadEquals(request, "Action=DescribeRegions", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -108,7 +108,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n"); assertPayloadEquals(request, - "Version=2010-06-15&Action=DescribeRegions&RegionName.1=us-east-1&RegionName.2=us-west-1", + "Action=DescribeRegions&RegionName.1=us-east-1&RegionName.2=us-west-1", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java index a6bab3a4de..8223af543c 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java @@ -61,7 +61,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest dateService; @@ -84,10 +89,11 @@ public class FormSigner implements HttpRequestFilter, RequestSigner { private Logger signatureLog = Logger.NULL; @Inject - public FormSigner(SignatureWire signatureWire, @Named(Constants.PROPERTY_IDENTITY) String accessKey, - @Named(Constants.PROPERTY_CREDENTIAL) String secretKey, @TimeStamp Provider dateService, + public FormSigner(SignatureWire signatureWire, @ApiVersion String apiVersion, @Identity String accessKey, + @Credential String secretKey, @TimeStamp Provider dateService, Crypto crypto, HttpUtils utils) { this.signatureWire = signatureWire; + this.apiVersion = apiVersion; this.accessKey = accessKey; this.secretKey = secretKey; this.dateService = dateService; @@ -99,6 +105,7 @@ public class FormSigner implements HttpRequestFilter, RequestSigner { checkNotNull(request.getFirstHeaderOrNull(HttpHeaders.HOST), "request is not ready to sign; host not present"); Multimap decodedParams = ModifyRequest.parseQueryToMap(request.getPayload().getRawContent() .toString()); + decodedParams.replaceValues(VERSION, ImmutableSet.of(apiVersion)); addSigningParams(decodedParams); validateParams(decodedParams); String stringToSign = createStringToSign(request, decodedParams); diff --git a/common/aws/src/test/java/org/jclouds/aws/filters/FormSignerTest.java b/common/aws/src/test/java/org/jclouds/aws/filters/FormSignerTest.java index ba64c54992..6cfffe4899 100644 --- a/common/aws/src/test/java/org/jclouds/aws/filters/FormSignerTest.java +++ b/common/aws/src/test/java/org/jclouds/aws/filters/FormSignerTest.java @@ -20,16 +20,22 @@ package org.jclouds.aws.filters; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; import static org.testng.Assert.assertEquals; +import java.net.URI; + +import javax.ws.rs.core.HttpHeaders; + import org.jclouds.PropertiesBuilder; import org.jclouds.date.TimeStamp; +import org.jclouds.http.HttpRequest; import org.jclouds.http.IntegrationTestAsyncClient; import org.jclouds.http.IntegrationTestClient; +import org.jclouds.io.Payloads; import org.jclouds.logging.config.NullLoggingModule; -import org.jclouds.rest.BaseRestClientTest.MockModule; import org.jclouds.rest.RequestSigner; import org.jclouds.rest.RestContextBuilder; import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextSpec; +import org.jclouds.rest.BaseRestClientTest.MockModule; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -60,6 +66,19 @@ public class FormSignerTest { } })); + @Test + void testBuildCanonicalizedStringSetsVersion() { + FormSigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector().getInstance( + FormSigner.class); + + assertEquals( + filter.filter( + HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).headers( + ImmutableMultimap.of(HttpHeaders.HOST, "localhost")).payload( + Payloads.newStringPayload("Action=DescribeImages&ImageId.1=ami-2bb65342")).build()) + .getPayload().getRawContent(), + "Action=DescribeImages&ImageId.1=ami-2bb65342&Signature=ugnt4m2eHE7Ka%2FvXTr9EhKZq7bhxOfvW0y4pAEqF97w%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=apiVersion&AWSAccessKeyId=identity"); + } @Test void testBuildCanonicalizedString() { diff --git a/labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java b/labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java index 1d920e02fa..e8bd45146e 100644 --- a/labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java +++ b/labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.elb; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -59,7 +58,6 @@ import com.google.common.util.concurrent.ListenableFuture; */ @Beta @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = ELBAsyncClient.VERSION) @VirtualHost public interface ELBAsyncClient { public static final String VERSION = "2011-11-15"; diff --git a/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java b/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java index 5964de9948..bf3fe21c41 100644 --- a/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java +++ b/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java @@ -67,7 +67,7 @@ public class ELBAsyncClientTest extends RestClientTest { assertNonPayloadHeadersEqual(request, "Host: elasticloadbalancing.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - String.format("Version=%s&Action=CreateLoadBalancer&Listeners.member.1.Protocol=http&LoadBalancerName=name&Listeners.member.1.LoadBalancerPort=80&Listeners.member.1.InstancePort=80", ELBAsyncClient.VERSION), + "Action=CreateLoadBalancer&Listeners.member.1.Protocol=http&LoadBalancerName=name&Listeners.member.1.LoadBalancerPort=80&Listeners.member.1.InstancePort=80", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -83,7 +83,7 @@ public class ELBAsyncClientTest extends RestClientTest { assertRequestLineEquals(request, "POST https://elasticloadbalancing.us-east-1.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: elasticloadbalancing.us-east-1.amazonaws.com\n"); - assertPayloadEquals(request, String.format("Version=%s&Action=DescribeLoadBalancers", ELBAsyncClient.VERSION), + assertPayloadEquals(request, "Action=DescribeLoadBalancers", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -101,7 +101,7 @@ public class ELBAsyncClientTest extends RestClientTest { assertNonPayloadHeadersEqual(request, "Host: elasticloadbalancing.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - String.format("Version=%s&Action=DescribeLoadBalancers&LoadBalancerNames.member.1=1&LoadBalancerNames.member.2=2", ELBAsyncClient.VERSION), + "Action=DescribeLoadBalancers&LoadBalancerNames.member.1=1&LoadBalancerNames.member.2=2", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -121,7 +121,7 @@ public class ELBAsyncClientTest extends RestClientTest { assertNonPayloadHeadersEqual(request, "Host: elasticloadbalancing.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - String.format("Version=%s&Action=RegisterInstancesWithLoadBalancer&LoadBalancerName=ReferenceAP1&Instances.member.1.InstanceId=i-6055fa09", ELBAsyncClient.VERSION), + "Action=RegisterInstancesWithLoadBalancer&LoadBalancerName=ReferenceAP1&Instances.member.1.InstanceId=i-6055fa09", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -141,7 +141,7 @@ public class ELBAsyncClientTest extends RestClientTest { assertNonPayloadHeadersEqual(request, "Host: elasticloadbalancing.us-east-1.amazonaws.com\n"); assertPayloadEquals( request, - String.format("Version=%s&Action=DeregisterInstancesFromLoadBalancer&LoadBalancerName=ReferenceAP1&Instances.member.1.InstanceId=i-6055fa09", ELBAsyncClient.VERSION), + "Action=DeregisterInstancesFromLoadBalancer&LoadBalancerName=ReferenceAP1&Instances.member.1.InstanceId=i-6055fa09", "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java index 5b125fe757..a79f049004 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java @@ -18,6 +18,7 @@ */ package org.jclouds.aws.ec2; +import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_AMI_QUERY; import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMI_QUERY; @@ -39,6 +40,7 @@ public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilde @Override protected Properties defaultProperties() { Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_API_VERSION, AWSEC2AsyncClient.VERSION); // sometimes, like in ec2, stop takes a very long time, perhaps // due to volume management. one example spent 2 minutes moving // from stopping->stopped state on an ec2 micro diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClient.java index cdcc825ae0..d194704b08 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.xml.ProductCodesHandler; import org.jclouds.aws.filters.FormSigner; import org.jclouds.ec2.binders.BindProductCodesToIndexedFormParams; @@ -51,7 +49,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface AWSAMIAsyncClient extends AMIAsyncClient { // TODO make AWSImage as it has product codes... diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClient.java index 3162e5b87b..5a09a40030 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.domain.AWSRunningInstance; import org.jclouds.aws.ec2.xml.AWSDescribeInstancesResponseHandler; import org.jclouds.aws.ec2.xml.AWSRunInstancesResponseHandler; @@ -57,7 +55,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface AWSInstanceAsyncClient extends InstanceAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClient.java index fc03d3d547..cec98084a3 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClient.java @@ -19,13 +19,11 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.functions.EncodedRSAPublicKeyToBase64; import org.jclouds.aws.filters.FormSigner; import org.jclouds.ec2.domain.KeyPair; @@ -47,7 +45,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface AWSKeyPairAsyncClient extends KeyPairAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClient.java index 217ff12ddc..c98a76a27a 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.options.CreateSecurityGroupOptions; import org.jclouds.aws.ec2.xml.CreateSecurityGroupResponseHandler; import org.jclouds.aws.filters.FormSigner; @@ -60,7 +58,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost @Beta public interface AWSSecurityGroupAsyncClient extends SecurityGroupAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java index d2964787e5..e219917413 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/MonitoringAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Map; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.domain.MonitoringState; import org.jclouds.aws.ec2.xml.MonitoringStateHandler; import org.jclouds.aws.filters.FormSigner; @@ -50,7 +48,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface MonitoringAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClient.java index 2383e8d9e5..9f6084ad30 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.domain.PlacementGroup; import org.jclouds.aws.ec2.xml.DescribePlacementGroupsResponseHandler; import org.jclouds.aws.filters.FormSigner; @@ -53,7 +51,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface PlacementGroupAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClient.java index fc8a919dbb..d65626b69f 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Set; @@ -27,7 +26,6 @@ import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.binders.BindLaunchSpecificationToFormParams; import org.jclouds.aws.ec2.binders.BindSpotInstanceRequestIdsToIndexedFormParams; import org.jclouds.aws.ec2.domain.LaunchSpecification; @@ -60,7 +58,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface SpotInstanceAsyncClient { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/TagAsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/TagAsyncClient.java index 49ceee9498..8a4513af9e 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/TagAsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/services/TagAsyncClient.java @@ -19,7 +19,6 @@ package org.jclouds.aws.ec2.services; import static org.jclouds.aws.reference.FormParameters.ACTION; -import static org.jclouds.aws.reference.FormParameters.VERSION; import java.util.Map; import java.util.Set; @@ -27,7 +26,6 @@ import java.util.Set; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.binders.BindResourceIdsToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindTagFiltersToIndexedFormParams; import org.jclouds.aws.ec2.binders.BindTagsToIndexedFormParams; @@ -55,7 +53,6 @@ import com.google.common.util.concurrent.ListenableFuture; * @author grkvlt@apache.org */ @RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = AWSEC2AsyncClient.VERSION) @VirtualHost public interface TagAsyncClient { /** diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java index b19e71bbe1..0d253b6b96 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java @@ -63,7 +63,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest