diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java
index 69598066d6..4c8b5f950f 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java
@@ -36,7 +36,6 @@ import com.google.inject.Provides;
*
*
* @author Adrian Cole
- * @see SQSAsyncApi
*/
@Beta
public interface SQSApi extends Closeable {
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java
index 4d6c7a5ac5..c9a9db4362 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java
@@ -25,8 +25,8 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
-import org.jclouds.sqs.config.SQSRestClientModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+import org.jclouds.sqs.config.SQSHttpApiModule;
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken;
@@ -37,33 +37,23 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
-public class SQSApiMetadata extends BaseRestApiMetadata {
+public class SQSApiMetadata extends BaseHttpApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SQSApi.class)} as
- * {@link SQSAsyncApi} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
- public Builder toBuilder() {
- return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
+ public Builder> toBuilder() {
+ return new ConcreteBuilder().fromApiMetadata(this);
}
- @SuppressWarnings("deprecation")
public SQSApiMetadata() {
- this(new Builder(SQSApi.class, SQSAsyncApi.class));
+ this(new ConcreteBuilder());
}
- protected SQSApiMetadata(Builder builder) {
+ protected SQSApiMetadata(Builder> builder) {
super(builder);
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(CREATE_QUEUE_MAX_RETRIES, "60");
properties.setProperty(CREATE_QUEUE_RETRY_INTERVAL, "1000");
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
@@ -71,10 +61,9 @@ public class SQSApiMetadata extends BaseRestApiMetadata {
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder {
+ public abstract static class Builder> extends BaseHttpApiMetadata.Builder {
- protected Builder(Class> api, Class> asyncApi) {
- super(api, asyncApi);
+ protected Builder() {
id("sqs")
.name("Amazon Simple Queue Service API")
.identityName("Access Key ID")
@@ -83,16 +72,18 @@ public class SQSApiMetadata extends BaseRestApiMetadata {
.defaultProperties(SQSApiMetadata.defaultProperties())
.defaultEndpoint("https://sqs.us-east-1.amazonaws.com")
.documentation(URI.create("http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference"))
- .defaultModules(ImmutableSet.>of(SQSRestClientModule.class));
+ .defaultModules(ImmutableSet.>of(SQSHttpApiModule.class));
}
@Override
public SQSApiMetadata build() {
return new SQSApiMetadata(this);
}
+ }
+ private static class ConcreteBuilder extends Builder {
@Override
- protected Builder self() {
+ protected ConcreteBuilder self() {
return this;
}
}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java
deleted file mode 100644
index b9abe89ed4..0000000000
--- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java
+++ /dev/null
@@ -1,84 +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.sqs;
-
-import java.io.Closeable;
-import java.net.URI;
-import java.util.Set;
-
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.Region;
-import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.sqs.features.MessageAsyncApi;
-import org.jclouds.sqs.features.PermissionAsyncApi;
-import org.jclouds.sqs.features.QueueAsyncApi;
-
-import com.google.common.annotations.Beta;
-import com.google.inject.Provides;
-
-/**
- * Provides access to SQS via REST API.
- *
- *
- * @see SQS
- * documentation
- * @author Adrian Cole
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SQSApi.class)} as
- * {@link SQSAsyncApi} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@Beta
-@RequestFilters(FormSigner.class)
-@VirtualHost
-public interface SQSAsyncApi extends Closeable {
- /**
- *
- * @return the Region codes configured
- */
- @Provides
- @Region
- Set getConfiguredRegions();
-
- /**
- * Provides asynchronous access to Queue features.
- */
- @Delegate
- QueueAsyncApi getQueueApi();
-
- @Delegate
- QueueAsyncApi getQueueApiForRegion(
- @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
-
- /**
- * Provides asynchronous access to Message features.
- */
- @Delegate
- MessageAsyncApi getMessageApiForQueue(@EndpointParam URI queue);
-
- /**
- * Provides asynchronous access to Permission features.
- */
- @Delegate
- PermissionAsyncApi getPermissionApiForQueue(@EndpointParam URI queue);
-
-}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/config/SQSRestClientModule.java b/apis/sqs/src/main/java/org/jclouds/sqs/config/SQSHttpApiModule.java
similarity index 73%
rename from apis/sqs/src/main/java/org/jclouds/sqs/config/SQSRestClientModule.java
rename to apis/sqs/src/main/java/org/jclouds/sqs/config/SQSHttpApiModule.java
index 69e16d5631..71a91fe6bf 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/config/SQSRestClientModule.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/config/SQSHttpApiModule.java
@@ -21,22 +21,18 @@ import static org.jclouds.reflect.Reflection2.typeToken;
import java.util.Map;
-import org.jclouds.aws.config.FormSigningRestClientModule;
+import org.jclouds.aws.config.FormSigningHttpApiModule;
import org.jclouds.aws.handlers.AWSServerErrorRetryHandler;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.sqs.SQSApi;
-import org.jclouds.sqs.SQSAsyncApi;
import org.jclouds.sqs.features.MessageApi;
-import org.jclouds.sqs.features.MessageAsyncApi;
import org.jclouds.sqs.features.PermissionApi;
-import org.jclouds.sqs.features.PermissionAsyncApi;
import org.jclouds.sqs.features.QueueApi;
-import org.jclouds.sqs.features.QueueAsyncApi;
import org.jclouds.sqs.handlers.ParseSQSErrorFromXmlContent;
import org.jclouds.sqs.handlers.SQSErrorRetryHandler;
@@ -47,16 +43,11 @@ import com.google.common.collect.ImmutableMap;
*
* @author Adrian Cole
*/
-@ConfiguresRestClient
-public class SQSRestClientModule extends FormSigningRestClientModule {
- public static final Map, Class>> DELEGATE_MAP = ImmutableMap., Class>> builder()//
- .put(QueueApi.class, QueueAsyncApi.class)
- .put(MessageApi.class, MessageAsyncApi.class)
- .put(PermissionApi.class, PermissionAsyncApi.class)
- .build();
+@ConfiguresHttpApi
+public class SQSHttpApiModule extends FormSigningHttpApiModule {
- public SQSRestClientModule() {
- super(typeToken(SQSApi.class), typeToken(SQSAsyncApi.class), DELEGATE_MAP);
+ public SQSHttpApiModule() {
+ super(SQSApi.class);
}
@Override
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageApi.java
index d8a4eee889..7cc529145f 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageApi.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageApi.java
@@ -16,12 +16,43 @@
*/
package org.jclouds.sqs.features;
+import static org.jclouds.sqs.reference.SQSParameters.ACTION;
+import static org.jclouds.sqs.reference.SQSParameters.VERSION;
+
import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.Constants;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.aws.filters.FormSigner;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.FormParams;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.VirtualHost;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.sqs.binders.BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams;
+import org.jclouds.sqs.binders.BindDeleteMessageBatchRequestEntryToIndexedFormParams;
+import org.jclouds.sqs.binders.BindSendMessageBatchRequestEntryToIndexedFormParams;
+import org.jclouds.sqs.binders.BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams;
import org.jclouds.sqs.domain.BatchResult;
import org.jclouds.sqs.domain.Message;
import org.jclouds.sqs.domain.MessageIdAndMD5;
import org.jclouds.sqs.options.ReceiveMessageOptions;
import org.jclouds.sqs.options.SendMessageOptions;
+import org.jclouds.sqs.xml.ChangeMessageVisibilityBatchResponseHandler;
+import org.jclouds.sqs.xml.DeleteMessageBatchResponseHandler;
+import org.jclouds.sqs.xml.MessageHandler;
+import org.jclouds.sqs.xml.ReceiveMessageResponseHandler;
+import org.jclouds.sqs.xml.RegexMessageIdAndMD5Handler;
+import org.jclouds.sqs.xml.SendMessageBatchResponseHandler;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Table;
@@ -30,9 +61,11 @@ import com.google.common.collect.Table;
* Provides access to SQS via their REST API.
*
*
- * @see MessageAsyncApi
* @author Adrian Cole
*/
+@RequestFilters(FormSigner.class)
+@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
+@VirtualHost
public interface MessageApi {
/**
@@ -67,7 +100,12 @@ public interface MessageApi {
* The receipt handle associated with the message you want to
* delete.
*/
- void delete(String receiptHandle);
+ @Named("DeleteMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "DeleteMessage")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void delete(@FormParam("ReceiptHandle") String receiptHandle);
/**
* Currently, you can send up to 10 {@link #delete} requests.
@@ -91,7 +129,13 @@ public interface MessageApi {
* @return result that contains success or errors of the operation
* @see #delete(String)
*/
- BatchResult delete(Map idReceiptHandle);
+ @Named("DeleteMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "DeleteMessageBatch")
+ @XMLResponseParser(DeleteMessageBatchResponseHandler.class)
+ BatchResult delete(
+ @BinderParam(BindDeleteMessageBatchRequestEntryToIndexedFormParams.class) Map idReceiptHandle);
/**
* Same as {@link #delete(Map)}, except that we generate numeric ids starting
@@ -101,7 +145,13 @@ public interface MessageApi {
* receipt handles to delete
* @see #delete(Map)
*/
- BatchResult delete(Iterable receiptHandles);
+ @Named("DeleteMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "DeleteMessageBatch")
+ @XMLResponseParser(DeleteMessageBatchResponseHandler.class)
+ BatchResult delete(
+ @BinderParam(BindDeleteMessageBatchRequestEntryToIndexedFormParams.class) Iterable receiptHandles);
/**
* The ChangeMessageVisibility action changes the visibility timeout of a
@@ -143,7 +193,12 @@ public interface MessageApi {
* The new value for the message's visibility timeout (in seconds)
* from 0 to 43200 (maximum 12 hours)
*/
- void changeVisibility(String receiptHandle, int visibilityTimeout);
+ @Named("ChangeMessageVisibility")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ChangeMessageVisibility")
+ void changeVisibility(@FormParam("ReceiptHandle") String receiptHandle,
+ @FormParam("VisibilityTimeout") int visibilityTimeout);
/**
* Currently, you can send up to 10 {@link #changeVisibility} requests.
@@ -168,7 +223,13 @@ public interface MessageApi {
* @return result that contains success or errors of the operation
* @see #changeVisibility(String, int)
*/
- BatchResult changeVisibility(Table idReceiptHandleVisibilityTimeout);
+ @Named("ChangeMessageVisibilityBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
+ @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
+ BatchResult changeVisibility(
+ @BinderParam(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class) Table idReceiptHandleVisibilityTimeout);
/**
* Same as {@link #changeVisibility(Table)}, except that we generate numeric
@@ -178,7 +239,13 @@ public interface MessageApi {
* receipt handle to visibility timeout
* @see #changeVisibility(Table)
*/
- BatchResult extends MessageIdAndMD5> changeVisibility(Map receiptHandleVisibilityTimeout);
+ @Named("ChangeMessageVisibilityBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
+ @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
+ BatchResult changeVisibility(
+ @BinderParam(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class) Map receiptHandleVisibilityTimeout);
/**
* Currently, you can send up to 10 {@link #changeVisibility} requests.
@@ -204,7 +271,15 @@ public interface MessageApi {
* @return result that contains success or errors of the operation
* @see #changeVisibility(String, int)
*/
- BatchResult changeVisibility(Map idReceiptHandle, int visibilityTimeout);
+ @Named("ChangeMessageVisibilityBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
+ @MapBinder(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class)
+ @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
+ BatchResult changeVisibility(
+ @PayloadParam("idReceiptHandle") Map idReceiptHandle,
+ @PayloadParam("visibilityTimeout") int visibilityTimeout);
/**
* Same as {@link #changeVisibility(Map, int)}, except that we generate
@@ -214,7 +289,15 @@ public interface MessageApi {
* receipt handles to change visibility
* @see #changeVisibility(Map, int)
*/
- BatchResult changeVisibility(Iterable receiptHandles, int visibilityTimeout);
+ @Named("ChangeMessageVisibilityBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
+ @MapBinder(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class)
+ @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
+ BatchResult changeVisibility(
+ @PayloadParam("receiptHandles") Iterable receiptHandles,
+ @PayloadParam("visibilityTimeout") int visibilityTimeout);
/**
* The SendMessage action delivers a message to the specified queue. The
@@ -238,7 +321,27 @@ public interface MessageApi {
* characters, see the preceding important note.
* @return id of the message and md5 of the content sent
*/
- MessageIdAndMD5 send(String message);
+ @Named("SendMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessage")
+ @ResponseParser(RegexMessageIdAndMD5Handler.class)
+ MessageIdAndMD5 send(@FormParam("MessageBody") String message);
+
+ /**
+ * same as {@link #sendMessage(URI, String)} except you can control options
+ * such as delay seconds.
+ *
+ * @param options
+ * options such as delay seconds
+ * @see #sendMessage(URI, String)
+ */
+ @Named("SendMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessage")
+ @ResponseParser(RegexMessageIdAndMD5Handler.class)
+ MessageIdAndMD5 send(@FormParam("MessageBody") String message, SendMessageOptions options);
/**
* Same as {@link #send(Map)} except you can set a delay for each message in
@@ -264,7 +367,14 @@ public interface MessageApi {
* @return result that contains success or errors of the operation
* @see #send(String, SendMessageOptions)
*/
- BatchResult extends MessageIdAndMD5> sendWithDelays(Table idMessageBodyDelaySeconds);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @ResponseParser(RegexMessageIdAndMD5Handler.class)
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> sendWithDelays(
+ @BinderParam(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class) Table idMessageBodyDelaySeconds);
/**
* Same as {@link #sendWithDelays(Table)}, except that we generate numeric
@@ -274,7 +384,14 @@ public interface MessageApi {
* message body to the delay desired
* @see #sendWithDelays(Table)
*/
- BatchResult extends MessageIdAndMD5> sendWithDelays(Map messageBodyDelaySeconds);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @ResponseParser(RegexMessageIdAndMD5Handler.class)
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> sendWithDelays(
+ @BinderParam(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class) Map messageBodyDelaySeconds);
/**
* Same as {@link #send(Map)} except you set a delay for all messages in the
@@ -287,7 +404,15 @@ public interface MessageApi {
*
* @see #send(String, SendMessageOptions)
*/
- BatchResult extends MessageIdAndMD5> sendWithDelay(Map idMessageBody, int delaySeconds);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @MapBinder(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class)
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> sendWithDelay(
+ @PayloadParam("idMessageBody") Map idMessageBody,
+ @PayloadParam("delaySeconds") int delaySeconds);
/**
* Same as {@link #sendWithDelay(Map, int)}, except that we generate numeric
@@ -297,7 +422,14 @@ public interface MessageApi {
* message bodies to send
* @see #sendWithDelay(Map, int)
*/
- BatchResult extends MessageIdAndMD5> sendWithDelay(Iterable messageBodies, int delaySeconds);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @MapBinder(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class)
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> sendWithDelay(
+ @PayloadParam("messageBodies") Iterable messageBodies, @PayloadParam("delaySeconds") int delaySeconds);
/**
* The SendMessageBatch action delivers up to ten messages to the specified
@@ -329,7 +461,13 @@ public interface MessageApi {
* @return result that contains success or errors of the operation
* @see #send(String)
*/
- BatchResult extends MessageIdAndMD5> send(Map idMessageBody);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> send(
+ @BinderParam(BindSendMessageBatchRequestEntryToIndexedFormParams.class) Map idMessageBody);
/**
* Same as {@link #send(Map)}, except that we generate numeric ids starting
@@ -339,17 +477,13 @@ public interface MessageApi {
* message bodies to send
* @see #send(Map)
*/
- BatchResult extends MessageIdAndMD5> send(Iterable messageBodies);
-
- /**
- * same as {@link #sendMessage(URI, String)} except you can control options
- * such as delay seconds.
- *
- * @param options
- * options such as delay seconds
- * @see #sendMessage(URI, String)
- */
- MessageIdAndMD5 send(String message, SendMessageOptions options);
+ @Named("SendMessageBatch")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SendMessageBatch")
+ @XMLResponseParser(SendMessageBatchResponseHandler.class)
+ BatchResult extends MessageIdAndMD5> send(
+ @BinderParam(BindSendMessageBatchRequestEntryToIndexedFormParams.class) Iterable messageBodies);
/**
* The ReceiveMessage action retrieves one or more messages from the
@@ -373,6 +507,11 @@ public interface MessageApi {
* from where you are receiving messages
* @return message including the receipt handle you can use to delete it
*/
+ @Named("ReceiveMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ReceiveMessage")
+ @XMLResponseParser(MessageHandler.class)
Message receive();
/**
@@ -386,6 +525,11 @@ public interface MessageApi {
* options such as VisibilityTimeout
* @see #receive(URI)
*/
+ @Named("ReceiveMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ReceiveMessage")
+ @XMLResponseParser(MessageHandler.class)
Message receive(ReceiveMessageOptions options);
/**
@@ -395,7 +539,12 @@ public interface MessageApi {
* maximum messages to receive, current limit is 10
* @see #receive(URI)
*/
- FluentIterable receive(int max);
+ @Named("ReceiveMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ReceiveMessage")
+ @XMLResponseParser(ReceiveMessageResponseHandler.class)
+ FluentIterable receive(@FormParam("MaxNumberOfMessages") int max);
/**
* same as {@link #receive(URI, int)} except you can provide options like
@@ -408,5 +557,12 @@ public interface MessageApi {
* options such as VisibilityTimeout
* @see #receive(URI, int)
*/
- FluentIterable receive(int max, ReceiveMessageOptions options);
+ @Named("ReceiveMessage")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ReceiveMessage")
+ @XMLResponseParser(ReceiveMessageResponseHandler.class)
+ FluentIterable receive(@FormParam("MaxNumberOfMessages") int max,
+ ReceiveMessageOptions options);
+
}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageAsyncApi.java
deleted file mode 100644
index ac96415339..0000000000
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/MessageAsyncApi.java
+++ /dev/null
@@ -1,294 +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.sqs.features;
-
-import static org.jclouds.sqs.reference.SQSParameters.ACTION;
-import static org.jclouds.sqs.reference.SQSParameters.VERSION;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.Constants;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.FormParams;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.sqs.binders.BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams;
-import org.jclouds.sqs.binders.BindDeleteMessageBatchRequestEntryToIndexedFormParams;
-import org.jclouds.sqs.binders.BindSendMessageBatchRequestEntryToIndexedFormParams;
-import org.jclouds.sqs.binders.BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams;
-import org.jclouds.sqs.domain.BatchResult;
-import org.jclouds.sqs.domain.Message;
-import org.jclouds.sqs.domain.MessageIdAndMD5;
-import org.jclouds.sqs.options.ReceiveMessageOptions;
-import org.jclouds.sqs.options.SendMessageOptions;
-import org.jclouds.sqs.xml.ChangeMessageVisibilityBatchResponseHandler;
-import org.jclouds.sqs.xml.DeleteMessageBatchResponseHandler;
-import org.jclouds.sqs.xml.MessageHandler;
-import org.jclouds.sqs.xml.ReceiveMessageResponseHandler;
-import org.jclouds.sqs.xml.RegexMessageIdAndMD5Handler;
-import org.jclouds.sqs.xml.SendMessageBatchResponseHandler;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Table;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to SQS via their REST API.
- *
- *
- * @author Adrian Cole
- */
-@RequestFilters(FormSigner.class)
-@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
-@VirtualHost
-public interface MessageAsyncApi {
-
- /**
- * @see MessageApi#delete(String)
- */
- @Named("DeleteMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DeleteMessage")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture delete(@FormParam("ReceiptHandle") String receiptHandle);
-
- /**
- * @see MessageApi#delete(Map)
- */
- @Named("DeleteMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DeleteMessageBatch")
- @XMLResponseParser(DeleteMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult> delete(
- @BinderParam(BindDeleteMessageBatchRequestEntryToIndexedFormParams.class) Map idReceiptHandle);
-
- /**
- * @see MessageApi#delete(Iterable)
- */
- @Named("DeleteMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DeleteMessageBatch")
- @XMLResponseParser(DeleteMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult> delete(
- @BinderParam(BindDeleteMessageBatchRequestEntryToIndexedFormParams.class) Iterable receiptHandles);
-
- /**
- * @see MessageApi#changeVisibility(String, int)
- */
- @Named("ChangeMessageVisibility")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ChangeMessageVisibility")
- ListenableFuture changeVisibility(@FormParam("ReceiptHandle") String receiptHandle,
- @FormParam("VisibilityTimeout") int visibilityTimeout);
-
- /**
- * @see MessageApi#changeVisibility(Table)
- */
- @Named("ChangeMessageVisibilityBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
- @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
- ListenableFuture extends BatchResult> changeVisibility(
- @BinderParam(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class) Table idReceiptHandleVisibilityTimeout);
-
- /**
- * @see MessageApi#changeVisibility(Map)
- */
- @Named("ChangeMessageVisibilityBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
- @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
- ListenableFuture extends BatchResult> changeVisibility(
- @BinderParam(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class) Map receiptHandleVisibilityTimeout);
-
- /**
- * @see MessageApi#changeVisibility(Map, int)
- */
- @Named("ChangeMessageVisibilityBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
- @MapBinder(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class)
- @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
- ListenableFuture extends BatchResult> changeVisibility(
- @PayloadParam("idReceiptHandle") Map idReceiptHandle,
- @PayloadParam("visibilityTimeout") int visibilityTimeout);
-
- /**
- * @see MessageApi#changeVisibility(Iterable, int)
- */
- @Named("ChangeMessageVisibilityBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ChangeMessageVisibilityBatch")
- @MapBinder(BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams.class)
- @XMLResponseParser(ChangeMessageVisibilityBatchResponseHandler.class)
- ListenableFuture extends BatchResult> changeVisibility(
- @PayloadParam("receiptHandles") Iterable receiptHandles,
- @PayloadParam("visibilityTimeout") int visibilityTimeout);
-
- /**
- * @see MessageApi#send(String)
- */
- @Named("SendMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessage")
- @ResponseParser(RegexMessageIdAndMD5Handler.class)
- ListenableFuture extends MessageIdAndMD5> send(@FormParam("MessageBody") String message);
-
- /**
- * @see MessageApi#send(String, SendMessageOptions)
- */
- @Named("SendMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessage")
- @ResponseParser(RegexMessageIdAndMD5Handler.class)
- ListenableFuture extends MessageIdAndMD5> send(@FormParam("MessageBody") String message, SendMessageOptions options);
-
- /**
- * @see MessageApi#sendWithDelays(Table)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @ResponseParser(RegexMessageIdAndMD5Handler.class)
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> sendWithDelays(
- @BinderParam(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class) Table idMessageBodyDelaySeconds);
-
- /**
- * @see MessageApi#sendWithDelays(Map)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @ResponseParser(RegexMessageIdAndMD5Handler.class)
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> sendWithDelays(
- @BinderParam(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class) Map messageBodyDelaySeconds);
-
- /**
- * @see MessageApi#sendWithDelay(Map, int)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @MapBinder(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class)
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> sendWithDelay(
- @PayloadParam("idMessageBody") Map idMessageBody,
- @PayloadParam("delaySeconds") int delaySeconds);
-
- /**
- * @see MessageApi#sendWithDelay(Iterable, int)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @MapBinder(BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams.class)
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> sendWithDelay(
- @PayloadParam("messageBodies") Iterable messageBodies, @PayloadParam("delaySeconds") int delaySeconds);
-
- /**
- * @see MessageApi#send(Map)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> send(
- @BinderParam(BindSendMessageBatchRequestEntryToIndexedFormParams.class) Map idMessageBody);
-
- /**
- * @see MessageApi#send(Iterable)
- */
- @Named("SendMessageBatch")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "SendMessageBatch")
- @XMLResponseParser(SendMessageBatchResponseHandler.class)
- ListenableFuture extends BatchResult extends MessageIdAndMD5>> send(
- @BinderParam(BindSendMessageBatchRequestEntryToIndexedFormParams.class) Iterable messageBodies);
-
- /**
- * @see MessageApi#receive()
- */
- @Named("ReceiveMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ReceiveMessage")
- @XMLResponseParser(MessageHandler.class)
- ListenableFuture receive();
-
- /**
- * @see MessageApi#receive(ReceiveMessageOptions)
- */
- @Named("ReceiveMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ReceiveMessage")
- @XMLResponseParser(MessageHandler.class)
- ListenableFuture extends Message> receive(ReceiveMessageOptions options);
-
- /**
- * @see MessageApi#receive(int)
- */
- @Named("ReceiveMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ReceiveMessage")
- @XMLResponseParser(ReceiveMessageResponseHandler.class)
- ListenableFuture extends FluentIterable extends Message>> receive(@FormParam("MaxNumberOfMessages") int max);
-
- /**
- * @see MessageApi#receive(int, ReceiveMessageOptions)
- */
- @Named("ReceiveMessage")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ReceiveMessage")
- @XMLResponseParser(ReceiveMessageResponseHandler.class)
- ListenableFuture extends FluentIterable extends Message>> receive(@FormParam("MaxNumberOfMessages") int max,
- ReceiveMessageOptions options);
-
-}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionApi.java
index 6ebd78134d..2d5787501a 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionApi.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionApi.java
@@ -16,15 +16,30 @@
*/
package org.jclouds.sqs.features;
+import static org.jclouds.sqs.reference.SQSParameters.ACTION;
+import static org.jclouds.sqs.reference.SQSParameters.VERSION;
+
+import javax.inject.Named;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.Constants;
+import org.jclouds.aws.filters.FormSigner;
+import org.jclouds.rest.annotations.FormParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.sqs.domain.Action;
/**
* Provides access to SQS via their REST API.
*
*
- * @see PermissionAsyncApi
* @author Adrian Cole
*/
+@RequestFilters(FormSigner.class)
+@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
+@VirtualHost
public interface PermissionApi {
/**
@@ -62,7 +77,12 @@ public interface PermissionApi {
* Constraints: Valid 12-digit AWS account number, without hyphens
*
*/
- void addPermissionToAccount(String label, Action permission, String accountId);
+ @Named("AddPermission")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "AddPermission")
+ void addPermissionToAccount(@FormParam("Label") String label,
+ @FormParam("ActionName.1") Action permission, @FormParam("AWSAccountId.1") String accountId);
/**
* The RemovePermission action revokes any permissions in the queue policy
@@ -76,6 +96,10 @@ public interface PermissionApi {
* The identification of the permission you want to remove. This is
* the label you added in AddPermission. example: AliceSendMessage
*/
- void remove(String label);
+ @Named("RemovePermission")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "RemovePermission")
+ void remove(@FormParam("Label") String label);
}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionAsyncApi.java
deleted file mode 100644
index c647b9518e..0000000000
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/PermissionAsyncApi.java
+++ /dev/null
@@ -1,66 +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.sqs.features;
-
-import static org.jclouds.sqs.reference.SQSParameters.ACTION;
-import static org.jclouds.sqs.reference.SQSParameters.VERSION;
-
-import javax.inject.Named;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.Constants;
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.rest.annotations.FormParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.sqs.domain.Action;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to SQS via their REST API.
- *
- *
- * @author Adrian Cole
- */
-@RequestFilters(FormSigner.class)
-@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
-@VirtualHost
-public interface PermissionAsyncApi {
-
- /**
- * @see PermissionApi#addPermissionToAccount
- */
- @Named("AddPermission")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "AddPermission")
- ListenableFuture addPermissionToAccount(@FormParam("Label") String label,
- @FormParam("ActionName.1") Action permission, @FormParam("AWSAccountId.1") String accountId);
-
- /**
- * @see PermissionApi#remove
- */
- @Named("RemovePermission")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "RemovePermission")
- ListenableFuture remove(@FormParam("Label") String label);
-
-}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueApi.java
index 3cfc926c0b..0e80783b48 100644
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueApi.java
+++ b/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueApi.java
@@ -16,11 +16,39 @@
*/
package org.jclouds.sqs.features;
+import static org.jclouds.sqs.reference.SQSParameters.ACTION;
+import static org.jclouds.sqs.reference.SQSParameters.VERSION;
+
import java.net.URI;
import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.Constants;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.aws.filters.FormSigner;
+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.ResponseParser;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.annotations.VirtualHost;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.sqs.binders.BindAttributeNamesToIndexedFormParams;
import org.jclouds.sqs.domain.QueueAttributes;
+import org.jclouds.sqs.functions.MapToQueueAttributes;
import org.jclouds.sqs.options.CreateQueueOptions;
import org.jclouds.sqs.options.ListQueuesOptions;
+import org.jclouds.sqs.xml.AttributesHandler;
+import org.jclouds.sqs.xml.RegexListQueuesResponseHandler;
+import org.jclouds.sqs.xml.RegexQueueHandler;
+import org.jclouds.sqs.xml.ValueHandler;
import com.google.common.collect.FluentIterable;
@@ -28,9 +56,11 @@ import com.google.common.collect.FluentIterable;
* Provides access to SQS via their REST API.
*
*
- * @see QueueAsyncApi
* @author Adrian Cole
*/
+@RequestFilters(FormSigner.class)
+@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
+@VirtualHost
public interface QueueApi {
/**
@@ -48,10 +78,20 @@ public interface QueueApi {
* "http://docs.amazonwebservices.com/AWSSimpleQueueService/2011-10-01/APIReference/Query_QueryListQueues.html"
* />
*/
+ @Named("ListQueues")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ListQueues")
+ @ResponseParser(RegexListQueuesResponseHandler.class)
FluentIterable list();
+ @Named("ListQueues")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "ListQueues")
+ @ResponseParser(RegexListQueuesResponseHandler.class)
FluentIterable list(ListQueuesOptions options);
-
+
/**
* The GetQueueUrl action returns the Uniform Resource Locater (URL) of a
* queue. This action provides a simple way to retrieve the URL of an SQS
@@ -61,7 +101,13 @@ public interface QueueApi {
* The name of an existing queue.
* @return uri of the queue or null if not found
*/
- URI get(String queueName);
+ @Named("GetQueueUrl")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "GetQueueUrl")
+ @ResponseParser(RegexQueueHandler.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ URI get(@FormParam("QueueName") String queueName);
/**
* like {@link #get(String)}, except specifying the owner of the queue.
@@ -73,7 +119,14 @@ public interface QueueApi {
* @param accountId
* @return The AWS account ID of the account that created the queue.
*/
- URI getInAccount(String queueName, String accountId);
+ @Named("GetQueueUrl")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "GetQueueUrl")
+ @ResponseParser(RegexQueueHandler.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ URI getInAccount(@FormParam("QueueName") String queueName,
+ @FormParam("QueueOwnerAWSAccountId") String accountId);
/**
* The CreateQueue action creates a new queue.
@@ -104,7 +157,12 @@ public interface QueueApi {
* characters; alphanumeric characters, hyphens (-), and
* underscores (_) are allowed.
*/
- URI create(String queueName);
+ @Named("CreateQueue")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "CreateQueue")
+ @ResponseParser(RegexQueueHandler.class)
+ URI create(@FormParam("QueueName") String queueName);
/**
* same as {@link #create(String, String)} except you can
@@ -114,7 +172,12 @@ public interface QueueApi {
* options such as delay seconds
* @see #create(String, String)
*/
- URI create(String queueName, CreateQueueOptions options);
+ @Named("CreateQueue")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "CreateQueue")
+ @ResponseParser(RegexQueueHandler.class)
+ URI create(@FormParam("QueueName") String queueName, CreateQueueOptions options);
/**
* The DeleteQueue action deletes the queue specified by the queue URL,
@@ -140,7 +203,12 @@ public interface QueueApi {
* @param queue
* queue you want to delete
*/
- void delete(URI queue);
+ @Named("DeleteQueue")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "DeleteQueue")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void delete(@EndpointParam URI queue);
/**
* returns all attributes of a queue.
@@ -148,7 +216,41 @@ public interface QueueApi {
* @param queue
* queue to get the attributes of
*/
- QueueAttributes getAttributes(URI queue);
+ @Named("GetQueueAttributes")
+ @POST
+ @Path("/")
+ @FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "All" })
+ @Transform(MapToQueueAttributes.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ @XMLResponseParser(AttributesHandler.class)
+ QueueAttributes getAttributes(@EndpointParam URI queue);
+
+ /**
+ * returns an attribute of a queue.
+ *
+ * @param queue
+ * queue to get the attributes of
+ */
+ @Named("GetQueueAttributes")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "GetQueueAttributes")
+ @XMLResponseParser(AttributesHandler.class)
+ Map getAttributes(@EndpointParam URI queue,
+ @BinderParam(BindAttributeNamesToIndexedFormParams.class) Iterable attributeNames);
+
+ /**
+ * returns an attribute of a queue.
+ *
+ * @param queue
+ * queue to get the attributes of
+ */
+ @Named("GetQueueAttributes")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "GetQueueAttributes")
+ @XMLResponseParser(ValueHandler.class)
+ String getAttribute(@EndpointParam URI queue, @FormParam("AttributeName.1") String attributeName);
/**
* The SetQueueAttributes action sets one attribute of a queue per request.
@@ -205,22 +307,11 @@ public interface QueueApi {
* DelaySeconds - An integer from 0 to 900 (15 minutes). The
* default for this attribute is 0.
*/
- void setAttribute(URI queue, String name, String value);
-
- /**
- * returns some attributes of a queue.
- *
- * @param queue
- * queue to get the attributes of
- */
- Map getAttributes(URI queue, Iterable attributeNames);
-
- /**
- * returns an attribute of a queue.
- *
- * @param queue
- * queue to get the attributes of
- */
- String getAttribute(URI queue, String attributeName);
+ @Named("SetQueueAttributes")
+ @POST
+ @Path("/")
+ @FormParams(keys = ACTION, values = "SetQueueAttributes")
+ void setAttribute(@EndpointParam URI queue, @FormParam("Attribute.Name") String name,
+ @FormParam("Attribute.Value") String value);
}
diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueAsyncApi.java
deleted file mode 100644
index 26d78c17a9..0000000000
--- a/apis/sqs/src/main/java/org/jclouds/sqs/features/QueueAsyncApi.java
+++ /dev/null
@@ -1,183 +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.sqs.features;
-
-import static org.jclouds.sqs.reference.SQSParameters.ACTION;
-import static org.jclouds.sqs.reference.SQSParameters.VERSION;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.Constants;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.aws.filters.FormSigner;
-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.ResponseParser;
-import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.sqs.binders.BindAttributeNamesToIndexedFormParams;
-import org.jclouds.sqs.domain.QueueAttributes;
-import org.jclouds.sqs.functions.MapToQueueAttributes;
-import org.jclouds.sqs.options.CreateQueueOptions;
-import org.jclouds.sqs.options.ListQueuesOptions;
-import org.jclouds.sqs.xml.AttributesHandler;
-import org.jclouds.sqs.xml.RegexListQueuesResponseHandler;
-import org.jclouds.sqs.xml.RegexQueueHandler;
-import org.jclouds.sqs.xml.ValueHandler;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to SQS via their REST API.
- *
- *
- * @author Adrian Cole
- */
-@RequestFilters(FormSigner.class)
-@FormParams(keys = VERSION, values = "{" + Constants.PROPERTY_API_VERSION + "}")
-@VirtualHost
-public interface QueueAsyncApi {
-
- /**
- * @see QueueApi#list
- */
- @Named("ListQueues")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ListQueues")
- @ResponseParser(RegexListQueuesResponseHandler.class)
- ListenableFuture> list();
-
- /**
- * @see QueueApi#list(ListQueuesOptions)
- */
- @Named("ListQueues")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "ListQueues")
- @ResponseParser(RegexListQueuesResponseHandler.class)
- ListenableFuture> list(ListQueuesOptions options);
-
- /**
- * @see QueueApi#get(String)
- */
- @Named("GetQueueUrl")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "GetQueueUrl")
- @ResponseParser(RegexQueueHandler.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture get(@FormParam("QueueName") String queueName);
-
- /**
- * @see QueueApi#getInAccount
- */
- @Named("GetQueueUrl")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "GetQueueUrl")
- @ResponseParser(RegexQueueHandler.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture getInAccount(@FormParam("QueueName") String queueName,
- @FormParam("QueueOwnerAWSAccountId") String accountId);
-
- /**
- * @see QueueApi#create
- */
- @Named("CreateQueue")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "CreateQueue")
- @ResponseParser(RegexQueueHandler.class)
- ListenableFuture create(@FormParam("QueueName") String queueName);
-
- /**
- * @see QueueApi#create
- */
- @Named("CreateQueue")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "CreateQueue")
- @ResponseParser(RegexQueueHandler.class)
- ListenableFuture create(@FormParam("QueueName") String queueName, CreateQueueOptions options);
-
- /**
- * @see QueueApi#delete
- */
- @Named("DeleteQueue")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "DeleteQueue")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture delete(@EndpointParam URI queue);
-
- /**
- * @see QueueApi#getAttributes(URI)
- */
- @Named("GetQueueAttributes")
- @POST
- @Path("/")
- @FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "All" })
- @Transform(MapToQueueAttributes.class)
- @Fallback(NullOnNotFoundOr404.class)
- @XMLResponseParser(AttributesHandler.class)
- ListenableFuture extends QueueAttributes> getAttributes(@EndpointParam URI queue);
-
- /**
- * @see QueueApi#getAttributes(URI, Iterable)
- */
- @Named("GetQueueAttributes")
- @POST
- @Path("/")
- @FormParams(keys = ACTION, values = "GetQueueAttributes")
- @XMLResponseParser(AttributesHandler.class)
- ListenableFuture