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 03:14:11 UTC
[3/3] git commit: Remove async from softlayer
Remove async from softlayer
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/dae2c67d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/dae2c67d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/dae2c67d
Branch: refs/heads/master
Commit: dae2c67d795c35d994193f5925a4ce3f4ca7b9ac
Parents: 82fe701
Author: Andrew Bayer <an...@gmail.com>
Authored: Thu Aug 1 13:07:09 2013 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Thu Aug 1 18:13:48 2013 -0700
----------------------------------------------------------------------
.../org/jclouds/softlayer/SoftLayerApi.java | 59 +++++
.../jclouds/softlayer/SoftLayerApiMetadata.java | 24 +-
.../jclouds/softlayer/SoftLayerAsyncClient.java | 63 ------
.../org/jclouds/softlayer/SoftLayerClient.java | 60 -----
.../SoftLayerComputeServiceContextModule.java | 16 +-
.../functions/VirtualGuestToNodeMetadata.java | 18 +-
.../SoftLayerComputeServiceAdapter.java | 31 ++-
.../config/SoftLayerHttpApiModule.java | 67 ++++++
.../config/SoftLayerRestClientModule.java | 90 --------
.../jclouds/softlayer/features/AccountApi.java | 59 +++++
.../softlayer/features/AccountAsyncClient.java | 56 -----
.../softlayer/features/AccountClient.java | 44 ----
.../softlayer/features/DatacenterApi.java | 69 ++++++
.../features/DatacenterAsyncClient.java | 68 ------
.../softlayer/features/DatacenterClient.java | 46 ----
.../softlayer/features/ProductPackageApi.java | 57 +++++
.../features/ProductPackageAsyncClient.java | 58 -----
.../features/ProductPackageClient.java | 39 ----
.../softlayer/features/VirtualGuestApi.java | 178 +++++++++++++++
.../features/VirtualGuestAsyncClient.java | 152 -------------
.../softlayer/features/VirtualGuestClient.java | 118 ----------
.../org/jclouds/softlayer/SoftLayerApiTest.java | 55 +++++
.../softlayer/SoftLayerAsyncClientTest.java | 63 ------
.../SoftLayerComputeServiceAdapterLiveTest.java | 10 +-
.../VirtualGuestToNodeMetadataTest.java | 4 +-
.../softlayer/features/AccountApiLiveTest.java | 47 ++++
.../softlayer/features/AccountApiTest.java | 55 +++++
.../features/AccountAsyncClientTest.java | 55 -----
.../features/AccountClientLiveTest.java | 47 ----
.../features/BaseSoftLayerApiLiveTest.java | 34 +++
.../features/BaseSoftLayerApiTest.java | 43 ++++
.../features/BaseSoftLayerAsyncClientTest.java | 43 ----
.../features/BaseSoftLayerClientLiveTest.java | 34 ---
.../features/DatacenterApiLiveTest.java | 102 +++++++++
.../softlayer/features/DatacenterApiTest.java | 85 ++++++++
.../features/DatacenterAsyncClientTest.java | 85 --------
.../features/DatacenterClientLiveTest.java | 102 ---------
.../features/ProductPackageApiLiveTest.java | 218 +++++++++++++++++++
.../features/ProductPackageApiTest.java | 55 +++++
.../features/ProductPackageAsyncClientTest.java | 55 -----
.../features/ProductPackageClientLiveTest.java | 218 -------------------
.../features/VirtualGuestApiExpectTest.java | 58 +++++
.../features/VirtualGuestApiLiveTest.java | 169 ++++++++++++++
.../softlayer/features/VirtualGuestApiTest.java | 175 +++++++++++++++
.../features/VirtualGuestAsyncClientTest.java | 175 ---------------
.../features/VirtualGuestClientExpectTest.java | 58 -----
.../features/VirtualGuestClientLiveTest.java | 169 --------------
47 files changed, 1631 insertions(+), 1955 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApi.java
new file mode 100644
index 0000000..98383b7
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApi.java
@@ -0,0 +1,59 @@
+/*
+ * 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.softlayer;
+
+import java.io.Closeable;
+
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.softlayer.features.AccountApi;
+import org.jclouds.softlayer.features.DatacenterApi;
+import org.jclouds.softlayer.features.ProductPackageApi;
+import org.jclouds.softlayer.features.VirtualGuestApi;
+
+/**
+ * Provides synchronous access to SoftLayer.
+ * <p/>
+ *
+ * @see <a href="http://sldn.softlayer.com/article/REST" />
+ * @author Adrian Cole
+ */
+public interface SoftLayerApi extends Closeable {
+
+ /**
+ * Provides synchronous access to VirtualGuest features.
+ */
+ @Delegate
+ VirtualGuestApi getVirtualGuestApi();
+
+ /**
+ * Provides synchronous access to Datacenter features.
+ */
+ @Delegate
+ DatacenterApi getDatacenterApi();
+
+ /**
+ * Provides synchronous access to ProductPackage features.
+ */
+ @Delegate
+ ProductPackageApi getProductPackageApi();
+
+ /**
+ * Provides synchronous access to Account features.
+ */
+ @Delegate
+ AccountApi getAccountApi();
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java
index fb7e386..97fea12 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java
@@ -23,12 +23,11 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import org.jclouds.softlayer.compute.config.SoftLayerComputeServiceContextModule;
-import org.jclouds.softlayer.config.SoftLayerRestClientModule;
+import org.jclouds.softlayer.config.SoftLayerHttpApiModule;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
@@ -36,17 +35,9 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
-public class SoftLayerApiMetadata extends BaseRestApiMetadata {
+public class SoftLayerApiMetadata extends BaseHttpApiMetadata<SoftLayerApi> {
+
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SoftLayerClient.class)} as
- * {@link SoftLayerAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<SoftLayerClient, SoftLayerAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<SoftLayerClient, SoftLayerAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
@@ -61,17 +52,16 @@ public class SoftLayerApiMetadata 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<SoftLayerApi, Builder> {
@SuppressWarnings("deprecation")
protected Builder() {
- super(SoftLayerClient.class, SoftLayerAsyncClient.class);
id("softlayer")
.name("SoftLayer API")
.identityName("API Username")
@@ -81,7 +71,7 @@ public class SoftLayerApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://api.softlayer.com/rest")
.defaultProperties(SoftLayerApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(SoftLayerRestClientModule.class, SoftLayerComputeServiceContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(SoftLayerHttpApiModule.class, SoftLayerComputeServiceContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java
deleted file mode 100644
index 62b62d6..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.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.softlayer;
-
-import java.io.Closeable;
-
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.softlayer.features.AccountAsyncClient;
-import org.jclouds.softlayer.features.DatacenterAsyncClient;
-import org.jclouds.softlayer.features.ProductPackageAsyncClient;
-import org.jclouds.softlayer.features.VirtualGuestAsyncClient;
-
-/**
- * Provides asynchronous access to SoftLayer via their REST API.
- * <p/>
- *
- * @see SoftLayerClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SoftLayerClient.class)} as
- * {@link SoftLayerAsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface SoftLayerAsyncClient extends Closeable {
-
- /**
- * Provides asynchronous access to VirtualGuest features.
- */
- @Delegate
- VirtualGuestAsyncClient getVirtualGuestClient();
-
- /**
- * Provides asynchronous access to Datacenter features.
- */
- @Delegate
- DatacenterAsyncClient getDatacenterClient();
-
- /**
- * Provides asynchronous access to ProductPackage features.
- */
- @Delegate
- ProductPackageAsyncClient getProductPackageClient();
-
- /**
- * Provides asynchronous access to Account features.
- */
- @Delegate
- AccountAsyncClient getAccountClient();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java
deleted file mode 100644
index f76141c..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java
+++ /dev/null
@@ -1,60 +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.softlayer;
-
-import java.io.Closeable;
-
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.softlayer.features.AccountClient;
-import org.jclouds.softlayer.features.DatacenterClient;
-import org.jclouds.softlayer.features.ProductPackageClient;
-import org.jclouds.softlayer.features.VirtualGuestClient;
-
-/**
- * Provides synchronous access to SoftLayer.
- * <p/>
- *
- * @see SoftLayerAsyncClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-public interface SoftLayerClient extends Closeable {
-
- /**
- * Provides synchronous access to VirtualGuest features.
- */
- @Delegate
- VirtualGuestClient getVirtualGuestClient();
-
- /**
- * Provides synchronous access to Datacenter features.
- */
- @Delegate
- DatacenterClient getDatacenterClient();
-
- /**
- * Provides synchronous access to ProductPackage features.
- */
- @Delegate
- ProductPackageClient getProductPackageClient();
-
- /**
- * Provides synchronous access to Account features.
- */
- @Delegate
- AccountClient getAccountClient();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/config/SoftLayerComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/config/SoftLayerComputeServiceContextModule.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/config/SoftLayerComputeServiceContextModule.java
index a84b6e9..f4c87f1 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/config/SoftLayerComputeServiceContextModule.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/config/SoftLayerComputeServiceContextModule.java
@@ -37,7 +37,7 @@ import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.domain.Location;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
-import org.jclouds.softlayer.SoftLayerClient;
+import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.compute.functions.DatacenterToLocation;
import org.jclouds.softlayer.compute.functions.ProductItemToImage;
import org.jclouds.softlayer.compute.functions.ProductItemsToHardware;
@@ -49,8 +49,8 @@ import org.jclouds.softlayer.domain.ProductItem;
import org.jclouds.softlayer.domain.ProductItemPrice;
import org.jclouds.softlayer.domain.ProductPackage;
import org.jclouds.softlayer.domain.VirtualGuest;
-import org.jclouds.softlayer.features.AccountClient;
-import org.jclouds.softlayer.features.ProductPackageClient;
+import org.jclouds.softlayer.features.AccountApi;
+import org.jclouds.softlayer.features.ProductPackageApi;
import com.google.common.base.Function;
import com.google.common.base.Objects;
@@ -93,16 +93,16 @@ public class SoftLayerComputeServiceContextModule extends
@Singleton
@Memoized
public Supplier<ProductPackage> getProductPackage(AtomicReference<AuthorizationException> authException,
- @Named(PROPERTY_SESSION_INTERVAL) long seconds, final SoftLayerClient client,
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, final SoftLayerApi client,
@Named(PROPERTY_SOFTLAYER_VIRTUALGUEST_PACKAGE_NAME) final String virtualGuestPackageName) {
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
new Supplier<ProductPackage>() {
@Override
public ProductPackage get() {
- AccountClient accountClient = client.getAccountClient();
- ProductPackageClient productPackageClient = client.getProductPackageClient();
- ProductPackage p = find(accountClient.getActivePackages(), named(virtualGuestPackageName));
- return productPackageClient.getProductPackage(p.getId());
+ AccountApi accountApi = client.getAccountApi();
+ ProductPackageApi productPackageApi = client.getProductPackageApi();
+ ProductPackage p = find(accountApi.getActivePackages(), named(virtualGuestPackageName));
+ return productPackageApi.getProductPackage(p.getId());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
index 93f0fc4..6475a33 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
@@ -34,7 +34,7 @@ import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.domain.Location;
import org.jclouds.location.predicates.LocationPredicates;
-import org.jclouds.softlayer.SoftLayerClient;
+import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.domain.ProductItem;
import org.jclouds.softlayer.domain.ProductOrder;
import org.jclouds.softlayer.domain.VirtualGuest;
@@ -105,13 +105,13 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
@Singleton
public static class GetHardwareForVirtualGuest {
- private final SoftLayerClient client;
+ private final SoftLayerApi api;
private final Function<Iterable<ProductItem>, Hardware> productItemsToHardware;
@Inject
- public GetHardwareForVirtualGuest(SoftLayerClient client,
+ public GetHardwareForVirtualGuest(SoftLayerApi api,
Function<Iterable<ProductItem>, Hardware> productItemsToHardware) {
- this.client = checkNotNull(client, "client");
+ this.api = checkNotNull(api, "api");
this.productItemsToHardware = checkNotNull(productItemsToHardware, "productItemsToHardware");
}
@@ -120,7 +120,7 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
// 'bad' orders have no start cpu's and cause the order lookup to fail.
if (guest.getStartCpus() < 1)
return null;
- ProductOrder order = client.getVirtualGuestClient().getOrderTemplate(guest.getId());
+ ProductOrder order = api.getVirtualGuestApi().getOrderTemplate(guest.getId());
if (order == null)
return null;
Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
@@ -131,18 +131,18 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
@Singleton
public static class GetImageForVirtualGuest {
- private SoftLayerClient client;
+ private SoftLayerApi api;
@Inject
- public GetImageForVirtualGuest(SoftLayerClient client) {
- this.client = client;
+ public GetImageForVirtualGuest(SoftLayerApi api) {
+ this.api = api;
}
public Image getImage(VirtualGuest guest) {
// 'bad' orders have no start cpu's and cause the order lookup to fail.
if (guest.getStartCpus() < 1)
return null;
- ProductOrder order = client.getVirtualGuestClient().getOrderTemplate(guest.getId());
+ ProductOrder order = api.getVirtualGuestApi().getOrderTemplate(guest.getId());
if (order == null)
return null;
Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
index 5e614bb..aad6afb 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java
@@ -48,7 +48,7 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.logging.Logger;
-import org.jclouds.softlayer.SoftLayerClient;
+import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.compute.functions.ProductItemToImage;
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
import org.jclouds.softlayer.domain.Datacenter;
@@ -65,10 +65,9 @@ import com.google.common.base.Splitter;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
-import com.google.common.collect.Iterables;
/**
- * defines the connection between the {@link SoftLayerClient} implementation and
+ * defines the connection between the {@link SoftLayerApi} implementation and
* the jclouds {@link ComputeService}
*
*/
@@ -80,7 +79,7 @@ public class SoftLayerComputeServiceAdapter implements
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- private final SoftLayerClient client;
+ private final SoftLayerApi client;
private final Supplier<ProductPackage> productPackageSupplier;
private final Predicate<VirtualGuest> loginDetailsTester;
private final long guestLoginDelay;
@@ -90,7 +89,7 @@ public class SoftLayerComputeServiceAdapter implements
private final Iterable<ProductItemPrice> prices;
@Inject
- public SoftLayerComputeServiceAdapter(SoftLayerClient client,
+ public SoftLayerComputeServiceAdapter(SoftLayerApi client,
VirtualGuestHasLoginDetailsPresent virtualGuestHasLoginDetailsPresent,
@Memoized Supplier<ProductPackage> productPackageSupplier, Iterable<ProductItemPrice> prices,
@Named(PROPERTY_SOFTLAYER_VIRTUALGUEST_CPU_REGEX) String cpuRegex,
@@ -127,7 +126,7 @@ public class SoftLayerComputeServiceAdapter implements
.virtualGuests(newGuest).build();
logger.debug(">> ordering new virtualGuest domain(%s) hostname(%s)", domainName, name);
- ProductOrderReceipt productOrderReceipt = client.getVirtualGuestClient().orderVirtualGuest(order);
+ ProductOrderReceipt productOrderReceipt = client.getVirtualGuestApi().orderVirtualGuest(order);
VirtualGuest result = get(productOrderReceipt.getOrderDetails().getVirtualGuests(), 0);
logger.trace("<< virtualGuest(%s)", result.getId());
@@ -137,7 +136,7 @@ public class SoftLayerComputeServiceAdapter implements
checkState(orderInSystem, "order for guest %s doesn't have login details within %sms", result,
Long.toString(guestLoginDelay));
- result = client.getVirtualGuestClient().getVirtualGuest(result.getId());
+ result = client.getVirtualGuestApi().getVirtualGuest(result.getId());
Password pw = get(result.getOperatingSystem().getPasswords(), 0);
return new NodeAndInitialCredentials<VirtualGuest>(result, result.getId() + "", LoginCredentials.builder().user(pw.getUsername()).password(
@@ -197,7 +196,7 @@ public class SoftLayerComputeServiceAdapter implements
@Override
public Iterable<VirtualGuest> listNodes() {
- return filter(client.getVirtualGuestClient().listVirtualGuests(), new Predicate<VirtualGuest>() {
+ return filter(client.getVirtualGuestApi().listVirtualGuests(), new Predicate<VirtualGuest>() {
@Override
public boolean apply(VirtualGuest arg0) {
@@ -230,7 +229,7 @@ public class SoftLayerComputeServiceAdapter implements
@Override
public VirtualGuest getNode(String id) {
long serverId = Long.parseLong(id);
- return client.getVirtualGuestClient().getVirtualGuest(serverId);
+ return client.getVirtualGuestApi().getVirtualGuest(serverId);
}
@Override
@@ -244,29 +243,29 @@ public class SoftLayerComputeServiceAdapter implements
id));
logger.debug(">> canceling service for guest(%s) billingItem(%s)", id, guest.getBillingItemId());
- client.getVirtualGuestClient().cancelService(guest.getBillingItemId());
+ client.getVirtualGuestApi().cancelService(guest.getBillingItemId());
}
@Override
public void rebootNode(String id) {
- client.getVirtualGuestClient().rebootHardVirtualGuest(Long.parseLong(id));
+ client.getVirtualGuestApi().rebootHardVirtualGuest(Long.parseLong(id));
}
@Override
public void resumeNode(String id) {
- client.getVirtualGuestClient().resumeVirtualGuest(Long.parseLong(id));
+ client.getVirtualGuestApi().resumeVirtualGuest(Long.parseLong(id));
}
@Override
public void suspendNode(String id) {
- client.getVirtualGuestClient().pauseVirtualGuest(Long.parseLong(id));
+ client.getVirtualGuestApi().pauseVirtualGuest(Long.parseLong(id));
}
public static class VirtualGuestHasLoginDetailsPresent implements Predicate<VirtualGuest> {
- private final SoftLayerClient client;
+ private final SoftLayerApi client;
@Inject
- public VirtualGuestHasLoginDetailsPresent(SoftLayerClient client) {
+ public VirtualGuestHasLoginDetailsPresent(SoftLayerApi client) {
this.client = checkNotNull(client, "client was null");
}
@@ -274,7 +273,7 @@ public class SoftLayerComputeServiceAdapter implements
public boolean apply(VirtualGuest guest) {
checkNotNull(guest, "virtual guest was null");
- VirtualGuest newGuest = client.getVirtualGuestClient().getVirtualGuest(guest.getId());
+ VirtualGuest newGuest = client.getVirtualGuestApi().getVirtualGuest(guest.getId());
boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
boolean hasPasswords = newGuest.getOperatingSystem() != null
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerHttpApiModule.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerHttpApiModule.java
new file mode 100644
index 0000000..f20a3f5
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerHttpApiModule.java
@@ -0,0 +1,67 @@
+/*
+ * 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.softlayer.config;
+
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRetryHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
+import org.jclouds.location.config.LocationModule;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
+import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.config.HttpApiModule;
+import org.jclouds.softlayer.SoftLayerApi;
+import org.jclouds.softlayer.handlers.SoftLayerErrorHandler;
+
+import com.google.inject.Scopes;
+
+/**
+ * Configures the SoftLayer connection.
+ *
+ * @author Adrian Cole
+ */
+@ConfiguresRestClient
+public class SoftLayerHttpApiModule extends HttpApiModule<SoftLayerApi> {
+
+ @Override
+ protected void configure() {
+ install(new SoftLayerParserModule());
+ super.configure();
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SoftLayerErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SoftLayerErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SoftLayerErrorHandler.class);
+ }
+
+ @Override
+ protected void bindRetryHandlers() {
+ bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ install(new LocationModule());
+ bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerRestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerRestClientModule.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerRestClientModule.java
deleted file mode 100644
index 1b0e591..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/config/SoftLayerRestClientModule.java
+++ /dev/null
@@ -1,90 +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.softlayer.config;
-
-import java.util.Map;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.location.config.LocationModule;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.softlayer.SoftLayerAsyncClient;
-import org.jclouds.softlayer.SoftLayerClient;
-import org.jclouds.softlayer.features.AccountAsyncClient;
-import org.jclouds.softlayer.features.AccountClient;
-import org.jclouds.softlayer.features.DatacenterAsyncClient;
-import org.jclouds.softlayer.features.DatacenterClient;
-import org.jclouds.softlayer.features.ProductPackageAsyncClient;
-import org.jclouds.softlayer.features.ProductPackageClient;
-import org.jclouds.softlayer.features.VirtualGuestAsyncClient;
-import org.jclouds.softlayer.features.VirtualGuestClient;
-import org.jclouds.softlayer.handlers.SoftLayerErrorHandler;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Scopes;
-
-/**
- * Configures the SoftLayer connection.
- *
- * @author Adrian Cole
- */
-@ConfiguresRestClient
-public class SoftLayerRestClientModule extends RestClientModule<SoftLayerClient, SoftLayerAsyncClient> {
-
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
- .put(VirtualGuestClient.class, VirtualGuestAsyncClient.class)//
- .put(DatacenterClient.class, DatacenterAsyncClient.class)//
- .put(ProductPackageClient.class, ProductPackageAsyncClient.class)//
- .put(AccountClient.class, AccountAsyncClient.class)//
- .build();
-
- public SoftLayerRestClientModule() {
- super(DELEGATE_MAP);
- }
-
- @Override
- protected void configure() {
- install(new SoftLayerParserModule());
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SoftLayerErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SoftLayerErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SoftLayerErrorHandler.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
- }
-
- @Override
- protected void installLocations() {
- install(new LocationModule());
- bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountApi.java
new file mode 100644
index 0000000..568d849
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountApi.java
@@ -0,0 +1,59 @@
+/*
+ * 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.softlayer.features;
+
+import java.util.Set;
+
+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;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.softlayer.domain.ProductPackage;
+
+/**
+ * Provides synchronous access to Account.
+ * <p/>
+ *
+ * @see <a href="http://sldn.softlayer.com/article/REST" />
+ * @author Jason King
+ */
+@RequestFilters(BasicAuthentication.class)
+@Path("/v{jclouds.api-version}")
+public interface AccountApi {
+
+ /**
+ *
+ * @return Gets all the active packages.
+ * This will give you a basic description of the packages that are currently
+ * active and from which you can order a server or additional services.
+ *
+ * Calling ProductPackage.getItems() will return an empty set.
+ * Use ProductPackageApi.getProductPackage(long id) to obtain items data.
+ * @see ProductPackageApi#getProductPackage
+ */
+ @GET
+ @Path("/SoftLayer_Account/ActivePackages.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Set<ProductPackage> getActivePackages();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountAsyncClient.java
deleted file mode 100644
index 2b60572..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountAsyncClient.java
+++ /dev/null
@@ -1,56 +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.softlayer.features;
-
-import java.util.Set;
-
-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.NullOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.softlayer.domain.ProductPackage;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Account via their REST API.
- * <p/>
- *
- * @see AccountClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Jason King
- */
-@RequestFilters(BasicAuthentication.class)
-@Path("/v{jclouds.api-version}")
-public interface AccountAsyncClient {
-
- /**
- * @see AccountClient#getActivePackages()
- */
- @GET
- @Path("/SoftLayer_Account/ActivePackages.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Set<ProductPackage>> getActivePackages();
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountClient.java
deleted file mode 100644
index c6fc31e..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/AccountClient.java
+++ /dev/null
@@ -1,44 +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.softlayer.features;
-
-import java.util.Set;
-import org.jclouds.softlayer.domain.ProductPackage;
-
-/**
- * Provides synchronous access to Account.
- * <p/>
- *
- * @see AccountAsyncClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Jason King
- */
-public interface AccountClient {
-
- /**
- *
- * @return Gets all the active packages.
- * This will give you a basic description of the packages that are currently
- * active and from which you can order a server or additional services.
- *
- * Calling ProductPackage.getItems() will return an empty set.
- * Use ProductPackageClient.getProductPackage(long id) to obtain items data.
- * @see ProductPackageClient#getProductPackage
- */
- Set<ProductPackage> getActivePackages();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterApi.java
new file mode 100644
index 0000000..8e7965a
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterApi.java
@@ -0,0 +1,69 @@
+/*
+ * 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.softlayer.features;
+
+import java.util.Set;
+
+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;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.softlayer.domain.Datacenter;
+
+/**
+ * Provides synchronous access to LocationDatacenter.
+ * <p/>
+ *
+ * @see <a href="http://sldn.softlayer.com/article/REST" />
+ * @author Adrian Cole
+ */
+@RequestFilters(BasicAuthentication.class)
+@Path("/v{jclouds.api-version}")
+public interface DatacenterApi {
+
+ /**
+ *
+ * @return an account's associated datacenter objects.
+ */
+ @GET
+ @Path("/SoftLayer_Location_Datacenter/Datacenters.json")
+ @QueryParams(keys = "objectMask", values = "locationAddress;regions")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+ Set<Datacenter> listDatacenters();
+
+ /**
+ *
+ * @param id
+ * id of the datacenter
+ * @return datacenter or null if not found
+ */
+ @GET
+ @Path("/SoftLayer_Location_Datacenter/{id}.json")
+ @QueryParams(keys = "objectMask", values = "locationAddress;regions")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Datacenter getDatacenter(@PathParam("id") long id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java
deleted file mode 100644
index e995c56..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java
+++ /dev/null
@@ -1,68 +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.softlayer.features;
-
-import java.util.Set;
-
-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.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.softlayer.domain.Datacenter;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to LocationDatacenter via their REST API.
- * <p/>
- *
- * @see DatacenterClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-@RequestFilters(BasicAuthentication.class)
-@Path("/v{jclouds.api-version}")
-public interface DatacenterAsyncClient {
-
- /**
- * @see DatacenterClient#listDatacenters
- */
- @GET
- @Path("/SoftLayer_Location_Datacenter/Datacenters.json")
- @QueryParams(keys = "objectMask", values = "locationAddress;regions")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Datacenter>> listDatacenters();
-
- /**
- * @see DatacenterClient#getDatacenter
- */
- @GET
- @Path("/SoftLayer_Location_Datacenter/{id}.json")
- @QueryParams(keys = "objectMask", values = "locationAddress;regions")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Datacenter> getDatacenter(@PathParam("id") long id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterClient.java
deleted file mode 100644
index 6034dc7..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterClient.java
+++ /dev/null
@@ -1,46 +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.softlayer.features;
-
-import java.util.Set;
-import org.jclouds.softlayer.domain.Datacenter;
-
-/**
- * Provides synchronous access to LocationDatacenter.
- * <p/>
- *
- * @see DatacenterAsyncClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-public interface DatacenterClient {
-
- /**
- *
- * @return an account's associated datacenter objects.
- */
- Set<Datacenter> listDatacenters();
-
- /**
- *
- * @param id
- * id of the datacenter
- * @return datacenter or null if not found
- */
- Datacenter getDatacenter(long id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageApi.java
new file mode 100644
index 0000000..efe1d9a
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageApi.java
@@ -0,0 +1,57 @@
+/*
+ * 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.softlayer.features;
+
+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;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.softlayer.domain.ProductPackage;
+
+/**
+ * Provides synchronous access to ProductPackage.
+ * <p/>
+ *
+ * @see <a href="http://sldn.softlayer.com/article/REST" />
+ * @author Adrian Cole
+ */
+@RequestFilters(BasicAuthentication.class)
+@Path("/v{jclouds.api-version}")
+public interface ProductPackageApi {
+ public static String PRODUCT_MASK = "items.prices;items.categories;locations.locationAddress;locations.regions";
+
+ /**
+ *
+ * @param id
+ * id of the product package
+ * @return product package or null if not found
+ */
+ @GET
+ @Path("/SoftLayer_Product_Package/{id}.json")
+ @QueryParams(keys = "objectMask", values = PRODUCT_MASK)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ProductPackage getProductPackage(@PathParam("id") long id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageAsyncClient.java
deleted file mode 100644
index 29bdb7f..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageAsyncClient.java
+++ /dev/null
@@ -1,58 +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.softlayer.features;
-
-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.NullOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.softlayer.domain.ProductPackage;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to ProductPackage via their REST API.
- * <p/>
- *
- * @see ProductPackageClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-@RequestFilters(BasicAuthentication.class)
-@Path("/v{jclouds.api-version}")
-public interface ProductPackageAsyncClient {
- public static String PRODUCT_MASK = "items.prices;items.categories;locations.locationAddress;locations.regions";
-
- /**
- * @see ProductPackageClient#getProductPackage
- */
- @GET
- @Path("/SoftLayer_Product_Package/{id}.json")
- @QueryParams(keys = "objectMask", values = PRODUCT_MASK)
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ProductPackage> getProductPackage(@PathParam("id") long id);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageClient.java
deleted file mode 100644
index 76acd3b..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/ProductPackageClient.java
+++ /dev/null
@@ -1,39 +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.softlayer.features;
-
-import org.jclouds.softlayer.domain.ProductPackage;
-
-/**
- * Provides synchronous access to ProductPackage.
- * <p/>
- *
- * @see ProductPackageAsyncClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-public interface ProductPackageClient {
-
- /**
- *
- * @param id
- * id of the product package
- * @return product package or null if not found
- */
- ProductPackage getProductPackage(long id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
new file mode 100644
index 0000000..6b76822
--- /dev/null
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
@@ -0,0 +1,178 @@
+/*
+ * 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.softlayer.features;
+
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.http.filters.BasicAuthentication;
+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.softlayer.binders.ProductOrderToJson;
+import org.jclouds.softlayer.domain.ProductOrder;
+import org.jclouds.softlayer.domain.ProductOrderReceipt;
+import org.jclouds.softlayer.domain.VirtualGuest;
+
+/**
+ * Provides synchronous access to VirtualGuest.
+ * <p/>
+ *
+ * @see <a href="http://sldn.softlayer.com/article/REST" />
+ * @author Adrian Cole
+ */
+@RequestFilters(BasicAuthentication.class)
+@Path("/v{jclouds.api-version}")
+public interface VirtualGuestApi {
+ public static String LIST_GUEST_MASK = "virtualGuests.powerState;virtualGuests.networkVlans;virtualGuests.operatingSystem.passwords;virtualGuests.datacenter;virtualGuests.billingItem";
+ public static String GUEST_MASK = "powerState;networkVlans;operatingSystem.passwords;datacenter;billingItem";
+
+ /**
+ *
+ * @return an account's associated virtual guest objects.
+ */
+ @GET
+ @Path("/SoftLayer_Account/VirtualGuests.json")
+ @QueryParams(keys = "objectMask", values = LIST_GUEST_MASK)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
+ Set<VirtualGuest> listVirtualGuests();
+
+ /**
+ *
+ * @param id
+ * id of the virtual guest
+ * @return virtual guest or null if not found
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}.json")
+ @QueryParams(keys = "objectMask", values = GUEST_MASK)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VirtualGuest getVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * hard reboot the guest.
+ *
+ * @param id
+ * id of the virtual guest
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}/rebootHard.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void rebootHardVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * Power off a guest
+ *
+ * @param id
+ * id of the virtual guest
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}/powerOff.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void powerOffVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * Power on a guest
+ *
+ * @param id
+ * id of the virtual guest
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}/powerOn.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void powerOnVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * pause the guest.
+ *
+ * @param id
+ * id of the virtual guest
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}/pause.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void pauseVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * resume the guest.
+ *
+ * @param id
+ * id of the virtual guest
+ */
+ @GET
+ @Path("/SoftLayer_Virtual_Guest/{id}/resume.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void resumeVirtualGuest(@PathParam("id") long id);
+
+ /**
+ * Cancel the resource or service for a billing Item
+ *
+ * @param id
+ * The id of the billing item to cancel
+ * @return true or false
+ */
+ @GET
+ @Path("/SoftLayer_Billing_Item/{id}/cancelService.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
+ boolean cancelService(@PathParam("id") long id);
+
+ /**
+ * Use this method for placing server orders and additional services orders.
+ * @param order
+ * Details required to order.
+ * @return A receipt for the order
+ * @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder" />
+ */
+ @POST
+ @Path("/SoftLayer_Product_Order/placeOrder.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ProductOrderReceipt orderVirtualGuest(@BinderParam(ProductOrderToJson.class)ProductOrder order);
+
+ /**
+ * Obtain an order container that is ready to be sent to the orderVirtualGuest method.
+ * This container will include all services that the selected computing instance has.
+ * If desired you may remove prices which were returned.
+ * @see <a href=" @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder" />
+ * @param id
+ * The id of the existing Virtual Guest
+ * @return
+ * The ProductOrder used to create the VirtualGust or null if not available
+ */
+ @GET
+ @Path("SoftLayer_Virtual_Guest/{id}/getOrderTemplate/MONTHLY.json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ProductOrder getOrderTemplate(@PathParam("id") long id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestAsyncClient.java
deleted file mode 100644
index 30fddc0..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestAsyncClient.java
+++ /dev/null
@@ -1,152 +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.softlayer.features;
-
-import java.util.Set;
-
-import javax.ws.rs.Consumes;
-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.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.http.filters.BasicAuthentication;
-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.softlayer.binders.ProductOrderToJson;
-import org.jclouds.softlayer.domain.ProductOrder;
-import org.jclouds.softlayer.domain.ProductOrderReceipt;
-import org.jclouds.softlayer.domain.VirtualGuest;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to VirtualGuest via their REST API.
- * <p/>
- *
- * @see VirtualGuestClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-@RequestFilters(BasicAuthentication.class)
-@Path("/v{jclouds.api-version}")
-public interface VirtualGuestAsyncClient {
- public static String LIST_GUEST_MASK = "virtualGuests.powerState;virtualGuests.networkVlans;virtualGuests.operatingSystem.passwords;virtualGuests.datacenter;virtualGuests.billingItem";
- public static String GUEST_MASK = "powerState;networkVlans;operatingSystem.passwords;datacenter;billingItem";
-
- /**
- * @see VirtualGuestClient#listVirtualGuests
- */
- @GET
- @Path("/SoftLayer_Account/VirtualGuests.json")
- @QueryParams(keys = "objectMask", values = LIST_GUEST_MASK)
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<VirtualGuest>> listVirtualGuests();
-
- /**
- * @see VirtualGuestClient#getVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}.json")
- @QueryParams(keys = "objectMask", values = GUEST_MASK)
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<VirtualGuest> getVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#rebootHardVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}/rebootHard.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> rebootHardVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#powerOffVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}/powerOff.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> powerOffVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#powerOnVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}/powerOn.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> powerOnVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#pauseVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}/pause.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> pauseVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#resumeVirtualGuest
- */
- @GET
- @Path("/SoftLayer_Virtual_Guest/{id}/resume.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> resumeVirtualGuest(@PathParam("id") long id);
-
- /**
- * @see VirtualGuestClient#cancelService
- */
- @GET
- @Path("/SoftLayer_Billing_Item/{id}/cancelService.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> cancelService(@PathParam("id") long id);
-
- /**
- * @see org.jclouds.softlayer.features.VirtualGuestClient#orderVirtualGuest
- */
- @POST
- @Path("/SoftLayer_Product_Order/placeOrder.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ProductOrderReceipt> orderVirtualGuest(@BinderParam(ProductOrderToJson.class)ProductOrder order);
-
- /**
- * Throws an Internal Server Error if called on bad orders (mapped to HttpResponseException)
- * @see VirtualGuestClient#getOrderTemplate
- * @throws org.jclouds.http.HttpResponseException if called with a 'bad' order.
- */
- @GET
- @Path("SoftLayer_Virtual_Guest/{id}/getOrderTemplate/MONTHLY.json")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ProductOrder> getOrderTemplate(@PathParam("id") long id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestClient.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestClient.java
deleted file mode 100644
index 0ebf166..0000000
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestClient.java
+++ /dev/null
@@ -1,118 +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.softlayer.features;
-
-import java.util.Set;
-import org.jclouds.softlayer.domain.ProductOrder;
-import org.jclouds.softlayer.domain.ProductOrderReceipt;
-import org.jclouds.softlayer.domain.VirtualGuest;
-
-/**
- * Provides synchronous access to VirtualGuest.
- * <p/>
- *
- * @see VirtualGuestAsyncClient
- * @see <a href="http://sldn.softlayer.com/article/REST" />
- * @author Adrian Cole
- */
-public interface VirtualGuestClient {
-
- /**
- *
- * @return an account's associated virtual guest objects.
- */
- Set<VirtualGuest> listVirtualGuests();
-
- /**
- *
- * @param id
- * id of the virtual guest
- * @return virtual guest or null if not found
- */
- VirtualGuest getVirtualGuest(long id);
-
- /**
- * hard reboot the guest.
- *
- * @param id
- * id of the virtual guest
- */
- void rebootHardVirtualGuest(long id);
-
- /**
- * Power off a guest
- *
- * @param id
- * id of the virtual guest
- */
- void powerOffVirtualGuest(long id);
-
- /**
- * Power on a guest
- *
- * @param id
- * id of the virtual guest
- */
- void powerOnVirtualGuest(long id);
-
- /**
- * pause the guest.
- *
- * @param id
- * id of the virtual guest
- */
- void pauseVirtualGuest(long id);
-
- /**
- * resume the guest.
- *
- * @param id
- * id of the virtual guest
- */
- void resumeVirtualGuest(long id);
-
-
- /**
- * Cancel the resource or service for a billing Item
- *
- * @param id
- * The id of the billing item to cancel
- * @return true or false
- */
- boolean cancelService(long id);
-
- /**
- * Use this method for placing server orders and additional services orders.
- * @param order
- * Details required to order.
- * @return A receipt for the order
- * @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder" />
- */
- ProductOrderReceipt orderVirtualGuest(ProductOrder order);
-
- /**
- * Obtain an order container that is ready to be sent to the orderVirtualGuest method.
- * This container will include all services that the selected computing instance has.
- * If desired you may remove prices which were returned.
- * @see <a href=" @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder" />
- * @param id
- * The id of the existing Virtual Guest
- * @return
- * The ProductOrder used to create the VirtualGust or null if not available
- */
- ProductOrder getOrderTemplate(long id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerApiTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerApiTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerApiTest.java
new file mode 100644
index 0000000..b0458c0
--- /dev/null
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerApiTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.softlayer;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.softlayer.features.BaseSoftLayerApiTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code SoftLayerApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "SoftLayerApiTest")
+public class SoftLayerApiTest extends BaseSoftLayerApiTest<SoftLayerApi> {
+
+ private SoftLayerApi syncClient;
+
+ public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
+ assert syncClient.getVirtualGuestApi() != null;
+ assert syncClient.getDatacenterApi() != null;
+ assert syncClient.getProductPackageApi() != null;
+ }
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ syncClient = injector.getInstance(SoftLayerApi.class);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java
deleted file mode 100644
index e3e5354..0000000
--- a/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.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.softlayer;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.softlayer.features.BaseSoftLayerAsyncClientTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Tests behavior of {@code SoftLayerAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "SoftLayerAsyncClientTest")
-public class SoftLayerAsyncClientTest extends BaseSoftLayerAsyncClientTest<SoftLayerAsyncClient> {
-
- private SoftLayerAsyncClient asyncClient;
- private SoftLayerClient syncClient;
-
- public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
- assert syncClient.getVirtualGuestClient() != null;
- assert syncClient.getDatacenterClient() != null;
- assert syncClient.getProductPackageClient() != null;
- }
-
- public void testAsync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
- assert asyncClient.getVirtualGuestClient() != null;
- assert asyncClient.getDatacenterClient() != null;
- assert asyncClient.getProductPackageClient() != null;
- }
-
- @BeforeClass
- @Override
- protected void setupFactory() throws IOException {
- super.setupFactory();
- asyncClient = injector.getInstance(SoftLayerAsyncClient.class);
- syncClient = injector.getInstance(SoftLayerClient.class);
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java
index 425918c..61a8b82 100644
--- a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java
@@ -29,12 +29,12 @@ import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
import org.jclouds.domain.LoginCredentials;
-import org.jclouds.softlayer.SoftLayerClient;
+import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
import org.jclouds.softlayer.domain.ProductItem;
import org.jclouds.softlayer.domain.VirtualGuest;
-import org.jclouds.softlayer.features.BaseSoftLayerClientLiveTest;
+import org.jclouds.softlayer.features.BaseSoftLayerApiLiveTest;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshClient.Factory;
import org.jclouds.sshj.config.SshjSshClientModule;
@@ -49,7 +49,7 @@ import com.google.inject.Injector;
import com.google.inject.Module;
@Test(groups = "live", singleThreaded = true, testName = "SoftLayerComputeServiceAdapterLiveTest")
-public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientLiveTest {
+public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerApiLiveTest {
private SoftLayerComputeServiceAdapter adapter;
private TemplateBuilder templateBuilder;
@@ -57,12 +57,12 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL
private NodeAndInitialCredentials<VirtualGuest> guest;
@Override
- protected SoftLayerClient create(Properties props, Iterable<Module> modules) {
+ protected SoftLayerApi create(Properties props, Iterable<Module> modules) {
Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
adapter = injector.getInstance(SoftLayerComputeServiceAdapter.class);
templateBuilder = injector.getInstance(TemplateBuilder.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
- return injector.getInstance(SoftLayerClient.class);
+ return injector.getInstance(SoftLayerApi.class);
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadataTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadataTest.java
index 208fb48..aac0081 100644
--- a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadataTest.java
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadataTest.java
@@ -31,7 +31,7 @@ import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.domain.Location;
-import org.jclouds.softlayer.SoftLayerClient;
+import org.jclouds.softlayer.SoftLayerApi;
import org.jclouds.softlayer.domain.VirtualGuest;
import org.jclouds.softlayer.parse.ParseBadVirtualGuest;
import org.jclouds.softlayer.parse.ParseVirtualGuestHaltedTest;
@@ -192,7 +192,7 @@ public class VirtualGuestToNodeMetadataTest {
private static class GetHardwareForVirtualGuestMock extends VirtualGuestToNodeMetadata.GetHardwareForVirtualGuest {
@SuppressWarnings("unchecked")
public GetHardwareForVirtualGuestMock() {
- super(createNiceMock(SoftLayerClient.class), createNiceMock(Function.class));
+ super(createNiceMock(SoftLayerApi.class), createNiceMock(Function.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/dae2c67d/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountApiLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountApiLiveTest.java
new file mode 100644
index 0000000..f80b0cc
--- /dev/null
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountApiLiveTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.softlayer.features;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.softlayer.domain.ProductPackage;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code AccountApi}
+ *
+ * @author Jason King
+ */
+@Test(groups = "live")
+public class AccountApiLiveTest extends BaseSoftLayerApiLiveTest {
+
+ @Test
+ public void testGetActivePackages() {
+ Set<ProductPackage> response = api.getAccountApi().getActivePackages();
+ assert null != response;
+
+ assertTrue(response.size() >= 0);
+ for (ProductPackage productPackage: response) {
+ assert productPackage.getId() > 0 : response;
+ assert productPackage.getName() != null : response;
+ assert productPackage.getDescription() != null : response;
+ assertTrue(productPackage.getItems().isEmpty());
+ }
+ }
+}