You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/05 01:16:40 UTC
git commit: JCLOUDS-40 unasync joyent
Repository: jclouds-labs
Updated Branches:
refs/heads/master ac22366f9 -> 591139c00
JCLOUDS-40 unasync joyent
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/591139c0
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/591139c0
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/591139c0
Branch: refs/heads/master
Commit: 591139c00ac7a3dab6a97f3dd7e2f99354ee4032
Parents: ac22366
Author: Adrian Cole <ac...@twitter.com>
Authored: Sat Oct 4 12:49:24 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Sat Oct 4 16:16:32 2014 -0700
----------------------------------------------------------------------
.../joyent/cloudapi/v6_5/JoyentCloudApi.java | 20 +--
.../cloudapi/v6_5/JoyentCloudApiMetadata.java | 27 ++--
.../cloudapi/v6_5/JoyentCloudAsyncApi.java | 83 -----------
.../v6_5/config/DatacentersAreZonesModule.java | 5 +-
.../v6_5/config/JoyentCloudHttpApiModule.java | 46 ++++++
.../config/JoyentCloudRestClientModule.java | 74 ---------
.../cloudapi/v6_5/features/DatacenterApi.java | 27 +++-
.../v6_5/features/DatacenterAsyncApi.java | 55 -------
.../cloudapi/v6_5/features/DatasetApi.java | 48 +++---
.../cloudapi/v6_5/features/DatasetAsyncApi.java | 67 ---------
.../joyent/cloudapi/v6_5/features/KeyApi.java | 47 +++++-
.../cloudapi/v6_5/features/KeyAsyncApi.java | 89 -----------
.../cloudapi/v6_5/features/MachineApi.java | 95 +++++++++---
.../cloudapi/v6_5/features/MachineAsyncApi.java | 149 -------------------
.../cloudapi/v6_5/features/PackageApi.java | 48 +++---
.../cloudapi/v6_5/features/PackageAsyncApi.java | 66 --------
.../internal/BaseJoyentCloudApiLiveTest.java | 5 +-
.../BaseJoyentCloudAsyncApiExpectTest.java | 35 -----
18 files changed, 258 insertions(+), 728 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApi.java
index 15eb4ca..f7bd0ac 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApi.java
@@ -16,6 +16,7 @@
*/
package org.jclouds.joyent.cloudapi.v6_5;
+import java.io.Closeable;
import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterApi;
@@ -30,14 +31,8 @@ import org.jclouds.rest.annotations.EndpointParam;
import com.google.inject.Provides;
-/**
- * Provides synchronous access to JoyentCloud.
- * <p/>
- *
- * @see JoyentCloudAsyncApi
- * @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
- */
-public interface JoyentCloudApi {
+/** Provides synchronous access to JoyentCloud. */
+public interface JoyentCloudApi extends Closeable {
/**
*
@@ -63,20 +58,17 @@ public interface JoyentCloudApi {
* Provides synchronous access to Machine features.
*/
@Delegate
- MachineApi getMachineApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
+ MachineApi getMachineApiForDatacenter(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
/**
* Provides synchronous access to Dataset features.
*/
@Delegate
- DatasetApi getDatasetApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
+ DatasetApi getDatasetApiForDatacenter(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
/**
* Provides synchronous access to Package features.
*/
@Delegate
- PackageApi getPackageApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
+ PackageApi getPackageApiForDatacenter(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApiMetadata.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApiMetadata.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApiMetadata.java
index 27fdd9c..1b75d7a 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApiMetadata.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudApiMetadata.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.joyent.cloudapi.v6_5;
+
import static org.jclouds.reflect.Reflection2.typeToken;
import java.net.URI;
@@ -23,23 +24,14 @@ import java.util.Properties;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
import org.jclouds.joyent.cloudapi.v6_5.config.DatacentersAreZonesModule;
+import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudHttpApiModule;
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudProperties;
-import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudRestClientModule;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for JoyentCloud ~6.5 API
- */
-public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
-
- public static final TypeToken<RestContext<JoyentCloudApi, JoyentCloudAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<JoyentCloudApi, JoyentCloudAsyncApi>>() {
- private static final long serialVersionUID = 1L;
- };
+public class JoyentCloudApiMetadata extends BaseHttpApiMetadata {
@Override
public Builder toBuilder() {
@@ -55,7 +47,7 @@ public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
// auth fail sometimes happens, as the rc.local script that injects the
// authorized key executes after ssh has started.
properties.setProperty("jclouds.ssh.max-retries", "7");
@@ -64,10 +56,10 @@ public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<JoyentCloudApi, Builder> {
protected Builder() {
- super(JoyentCloudApi.class, JoyentCloudAsyncApi.class);
+ super(JoyentCloudApi.class);
id("joyent-cloudapi")
.name("Joyent Cloud API")
.identityName("username")
@@ -77,7 +69,10 @@ public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://api.joyentcloud.com")
.defaultProperties(JoyentCloudApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>> of(DatacentersAreZonesModule.class, JoyentCloudRestClientModule.class, JoyentCloudComputeServiceContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>> builder()
+ .add(DatacentersAreZonesModule.class)
+ .add(JoyentCloudHttpApiModule.class)
+ .add(JoyentCloudComputeServiceContextModule.class).build());
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudAsyncApi.java
deleted file mode 100644
index 66787eb..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/JoyentCloudAsyncApi.java
+++ /dev/null
@@ -1,83 +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.joyent.cloudapi.v6_5;
-
-import java.util.Set;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncApi;
-import org.jclouds.location.Zone;
-import org.jclouds.location.functions.ZoneToEndpoint;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to JoyentCloud via their REST API.
- * <p/>
- *
- * @see JoyentCloudApi
- * @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
- */
-public interface JoyentCloudAsyncApi {
-
- /**
- *
- * @return the datacenter codes configured
- */
- @Provides
- @Zone
- Set<String> getConfiguredDatacenters();
-
- /**
- * Provides asynchronous access to Datacenter features.
- */
- @Delegate
- DatacenterAsyncApi getDatacenterApi();
-
- /**
- * Provides asynchronous access to Key features.
- */
- @Delegate
- KeyAsyncApi getKeyApi();
-
- /**
- * Provides asynchronous access to Machine features.
- */
- @Delegate
- MachineAsyncApi getMachineApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
-
- /**
- * Provides asynchronous access to Dataset features.
- */
- @Delegate
- DatasetAsyncApi getDatasetApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
-
- /**
- * Provides asynchronous access to Package features.
- */
- @Delegate
- PackageAsyncApi getPackageApiForDatacenter(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String datacenter);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/DatacentersAreZonesModule.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/DatacentersAreZonesModule.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/DatacentersAreZonesModule.java
index 8c188cf..37b37d3 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/DatacentersAreZonesModule.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/DatacentersAreZonesModule.java
@@ -16,9 +16,8 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.config;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncApi;
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterApi;
import org.jclouds.joyent.cloudapi.v6_5.suppliers.ZoneIdToURIFromDatacentersApi;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
@@ -35,7 +34,7 @@ public class DatacentersAreZonesModule extends AbstractModule {
@Override
protected void configure() {
// datacenter api is needed for obtaining zone ids
- bindSyncToAsyncHttpApi(binder(), DatacenterApi.class, DatacenterAsyncApi.class);
+ bindHttpApi(binder(), DatacenterApi.class);
bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromDatacentersApi.class).in(Scopes.SINGLETON);
bind(ZoneIdsSupplier.class).to(ZoneIdsFromZoneIdToURIKeySet.class).in(Scopes.SINGLETON);
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudHttpApiModule.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudHttpApiModule.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudHttpApiModule.java
new file mode 100644
index 0000000..ef26751
--- /dev/null
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudHttpApiModule.java
@@ -0,0 +1,46 @@
+/*
+ * 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.joyent.cloudapi.v6_5.config;
+
+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.joyent.cloudapi.v6_5.JoyentCloudApi;
+import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+
+@ConfiguresHttpApi
+public class JoyentCloudHttpApiModule extends HttpApiModule<JoyentCloudApi> {
+
+ @Override
+ protected void configure() {
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ super.configure();
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(JoyentCloudErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(JoyentCloudErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(JoyentCloudErrorHandler.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudRestClientModule.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudRestClientModule.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudRestClientModule.java
deleted file mode 100644
index 9e93d5a..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/config/JoyentCloudRestClientModule.java
+++ /dev/null
@@ -1,74 +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.joyent.cloudapi.v6_5.config;
-
-import java.util.Map;
-
-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.joyent.cloudapi.v6_5.JoyentCloudAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.DatasetApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.KeyApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.MachineApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncApi;
-import org.jclouds.joyent.cloudapi.v6_5.features.PackageApi;
-import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Configures the JoyentCloud connection.
- */
-@ConfiguresRestClient
-public class JoyentCloudRestClientModule extends RestClientModule<JoyentCloudApi, JoyentCloudAsyncApi> {
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
- .put(DatacenterApi.class, DatacenterAsyncApi.class)
- .put(KeyApi.class, KeyAsyncApi.class)
- .put(MachineApi.class, MachineAsyncApi.class)
- .put(DatasetApi.class, DatasetAsyncApi.class)
- .put(PackageApi.class, PackageAsyncApi.class).build();
-
- public JoyentCloudRestClientModule() {
- super(DELEGATE_MAP);
- }
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(JoyentCloudErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(JoyentCloudErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(JoyentCloudErrorHandler.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterApi.java
index 823b1d7..babf198 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterApi.java
@@ -16,14 +16,26 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.features;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
+
import java.net.URI;
import java.util.Map;
-/**
- * Datacenter Services
- *
- * @see DatacenterAsyncApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#datacenters">api doc</a>
- */
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.RequestFilters;
+
+@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
+@RequestFilters(BasicAuthentication.class)
+@Path("/my/datacenters")
+@Consumes(APPLICATION_JSON)
public interface DatacenterApi {
/**
@@ -31,5 +43,8 @@ public interface DatacenterApi {
*
* @return keys are the datacenter name, and the value is the URL.
*/
+ @Named("ListDataCenters")
+ @GET
+ @Fallback(EmptyMapOnNotFoundOr404.class)
Map<String, URI> getDatacenters();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterAsyncApi.java
deleted file mode 100644
index 08fc42d..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatacenterAsyncApi.java
+++ /dev/null
@@ -1,55 +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.joyent.cloudapi.v6_5.features;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Datacenter Services
- *
- * @see DatacenterApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#datacenters">api doc</a>
- */
-@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
-@RequestFilters(BasicAuthentication.class)
-public interface DatacenterAsyncApi {
-
- /**
- * @see DatacenterApi#getDatacenters
- */
- @Named("ListDataCenters")
- @GET
- @Path("/my/datacenters")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyMapOnNotFoundOr404.class)
- ListenableFuture<Map<String, URI>> getDatacenters();
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetApi.java
index 3622535..e7de9fb 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetApi.java
@@ -16,31 +16,39 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.features;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+
import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.RequestFilters;
-/**
- * Provides synchronous access to Datasets.
- * <p/>
- *
- * @see DatasetAsyncApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#datasets">api doc</a>
- */
+@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
+@RequestFilters(BasicAuthentication.class)
+@Consumes(APPLICATION_JSON)
+@Path("/my/datasets")
public interface DatasetApi {
- /**
- * Provides a list of datasets available in this datacenter.
- *
- * @return
- */
+ @Named("ListDatasets")
+ @GET
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Dataset> list();
- /**
- * Gets an individual dataset by id.
- *
- * @param id
- * the id of the dataset
- * @return
- */
- Dataset get(String id);
+ @Named("GetDataset")
+ @GET
+ @Path("/{id}")
+ @Consumes(APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ Dataset get(@PathParam("id") String id);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetAsyncApi.java
deleted file mode 100644
index d6f40e0..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/DatasetAsyncApi.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.joyent.cloudapi.v6_5.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Dataset via their REST API.
- * <p/>
- *
- * @see DatasetApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#datasets">api doc</a>
- */
-@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
-@RequestFilters(BasicAuthentication.class)
-public interface DatasetAsyncApi {
- /**
- * @see DatasetApi#list
- */
- @Named("ListDatasets")
- @GET
- @Path("/my/datasets")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Dataset>> list();
-
- /**
- * @see DatasetApi#get
- */
- @Named("GetDataset")
- @GET
- @Path("/my/datasets/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Dataset> get(@PathParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyApi.java
index 84f8f95..31473d5 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyApi.java
@@ -16,36 +16,71 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.features;
+import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+
import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+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.http.filters.BasicAuthentication;
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
/**
* Keys are the means by which you operate on your SSH/signing keys. Currently
* CloudAPI supports uploads of public keys in the OpenSSH format.
- *
- * @see KeyAsyncApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#keys">api doc</a>
*/
+@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
+@RequestFilters(BasicAuthentication.class)
+@Path("/my/keys")
+@Consumes(MediaType.APPLICATION_JSON)
public interface KeyApi {
/**
* Lists all public keys we have on record for the specified account.
*/
+ @Named("ListKeys")
+ @GET
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Key> list();
/**
* Retrieves an individual key record.
*/
- Key get(String name);
+ @Named("GetKey")
+ @GET
+ @Path("/{name}")
+ @Fallback(NullOnNotFoundOr404.class)
+ Key get(@PathParam("name") String name);
/**
* Uploads a new OpenSSH key to SmartDataCenter for use in SSH and HTTP
* signing.
*/
- Key create(Key key);
+ @Named("CreateKey")
+ @POST
+ Key create(@BinderParam(BindToJsonPayload.class) Key key);
/**
* Deletes an SSH key by name.
*/
- void delete(String name);
+ @Named("DeleteKey")
+ @DELETE
+ @Path("/{name}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void delete(@PathParam("name") String name);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyAsyncApi.java
deleted file mode 100644
index 2cce3a3..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/KeyAsyncApi.java
+++ /dev/null
@@ -1,89 +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.joyent.cloudapi.v6_5.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-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.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * @see KeyApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#keys">api doc</a>
- */
-@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
-@RequestFilters(BasicAuthentication.class)
-public interface KeyAsyncApi {
- /**
- * @see KeyApi#list
- */
- @Named("ListKeys")
- @GET
- @Path("/my/keys")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Key>> list();
-
- /**
- * @see KeyApi#get
- */
- @Named("GetKey")
- @GET
- @Path("/my/keys/{name}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Key> get(@PathParam("name") String name);
-
- /**
- * @see KeyApi#create
- */
- @Named("CreateKey")
- @POST
- @Path("/my/keys")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Key> create(@BinderParam(BindToJsonPayload.class) Key key);
-
- /**
- * @see KeyApi#delete
- */
- @Named("DeleteKey")
- @DELETE
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/my/keys/{name}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> delete(@PathParam("name") String name);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApi.java
index 158c701..c528a82 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApi.java
@@ -16,17 +16,37 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.features;
+import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+
import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
-/**
- * Provides synchronous access to Machine.
- * <p/>
- *
- * @see MachineAsyncApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#machines">api doc</a>
- */
+@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
+@RequestFilters(BasicAuthentication.class)
+@Consumes(APPLICATION_JSON)
+@Path("/my/machines")
public interface MachineApi {
/**
@@ -34,16 +54,16 @@ public interface MachineApi {
*
* @return an account's associated machine objects.
*/
+ @Named("ListMachines")
+ @GET
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Machine> list();
- /**
- * Gets the details for an individual machine.
- *
- * @param id
- * the id of the machine
- * @return
- */
- Machine get(String id);
+ @Named("GetMachine")
+ @GET
+ @Path("/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ Machine get(@PathParam("id") String id);
/**
* Allows you to provision a machine. Note that if you do not specify a
@@ -77,13 +97,17 @@ public interface MachineApi {
*
* @return the newly created machine
*/
- Machine createWithDataset(String datasetURN, CreateMachineOptions options);
+ @Named("CreateMachine")
+ @POST
+ Machine createWithDataset(@QueryParam("dataset") String datasetURN, CreateMachineOptions options);
/**
*
- * @see #createWithDataset(CreateMachineOptions)
+ * @see #createWithDataset(String, CreateMachineOptions)
*/
- Machine createWithDataset(String datasetURN);
+ @Named("CreateMachine")
+ @POST
+ Machine createWithDataset(@QueryParam("dataset") String datasetURN);
/**
* Allows you to shut down a machine.
@@ -91,7 +115,12 @@ public interface MachineApi {
* @param id
* the id of the machine to stop
*/
- void stop(String id);
+ @Named("StopMachine")
+ @POST
+ @Produces(APPLICATION_FORM_URLENCODED)
+ @Path("/{id}")
+ @Payload("action=stop")
+ void stop(@PathParam("id") String id);
/**
* Allows you to boot up a machine.
@@ -99,7 +128,12 @@ public interface MachineApi {
* @param id
* the id of the machine to start
*/
- void start(String id);
+ @Named("StartMachine")
+ @POST
+ @Produces(APPLICATION_FORM_URLENCODED)
+ @Path("/{id}")
+ @Payload("action=start")
+ void start(@PathParam("id") String id);
/**
* Allows you to reboot a machine.
@@ -107,7 +141,12 @@ public interface MachineApi {
* @param id
* the id of the machine to reboot
*/
- void reboot(String id);
+ @Named("RestartMachine")
+ @POST
+ @Produces(APPLICATION_FORM_URLENCODED)
+ @Path("/{id}")
+ @Payload("action=reboot")
+ void reboot(@PathParam("id") String id);
/**
* Allows you to resize a machine. (Works only for smart machines)
@@ -117,7 +156,12 @@ public interface MachineApi {
* @param packageJoyentCloud
* the package to use for the machine
*/
- void resize(String id, String packageJoyentCloud);
+ @Named("ResizeMachine")
+ @POST
+ @Produces(APPLICATION_FORM_URLENCODED)
+ @Path("/{id}")
+ @Payload("action=resize&package={package}")
+ void resize(@PathParam("id") String id, @PayloadParam("package") String packageJoyentCloud);
/**
* Allows you to delete a machine (the machine must be stopped before it can
@@ -126,6 +170,9 @@ public interface MachineApi {
* @param id
* the id of the machine to delete
*/
- void delete(String id);
-
+ @Named("DeleteMachine")
+ @DELETE
+ @Path("/{id}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void delete(@PathParam("id") String id);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineAsyncApi.java
deleted file mode 100644
index 7d7af92..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineAsyncApi.java
+++ /dev/null
@@ -1,149 +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.joyent.cloudapi.v6_5.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
-import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Machine via their REST API.
- * <p/>
- *
- * @see MachineApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#machines">api doc</a>
- */
-@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
-@RequestFilters(BasicAuthentication.class)
-public interface MachineAsyncApi {
-
- /**
- * @see MachineApi#list
- */
- @Named("ListMachines")
- @GET
- @Path("/my/machines")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Machine>> list();
-
- /**
- * @see MachineApi#get
- */
- @Named("GetMachine")
- @GET
- @Path("/my/machines/{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Machine> get(@PathParam("id") String id);
-
- /**
- * @see MachineApi#createWithDataset(String)
- */
- @Named("CreateMachine")
- @POST
- @Path("/my/machines")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Machine> createWithDataset(@QueryParam("dataset") String datasetURN);
-
- /**
- * @see MachineApi#createWithDataset(String, CreateMachineOptions)
- */
- @Named("CreateMachine")
- @POST
- @Path("/my/machines")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<Machine> createWithDataset(@QueryParam("dataset") String datasetURN, CreateMachineOptions options);
-
- /**
- * @see MachineApi#stop
- */
- @Named("StopMachine")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_FORM_URLENCODED)
- @Path("/my/machines/{id}")
- @Payload("action=stop")
- ListenableFuture<Void> stop(@PathParam("id") String id);
-
- /**
- * @see MachineApi#start
- */
- @Named("StartMachine")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_FORM_URLENCODED)
- @Path("/my/machines/{id}")
- @Payload("action=start")
- ListenableFuture<Void> start(@PathParam("id") String id);
-
- /**
- * @see MachineApi#reboot
- */
- @Named("RestartMachine")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_FORM_URLENCODED)
- @Path("/my/machines/{id}")
- @Payload("action=reboot")
- ListenableFuture<Void> reboot(@PathParam("id") String id);
-
- /**
- * @see MachineApi#resize
- */
- @Named("ResizeMachine")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_FORM_URLENCODED)
- @Path("/my/machines/{id}")
- @Payload("action=resize&package={package}")
- ListenableFuture<Void> resize(@PathParam("id") String id, @PayloadParam("package") String packageJoyentCloud);
-
- /**
- * @see MachineApi#delete
- */
- @Named("DeleteMachine")
- @DELETE
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/my/machines/{id}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> delete(@PathParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageApi.java
index 2e1f074..7003cd2 100644
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageApi.java
+++ b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageApi.java
@@ -16,29 +16,41 @@
*/
package org.jclouds.joyent.cloudapi.v6_5.features;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+
import java.util.Set;
-/**
- * Provides synchronous access to Packages.
- * <p/>
- *
- * @see PackageAsyncApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#packages">api doc</a>
- */
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.RequestFilters;
+
+@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
+@RequestFilters(BasicAuthentication.class)
+@Path("/my/packages")
+@Consumes(APPLICATION_JSON)
public interface PackageApi {
/**
* Provides a list of packages available in this datacenter.
- *
- * @return
*/
- Set<org.jclouds.joyent.cloudapi.v6_5.domain.Package> list();
+ @Named("ListPackages")
+ @GET
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<Package> list();
- /**
- * Gets an individual package by id.
- *
- * @param name
- * the name of the package
- * @return
- */
- org.jclouds.joyent.cloudapi.v6_5.domain.Package get(String name);
+ @Named("GetPackage")
+ @GET
+ @Path("/{name}")
+ @Fallback(NullOnNotFoundOr404.class)
+ Package get(@PathParam("name") String name);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageAsyncApi.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageAsyncApi.java b/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageAsyncApi.java
deleted file mode 100644
index 8e8b519..0000000
--- a/joyent-cloudapi/src/main/java/org/jclouds/joyent/cloudapi/v6_5/features/PackageAsyncApi.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.joyent.cloudapi.v6_5.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Dataset via their REST API.
- * <p/>
- *
- * @see PackageApi
- * @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/index.html#packages">api doc</a>
- */
-@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
-@RequestFilters(BasicAuthentication.class)
-public interface PackageAsyncApi {
- /**
- * @see PackageApi#list
- */
- @Named("ListPackages")
- @GET
- @Path("/my/packages")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<org.jclouds.joyent.cloudapi.v6_5.domain.Package>> list();
-
- /**
- * @see PackageApi#get
- */
- @Named("GetPackage")
- @GET
- @Path("/my/packages/{name}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<org.jclouds.joyent.cloudapi.v6_5.domain.Package> get(@PathParam("name") String name);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java b/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java
index 458df3d..c059083 100644
--- a/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java
+++ b/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java
@@ -18,8 +18,7 @@ package org.jclouds.joyent.cloudapi.v6_5.internal;
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApi;
-import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncApi;
-import org.jclouds.rest.RestContext;
+import org.jclouds.rest.ApiContext;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
@@ -36,7 +35,7 @@ public class BaseJoyentCloudApiLiveTest extends BaseComputeServiceContextLiveTes
provider = "joyent-cloudapi";
}
- protected RestContext<JoyentCloudApi, JoyentCloudAsyncApi> cloudApiContext;
+ protected ApiContext<JoyentCloudApi> cloudApiContext;
@BeforeGroups(groups = { "integration", "live" })
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/591139c0/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudAsyncApiExpectTest.java
----------------------------------------------------------------------
diff --git a/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudAsyncApiExpectTest.java b/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudAsyncApiExpectTest.java
deleted file mode 100644
index c3f0fe5..0000000
--- a/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudAsyncApiExpectTest.java
+++ /dev/null
@@ -1,35 +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.joyent.cloudapi.v6_5.internal;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncApi;
-
-import com.google.common.base.Function;
-import com.google.inject.Module;
-
-/**
- * Base class for writing Cloud Api Rest Api Expect tests
- */
-public class BaseJoyentCloudAsyncApiExpectTest extends BaseJoyentCloudExpectTest<JoyentCloudAsyncApi> {
- public JoyentCloudAsyncApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
- return createInjector(fn, module, props).getInstance(JoyentCloudAsyncApi.class);
- }
-}