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:01 UTC
[08/10] git commit: Remove async from gogrid
Remove async from gogrid
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/d4bf5112
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/d4bf5112
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/d4bf5112
Branch: refs/heads/master
Commit: d4bf51128e9e67f6d9be6cd87c65fa7511074002
Parents: a2af31c
Author: Andrew Bayer <an...@gmail.com>
Authored: Fri Aug 2 07:57:07 2013 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Fri Aug 2 07:57:42 2013 -0700
----------------------------------------------------------------------
.../main/java/org/jclouds/gogrid/GoGridApi.java | 63 ++++
.../org/jclouds/gogrid/GoGridApiMetadata.java | 23 +-
.../org/jclouds/gogrid/GoGridAsyncClient.java | 66 -----
.../java/org/jclouds/gogrid/GoGridClient.java | 63 ----
...ndObjectNameToGetJobsRequestQueryParams.java | 2 +-
.../strategy/GoGridComputeServiceAdapter.java | 9 +-
.../gogrid/config/GoGridHttpApiModule.java | 88 ++++++
.../gogrid/config/GoGridRestClientModule.java | 112 -------
.../org/jclouds/gogrid/domain/PowerCommand.java | 2 +-
.../jclouds/gogrid/features/GridImageApi.java | 169 +++++++++++
.../org/jclouds/gogrid/features/GridIpApi.java | 107 +++++++
.../org/jclouds/gogrid/features/GridJobApi.java | 93 ++++++
.../gogrid/features/GridLoadBalancerApi.java | 193 ++++++++++++
.../jclouds/gogrid/features/GridServerApi.java | 296 +++++++++++++++++++
.../gogrid/options/AddLoadBalancerOptions.java | 2 +-
.../LoadBalancerLatestJobCompleted.java | 6 +-
.../predicates/ServerLatestJobCompleted.java | 6 +-
.../gogrid/services/GridImageAsyncClient.java | 127 --------
.../gogrid/services/GridImageClient.java | 111 -------
.../gogrid/services/GridIpAsyncClient.java | 94 ------
.../jclouds/gogrid/services/GridIpClient.java | 71 -----
.../gogrid/services/GridJobAsyncClient.java | 71 -----
.../jclouds/gogrid/services/GridJobClient.java | 67 -----
.../services/GridLoadBalancerAsyncClient.java | 136 ---------
.../gogrid/services/GridLoadBalancerClient.java | 134 ---------
.../gogrid/services/GridServerAsyncClient.java | 218 --------------
.../gogrid/services/GridServerClient.java | 199 -------------
.../java/org/jclouds/gogrid/GoGridApiTest.java | 52 ++++
.../jclouds/gogrid/GoGridAsyncClientTest.java | 63 ----
.../jclouds/gogrid/GoGridLiveTestDisabled.java | 2 +-
.../compute/GoGridComputeServiceLiveTest.java | 4 +-
.../gogrid/features/BaseGoGridApiLiveTest.java | 33 +++
.../gogrid/features/BaseGoGridApiTest.java | 69 +++++
.../features/BaseGoGridHttpApiExpectTest.java | 51 ++++
.../gogrid/features/GridImageApiLiveTest.java | 138 +++++++++
.../gogrid/features/GridImageApiTest.java | 192 ++++++++++++
.../jclouds/gogrid/features/GridIpApiTest.java | 87 ++++++
.../gogrid/features/GridJobApiLiveTest.java | 64 ++++
.../jclouds/gogrid/features/GridJobApiTest.java | 127 ++++++++
.../features/GridLoadBalancerApiTest.java | 209 +++++++++++++
.../gogrid/features/GridServerApiTest.java | 273 +++++++++++++++++
.../features/GridServerClientExpectTest.java | 143 +++++++++
.../ServerLatestJobCompletedTest.java | 4 +-
.../services/BaseGoGridAsyncClientTest.java | 69 -----
.../services/BaseGoGridClientLiveTest.java | 33 ---
.../BaseGoGridRestClientExpectTest.java | 51 ----
.../services/GridImageAsyncClientTest.java | 192 ------------
.../services/GridImageClientLiveTest.java | 138 ---------
.../gogrid/services/GridIpAsyncClientTest.java | 87 ------
.../gogrid/services/GridJobAsyncClientTest.java | 127 --------
.../gogrid/services/GridJobClientLiveTest.java | 64 ----
.../GridLoadBalancerAsyncClientTest.java | 209 -------------
.../services/GridServerAsyncClientTest.java | 273 -----------------
.../services/GridServerClientExpectTest.java | 143 ---------
54 files changed, 2471 insertions(+), 2954 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApi.java
new file mode 100644
index 0000000..a2ef544
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApi.java
@@ -0,0 +1,63 @@
+/*
+ * 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.gogrid;
+
+import java.io.Closeable;
+
+import org.jclouds.gogrid.features.GridImageApi;
+import org.jclouds.gogrid.features.GridIpApi;
+import org.jclouds.gogrid.features.GridJobApi;
+import org.jclouds.gogrid.features.GridLoadBalancerApi;
+import org.jclouds.gogrid.features.GridServerApi;
+import org.jclouds.rest.annotations.Delegate;
+
+/**
+ * @author Oleksiy Yarmula
+ */
+public interface GoGridApi extends Closeable {
+
+ /**
+ * Services with methods, related to managing servers
+ */
+ @Delegate
+ GridServerApi getServerServices();
+
+ /**
+ * Services with methods, related to retrieving jobs
+ */
+ @Delegate
+ GridJobApi getJobServices();
+
+ /**
+ * Services with methods, related to retrieving IP addresses
+ */
+ @Delegate
+ GridIpApi getIpServices();
+
+ /**
+ * Services with methods, related to managing load balancers.
+ */
+ @Delegate
+ GridLoadBalancerApi getLoadBalancerServices();
+
+ /**
+ * Services with methods, related to managing images.
+ */
+ @Delegate
+ GridImageApi getImageServices();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java
index 53ec0b8..20af47b 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java
@@ -24,11 +24,10 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.gogrid.compute.config.GoGridComputeServiceContextModule;
-import org.jclouds.gogrid.config.GoGridRestClientModule;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.gogrid.config.GoGridHttpApiModule;
+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 GoGridApiMetadata extends BaseRestApiMetadata {
+public class GoGridApiMetadata extends BaseHttpApiMetadata<GoGridApi> {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GoGridClient.class)} as
- * {@link GoGridAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<GoGridClient, GoGridAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<GoGridClient, GoGridAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
@@ -61,17 +51,16 @@ public class GoGridApiMetadata 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<GoGridApi, Builder> {
@SuppressWarnings("deprecation")
protected Builder() {
- super(GoGridClient.class, GoGridAsyncClient.class);
id("gogrid")
.name("GoGrid API")
.identityName("API Key")
@@ -81,7 +70,7 @@ public class GoGridApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://api.gogrid.com/api")
.defaultProperties(GoGridApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(GoGridRestClientModule.class, GoGridComputeServiceContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(GoGridHttpApiModule.class, GoGridComputeServiceContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java
deleted file mode 100644
index 91b321e..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.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.gogrid;
-
-import java.io.Closeable;
-
-import org.jclouds.gogrid.services.GridImageAsyncClient;
-import org.jclouds.gogrid.services.GridIpAsyncClient;
-import org.jclouds.gogrid.services.GridJobAsyncClient;
-import org.jclouds.gogrid.services.GridLoadBalancerAsyncClient;
-import org.jclouds.gogrid.services.GridServerAsyncClient;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * @author Oleksiy Yarmula
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GoGridClient.class)} as
- * {@link GoGridAsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface GoGridAsyncClient extends Closeable {
-
- /**
- * @see GoGridClient#getServerServices()
- */
- @Delegate
- GridServerAsyncClient getServerServices();
-
- /**
- * @see GoGridClient#getJobServices()
- */
- @Delegate
- GridJobAsyncClient getJobServices();
-
- /**
- * @see GoGridClient#getIpServices()
- */
- @Delegate
- GridIpAsyncClient getIpServices();
-
- /**
- * @see GoGridClient#getLoadBalancerServices()
- */
- @Delegate
- GridLoadBalancerAsyncClient getLoadBalancerServices();
-
- /**
- * @see GoGridClient#getImageServices()
- */
- @Delegate
- GridImageAsyncClient getImageServices();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java
deleted file mode 100644
index fac2205..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java
+++ /dev/null
@@ -1,63 +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.gogrid;
-
-import java.io.Closeable;
-
-import org.jclouds.gogrid.services.GridImageClient;
-import org.jclouds.gogrid.services.GridIpClient;
-import org.jclouds.gogrid.services.GridJobClient;
-import org.jclouds.gogrid.services.GridLoadBalancerClient;
-import org.jclouds.gogrid.services.GridServerClient;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * @author Oleksiy Yarmula
- */
-public interface GoGridClient extends Closeable {
-
- /**
- * Services with methods, related to managing servers
- */
- @Delegate
- GridServerClient getServerServices();
-
- /**
- * Services with methods, related to retrieving jobs
- */
- @Delegate
- GridJobClient getJobServices();
-
- /**
- * Services with methods, related to retrieving IP addresses
- */
- @Delegate
- GridIpClient getIpServices();
-
- /**
- * Services with methods, related to managing load balancers.
- */
- @Delegate
- GridLoadBalancerClient getLoadBalancerServices();
-
- /**
- * Services with methods, related to managing images.
- */
- @Delegate
- GridImageClient getImageServices();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/binders/BindObjectNameToGetJobsRequestQueryParams.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/binders/BindObjectNameToGetJobsRequestQueryParams.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/binders/BindObjectNameToGetJobsRequestQueryParams.java
index d8861ef..0b38085 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/binders/BindObjectNameToGetJobsRequestQueryParams.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/binders/BindObjectNameToGetJobsRequestQueryParams.java
@@ -25,7 +25,7 @@ import org.jclouds.rest.Binder;
/**
*
- * @see org.jclouds.gogrid.services.GridJobClient#getJobsForObjectName(String)
+ * @see org.jclouds.gogrid.features.GridJobApi#getJobsForObjectName(String)
*
* @author Oleksiy Yarmula
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/compute/strategy/GoGridComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/compute/strategy/GoGridComputeServiceAdapter.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/compute/strategy/GoGridComputeServiceAdapter.java
index 837fa71..2087845 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/compute/strategy/GoGridComputeServiceAdapter.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/compute/strategy/GoGridComputeServiceAdapter.java
@@ -32,7 +32,7 @@ import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.domain.LoginCredentials;
-import org.jclouds.gogrid.GoGridClient;
+import org.jclouds.gogrid.GoGridApi;
import org.jclouds.gogrid.compute.suppliers.GoGridHardwareSupplier;
import org.jclouds.gogrid.domain.Ip;
import org.jclouds.gogrid.domain.IpType;
@@ -48,12 +48,11 @@ import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Throwables;
import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.primitives.Longs;
/**
- * defines the connection between the {@link GoGridClient} implementation and the jclouds
+ * defines the connection between the {@link org.jclouds.gogrid.GoGridApi} implementation and the jclouds
* {@link ComputeService}
*
*/
@@ -63,13 +62,13 @@ public class GoGridComputeServiceAdapter implements ComputeServiceAdapter<Server
@Resource
protected Logger logger = Logger.NULL;
- private final GoGridClient client;
+ private final GoGridApi client;
private final Function<Hardware, String> sizeToRam;
private final Predicate<Server> serverLatestJobCompleted;
private final Predicate<Server> serverLatestJobCompletedShort;
@Inject
- protected GoGridComputeServiceAdapter(GoGridClient client, Function<Hardware, String> sizeToRam, Timeouts timeouts) {
+ protected GoGridComputeServiceAdapter(GoGridApi client, Function<Hardware, String> sizeToRam, Timeouts timeouts) {
this.client = checkNotNull(client, "client");
this.sizeToRam = checkNotNull(sizeToRam, "sizeToRam");
this.serverLatestJobCompleted = retry(new ServerLatestJobCompleted(client.getJobServices()),
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
new file mode 100644
index 0000000..7585583
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
@@ -0,0 +1,88 @@
+/*
+ * 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.gogrid.config;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Named;
+
+import org.jclouds.date.TimeStamp;
+import org.jclouds.gogrid.GoGridApi;
+import org.jclouds.gogrid.handlers.GoGridErrorHandler;
+import org.jclouds.gogrid.location.GoGridDefaultLocationSupplier;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+/**
+ * Configures the GoGrid connection.
+ *
+ * @author Adrian Cole
+ * @author Oleksiy Yarmula
+ */
+@ConfiguresRestClient
+public class GoGridHttpApiModule extends HttpApiModule<GoGridApi> {
+
+ @Provides
+ @TimeStamp
+ protected Long provideTimeStamp(@TimeStamp Supplier<Long> cache) {
+ return cache.get();
+ }
+
+ /**
+ * borrowing concurrency code to ensure that caching takes place properly
+ */
+ @Provides
+ @TimeStamp
+ Supplier<Long> provideTimeStampCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds) {
+ return Suppliers.memoizeWithExpiration(new Supplier<Long>() {
+ public Long get() {
+ return System.currentTimeMillis() / 1000;
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GoGridErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GoGridErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GoGridErrorHandler.class);
+ }
+
+ @Override
+ protected void configure() {
+ install(new GoGridParserModule());
+ super.configure();
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ bind(ImplicitLocationSupplier.class).to(GoGridDefaultLocationSupplier.class).in(Scopes.SINGLETON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridRestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridRestClientModule.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridRestClientModule.java
deleted file mode 100644
index d9bc670..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridRestClientModule.java
+++ /dev/null
@@ -1,112 +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.gogrid.config;
-
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-
-import org.jclouds.date.TimeStamp;
-import org.jclouds.gogrid.GoGridAsyncClient;
-import org.jclouds.gogrid.GoGridClient;
-import org.jclouds.gogrid.handlers.GoGridErrorHandler;
-import org.jclouds.gogrid.location.GoGridDefaultLocationSupplier;
-import org.jclouds.gogrid.services.GridImageAsyncClient;
-import org.jclouds.gogrid.services.GridImageClient;
-import org.jclouds.gogrid.services.GridIpAsyncClient;
-import org.jclouds.gogrid.services.GridIpClient;
-import org.jclouds.gogrid.services.GridJobAsyncClient;
-import org.jclouds.gogrid.services.GridJobClient;
-import org.jclouds.gogrid.services.GridLoadBalancerAsyncClient;
-import org.jclouds.gogrid.services.GridLoadBalancerClient;
-import org.jclouds.gogrid.services.GridServerAsyncClient;
-import org.jclouds.gogrid.services.GridServerClient;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-/**
- * Configures the GoGrid connection.
- *
- * @author Adrian Cole
- * @author Oleksiy Yarmula
- */
-@ConfiguresRestClient
-public class GoGridRestClientModule extends RestClientModule<GoGridClient, GoGridAsyncClient> {
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
- .put(GridServerClient.class, GridServerAsyncClient.class)//
- .put(GridJobClient.class, GridJobAsyncClient.class)//
- .put(GridIpClient.class, GridIpAsyncClient.class)//
- .put(GridLoadBalancerClient.class, GridLoadBalancerAsyncClient.class)//
- .put(GridImageClient.class, GridImageAsyncClient.class)//
- .build();
-
- public GoGridRestClientModule() {
- super(DELEGATE_MAP);
- }
-
- @Provides
- @TimeStamp
- protected Long provideTimeStamp(@TimeStamp Supplier<Long> cache) {
- return cache.get();
- }
-
- /**
- * borrowing concurrency code to ensure that caching takes place properly
- */
- @Provides
- @TimeStamp
- Supplier<Long> provideTimeStampCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds) {
- return Suppliers.memoizeWithExpiration(new Supplier<Long>() {
- public Long get() {
- return System.currentTimeMillis() / 1000;
- }
- }, seconds, TimeUnit.SECONDS);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GoGridErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GoGridErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GoGridErrorHandler.class);
- }
-
- @Override
- protected void configure() {
- install(new GoGridParserModule());
- super.configure();
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- bind(ImplicitLocationSupplier.class).to(GoGridDefaultLocationSupplier.class).in(Scopes.SINGLETON);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/PowerCommand.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/PowerCommand.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/PowerCommand.java
index 9b0313b..c77d578 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/PowerCommand.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/domain/PowerCommand.java
@@ -27,7 +27,7 @@ package org.jclouds.gogrid.domain;
* <li>Restart</li>
* </ul>
*
- * @see org.jclouds.gogrid.services.GridServerClient#power(String, PowerCommand)
+ * @see org.jclouds.gogrid.features.GridServerApi#power(String, PowerCommand)
* @see <a href="http://wiki.gogrid.com/wiki/index.php/API:grid.server.power" />
*
* @author Oleksiy Yarmula
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridImageApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridImageApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridImageApi.java
new file mode 100644
index 0000000..517c2c6
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridImageApi.java
@@ -0,0 +1,169 @@
+/*
+ * 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.gogrid.features;
+
+import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.ID_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_DESCRIPTION_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_FRIENDLY_NAME_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_ID_OR_NAME_KEY;
+
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.gogrid.binders.BindIdsToQueryParams;
+import org.jclouds.gogrid.binders.BindNamesToQueryParams;
+import org.jclouds.gogrid.domain.Option;
+import org.jclouds.gogrid.domain.ServerImage;
+import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
+import org.jclouds.gogrid.functions.ParseImageFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseImageListFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
+import org.jclouds.gogrid.options.GetImageListOptions;
+import org.jclouds.gogrid.options.SaveImageOptions;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+
+/**
+ * Manages the server images
+ *
+ * @see <a
+ * href="http://wiki.gogrid.com/wiki/index.php/API#Server_Image_Methods"/>
+ * @author Oleksiy Yarmula
+ */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
+public interface GridImageApi {
+
+ /**
+ * Returns all server images.
+ *
+ * @param options
+ * options to narrow the search down
+ * @return server images found
+ */
+ @GET
+ @ResponseParser(ParseImageListFromJsonResponse.class)
+ @Path("/grid/image/list")
+ Set<ServerImage> getImageList(GetImageListOptions... options);
+
+ /**
+ * Returns images, found by specified ids
+ *
+ * @param ids
+ * the ids that match existing images
+ * @return images found
+ */
+ @GET
+ @ResponseParser(ParseImageListFromJsonResponse.class)
+ @Path("/grid/image/get")
+ Set<ServerImage> getImagesById(@BinderParam(BindIdsToQueryParams.class) Long... ids);
+
+ /**
+ * Returns images, found by specified names
+ *
+ * @param names
+ * the names that march existing images
+ * @return images found
+ */
+ @GET
+ @ResponseParser(ParseImageListFromJsonResponse.class)
+ @Path("/grid/image/get")
+ Set<ServerImage> getImagesByName(@BinderParam(BindNamesToQueryParams.class) String... names);
+
+ /**
+ * Edits an existing image
+ *
+ * @param idOrName
+ * id or name of the existing image
+ * @param newDescription
+ * description to replace the current one
+ * @return edited server image
+ */
+ @GET
+ @ResponseParser(ParseImageFromJsonResponse.class)
+ @Path("/grid/image/edit")
+ ServerImage editImageDescription(@QueryParam(IMAGE_KEY) String idOrName,
+ @QueryParam(IMAGE_DESCRIPTION_KEY) String newDescription);
+
+ /**
+ * Edits an existing image
+ *
+ * @param idOrName
+ * id or name of the existing image
+ * @param newFriendlyName
+ * friendly name to replace the current one
+ * @return edited server image
+ */
+ @GET
+ @ResponseParser(ParseImageFromJsonResponse.class)
+ @Path("/grid/image/edit")
+ ServerImage editImageFriendlyName(@QueryParam(IMAGE_KEY) String idOrName,
+ @QueryParam(IMAGE_FRIENDLY_NAME_KEY) String newFriendlyName);
+
+ /**
+ * Retrieves the list of supported Datacenters to save images in. The objects
+ * will have datacenter ID, name and description. In most cases, id or name
+ * will be used for {@link #getImageList}.
+ *
+ * @return supported datacenters
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "datacenter")
+ Set<Option> getDatacenters();
+
+ /**
+ * Deletes an existing image
+ *
+ * @param id
+ * id of the existing image
+ */
+ @GET
+ @ResponseParser(ParseImageFromJsonResponse.class)
+ @Path("/grid/image/delete")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerImage deleteById(@QueryParam(ID_KEY) long id);
+
+ /**
+ * This call will save a private (visible to only you) server image to your
+ * library of available images. The image will be saved from an existing
+ * server.
+ *
+ * @param idOrName
+ * id or name of the existing server
+ * @param friendlyName
+ * friendly name of the image
+ * @return saved server image
+ */
+ @GET
+ @ResponseParser(ParseImageFromJsonResponse.class)
+ @Path("/grid/image/save")
+ ServerImage saveImageFromServer(@QueryParam(IMAGE_FRIENDLY_NAME_KEY) String friendlyName,
+ @QueryParam(SERVER_ID_OR_NAME_KEY) String idOrName, SaveImageOptions... options);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridIpApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridIpApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridIpApi.java
new file mode 100644
index 0000000..c5bfdd3
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridIpApi.java
@@ -0,0 +1,107 @@
+/*
+ * 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.gogrid.features;
+
+import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_STATE_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_TYPE_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
+
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.jclouds.gogrid.domain.Ip;
+import org.jclouds.gogrid.domain.Option;
+import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
+import org.jclouds.gogrid.functions.ParseIpListFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
+import org.jclouds.gogrid.options.GetIpListOptions;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+
+/**
+ * @author Oleksiy Yarmula
+ */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
+public interface GridIpApi {
+
+ /**
+ * Returns all IPs in the system that match the options
+ *
+ * @param options
+ * options to narrow the search down
+ * @return IPs found by the search
+ */
+ @GET
+ @ResponseParser(ParseIpListFromJsonResponse.class)
+ @Path("/grid/ip/list")
+ Set<Ip> getIpList(GetIpListOptions... options);
+
+ /**
+ * Returns the list of unassigned IPs.
+ *
+ * NOTE: this returns both public and private IPs!
+ *
+ * @return unassigned IPs
+ */
+ @GET
+ @ResponseParser(ParseIpListFromJsonResponse.class)
+ @Path("/grid/ip/list")
+ @QueryParams(keys = IP_STATE_KEY, values = "Unassigned")
+ Set<Ip> getUnassignedIpList();
+
+ /**
+ * Returns the list of unassigned public IPs.
+ *
+ * @return unassigned public IPs
+ */
+ @GET
+ @ResponseParser(ParseIpListFromJsonResponse.class)
+ @Path("/grid/ip/list")
+ @QueryParams(keys = { IP_STATE_KEY, IP_TYPE_KEY }, values = { "Unassigned", "Public" })
+ Set<Ip> getUnassignedPublicIpList();
+
+ /**
+ * Returns the list of assigned IPs
+ *
+ * NOTE: this returns both public and private IPs!
+ *
+ * @return assigned IPs
+ */
+ @GET
+ @ResponseParser(ParseIpListFromJsonResponse.class)
+ @Path("/grid/ip/list")
+ @QueryParams(keys = IP_STATE_KEY, values = "Assigned")
+ Set<Ip> getAssignedIpList();
+
+ /**
+ * Retrieves the list of supported Datacenters to retrieve ips from. The objects will have
+ * datacenter ID, name and description. In most cases, id or name will be used for
+ * {@link #addServer}.
+ *
+ * @return supported datacenters
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "ip.datacenter")
+ Set<Option> getDatacenters();
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridJobApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridJobApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridJobApi.java
new file mode 100644
index 0000000..16119be
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridJobApi.java
@@ -0,0 +1,93 @@
+/*
+ * 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.gogrid.features;
+
+import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
+
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.jclouds.gogrid.binders.BindIdsToQueryParams;
+import org.jclouds.gogrid.binders.BindObjectNameToGetJobsRequestQueryParams;
+import org.jclouds.gogrid.domain.Job;
+import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
+import org.jclouds.gogrid.functions.ParseJobListFromJsonResponse;
+import org.jclouds.gogrid.options.GetJobListOptions;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+
+/**
+ * Manages the customer's jobs.
+ *
+ * @see <a href="http://wiki.gogrid.com/wiki/index.php/API#Job_Methods" />
+ *
+ * @author Oleksiy Yarmula
+ */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
+public interface GridJobApi {
+
+ /**
+ * Returns all jobs found. The resulting set may be narrowed down by providing
+ * {@link GetJobListOptions}.
+ *
+ * By default, the result is <=100 items from the date range of 4 weeks ago to now.
+ *
+ * NOTE: this method results in a big volume of data in response
+ *
+ * @return jobs found by request
+ */
+ @GET
+ @ResponseParser(ParseJobListFromJsonResponse.class)
+ @Path("/grid/job/list")
+ Set<Job> getJobList(GetJobListOptions... options);
+
+ /**
+ * Returns jobs found for an object with a provided name.
+ *
+ * Usually, in GoGrid a name will uniquely identify the object, or, as the docs state, some API
+ * methods will cause errors.
+ *
+ * @param objectName
+ * name of the object
+ * @return found jobs for the object
+ */
+ @GET
+ @ResponseParser(ParseJobListFromJsonResponse.class)
+ @Path("/grid/job/list")
+ Set<Job> getJobsForObjectName(
+ @BinderParam(BindObjectNameToGetJobsRequestQueryParams.class) String objectName);
+
+ /**
+ * Returns jobs for the corresponding id(s).
+ *
+ * NOTE: there is a 1:1 relation between a job and its ID.
+ *
+ * @param ids
+ * ids for the jobs
+ * @return jobs found by the ids
+ */
+ @GET
+ @ResponseParser(ParseJobListFromJsonResponse.class)
+ @Path("/grid/job/get")
+ Set<Job> getJobsById(@BinderParam(BindIdsToQueryParams.class) long... ids);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridLoadBalancerApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridLoadBalancerApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridLoadBalancerApi.java
new file mode 100644
index 0000000..5dcf978
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridLoadBalancerApi.java
@@ -0,0 +1,193 @@
+/*
+ * 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.gogrid.features;
+
+import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.ID_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.NAME_KEY;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.gogrid.binders.BindIdsToQueryParams;
+import org.jclouds.gogrid.binders.BindNamesToQueryParams;
+import org.jclouds.gogrid.binders.BindRealIpPortPairsToQueryParams;
+import org.jclouds.gogrid.binders.BindVirtualIpPortPairToQueryParams;
+import org.jclouds.gogrid.domain.IpPortPair;
+import org.jclouds.gogrid.domain.LoadBalancer;
+import org.jclouds.gogrid.domain.Option;
+import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
+import org.jclouds.gogrid.functions.ParseLoadBalancerFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseLoadBalancerListFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
+import org.jclouds.gogrid.options.AddLoadBalancerOptions;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+
+/**
+ * @author Oleksiy Yarmula
+ */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
+public interface GridLoadBalancerApi {
+
+
+ /**
+ * Returns all load balancers found for the current user.
+ *
+ * @return load balancers found
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerListFromJsonResponse.class)
+ @Path("/grid/loadbalancer/list")
+ Set<LoadBalancer> getLoadBalancerList();
+
+ /**
+ * Returns the load balancer(s) by unique name(s).
+ *
+ * Given a name or a set of names, finds one or multiple load balancers.
+ *
+ * @param names
+ * to get the load balancers
+ * @return load balancer(s) matching the name(s)
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerListFromJsonResponse.class)
+ @Path("/grid/loadbalancer/get")
+ Set<LoadBalancer> getLoadBalancersByName(
+ @BinderParam(BindNamesToQueryParams.class) String... names);
+
+ /**
+ * Returns the load balancer(s) by unique id(s).
+ *
+ * Given an id or a set of ids, finds one or multiple load balancers.
+ *
+ * @param ids
+ * to get the load balancers
+ * @return load balancer(s) matching the ids
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerListFromJsonResponse.class)
+ @Path("/grid/loadbalancer/get")
+ Set<LoadBalancer> getLoadBalancersById(
+ @BinderParam(BindIdsToQueryParams.class) Long... ids);
+
+ /**
+ * Creates a load balancer with given properties.
+ *
+ * @param name
+ * name of the load balancer
+ * @param virtualIp
+ * virtual IP with IP address set in {@link org.jclouds.gogrid.domain.Ip#ip} and port
+ * set in {@link IpPortPair#port}
+ * @param realIps
+ * real IPs to bind the virtual IP to, with IP address set in
+ * {@link org.jclouds.gogrid.domain.Ip#ip} and port set in {@link IpPortPair#port}
+ * @param options
+ * options that specify load balancer's type (round robin, least load), persistence
+ * strategy, or description.
+ * @return created load balancer object
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerFromJsonResponse.class)
+ @Path("/grid/loadbalancer/add")
+ LoadBalancer addLoadBalancer(@QueryParam(NAME_KEY) String name,
+ @BinderParam(BindVirtualIpPortPairToQueryParams.class) IpPortPair virtualIp,
+ @BinderParam(BindRealIpPortPairsToQueryParams.class) List<IpPortPair> realIps,
+ AddLoadBalancerOptions... options);
+
+ /**
+ * Edits the existing load balancer to change the real IP mapping.
+ *
+ * @param name
+ * id of the existing load balancer
+ * @param realIps
+ * real IPs to bind the virtual IP to, with IP address set in
+ * {@link org.jclouds.gogrid.domain.Ip#ip} and port set in {@link IpPortPair#port}
+ * @return edited object
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerFromJsonResponse.class)
+ @Path("/grid/loadbalancer/edit")
+ LoadBalancer editLoadBalancerNamed(@QueryParam(NAME_KEY) String name,
+ @BinderParam(BindRealIpPortPairsToQueryParams.class) List<IpPortPair> realIps);
+
+ /**
+ * Edits the existing load balancer to change the real IP mapping.
+ *
+ * @param id
+ * name of the existing load balancer
+ * @param realIps
+ * real IPs to bind the virtual IP to, with IP address set in
+ * {@link org.jclouds.gogrid.domain.Ip#ip} and port set in {@link IpPortPair#port}
+ * @return edited object
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerFromJsonResponse.class)
+ @Path("/grid/loadbalancer/edit")
+ LoadBalancer editLoadBalancer(@QueryParam(ID_KEY) long id,
+ @BinderParam(BindRealIpPortPairsToQueryParams.class) List<IpPortPair> realIps);
+
+ /**
+ * Deletes the load balancer by Id
+ *
+ * @param id
+ * id of the load balancer to delete
+ * @return load balancer before the command is executed
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerFromJsonResponse.class)
+ @Path("/grid/loadbalancer/delete")
+ LoadBalancer deleteById(@QueryParam(ID_KEY) Long id);
+
+ /**
+ * Deletes the load balancer by name;
+ *
+ * NOTE: Using this parameter may generate an error if one or more load balancers share a
+ * non-unique name.
+ *
+ * @param name
+ * name of the load balancer to be deleted
+ *
+ * @return load balancer before the command is executed
+ */
+ @GET
+ @ResponseParser(ParseLoadBalancerFromJsonResponse.class)
+ @Path("/grid/loadbalancer/delete")
+ LoadBalancer deleteByName(@QueryParam(NAME_KEY) String name);
+
+ /**
+ * Retrieves the list of supported Datacenters to launch servers into. The objects will have
+ * datacenter ID, name and description. In most cases, id or name will be used for
+ * {@link #addLoadBalancer}.
+ *
+ * @return supported datacenters
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "loadbalancer.datacenter")
+ Set<Option> getDatacenters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridServerApi.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridServerApi.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridServerApi.java
new file mode 100644
index 0000000..0615579
--- /dev/null
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/features/GridServerApi.java
@@ -0,0 +1,296 @@
+/*
+ * 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.gogrid.features;
+
+import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.ID_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.NAME_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.POWER_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_ID_OR_NAME_KEY;
+import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_RAM_KEY;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.domain.Credentials;
+import org.jclouds.gogrid.binders.BindIdsToQueryParams;
+import org.jclouds.gogrid.binders.BindNamesToQueryParams;
+import org.jclouds.gogrid.domain.Option;
+import org.jclouds.gogrid.domain.PowerCommand;
+import org.jclouds.gogrid.domain.Server;
+import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
+import org.jclouds.gogrid.functions.ParseCredentialsFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
+import org.jclouds.gogrid.functions.ParseServerNameToCredentialsMapFromJsonResponse;
+import org.jclouds.gogrid.options.AddServerOptions;
+import org.jclouds.gogrid.options.GetServerListOptions;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.OnlyElement;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides synchronous access to GoGrid.
+ * <p/>
+ *
+ * @see <a href="http://wiki.gogrid.com/wiki/index.php/API" />
+ *
+ * @author Adrian Cole
+ * @author Oleksiy Yarmula
+ */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@QueryParams(keys = VERSION, values = "1.6")
+public interface GridServerApi {
+
+ /**
+ * Returns the list of all servers.
+ *
+ * The result can be narrowed down by providing the options.
+ *
+ * @param getServerListOptions
+ * options to narrow down the result
+ * @return servers found by the request
+ */
+ @GET
+ @SelectJson("list")
+ @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+ @Path("/grid/server/list")
+ Set<Server> getServerList(GetServerListOptions... getServerListOptions);
+
+ /**
+ * Returns the server(s) by unique name(s).
+ *
+ * Given a name or a set of names, finds one or multiple servers.
+ *
+ * @param names
+ * to get the servers
+ * @return server(s) matching the name(s)
+ */
+ @GET
+ @SelectJson("list")
+ @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+ @Path("/grid/server/get")
+ Set<Server> getServersByName(
+ @BinderParam(BindNamesToQueryParams.class) String... names);
+
+ /**
+ * Returns the server(s) by unique id(s).
+ *
+ * Given an id or a set of ids, finds one or multiple servers.
+ *
+ * @param ids
+ * to get the servers
+ * @return server(s) matching the ids
+ */
+ @GET
+ @SelectJson("list")
+ @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+ @Path("/grid/server/get")
+ Set<Server> getServersById(
+ @BinderParam(BindIdsToQueryParams.class) long... ids);
+
+ /**
+ * Returns a map of running servers' names to the log in credentials.
+ *
+ * @return map <String server name => Credentials>
+ */
+ @GET
+ @ResponseParser(ParseServerNameToCredentialsMapFromJsonResponse.class)
+ @Path("/support/password/list")
+ Map<String, Credentials> getServerCredentialsList();
+
+ /**
+ *
+ * @return the login user and password of a server, or null if none found
+ */
+ @GET
+ @ResponseParser(ParseCredentialsFromJsonResponse.class)
+ @Path("/support/grid/password/get")
+ Credentials getServerCredentials(@QueryParam("id") long id);
+
+ /**
+ * Adds a server with specified attributes
+ *
+ * @param name
+ * name of the server
+ * @param image
+ * image (id or name)
+ * @param ram
+ * ram type (id or name)
+ * @param ip
+ * ip address
+ * @param addServerOptions
+ * options to make it a sandbox instance or/and description
+ * @return created server
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/add")
+ Server addServer(@QueryParam(NAME_KEY) String name,
+ @QueryParam(IMAGE_KEY) String image, @QueryParam(SERVER_RAM_KEY) String ram,
+ @QueryParam(IP_KEY) String ip, AddServerOptions... addServerOptions);
+
+ /**
+ * Changes the server's state according to {@link PowerCommand}
+ *
+ * @param idOrName
+ * id or name of the server to apply the command
+ * @param power
+ * new desired state
+ * @return server immediately after applying the command
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/power")
+ Server power(
+ @QueryParam(SERVER_ID_OR_NAME_KEY) String idOrName,
+ @QueryParam(POWER_KEY) PowerCommand power);
+
+ /**
+ * Deletes the server by Id
+ *
+ * @param id
+ * id of the server to delete
+ * @return server before the command is executed
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/delete")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Server deleteById(@QueryParam(ID_KEY) long id);
+
+ /**
+ * Deletes the server by name;
+ *
+ * NOTE: Using this parameter may generate an error if one or more servers
+ * share a non-unique name.
+ *
+ * @param name
+ * name of the server to be deleted
+ *
+ * @return server before the command is executed
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/delete")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Server deleteByName(@QueryParam(NAME_KEY) String name);
+
+ /**
+ * Retrieves the list of supported RAM configurations. The objects will have
+ * RAM ID, name and description. In most cases, id or name will be used for
+ * {@link #addServer}.
+ *
+ * To see how RAM maps to CPU and disk space (as of March 2010), see
+ * {@link org.jclouds.gogrid.compute.config.GoGridComputeServiceContextModule#provideSizeToRam}
+ * .
+ *
+ * @return supported ram sizes
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "server.ram")
+ Set<Option> getRamSizes();
+
+ /**
+ * Retrieves the list of supported server types, for example Web/App Server and Database Server. In most cases, id
+ * or name will be used for {@link #editServerType}.
+ *
+ * @return supported server types
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "server.type")
+ Set<Option> getTypes();
+
+ /**
+ * Retrieves the list of supported Datacenters to launch servers into. The
+ * objects will have datacenter ID, name and description. In most cases, id
+ * or name will be used for {@link #addServer}.
+ *
+ * @return supported datacenters
+ */
+ @GET
+ @ResponseParser(ParseOptionsFromJsonResponse.class)
+ @Path("/common/lookup/list")
+ @QueryParams(keys = LOOKUP_LIST_KEY, values = "server.datacenter")
+ Set<Option> getDatacenters();
+
+ /**
+ * Edits an existing server
+ *
+ * @param id
+ * id of the existing server
+ * @param newDescription
+ * description to replace the current one
+ * @return edited server
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/edit")
+ Server editServerDescription(@QueryParam("id") long id,
+ @QueryParam("description") String newDescription);
+
+ /**
+ * Edits an existing server
+ *
+ * @param id
+ * id of the existing server
+ * @param ram
+ * ram to replace the current one
+ * @return edited server
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/edit")
+ Server editServerRam(@QueryParam("id") long id,
+ @QueryParam("server.ram") String ram);
+
+ /**
+ * Edits an existing server
+ *
+ * @param id
+ * id of the existing server
+ * @param newType
+ * type to replace the current one
+ * @return edited server
+ */
+ @GET
+ @SelectJson("list")
+ @OnlyElement
+ @Path("/grid/server/edit")
+ Server editServerType(@QueryParam("id") long id,
+ @QueryParam("server.type") String newType);}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/options/AddLoadBalancerOptions.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/options/AddLoadBalancerOptions.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/options/AddLoadBalancerOptions.java
index e75d253..acfc22e 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/options/AddLoadBalancerOptions.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/options/AddLoadBalancerOptions.java
@@ -28,7 +28,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
/**
* Optional parameters for adding a load balancer.
*
- * @see org.jclouds.gogrid.services.GridLoadBalancerClient#addLoadBalancer
+ * @see org.jclouds.gogrid.features.GridLoadBalancerApi#addLoadBalancer
* @see <a href="http://wiki.gogrid.com/wiki/index.php/API:grid.loadbalancer.add"/>
*
* @author Oleksiy Yarmula
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/LoadBalancerLatestJobCompleted.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/LoadBalancerLatestJobCompleted.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/LoadBalancerLatestJobCompleted.java
index bcf5fd0..44fd29d 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/LoadBalancerLatestJobCompleted.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/LoadBalancerLatestJobCompleted.java
@@ -25,7 +25,7 @@ import javax.inject.Singleton;
import org.jclouds.gogrid.domain.Job;
import org.jclouds.gogrid.domain.JobState;
import org.jclouds.gogrid.domain.LoadBalancer;
-import org.jclouds.gogrid.services.GridJobClient;
+import org.jclouds.gogrid.features.GridJobApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -38,13 +38,13 @@ import com.google.inject.Inject;
@Singleton
public class LoadBalancerLatestJobCompleted implements Predicate<LoadBalancer> {
- protected GridJobClient jobClient;
+ protected GridJobApi jobClient;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public LoadBalancerLatestJobCompleted(GridJobClient jobClient) {
+ public LoadBalancerLatestJobCompleted(GridJobApi jobClient) {
this.jobClient = jobClient;
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/ServerLatestJobCompleted.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/ServerLatestJobCompleted.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/ServerLatestJobCompleted.java
index f8fbdde..2f689a4 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/ServerLatestJobCompleted.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/predicates/ServerLatestJobCompleted.java
@@ -25,7 +25,7 @@ import javax.inject.Singleton;
import org.jclouds.gogrid.domain.Job;
import org.jclouds.gogrid.domain.JobState;
import org.jclouds.gogrid.domain.Server;
-import org.jclouds.gogrid.services.GridJobClient;
+import org.jclouds.gogrid.features.GridJobApi;
import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
@@ -44,13 +44,13 @@ import com.google.inject.Inject;
@Singleton
public class ServerLatestJobCompleted implements Predicate<Server> {
- protected GridJobClient jobClient;
+ protected GridJobApi jobClient;
@Resource
protected Logger logger = Logger.NULL;
@Inject
- public ServerLatestJobCompleted(GridJobClient jobClient) {
+ public ServerLatestJobCompleted(GridJobApi jobClient) {
this.jobClient = jobClient;
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java
deleted file mode 100644
index 779a60d..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java
+++ /dev/null
@@ -1,127 +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.gogrid.services;
-
-import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.ID_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_DESCRIPTION_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_FRIENDLY_NAME_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.IMAGE_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.SERVER_ID_OR_NAME_KEY;
-
-import java.util.Set;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.gogrid.binders.BindIdsToQueryParams;
-import org.jclouds.gogrid.binders.BindNamesToQueryParams;
-import org.jclouds.gogrid.domain.Option;
-import org.jclouds.gogrid.domain.ServerImage;
-import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
-import org.jclouds.gogrid.functions.ParseImageFromJsonResponse;
-import org.jclouds.gogrid.functions.ParseImageListFromJsonResponse;
-import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
-import org.jclouds.gogrid.options.GetImageListOptions;
-import org.jclouds.gogrid.options.SaveImageOptions;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * @author Oleksiy Yarmula
- */
-@RequestFilters(SharedKeyLiteAuthentication.class)
-@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
-public interface GridImageAsyncClient {
-
- /**
- * @see GridImageClient#getImageList
- */
- @GET
- @ResponseParser(ParseImageListFromJsonResponse.class)
- @Path("/grid/image/list")
- ListenableFuture<Set<ServerImage>> getImageList(GetImageListOptions... options);
-
- /**
- * @see GridImageClient#getImagesById
- */
- @GET
- @ResponseParser(ParseImageListFromJsonResponse.class)
- @Path("/grid/image/get")
- ListenableFuture<Set<ServerImage>> getImagesById(@BinderParam(BindIdsToQueryParams.class) Long... ids);
-
- /**
- * @see GridImageClient#getImagesByName
- */
- @GET
- @ResponseParser(ParseImageListFromJsonResponse.class)
- @Path("/grid/image/get")
- ListenableFuture<Set<ServerImage>> getImagesByName(@BinderParam(BindNamesToQueryParams.class) String... names);
-
- /**
- * @see GridImageClient#editImageDescription
- */
- @GET
- @ResponseParser(ParseImageFromJsonResponse.class)
- @Path("/grid/image/edit")
- ListenableFuture<ServerImage> editImageDescription(@QueryParam(IMAGE_KEY) String idOrName,
- @QueryParam(IMAGE_DESCRIPTION_KEY) String newDescription);
-
- /**
- * @see GridImageClient#editImageFriendlyName
- */
- @GET
- @ResponseParser(ParseImageFromJsonResponse.class)
- @Path("/grid/image/edit")
- ListenableFuture<ServerImage> editImageFriendlyName(@QueryParam(IMAGE_KEY) String idOrName,
- @QueryParam(IMAGE_FRIENDLY_NAME_KEY) String newFriendlyName);
-
- /**
- * @see GridImageClient#getDatacenters
- */
- @GET
- @ResponseParser(ParseOptionsFromJsonResponse.class)
- @Path("/common/lookup/list")
- @QueryParams(keys = LOOKUP_LIST_KEY, values = "datacenter")
- ListenableFuture<Set<Option>> getDatacenters();
-
- /**
- * @see GridImageClient#deleteById(Long)
- */
- @GET
- @ResponseParser(ParseImageFromJsonResponse.class)
- @Path("/grid/image/delete")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ServerImage> deleteById(@QueryParam(ID_KEY) long id);
-
- /**
- * @see GridImageClient#saveImageFromServer
- */
- @GET
- @ResponseParser(ParseImageFromJsonResponse.class)
- @Path("/grid/image/save")
- ListenableFuture<ServerImage> saveImageFromServer(@QueryParam(IMAGE_FRIENDLY_NAME_KEY) String friendlyName,
- @QueryParam(SERVER_ID_OR_NAME_KEY) String idOrName, SaveImageOptions... options);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageClient.java
deleted file mode 100644
index ee30738..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageClient.java
+++ /dev/null
@@ -1,111 +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.gogrid.services;
-
-import java.util.Set;
-import org.jclouds.gogrid.domain.Option;
-import org.jclouds.gogrid.domain.ServerImage;
-import org.jclouds.gogrid.options.GetImageListOptions;
-import org.jclouds.gogrid.options.SaveImageOptions;
-
-/**
- * Manages the server images
- *
- * @see <a
- * href="http://wiki.gogrid.com/wiki/index.php/API#Server_Image_Methods"/>
- * @author Oleksiy Yarmula
- */
-public interface GridImageClient {
- /**
- * Deletes an existing image
- *
- * @param id
- * id of the existing image
- */
- ServerImage deleteById(long id);
-
- /**
- * This call will save a private (visible to only you) server image to your
- * library of available images. The image will be saved from an existing
- * server.
- *
- * @param idOrName
- * id or name of the existing server
- * @param friendlyName
- * friendly name of the image
- * @return saved server image
- */
- ServerImage saveImageFromServer(String friendlyName, String idOrName, SaveImageOptions... options);
-
- /**
- * Returns all server images.
- *
- * @param options
- * options to narrow the search down
- * @return server images found
- */
- Set<ServerImage> getImageList(GetImageListOptions... options);
-
- /**
- * Returns images, found by specified ids
- *
- * @param ids
- * the ids that match existing images
- * @return images found
- */
- Set<ServerImage> getImagesById(Long... ids);
-
- /**
- * Returns images, found by specified names
- *
- * @param names
- * the names that march existing images
- * @return images found
- */
- Set<ServerImage> getImagesByName(String... names);
-
- /**
- * Edits an existing image
- *
- * @param idOrName
- * id or name of the existing image
- * @param newDescription
- * description to replace the current one
- * @return edited server image
- */
- ServerImage editImageDescription(String idOrName, String newDescription);
-
- /**
- * Edits an existing image
- *
- * @param idOrName
- * id or name of the existing image
- * @param newFriendlyName
- * friendly name to replace the current one
- * @return edited server image
- */
- ServerImage editImageFriendlyName(String idOrName, String newFriendlyName);
-
- /**
- * Retrieves the list of supported Datacenters to save images in. The objects
- * will have datacenter ID, name and description. In most cases, id or name
- * will be used for {@link #getImageList}.
- *
- * @return supported datacenters
- */
- Set<Option> getDatacenters();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java
deleted file mode 100644
index 3cde534..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java
+++ /dev/null
@@ -1,94 +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.gogrid.services;
-
-import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_STATE_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_TYPE_KEY;
-import static org.jclouds.gogrid.reference.GoGridQueryParams.LOOKUP_LIST_KEY;
-
-import java.util.Set;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-
-import org.jclouds.gogrid.domain.Ip;
-import org.jclouds.gogrid.domain.Option;
-import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
-import org.jclouds.gogrid.functions.ParseIpListFromJsonResponse;
-import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse;
-import org.jclouds.gogrid.options.GetIpListOptions;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * @see org.jclouds.gogrid.services.GridImageClient
- *
- * @author Oleksiy Yarmula
- */
-@RequestFilters(SharedKeyLiteAuthentication.class)
-@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
-public interface GridIpAsyncClient {
-
- /**
- * @see GridIpClient#getIpList(org.jclouds.gogrid.options.GetIpListOptions...)
- */
- @GET
- @ResponseParser(ParseIpListFromJsonResponse.class)
- @Path("/grid/ip/list")
- ListenableFuture<Set<Ip>> getIpList(GetIpListOptions... options);
-
- /**
- * @see org.jclouds.gogrid.services.GridIpClient#getUnassignedIpList()
- */
- @GET
- @ResponseParser(ParseIpListFromJsonResponse.class)
- @Path("/grid/ip/list")
- @QueryParams(keys = IP_STATE_KEY, values = "Unassigned")
- ListenableFuture<Set<Ip>> getUnassignedIpList();
-
- /**
- * @see org.jclouds.gogrid.services.GridIpClient#getUnassignedPublicIpList()
- */
- @GET
- @ResponseParser(ParseIpListFromJsonResponse.class)
- @Path("/grid/ip/list")
- @QueryParams(keys = { IP_STATE_KEY, IP_TYPE_KEY }, values = { "Unassigned", "Public" })
- ListenableFuture<Set<Ip>> getUnassignedPublicIpList();
-
- /**
- * @see org.jclouds.gogrid.services.GridIpClient#getAssignedIpList()
- */
- @GET
- @ResponseParser(ParseIpListFromJsonResponse.class)
- @Path("/grid/ip/list")
- @QueryParams(keys = IP_STATE_KEY, values = "Assigned")
- ListenableFuture<Set<Ip>> getAssignedIpList();
-
- /**
- *
- * @see org.jclouds.gogrid.services.GridIpClient#getDatacenters
- */
- @GET
- @ResponseParser(ParseOptionsFromJsonResponse.class)
- @Path("/common/lookup/list")
- @QueryParams(keys = LOOKUP_LIST_KEY, values = "ip.datacenter")
- ListenableFuture<Set<Option>> getDatacenters();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpClient.java
deleted file mode 100644
index 09705a8..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpClient.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.gogrid.services;
-
-import java.util.Set;
-import org.jclouds.gogrid.domain.Ip;
-import org.jclouds.gogrid.domain.Option;
-import org.jclouds.gogrid.options.GetIpListOptions;
-
-/**
- * @author Oleksiy Yarmula
- */
-public interface GridIpClient {
-
- /**
- * Returns all IPs in the system that match the options
- *
- * @param options
- * options to narrow the search down
- * @return IPs found by the search
- */
- Set<Ip> getIpList(GetIpListOptions... options);
-
- /**
- * Returns the list of unassigned IPs.
- *
- * NOTE: this returns both public and private IPs!
- *
- * @return unassigned IPs
- */
- Set<Ip> getUnassignedIpList();
-
- /**
- * Returns the list of unassigned public IPs.
- *
- * @return unassigned public IPs
- */
- Set<Ip> getUnassignedPublicIpList();
-
- /**
- * Returns the list of assigned IPs
- *
- * NOTE: this returns both public and private IPs!
- *
- * @return assigned IPs
- */
- Set<Ip> getAssignedIpList();
-
- /**
- * Retrieves the list of supported Datacenters to retrieve ips from. The objects will have
- * datacenter ID, name and description. In most cases, id or name will be used for
- * {@link #addServer}.
- *
- * @return supported datacenters
- */
- Set<Option> getDatacenters();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java
deleted file mode 100644
index 103a15d..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.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.gogrid.services;
-
-import static org.jclouds.gogrid.reference.GoGridHeaders.VERSION;
-
-import java.util.Set;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-
-import org.jclouds.gogrid.binders.BindIdsToQueryParams;
-import org.jclouds.gogrid.binders.BindObjectNameToGetJobsRequestQueryParams;
-import org.jclouds.gogrid.domain.Job;
-import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
-import org.jclouds.gogrid.functions.ParseJobListFromJsonResponse;
-import org.jclouds.gogrid.options.GetJobListOptions;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * @author Oleksiy Yarmula
- */
-@RequestFilters(SharedKeyLiteAuthentication.class)
-@QueryParams(keys = VERSION, values = "{jclouds.api-version}")
-public interface GridJobAsyncClient {
-
- /**
- * @see GridJobClient#getJobList(org.jclouds.gogrid.options.GetJobListOptions...)
- */
- @GET
- @ResponseParser(ParseJobListFromJsonResponse.class)
- @Path("/grid/job/list")
- ListenableFuture<Set<Job>> getJobList(GetJobListOptions... options);
-
- /**
- * @see GridJobClient#getJobsForObjectName(String)
- */
- @GET
- @ResponseParser(ParseJobListFromJsonResponse.class)
- @Path("/grid/job/list")
- ListenableFuture<Set<Job>> getJobsForObjectName(
- @BinderParam(BindObjectNameToGetJobsRequestQueryParams.class) String objectName);
-
- /**
- * @see GridJobClient#getJobsById
- */
- @GET
- @ResponseParser(ParseJobListFromJsonResponse.class)
- @Path("/grid/job/get")
- ListenableFuture<Set<Job>> getJobsById(@BinderParam(BindIdsToQueryParams.class) long... ids);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/d4bf5112/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobClient.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobClient.java
deleted file mode 100644
index 5e6476b..0000000
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobClient.java
+++ /dev/null
@@ -1,67 +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.gogrid.services;
-
-import java.util.Set;
-import org.jclouds.gogrid.domain.Job;
-import org.jclouds.gogrid.options.GetJobListOptions;
-
-/**
- * Manages the customer's jobs.
- *
- * @see <a href="http://wiki.gogrid.com/wiki/index.php/API#Job_Methods" />
- *
- * @author Oleksiy Yarmula
- */
-public interface GridJobClient {
-
- /**
- * Returns all jobs found. The resulting set may be narrowed down by providing
- * {@link GetJobListOptions}.
- *
- * By default, the result is <=100 items from the date range of 4 weeks ago to now.
- *
- * NOTE: this method results in a big volume of data in response
- *
- * @return jobs found by request
- */
- Set<Job> getJobList(GetJobListOptions... options);
-
- /**
- * Returns jobs found for an object with a provided name.
- *
- * Usually, in GoGrid a name will uniquely identify the object, or, as the docs state, some API
- * methods will cause errors.
- *
- * @param serverName
- * name of the object
- * @return found jobs for the object
- */
- Set<Job> getJobsForObjectName(String serverName);
-
- /**
- * Returns jobs for the corresponding id(s).
- *
- * NOTE: there is a 1:1 relation between a job and its ID.
- *
- * @param ids
- * ids for the jobs
- * @return jobs found by the ids
- */
- Set<Job> getJobsById(long... ids);
-
-}