You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/08/02 16:58:03 UTC
[10/10] git commit: Remove async from glesys
Remove async from glesys
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/a14c03ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/a14c03ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/a14c03ba
Branch: refs/heads/master
Commit: a14c03ba0b6be2a0c1cb20374a0efdf1aee3f0a8
Parents: d4bf511
Author: Andrew Bayer <an...@gmail.com>
Authored: Fri Aug 2 07:57:30 2013 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Fri Aug 2 07:57:42 2013 -0700
----------------------------------------------------------------------
.../main/java/org/jclouds/glesys/GleSYSApi.java | 1 -
.../org/jclouds/glesys/GleSYSApiMetadata.java | 23 +-
.../java/org/jclouds/glesys/GleSYSAsyncApi.java | 71 -----
.../compute/GleSYSComputeServiceAdapter.java | 16 +-
.../glesys/config/GleSYSHttpApiModule.java | 65 +++++
.../glesys/config/GleSYSRestClientModule.java | 91 -------
.../org/jclouds/glesys/features/ArchiveApi.java | 64 ++++-
.../glesys/features/ArchiveAsyncApi.java | 121 ---------
.../org/jclouds/glesys/features/DomainApi.java | 78 +++++-
.../jclouds/glesys/features/DomainAsyncApi.java | 146 -----------
.../glesys/features/EmailAccountApi.java | 70 ++++-
.../glesys/features/EmailAccountAsyncApi.java | 135 ----------
.../java/org/jclouds/glesys/features/IpApi.java | 95 ++++++-
.../org/jclouds/glesys/features/IpAsyncApi.java | 162 ------------
.../org/jclouds/glesys/features/ServerApi.java | 173 ++++++++++--
.../jclouds/glesys/features/ServerAsyncApi.java | 262 -------------------
.../java/org/jclouds/glesys/GleSYSApiTest.java | 62 +++++
.../org/jclouds/glesys/GleSYSAsyncApiTest.java | 71 -----
.../glesys/features/ArchiveApiExpectTest.java | 2 +-
.../glesys/features/DomainApiExpectTest.java | 2 +-
.../glesys/features/ServerApiExpectTest.java | 4 +-
21 files changed, 559 insertions(+), 1155 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java
index 096b30b..d0e2c93 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java
@@ -29,7 +29,6 @@ import org.jclouds.rest.annotations.Delegate;
* Provides synchronous access to GleSYS.
* <p/>
*
- * @see GleSYSAsyncApi
* @see <a href="https://customer.glesys.com/api.php" />
* @author Adrian Cole
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java
index 8ffb57a..7259d74 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java
@@ -24,11 +24,10 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.glesys.compute.config.GleSYSComputeServiceContextModule;
-import org.jclouds.glesys.config.GleSYSRestClientModule;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.glesys.config.GleSYSHttpApiModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
@@ -36,17 +35,8 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
-public class GleSYSApiMetadata extends BaseRestApiMetadata {
+public class GleSYSApiMetadata extends BaseHttpApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GleSYSApi.class)} as
- * {@link GleSYSAsyncApi} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<GleSYSApi, GleSYSAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<GleSYSApi, GleSYSAsyncApi>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
@@ -61,17 +51,16 @@ public class GleSYSApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty("jclouds.ssh.max-retries", "5");
properties.setProperty("jclouds.ssh.retry-auth", "true");
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<GleSYSApi, Builder> {
@SuppressWarnings("deprecation")
protected Builder() {
- super(GleSYSApi.class, GleSYSAsyncApi.class);
id("glesys")
.name("GleSYS API")
.identityName("Username")
@@ -82,7 +71,7 @@ public class GleSYSApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://api.glesys.com")
.defaultProperties(GleSYSApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(GleSYSComputeServiceContextModule.class, GleSYSRestClientModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(GleSYSComputeServiceContextModule.class, GleSYSHttpApiModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java
deleted file mode 100644
index e93f40a..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java
+++ /dev/null
@@ -1,71 +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.glesys;
-
-import java.io.Closeable;
-
-import org.jclouds.glesys.features.ArchiveAsyncApi;
-import org.jclouds.glesys.features.DomainAsyncApi;
-import org.jclouds.glesys.features.EmailAccountAsyncApi;
-import org.jclouds.glesys.features.IpAsyncApi;
-import org.jclouds.glesys.features.ServerAsyncApi;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * Provides asynchronous access to GleSYS via their REST API.
- * <p/>
- *
- * @see GleSYSApi
- * @see <a href="https://customer.glesys.com/api.php" />
- * @author Adrian Cole
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GleSYSApi.class)} as
- * {@link GleSYSAsyncApi} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface GleSYSAsyncApi extends Closeable {
-
- /**
- * Provides asynchronous access to Server features.
- */
- @Delegate
- ServerAsyncApi getServerApi();
-
- /**
- * Provides asynchronous access to Ip Address features.
- */
- @Delegate
- IpAsyncApi getIpApi();
-
- /**
- * Provides asynchronous access to Archive features.
- */
- @Delegate
- ArchiveAsyncApi getArchiveApi();
-
- /**
- * Provides asynchronous access to DNS features.
- */
- @Delegate
- DomainAsyncApi getDomainApi();
-
- /**
- * Provides asynchronous access to E-Mail features.
- */
- @Delegate
- EmailAccountAsyncApi getEmailAccountApi();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java b/providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java
index 74669ef..9858595 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java
@@ -24,7 +24,6 @@ import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.find;
import static com.google.common.io.BaseEncoding.base16;
import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
-import static org.jclouds.concurrent.FutureIterables.transformParallel;
import static org.jclouds.util.Predicates2.retry;
import java.util.Map;
@@ -53,7 +52,6 @@ import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.glesys.GleSYSApi;
-import org.jclouds.glesys.GleSYSAsyncApi;
import org.jclouds.glesys.compute.options.GleSYSTemplateOptions;
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
import org.jclouds.glesys.domain.OSTemplate;
@@ -72,8 +70,6 @@ import com.google.common.base.Supplier;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
/**
@@ -89,17 +85,15 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
protected Logger logger = Logger.NULL;
private final GleSYSApi api;
- private final GleSYSAsyncApi aapi;
private final ListeningExecutorService userExecutor;
private final Timeouts timeouts;
private final Supplier<Set<? extends Location>> locations;
@Inject
- public GleSYSComputeServiceAdapter(GleSYSApi api, GleSYSAsyncApi aapi,
+ public GleSYSComputeServiceAdapter(GleSYSApi api,
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Timeouts timeouts,
@Memoized Supplier<Set<? extends Location>> locations) {
this.api = checkNotNull(api, "api");
- this.aapi = checkNotNull(aapi, "aapi");
this.userExecutor = checkNotNull(userExecutor, "userExecutor");
this.timeouts = checkNotNull(timeouts, "timeouts");
this.locations = checkNotNull(locations, "locations");
@@ -210,11 +204,11 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
@Override
public Iterable<ServerDetails> listNodes() {
- return transformParallel(api.getServerApi().list(), new Function<Server, ListenableFuture<? extends ServerDetails>>() {
- public ListenableFuture<ServerDetails> apply(Server from) {
- return aapi.getServerApi().get(from.getId());
+ return api.getServerApi().list().transform(new Function<Server, ServerDetails>() {
+ public ServerDetails apply(Server from) {
+ return api.getServerApi().get(from.getId());
}
- }, userExecutor, null, logger, "server details");
+ });
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
new file mode 100644
index 0000000..9e4764a
--- /dev/null
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
@@ -0,0 +1,65 @@
+/*
+ * 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.glesys.config;
+
+import org.jclouds.glesys.GleSYSApi;
+import org.jclouds.glesys.handlers.GleSYSErrorHandler;
+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.http.handlers.BackoffLimitedRetryHandler;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
+import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.inject.Scopes;
+
+/**
+ * Configures the GleSYS connection.
+ *
+ * @author Adrian Cole
+ */
+@ConfiguresRestClient
+public class GleSYSHttpApiModule extends HttpApiModule<GleSYSApi> {
+
+ @Override
+ protected void configure() {
+ install(new GleSYSParserModule());
+ super.configure();
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GleSYSErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GleSYSErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GleSYSErrorHandler.class);
+ }
+
+ @Override
+ protected void bindRetryHandlers() {
+ bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSRestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSRestClientModule.java b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSRestClientModule.java
deleted file mode 100644
index 82f9760..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSRestClientModule.java
+++ /dev/null
@@ -1,91 +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.glesys.config;
-
-import java.util.Map;
-
-import org.jclouds.glesys.GleSYSApi;
-import org.jclouds.glesys.GleSYSAsyncApi;
-import org.jclouds.glesys.features.ArchiveApi;
-import org.jclouds.glesys.features.ArchiveAsyncApi;
-import org.jclouds.glesys.features.DomainApi;
-import org.jclouds.glesys.features.DomainAsyncApi;
-import org.jclouds.glesys.features.EmailAccountApi;
-import org.jclouds.glesys.features.EmailAccountAsyncApi;
-import org.jclouds.glesys.features.IpApi;
-import org.jclouds.glesys.features.IpAsyncApi;
-import org.jclouds.glesys.features.ServerApi;
-import org.jclouds.glesys.features.ServerAsyncApi;
-import org.jclouds.glesys.handlers.GleSYSErrorHandler;
-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.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Scopes;
-
-/**
- * Configures the GleSYS connection.
- *
- * @author Adrian Cole
- */
-@ConfiguresRestClient
-public class GleSYSRestClientModule extends RestClientModule<GleSYSApi, GleSYSAsyncApi> {
-
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
- .put(ServerApi.class, ServerAsyncApi.class)//
- .put(IpApi.class, IpAsyncApi.class)//
- .put(ArchiveApi.class, ArchiveAsyncApi.class)//
- .put(DomainApi.class, DomainAsyncApi.class)//
- .put(EmailAccountApi.class, EmailAccountAsyncApi.class)//
- .build();
-
- public GleSYSRestClientModule() {
- super(DELEGATE_MAP);
- }
-
- @Override
- protected void configure() {
- install(new GleSYSParserModule());
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GleSYSErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GleSYSErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GleSYSErrorHandler.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveApi.java
index e441918..34ce600 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveApi.java
@@ -16,8 +16,21 @@
*/
package org.jclouds.glesys.features;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
import org.jclouds.glesys.domain.Archive;
import org.jclouds.glesys.domain.ArchiveAllowedArguments;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
import com.google.common.collect.FluentIterable;
@@ -26,14 +39,20 @@ import com.google.common.collect.FluentIterable;
* <p/>
*
* @author Adam Lowe
- * @see ArchiveAsyncApi
* @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
*/
+@RequestFilters(BasicAuthentication.class)
public interface ArchiveApi {
/**
* Lists all active disks on this account.
*/
+ @Named("archive:list")
+ @POST
+ @Path("/archive/list/format/json")
+ @SelectJson("archives")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
FluentIterable<Archive> list();
/**
@@ -42,24 +61,39 @@ public interface ArchiveApi {
* @param username the username associated with the archive
* @return the archive information or null if not found
*/
- Archive get(String username);
+ @Named("archive:details")
+ @POST
+ @Path("/archive/details/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Archive get(@FormParam("username") String username);
/**
* Create a new backup volume.
*
- * @param username the archive username, this must be prefixed by Glesys account name (in lower case) and an
+ * @param username the archive username, this must be prefixed by Glesys account name (in lower case) and an
* underscore, ex. "c100005_archive1"
* @param password the new password
* @param size the new size required in GB
*/
- Archive createWithCredentialsAndSize(String username, String password, int size);
+ @Named("archive:create")
+ @POST
+ @Path("/archive/create/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Archive createWithCredentialsAndSize(@FormParam("username") String username, @FormParam("password") String password,
+ @FormParam("size")int size);
/**
* Delete an archive volume. All files on the volume
*
* @param username the username associated with the archive
*/
- void delete(String username);
+ @Named("archive:delete")
+ @POST
+ @Path("/archive/delete/format/json")
+ void delete(@FormParam("username") String username);
/**
* Resize an archive volume. It is only possible to upgrade the size of the disk. Downgrading is currently not
@@ -69,7 +103,12 @@ public interface ArchiveApi {
* @param username the username associated with the archive
* @param size the new size required, see #getAllowedArguments for valid values
*/
- Archive resize(String username, int size);
+ @Named("archive:resize")
+ @POST
+ @Path("/archive/resize/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Archive resize(@FormParam("username") String username, @FormParam("size") int size);
/**
* Change the password for an archive user.
@@ -77,11 +116,22 @@ public interface ArchiveApi {
* @param username the archive username
* @param password the new password
*/
- Archive changePassword(String username, String password);
+ @Named("archive:changepassword")
+ @POST
+ @Path("/archive/changepassword/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Archive changePassword(@FormParam("username") String username, @FormParam("password") String password);
/**
* Lists the allowed arguments for some of the functions in this module such as archive size.
*/
+ @Named("archive:allowedarguments")
+ @GET
+ @Path("/archive/allowedarguments/format/json")
+ @SelectJson("argumentslist")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
ArchiveAllowedArguments getAllowedArguments();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveAsyncApi.java
deleted file mode 100644
index 42fde23..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/ArchiveAsyncApi.java
+++ /dev/null
@@ -1,121 +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.glesys.features;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.glesys.domain.Archive;
-import org.jclouds.glesys.domain.ArchiveAllowedArguments;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Archive data via the Glesys REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see ArchiveApi
- * @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
- */
-@RequestFilters(BasicAuthentication.class)
-public interface ArchiveAsyncApi {
-
- /**
- * @see ArchiveApi#list
- */
- @Named("archive:list")
- @POST
- @Path("/archive/list/format/json")
- @SelectJson("archives")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<Archive>> list();
-
- /**
- * @see ArchiveApi#get
- */
- @Named("archive:details")
- @POST
- @Path("/archive/details/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Archive> get(@FormParam("username") String username);
-
- /**
- * @see ArchiveApi#createWithCredentialsAndSize
- */
- @Named("archive:create")
- @POST
- @Path("/archive/create/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Archive> createWithCredentialsAndSize(@FormParam("username") String username, @FormParam("password") String password,
- @FormParam("size")int size);
-
- /**
- * @see ArchiveApi#delete
- */
- @Named("archive:delete")
- @POST
- @Path("/archive/delete/format/json")
- ListenableFuture<Void> delete(@FormParam("username") String username);
-
- /**
- * @see ArchiveApi#resize
- */
- @Named("archive:resize")
- @POST
- @Path("/archive/resize/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Archive> resize(@FormParam("username") String username, @FormParam("size") int size);
- /**
- * @see ArchiveApi#changePassword
- */
- @Named("archive:changepassword")
- @POST
- @Path("/archive/changepassword/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Archive> changePassword(@FormParam("username") String username, @FormParam("password") String password);
-
- /**
- * @see org.jclouds.glesys.features.ArchiveApi#getAllowedArguments
- */
- @Named("archive:allowedarguments")
- @GET
- @Path("/archive/allowedarguments/format/json")
- @SelectJson("argumentslist")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ArchiveAllowedArguments> getAllowedArguments();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainApi.java
index 88598ee..208bf1b 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainApi.java
@@ -17,12 +17,25 @@
package org.jclouds.glesys.features;
import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
import org.jclouds.glesys.domain.Domain;
import org.jclouds.glesys.domain.DomainRecord;
import org.jclouds.glesys.options.AddDomainOptions;
import org.jclouds.glesys.options.AddRecordOptions;
import org.jclouds.glesys.options.DomainOptions;
import org.jclouds.glesys.options.UpdateRecordOptions;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
import com.google.common.collect.FluentIterable;
@@ -31,9 +44,9 @@ import com.google.common.collect.FluentIterable;
* <p/>
*
* @author Adam Lowe
- * @see DomainAsyncApi
* @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
*/
+@RequestFilters(BasicAuthentication.class)
public interface DomainApi {
/**
@@ -41,6 +54,12 @@ public interface DomainApi {
*
* @return an account's associated domain objects.
*/
+ @Named("domain:list")
+ @POST
+ @Path("/domain/list/format/json")
+ @SelectJson("domains")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
FluentIterable<Domain> list();
/**
@@ -48,16 +67,27 @@ public interface DomainApi {
*
* @return the requested domain object.
*/
- Domain get(String domain);
+ @Named("domain:details")
+ @POST
+ @Path("/domain/details/format/json")
+ @SelectJson("domain")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Domain get(@FormParam("domainname") String name);
/**
* Add a domain to the Glesys dns-system
*
- * @param domain the name of the domain to add.
+ * @param name the name of the domain to add.
* @param options optional parameters
* @return information about the added domain
*/
- Domain create(String domain, AddDomainOptions... options);
+ @Named("domain:add")
+ @POST
+ @Path("/domain/add/format/json")
+ @SelectJson("domain")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Domain create(@FormParam("domainname") String name, AddDomainOptions... options);
/**
* Update a domain to the Glesys dns-system
@@ -66,21 +96,34 @@ public interface DomainApi {
* @param options optional parameters
* @return information about the modified domain
*/
- Domain update(String domain, DomainOptions options);
+ @Named("domain:edit")
+ @POST
+ @Path("/domain/edit/format/json")
+ @SelectJson("domain")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Domain update(@FormParam("domainname") String domain, DomainOptions options);
/**
* Remove a domain to the Glesys dns-system
*
* @param domain the name of the domain to remove
*/
- void delete(String domain);
+ @Named("domain:delete")
+ @POST
+ @Path("/domain/delete/format/json")
+ void delete(@FormParam("domainname") String domain);
/**
* Retrieve the DNS records for a given domain
*
* @param domain the name of the domain to retrieve records for
*/
- Set<DomainRecord> listRecords(String domain);
+ @Named("domain:listrecords")
+ @POST
+ @Path("/domain/listrecords/format/json")
+ @SelectJson("records")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Set<DomainRecord> listRecords(@FormParam("domainname") String domain);
/**
* Add a DNS Record
@@ -88,7 +131,14 @@ public interface DomainApi {
* @param domain the domain to add the record to
* @param options optional settings for the record
*/
- DomainRecord createRecord(String domain, String host, String type, String data, AddRecordOptions... options);
+ @Named("domain:addrecord")
+ @POST
+ @Path("/domain/addrecord/format/json")
+ @SelectJson("record")
+ @Consumes(MediaType.APPLICATION_JSON)
+ DomainRecord createRecord(@FormParam("domainname") String domain, @FormParam("host") String host,
+ @FormParam("type") String type, @FormParam("data") String data,
+ AddRecordOptions... options);
/**
* Modify a specific DNS Record
@@ -97,7 +147,12 @@ public interface DomainApi {
* @param options the settings to change
* @see #listRecords to retrieve the necessary ids
*/
- DomainRecord updateRecord(String recordId, UpdateRecordOptions options);
+ @Named("domain:updaterecord")
+ @POST
+ @Path("/domain/updaterecord/format/json")
+ @SelectJson("record")
+ @Consumes(MediaType.APPLICATION_JSON)
+ DomainRecord updateRecord(@FormParam("recordid") String recordId, UpdateRecordOptions options);
/**
* Delete a DNS record
@@ -105,6 +160,9 @@ public interface DomainApi {
* @param recordId the id for the record to delete
* @see #listRecords to retrieve the necessary ids
*/
- void deleteRecord(String recordId);
+ @Named("domain:deleterecord")
+ @POST
+ @Path("/domain/deleterecord/format/json")
+ void deleteRecord(@FormParam("recordid") String recordId);
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainAsyncApi.java
deleted file mode 100644
index 16b0a17..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/DomainAsyncApi.java
+++ /dev/null
@@ -1,146 +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.glesys.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.glesys.domain.Domain;
-import org.jclouds.glesys.domain.DomainRecord;
-import org.jclouds.glesys.options.AddDomainOptions;
-import org.jclouds.glesys.options.AddRecordOptions;
-import org.jclouds.glesys.options.DomainOptions;
-import org.jclouds.glesys.options.UpdateRecordOptions;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Domain (DNS) data via the Glesys REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see DomainApi
- * @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
- */
-@RequestFilters(BasicAuthentication.class)
-public interface DomainAsyncApi {
-
- /**
- * @see org.jclouds.glesys.features.DomainApi#list
- */
- @Named("domain:list")
- @POST
- @Path("/domain/list/format/json")
- @SelectJson("domains")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<Domain>> list();
-
- /**
- * @see org.jclouds.glesys.features.DomainApi#get
- */
- @Named("domain:details")
- @POST
- @Path("/domain/details/format/json")
- @SelectJson("domain")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Domain> get(@FormParam("domainname") String name);
-
- /**
- * @see DomainApi#create
- */
- @Named("domain:add")
- @POST
- @Path("/domain/add/format/json")
- @SelectJson("domain")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Domain> create(@FormParam("domainname") String name, AddDomainOptions... options);
-
- /**
- * @see DomainApi#update
- */
- @Named("domain:edit")
- @POST
- @Path("/domain/edit/format/json")
- @SelectJson("domain")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Domain> update(@FormParam("domainname") String domain, DomainOptions options);
-
-
- /**
- * @see DomainApi#delete
- */
- @Named("domain:delete")
- @POST
- @Path("/domain/delete/format/json")
- ListenableFuture<Void> delete(@FormParam("domainname") String domain);
-
- /**
- * @see DomainApi#listRecords
- */
- @Named("domain:listrecords")
- @POST
- @Path("/domain/listrecords/format/json")
- @SelectJson("records")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Set<DomainRecord>> listRecords(@FormParam("domainname") String domain);
-
- /**
- * @see DomainApi#createRecord
- */
- @Named("domain:addrecord")
- @POST
- @Path("/domain/addrecord/format/json")
- @SelectJson("record")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<DomainRecord> createRecord(@FormParam("domainname") String domain, @FormParam("host") String host,
- @FormParam("type") String type, @FormParam("data") String data,
- AddRecordOptions... options);
-
- /**
- * @see DomainApi#updateRecord
- */
- @Named("domain:updaterecord")
- @POST
- @Path("/domain/updaterecord/format/json")
- @SelectJson("record")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<DomainRecord> updateRecord(@FormParam("recordid") String record_id, UpdateRecordOptions options);
-
- /**
- * @see DomainApi#deleteRecord
- */
- @Named("domain:deleterecord")
- @POST
- @Path("/domain/deleterecord/format/json")
- ListenableFuture<Void> deleteRecord(@FormParam("recordid") String recordId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountApi.java
index b6d0470..de28af3 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountApi.java
@@ -16,11 +16,23 @@
*/
package org.jclouds.glesys.features;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
import org.jclouds.glesys.domain.EmailAccount;
import org.jclouds.glesys.domain.EmailAlias;
import org.jclouds.glesys.domain.EmailOverview;
import org.jclouds.glesys.options.CreateAccountOptions;
import org.jclouds.glesys.options.UpdateAccountOptions;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
import com.google.common.collect.FluentIterable;
@@ -29,9 +41,9 @@ import com.google.common.collect.FluentIterable;
* <p/>
*
* @author Adam Lowe
- * @see org.jclouds.glesys.features.EmailAccountAsyncApi
* @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
*/
+@RequestFilters(BasicAuthentication.class)
public interface EmailAccountApi {
/**
@@ -39,6 +51,12 @@ public interface EmailAccountApi {
*
* @return the relevant summary data
*/
+ @Named("email:overview")
+ @POST
+ @Path("/email/overview/format/json")
+ @SelectJson("overview")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
EmailOverview getOverview();
/**
@@ -46,14 +64,26 @@ public interface EmailAccountApi {
*
* @return the relevant set of details
*/
- FluentIterable<EmailAccount> listDomain(String domain);
+ @Named("email:list:accounts")
+ @POST
+ @Path("/email/list/format/json")
+ @SelectJson("emailaccounts")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+ FluentIterable<EmailAccount> listDomain(@FormParam("domainname") String domain);
/**
* Get the set of details about e-mail aliases
*
* @return the relevant set of details
*/
- FluentIterable<EmailAlias> listAliasesInDomain(String domain);
+ @Named("email:list:aliases")
+ @POST
+ @Path("/email/list/format/json")
+ @SelectJson("emailaliases")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+ FluentIterable<EmailAlias> listAliasesInDomain(@FormParam("domainname") String domain);
/**
* Create a new e-mail account
@@ -63,7 +93,12 @@ public interface EmailAccountApi {
* @param options optional parameters
* @see DomainApi#create
*/
- EmailAccount createWithPassword(String accountAddress, String password, CreateAccountOptions... options);
+ @Named("email:createaccount")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("emailaccount")
+ @Path("/email/createaccount/format/json")
+ EmailAccount createWithPassword(@FormParam("emailaccount") String accountAddress, @FormParam("password") String password, CreateAccountOptions... options);
/**
* Create an e-mail alias for an e-mail account
@@ -72,7 +107,12 @@ public interface EmailAccountApi {
* @param toEmailAddress the existing e-mail account address the alias should forward to
* @see DomainApi#create
*/
- EmailAlias createAlias(String aliasAddress, String toEmailAddress);
+ @Named("email:createalias")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("alias")
+ @Path("/email/createalias/format/json")
+ EmailAlias createAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
/**
* Adjust an e-mail account's settings
@@ -80,7 +120,12 @@ public interface EmailAccountApi {
* @param accountAddress the existing e-mail account address
* @param options optional parameters
*/
- EmailAccount update(String accountAddress, UpdateAccountOptions... options);
+ @Named("email:editaccount")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("emailaccount")
+ @Path("/email/editaccount/format/json")
+ EmailAccount update(@FormParam("emailaccount") String accountAddress, UpdateAccountOptions... options);
/**
* Adjust (re-target) an e-mail alias
@@ -88,13 +133,22 @@ public interface EmailAccountApi {
* @param aliasAddress the existing alias e-mail address
* @param toEmailAddress the existing e-mail account address the alias should forward to
*/
- EmailAlias updateAlias(String aliasAddress, String toEmailAddress);
+ @Named("email:editalias")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("alias")
+ @Path("/email/editalias/format/json")
+ EmailAlias updateAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
/**
* Delete an e-mail account or alias
*
* @param accountAddress the existing alias e-mail account or alias address
*/
- boolean delete(String accountAddress);
+ @Named("email:delete")
+ @POST
+ @Path("/email/delete/format/json")
+ @Fallback(Fallbacks.TrueOnNotFoundOr404.class)
+ boolean delete(@FormParam("email") String accountAddress);
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountAsyncApi.java
deleted file mode 100644
index 578e727..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/EmailAccountAsyncApi.java
+++ /dev/null
@@ -1,135 +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.glesys.features;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
-import org.jclouds.glesys.domain.EmailAccount;
-import org.jclouds.glesys.domain.EmailAlias;
-import org.jclouds.glesys.domain.EmailOverview;
-import org.jclouds.glesys.options.CreateAccountOptions;
-import org.jclouds.glesys.options.UpdateAccountOptions;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to E-Mail data via the Glesys REST API.
- * <p/>
- *
- * @author Adam Lowe
- * @see org.jclouds.glesys.features.EmailAccountApi
- * @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
- */
-@RequestFilters(BasicAuthentication.class)
-public interface EmailAccountAsyncApi {
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#getOverview
- */
- @Named("email:overview")
- @POST
- @Path("/email/overview/format/json")
- @SelectJson("overview")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<EmailOverview> getOverview();
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#listDomain
- */
- @Named("email:list:accounts")
- @POST
- @Path("/email/list/format/json")
- @SelectJson("emailaccounts")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<EmailAccount>> listDomain(@FormParam("domainname") String domain);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#listAliasesInDomain
- */
- @Named("email:list:aliases")
- @POST
- @Path("/email/list/format/json")
- @SelectJson("emailaliases")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<EmailAlias>> listAliasesInDomain(@FormParam("domainname") String domain);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#createWithPassword
- */
- @Named("email:createaccount")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("emailaccount")
- @Path("/email/createaccount/format/json")
- ListenableFuture<EmailAccount> createWithPassword(@FormParam("emailaccount") String accountAddress, @FormParam("password") String password, CreateAccountOptions... options);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#createAlias
- */
- @Named("email:createalias")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("alias")
- @Path("/email/createalias/format/json")
- ListenableFuture<EmailAlias> createAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#update
- */
- @Named("email:editaccount")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("emailaccount")
- @Path("/email/editaccount/format/json")
- ListenableFuture<EmailAccount> update(@FormParam("emailaccount") String accountAddress, UpdateAccountOptions... options);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#updateAlias
- */
- @Named("email:editalias")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("alias")
- @Path("/email/editalias/format/json")
- ListenableFuture<EmailAlias> updateAlias(@FormParam("emailalias") String aliasAddress, @FormParam("goto") String toEmailAddress);
-
- /**
- * @see org.jclouds.glesys.features.EmailAccountApi#delete
- */
- @Named("email:delete")
- @POST
- @Path("/email/delete/format/json")
- @Fallback(TrueOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@FormParam("email") String accountAddress);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/IpApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/IpApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/IpApi.java
index 7f2a955..062d93c 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/IpApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/features/IpApi.java
@@ -16,8 +16,23 @@
*/
package org.jclouds.glesys.features;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
import org.jclouds.glesys.domain.IpDetails;
import org.jclouds.glesys.options.ListIpOptions;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.FormParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
import com.google.common.collect.FluentIterable;
@@ -26,9 +41,9 @@ import com.google.common.collect.FluentIterable;
* <p/>
*
* @author Adrian Cole, Mattias Holmqvist, Adam Lowe
- * @see IpAsyncApi
* @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
*/
+@RequestFilters(BasicAuthentication.class)
public interface IpApi {
/**
* Get a set of all IP addresses that are available and not used on any account or server.
@@ -38,7 +53,15 @@ public interface IpApi {
* @param platform the platform
* @return a set of free IP addresses
*/
- FluentIterable<String> listFree(int ipVersion, String datacenter, String platform);
+ @Named("ip:listfree")
+ @GET
+ @Path("/ip/listfree/ipversion/{ipversion}/datacenter/{datacenter}/platform/{platform}/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("ipaddresses")
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+ FluentIterable<String> listFree(@PathParam("ipversion") int ipVersion,
+ @PathParam("datacenter") String datacenter,
+ @PathParam("platform") String platform);
/**
* Take a free IP address and add it to this account. You can list free IP addresses with the function listFree().
@@ -46,7 +69,12 @@ public interface IpApi {
*
* @param ipAddress the IP address to be add to this account (reserve)
*/
- IpDetails take(String ipAddress);
+ @Named("ip:take")
+ @POST
+ @Path("/ip/take/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails take(@FormParam("ipaddress") String ipAddress);
/**
* Return an unused IP address to the pool of free ips. If the IP address is allocated to a server,
@@ -54,7 +82,12 @@ public interface IpApi {
*
* @param ipAddress the IP address to be released
*/
- IpDetails release(String ipAddress);
+ @Named("ip:release")
+ @POST
+ @Path("/ip/release/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails release(@FormParam("ipaddress") String ipAddress);
/**
* Get IP addresses associated with your account (reserved, assigned to servers, etc)
@@ -62,6 +95,12 @@ public interface IpApi {
* @param options options to filter the results (by IPV4/6, serverId, etc)
* @return the set of IP addresses
*/
+ @Named("ip:listown")
+ @GET
+ @Path("/ip/listown/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @SelectJson("iplist")
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
FluentIterable<IpDetails> list(ListIpOptions... options);
/**
@@ -71,7 +110,13 @@ public interface IpApi {
* @param ipAddress the ip address
* @return details about the given IP address
*/
- IpDetails get(String ipAddress);
+ @Named("ip:details")
+ @GET
+ @Path("/ip/details/ipaddress/{ipaddress}/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ IpDetails get(@PathParam("ipaddress") String ipAddress);
/**
* Add an IP address to an server. The IP has to be free, but reserved to this account. You are able to list such addresses
@@ -82,7 +127,13 @@ public interface IpApi {
* @param ipAddress the IP address to remove
* @param serverId the server to add the IP address to
*/
- IpDetails addToServer(String ipAddress, String serverId);
+ @Named("ip:add")
+ @POST
+ @Path("/ip/add/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails addToServer(@FormParam("ipaddress") String ipAddress,
+ @FormParam("serverid") String serverId);
/**
* Remove an IP address from a server. This does not release it back to GleSYS pool of free ips. The address will be
@@ -93,7 +144,13 @@ public interface IpApi {
* @param serverId the server to remove the IP address from
* @see #removeFromServerAndRelease
*/
- IpDetails removeFromServer(String ipAddress, String serverId);
+ @Named("ip:remove")
+ @POST
+ @Path("/ip/remove/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails removeFromServer(@FormParam("ipaddress") String ipAddress,
+ @FormParam("serverid") String serverId);
/**
* Remove an IP address from a server and release it back to GleSYS pool of free ips.
@@ -102,16 +159,34 @@ public interface IpApi {
* @param serverId the server to remove the IP address from
* @see #removeFromServer
*/
- IpDetails removeFromServerAndRelease(String ipAddress, String serverId);
+ @Named("ip:remove:release")
+ @POST
+ @FormParams(keys = "release", values = "true")
+ @Path("/ip/remove/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails removeFromServerAndRelease(@FormParam("ipaddress") String ipAddress,
+ @FormParam("serverid") String serverId);
/**
* Sets PTR data for an IP. Use ip/listown or ip/details to get current PTR data
*/
- IpDetails setPtr(String ipAddress, String ptr);
+ @Named("ip:setptr")
+ @POST
+ @Path("/ip/setptr/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails setPtr(@FormParam("ipaddress") String ipAddress,
+ @FormParam("data") String ptr);
/**
* Resets PTR data for an IP back to the default value
*/
- IpDetails resetPtr(String ipAddress);
+ @Named("ip:resetptr")
+ @POST
+ @Path("/ip/resetptr/format/json")
+ @SelectJson("details")
+ @Consumes(MediaType.APPLICATION_JSON)
+ IpDetails resetPtr(@FormParam("ipaddress") String ipAddress);
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/IpAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/IpAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/IpAsyncApi.java
deleted file mode 100644
index 42e033b..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/IpAsyncApi.java
+++ /dev/null
@@ -1,162 +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.glesys.features;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.glesys.domain.IpDetails;
-import org.jclouds.glesys.options.ListIpOptions;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.FormParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to IP Addresses via their REST API.
- * <p/>
- *
- * @author Adrian Cole, Mattias Holmqvist, Adam Lowe
- * @see IpApi
- * @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
- */
-@RequestFilters(BasicAuthentication.class)
-public interface IpAsyncApi {
- /**
- * @see IpApi#listFree
- */
- @Named("ip:listfree")
- @GET
- @Path("/ip/listfree/ipversion/{ipversion}/datacenter/{datacenter}/platform/{platform}/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("ipaddresses")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<String>> listFree(@PathParam("ipversion") int ipversion,
- @PathParam("datacenter") String datacenter,
- @PathParam("platform") String platform);
-
- /**
- * @see IpApi#take
- */
- @Named("ip:take")
- @POST
- @Path("/ip/take/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> take(@FormParam("ipaddress") String ipAddress);
-
- /**
- * @see IpApi#release
- */
- @Named("ip:release")
- @POST
- @Path("/ip/release/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> release(@FormParam("ipaddress") String ipAddress);
-
- /**
- * @see IpApi#list
- */
- @Named("ip:listown")
- @GET
- @Path("/ip/listown/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("iplist")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<IpDetails>> list(ListIpOptions... options);
-
- /**
- * @see IpApi#get
- */
- @Named("ip:details")
- @GET
- @Path("/ip/details/ipaddress/{ipaddress}/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<IpDetails> get(@PathParam("ipaddress") String ipAddress);
-
- /**
- * @see IpApi#addToServer
- */
- @Named("ip:add")
- @POST
- @Path("/ip/add/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> addToServer(@FormParam("ipaddress") String ipAddress,
- @FormParam("serverid") String serverId);
-
- /**
- * @see IpApi#removeFromServer
- */
- @Named("ip:remove")
- @POST
- @Path("/ip/remove/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> removeFromServer(@FormParam("ipaddress") String ipAddress,
- @FormParam("serverid") String serverId);
-
- /**
- * @see IpApi#removeFromServer
- */
- @Named("ip:remove:release")
- @POST
- @FormParams(keys = "release", values = "true")
- @Path("/ip/remove/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> removeFromServerAndRelease(@FormParam("ipaddress") String ipAddress,
- @FormParam("serverid") String serverId);
-
- /**
- * @see IpApi#setPtr
- */
- @Named("ip:setptr")
- @POST
- @Path("/ip/setptr/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> setPtr(@FormParam("ipaddress") String ipAddress,
- @FormParam("data") String ptr);
-
- /**
- * @see IpApi#resetPtr
- */
- @Named("ip:resetptr")
- @POST
- @Path("/ip/resetptr/format/json")
- @SelectJson("details")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<IpDetails> resetPtr(@FormParam("ipaddress") String ipAddress);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerApi.java
index 0508c6f..0c42394 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerApi.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerApi.java
@@ -17,6 +17,17 @@
package org.jclouds.glesys.features;
import java.util.Map;
+import java.util.SortedMap;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
import org.jclouds.glesys.domain.Console;
import org.jclouds.glesys.domain.OSTemplate;
@@ -26,13 +37,21 @@ import org.jclouds.glesys.domain.ServerDetails;
import org.jclouds.glesys.domain.ServerLimit;
import org.jclouds.glesys.domain.ServerSpec;
import org.jclouds.glesys.domain.ServerStatus;
+import org.jclouds.glesys.functions.ParseTemplatesFromHttpResponse;
import org.jclouds.glesys.options.CloneServerOptions;
import org.jclouds.glesys.options.CreateServerOptions;
import org.jclouds.glesys.options.DestroyServerOptions;
-import org.jclouds.glesys.options.UpdateServerOptions;
import org.jclouds.glesys.options.ServerStatusOptions;
+import org.jclouds.glesys.options.UpdateServerOptions;
+import org.jclouds.http.filters.BasicAuthentication;
+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.SelectJson;
-import com.google.common.annotations.Beta;
import com.google.common.collect.FluentIterable;
/**
@@ -41,9 +60,9 @@ import com.google.common.collect.FluentIterable;
*
* @author Adrian Cole
* @author Adam Lowe
- * @see ServerAsyncApi
* @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
*/
+@RequestFilters(BasicAuthentication.class)
public interface ServerApi {
/**
@@ -51,6 +70,12 @@ public interface ServerApi {
*
* @return an account's associated server objects.
*/
+ @Named("server:list")
+ @POST
+ @Path("/server/list/format/json")
+ @SelectJson("servers")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
FluentIterable<Server> list();
/**
@@ -61,7 +86,14 @@ public interface ServerApi {
* @param id id of the server
* @return server or null if not found
*/
- ServerDetails get(String id);
+ @Named("server:details")
+ @POST
+ @Path("/server/details/format/json")
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @FormParams(keys = "includestate", values = "true")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerDetails get(@FormParam("serverid") String id);
/**
* Get detailed information about a server status including up-time and
@@ -71,7 +103,13 @@ public interface ServerApi {
* @param options optional parameters
* @return the status of the server or null if not found
*/
- ServerStatus getStatus(String id, ServerStatusOptions... options);
+ @Named("server:status")
+ @POST
+ @Path("/server/status/format/json")
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerStatus getStatus(@FormParam("serverid") String id, ServerStatusOptions... options);
/**
* Get detailed information about a server's limits (for OpenVZ only).
@@ -80,7 +118,13 @@ public interface ServerApi {
* @param id id of the server
* @return the requested information about the server or null if not found
*/
- Map<String, ServerLimit> getLimits(String id);
+ @Named("server:limits")
+ @POST
+ @Path("/server/limits/format/json")
+ @SelectJson("limits")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ SortedMap<String, ServerLimit> getLimits(@FormParam("serverid") String id);
/**
* Get information about how to connect to a server via VNC
@@ -88,21 +132,38 @@ public interface ServerApi {
* @param id id of the server
* @return the requested information about the server or null if not found
*/
- Console getConsole(String id);
+ @Named("server:console")
+ @POST
+ @Path("/server/console/format/json")
+ @SelectJson("console")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Console getConsole(@FormParam("serverid") String id);
/**
* Get information about the OS templates available
*
* @return the set of information about each template
*/
- FluentIterable<OSTemplate> listTemplates();
+ @Named("server:allowedarguments")
+ @GET
+ @Path("/server/allowedarguments/format/json")
+ @SelectJson("argumentslist")
+ @Consumes(MediaType.APPLICATION_JSON)
+ Map<String, AllowedArgumentsForCreateServer> getAllowedArgumentsForCreateByPlatform();
/**
* Get information about valid arguments to #createServer for each platform
*
* @return a map of argument lists, keyed on platform
*/
- Map<String, AllowedArgumentsForCreateServer> getAllowedArgumentsForCreateByPlatform();
+ @Named("server:templates")
+ @GET
+ @Path("/server/templates/format/json")
+ @ResponseParser(ParseTemplatesFromHttpResponse.class)
+ @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+ @Consumes(MediaType.APPLICATION_JSON)
+ FluentIterable<OSTemplate> listTemplates();
/**
* Reset the fail count for a server limit (for OpenVZ only).
@@ -110,35 +171,61 @@ public interface ServerApi {
* @param id id of the server
* @param type the type of limit to reset
*/
- Map<String, ServerLimit> resetLimit(String id, String type);
+ @Named("server:resetlimit")
+ @POST
+ @Path("/server/resetlimit/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ SortedMap<String, ServerLimit> resetLimit(@FormParam("serverid") String id,
+ @FormParam("type") String type);
/**
* Reboot a server
*
* @param id id of the server
*/
- ServerDetails reboot(String id);
+ @Named("server:reboot")
+ @POST
+ @SelectJson("server")
+ @Path("/server/reboot/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails reboot(@FormParam("serverid") String id);
/**
* Start a server
*
* @param id id of the server
*/
- ServerDetails start(String id);
+ @Named("server:start")
+ @POST
+ @SelectJson("server")
+ @Path("/server/start/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails start(@FormParam("serverid") String id);
/**
* Stop a server
*
* @param id id of the server
*/
- ServerDetails stop(String id);
+ @Named("server:stop")
+ @POST
+ @SelectJson("server")
+ @Path("/server/stop/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails stop(@FormParam("serverid") String id);
/**
* hard stop a server
*
* @param id id of the server
*/
- ServerDetails hardStop(String id);
+ @Named("server:stop:hard")
+ @POST
+ @SelectJson("server")
+ @Path("/server/stop/format/json")
+ @FormParams(keys = "type", values = "hard")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails hardStop(@FormParam("serverid") String id);
/**
* Create a new server
@@ -147,25 +234,43 @@ public interface ServerApi {
* @param rootPassword the root password to use
* @param options optional settings ex. description
*/
- ServerDetails createWithHostnameAndRootPassword(ServerSpec serverSpec, String hostname, String rootPassword,
- CreateServerOptions... options);
+ @Named("server:create")
+ @POST
+ @SelectJson("server")
+ @Path("/server/create/format/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @MapBinder(CreateServerOptions.class)
+ ServerDetails createWithHostnameAndRootPassword(ServerSpec serverSpec,
+ @PayloadParam("hostname") String hostname, @PayloadParam("rootpassword") String rootPassword,
+ CreateServerOptions... options);
/**
- * Update the configuration of a server
+ * Clone a server
*
- * @param serverid the serverId of the server to edit
+ * @param serverid the serverId of the server to clone
+ * @param hostname the new host name of the cloned server
* @param options the settings to change
*/
- ServerDetails update(String serverid, UpdateServerOptions options);
+ @Named("server:clone")
+ @POST
+ @Path("/server/clone/format/json")
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails clone(@FormParam("serverid") String serverid,
+ @FormParam("hostname") String hostname, CloneServerOptions... options);
/**
- * Clone a server
+ * Update the configuration of a server
*
- * @param serverid the serverId of the server to clone
- * @param hostname the new host name of the cloned server
+ * @param serverid the serverId of the server to edit
* @param options the settings to change
*/
- ServerDetails clone(String serverid, String hostname, CloneServerOptions... options);
+ @Named("server:edit")
+ @POST
+ @Path("/server/edit/format/json")
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails update(@FormParam("serverid") String serverid, UpdateServerOptions options);
/**
* Destroy a server
@@ -173,7 +278,10 @@ public interface ServerApi {
* @param id the id of the server
* @param keepIp if DestroyServerOptions.keepIp(true) the servers ip will be retained for use in your GleSYS account
*/
- ServerDetails destroy(String id, DestroyServerOptions keepIp);
+ @Named("server:destroy")
+ @POST
+ @Path("/server/destroy/format/json")
+ void destroy(@FormParam("serverid") String id, DestroyServerOptions keepIp);
/**
* Reset the root password of a server
@@ -181,7 +289,12 @@ public interface ServerApi {
* @param id the id of the server
* @param password the new password to use
*/
- ServerDetails resetPassword(String id, String password);
+ @Named("server:resetpassword")
+ @POST
+ @Path("/server/resetpassword/format/json")
+ @SelectJson("server")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ServerDetails resetPassword(@FormParam("serverid") String id, @FormParam("rootpassword") String password);
/**
* Return resource usage over time for server
@@ -190,8 +303,12 @@ public interface ServerApi {
* @param resource the name of the resource to retrieve usage information for (e.g. "cpuusage")
* @param resolution the time-period to extract data for (one of "minute", "hour" or "day)
*/
- @Beta
- // TODO: better name
- ResourceUsage getResourceUsage(String id, String resource, String resolution);
+ @Named("server:resourceusage")
+ @POST
+ @Path("/server/resourceusage/format/json")
+ @SelectJson("usage")
+ @Consumes(MediaType.APPLICATION_JSON)
+ ResourceUsage getResourceUsage(@FormParam("serverid") String id, @FormParam("resource") String resource,
+ @FormParam("resolution") String resolution);
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerAsyncApi.java
deleted file mode 100644
index 339e1fa..0000000
--- a/providers/glesys/src/main/java/org/jclouds/glesys/features/ServerAsyncApi.java
+++ /dev/null
@@ -1,262 +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.glesys.features;
-
-import java.util.Map;
-import java.util.SortedMap;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
-import org.jclouds.glesys.domain.Console;
-import org.jclouds.glesys.domain.OSTemplate;
-import org.jclouds.glesys.domain.ResourceUsage;
-import org.jclouds.glesys.domain.Server;
-import org.jclouds.glesys.domain.ServerDetails;
-import org.jclouds.glesys.domain.ServerLimit;
-import org.jclouds.glesys.domain.ServerSpec;
-import org.jclouds.glesys.domain.ServerStatus;
-import org.jclouds.glesys.functions.ParseTemplatesFromHttpResponse;
-import org.jclouds.glesys.options.CloneServerOptions;
-import org.jclouds.glesys.options.CreateServerOptions;
-import org.jclouds.glesys.options.DestroyServerOptions;
-import org.jclouds.glesys.options.ServerStatusOptions;
-import org.jclouds.glesys.options.UpdateServerOptions;
-import org.jclouds.http.filters.BasicAuthentication;
-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.SelectJson;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Server via their REST API.
- * <p/>
- *
- * @author Adrian Cole
- * @author Adam Lowe
- * @see ServerApi
- * @see <a href="https://github.com/GleSYS/API/wiki/API-Documentation" />
- */
-@RequestFilters(BasicAuthentication.class)
-public interface ServerAsyncApi {
-
- /**
- * @see ServerApi#list
- */
- @Named("server:list")
- @POST
- @Path("/server/list/format/json")
- @SelectJson("servers")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<FluentIterable<Server>> list();
-
- /**
- * @see ServerApi#get
- */
- @Named("server:details")
- @POST
- @Path("/server/details/format/json")
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- @FormParams(keys = "includestate", values = "true")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ServerDetails> get(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#getStatus
- */
- @Named("server:status")
- @POST
- @Path("/server/status/format/json")
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ServerStatus> getStatus(@FormParam("serverid") String id, ServerStatusOptions... options);
-
- /**
- * @see ServerApi#getLimits
- */
- @Named("server:limits")
- @POST
- @Path("/server/limits/format/json")
- @SelectJson("limits")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<SortedMap<String, ServerLimit>> getLimits(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#getConsole
- */
- @Named("server:console")
- @POST
- @Path("/server/console/format/json")
- @SelectJson("console")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Console> getConsole(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#getAllowedArgumentsForCreateByPlatform
- */
- @Named("server:allowedarguments")
- @GET
- @Path("/server/allowedarguments/format/json")
- @SelectJson("argumentslist")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Map<String, AllowedArgumentsForCreateServer>> getAllowedArgumentsForCreateByPlatform();
-
- /**
- * @see ServerApi#listTemplates
- */
- @Named("server:templates")
- @GET
- @Path("/server/templates/format/json")
- @ResponseParser(ParseTemplatesFromHttpResponse.class)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<FluentIterable<OSTemplate>> listTemplates();
-
- /**
- * @see ServerApi#stop
- */
- @Named("server:resetlimit")
- @POST
- @Path("/server/resetlimit/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<SortedMap<String, ServerLimit>> resetLimit(@FormParam("serverid") String id,
- @FormParam("type") String type);
-
- /**
- * @see ServerApi#reboot
- */
- @Named("server:reboot")
- @POST
- @SelectJson("server")
- @Path("/server/reboot/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> reboot(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#start
- */
- @Named("server:start")
- @POST
- @SelectJson("server")
- @Path("/server/start/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> start(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#stop
- */
- @Named("server:stop")
- @POST
- @SelectJson("server")
- @Path("/server/stop/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> stop(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#hardStop
- */
- @Named("server:stop:hard")
- @POST
- @SelectJson("server")
- @Path("/server/stop/format/json")
- @FormParams(keys = "type", values = "hard")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> hardStop(@FormParam("serverid") String id);
-
- /**
- * @see ServerApi#createWithHostnameAndRootPassword
- */
- @Named("server:create")
- @POST
- @SelectJson("server")
- @Path("/server/create/format/json")
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(CreateServerOptions.class)
- ListenableFuture<ServerDetails> createWithHostnameAndRootPassword(ServerSpec serverSpec,
- @PayloadParam("hostname") String hostname, @PayloadParam("rootpassword") String rootPassword,
- CreateServerOptions... options);
-
- /**
- * @see ServerApi#clone
- */
- @Named("server:clone")
- @POST
- @Path("/server/clone/format/json")
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> clone(@FormParam("serverid") String serverid,
- @FormParam("hostname") String hostname, CloneServerOptions... options);
-
- /**
- * @see ServerApi#update
- */
- @Named("server:edit")
- @POST
- @Path("/server/edit/format/json")
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> update(@FormParam("serverid") String serverid, UpdateServerOptions options);
-
- /**
- * @see ServerApi#destroy
- */
- @Named("server:destroy")
- @POST
- @Path("/server/destroy/format/json")
- ListenableFuture<Void> destroy(@FormParam("serverid") String id, DestroyServerOptions keepIp);
-
- /**
- * @see ServerApi#resetPassword
- */
- @Named("server:resetpassword")
- @POST
- @Path("/server/resetpassword/format/json")
- @SelectJson("server")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ServerDetails> resetPassword(@FormParam("serverid") String id, @FormParam("rootpassword") String password);
-
- /**
- * @see ServerApi#getResourceUsage
- */
- @Named("server:resourceusage")
- @POST
- @Path("/server/resourceusage/format/json")
- @SelectJson("usage")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<ResourceUsage> getResourceUsage(@FormParam("serverid") String id, @FormParam("resource") String resource,
- @FormParam("resolution") String resolution);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a14c03ba/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
new file mode 100644
index 0000000..cc5fd27
--- /dev/null
+++ b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.glesys;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseAsyncApiTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code GleSYSApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "GleSYSApiTest")
+public class GleSYSApiTest extends BaseAsyncApiTest<GleSYSApi> {
+ private GleSYSApi syncApi;
+
+ @Override
+ public ProviderMetadata createProviderMetadata() {
+ return new GleSYSProviderMetadata();
+ }
+
+ public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
+ assert syncApi.getServerApi() != null;
+ assert syncApi.getIpApi() != null;
+ assert syncApi.getDomainApi() != null;
+ assert syncApi.getArchiveApi() != null;
+ }
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ syncApi = injector.getInstance(GleSYSApi.class);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+
+ }
+}