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/07/01 21:15:04 UTC
[17/24] JCLOUDS-151 - CloudStack refactored to remove async,
*Client renamed to *Api.
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java
deleted file mode 100644
index 7a70393..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.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.cloudstack.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-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.cloudstack.domain.VMGroup;
-import org.jclouds.cloudstack.filters.AuthenticationFilter;
-import org.jclouds.cloudstack.options.CreateVMGroupOptions;
-import org.jclouds.cloudstack.options.ListVMGroupsOptions;
-import org.jclouds.cloudstack.options.UpdateVMGroupOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.OnlyElement;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to CloudStack VM group features.
- * <p/>
- *
- * @author Richard Downer
- * @see VMGroupClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- */
-@RequestFilters(AuthenticationFilter.class)
-@QueryParams(keys = "response", values = "json")
-public interface VMGroupAsyncClient {
- /**
- * Lists VM groups
- *
- * @param options if present, how to constrain the list.
- * @return VM groups matching query, or empty set, if no zones are found
- */
- @Named("listInstanceGroups")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listInstanceGroups", "true" })
- @SelectJson("instancegroup")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<VMGroup>> listInstanceGroups(ListVMGroupsOptions... options);
-
- /**
- * @see VMGroupClient#getInstanceGroup
- */
- @Named("listInstanceGroups")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listInstanceGroups", "true" })
- @SelectJson("instancegroup")
- @OnlyElement
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<VMGroup> getInstanceGroup(@QueryParam("id") String id);
-
- /**
- * Creates a VM group
- *
- * @param name the name of the VM group
- * @param options optional parameters
- * @return the new VMGroup
- */
- @Named("createInstanceGroup")
- @GET
- @QueryParams(keys = "command", values = "createInstanceGroup")
- @SelectJson("instancegroup")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<VMGroup> createInstanceGroup(@QueryParam("name") String name, CreateVMGroupOptions... options);
-
- /**
- * Modify a VM group
- *
- * @param name the new name of the group
- * @return the modified VMGroup
- */
- @Named("updateInstanceGroup")
- @GET
- @QueryParams(keys = "command", values = "updateInstanceGroup")
- @SelectJson("instancegroup")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<VMGroup> updateInstanceGroup(@QueryParam("id") String id, UpdateVMGroupOptions... options);
-
- /**
- * Delete a VM group
- *
- * @param id the ID of the VM group
- * @return a future with a void data type
- */
- @Named("deleteInstanceGroup")
- @GET
- @QueryParams(keys = "command", values = "deleteInstanceGroup")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteInstanceGroup(@QueryParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupClient.java
deleted file mode 100644
index 8dffacd..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupClient.java
+++ /dev/null
@@ -1,73 +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.cloudstack.features;
-
-import java.util.Set;
-import org.jclouds.cloudstack.domain.VMGroup;
-import org.jclouds.cloudstack.options.CreateVMGroupOptions;
-import org.jclouds.cloudstack.options.ListVMGroupsOptions;
-import org.jclouds.cloudstack.options.UpdateVMGroupOptions;
-
-/**
- * Provides synchronous access to CloudStack VM group features.
- * <p/>
- *
- * @author Richard Downer
- * @see VMGroupAsyncClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- */
-public interface VMGroupClient {
- /**
- * Lists VM groups
- *
- * @param options if present, how to constrain the list.
- * @return VM groups matching query, or empty set, if no groups are found
- */
- Set<VMGroup> listInstanceGroups(ListVMGroupsOptions... options);
-
- /**
- * Retrieve a VM group by its id
- *
- * @param id the id of the required VM group.
- * @return the VM group with the requested id, or null if not found
- */
- VMGroup getInstanceGroup(String id);
-
- /**
- * Creates a VM group
- *
- * @param name the name of the VM group
- * @param options optional parameters
- * @return the new VMGroup
- */
- VMGroup createInstanceGroup(String name, CreateVMGroupOptions... options);
-
- /**
- * Modify a VM group
- *
- * @param name the new name of the group
- * @return the modified VMGroup
- */
- VMGroup updateInstanceGroup(String id, UpdateVMGroupOptions... options);
-
- /**
- * Delete a VM group
- *
- * @param id the ID of the VM group
- */
- void deleteInstanceGroup(String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineApi.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineApi.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineApi.java
new file mode 100644
index 0000000..2013c8e
--- /dev/null
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineApi.java
@@ -0,0 +1,259 @@
+/*
+ * 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.cloudstack.features;
+
+import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.cloudstack.domain.AsyncCreateResponse;
+import org.jclouds.cloudstack.domain.VirtualMachine;
+import org.jclouds.cloudstack.filters.AuthenticationFilter;
+import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
+import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
+import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
+import org.jclouds.cloudstack.options.StopVirtualMachineOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.OnlyElement;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides synchronous access to cloudstack via their REST API.
+ * <p/>
+ *
+ * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AuthenticationFilter.class)
+@QueryParams(keys = "response", values = "json")
+public interface VirtualMachineApi {
+
+ /**
+ * Lists VirtualMachines
+ *
+ * @param options
+ * if present, how to constrain the list.
+ * @return VirtualMachines matching query, or empty set, if no
+ * VirtualMachines are found
+ */
+ @Named("listVirtualMachines")
+ @GET
+ @QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
+ @SelectJson("virtualmachine")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<VirtualMachine> listVirtualMachines(ListVirtualMachinesOptions... options);
+
+ /**
+ * get a specific VirtualMachine by id
+ *
+ * @param id
+ * VirtualMachine to get
+ * @return VirtualMachine or null if not found
+ */
+ @Named("listVirtualMachines")
+ @GET
+ @QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
+ @SelectJson("virtualmachine")
+ @OnlyElement
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ VirtualMachine getVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Creates and automatically starts a virtual machine based on a service
+ * offering, disk offering, and template.
+ *
+ * @param zoneId
+ * availability zone for the virtual machine
+ * @param serviceOfferingId
+ * the ID of the service offering for the virtual machine
+ * @param templateId
+ * the ID of the template for the virtual machine
+ *
+ * @return virtual machine
+ */
+ @Named("deployVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "deployVirtualMachine")
+ @SelectJson({ "deployvirtualmachine", "deployvirtualmachineresponse" })
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse deployVirtualMachineInZone(@QueryParam("zoneid") String zoneId,
+ @QueryParam("serviceofferingid") String serviceOfferingId, @QueryParam("templateid") String templateId,
+ DeployVirtualMachineOptions... options);
+
+ /**
+ * Reboots a virtual machine.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("rebootVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "rebootVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String rebootVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Starts a virtual machine.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("startVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "startVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String startVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Stops a virtual machine.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("stopVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "stopVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String stopVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Stops a virtual machine.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @param options
+ * If present, whether to force stop.
+ * @return job id related to destroying the VM
+ */
+ @GET
+ @QueryParams(keys = "command", values = "stopVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String stopVirtualMachine(@QueryParam("id") String id,
+ StopVirtualMachineOptions options);
+
+ /**
+ * Resets the password for virtual machine. The virtual machine must be in a
+ * "Stopped" state and the template must already support this feature for
+ * this command to take effect.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("resetPasswordForVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "resetPasswordForVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String resetPasswordForVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Return an encrypted password for the virtual machine. The command
+ * is asynchronous.
+ *
+ * @param id
+ * the ID of the virtual machine
+ * @return encrypted password
+ */
+ @Named("getVMPassword")
+ @GET
+ @QueryParams(keys = "command", values = "getVMPassword")
+ @SelectJson("encryptedpassword")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String getEncryptedPasswordForVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Changes the service offering for a virtual machine. The virtual machine
+ * must be in a "Stopped" state for this command to take effect.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("changeServiceForVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "changeServiceForVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String changeServiceForVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Updates parameters of a virtual machine.
+ *
+ * @param id
+ * The ID of the virtual machine
+ * @return job id related to destroying the VM
+ */
+ @Named("updateVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "updateVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ String updateVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Destroys a virtual machine. Once destroyed, only the administrator can
+ * recover it.
+ *
+ * @param id
+ * vm to destroy
+ * @return job id related to destroying the VM, or null if resource was not
+ * found
+ */
+ @Named("destroyVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "destroyVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ String destroyVirtualMachine(@QueryParam("id") String id);
+
+ /**
+ * Re-assign a virtual machine to a different account/domain.
+ *
+ * @param virtualMachineId
+ * VirtualMachine to re-assign
+ * @param options
+ * AssignVirtualMachineOptions specifying account and domain to transfer to, and optional network and security group IDs.
+ * @return VirtualMachine or null if not found
+ */
+ @Named("assignVirtualMachine")
+ @GET
+ @QueryParams(keys = "command", values = "assignVirtualMachine")
+ @SelectJson("jobid")
+ @Consumes(MediaType.APPLICATION_JSON)
+ VirtualMachine assignVirtualMachine(@QueryParam("virtualmachineid") String virtualMachineId,
+ AssignVirtualMachineOptions... options);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java
deleted file mode 100644
index 5f1aab2..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java
+++ /dev/null
@@ -1,193 +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.cloudstack.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.cloudstack.domain.AsyncCreateResponse;
-import org.jclouds.cloudstack.domain.VirtualMachine;
-import org.jclouds.cloudstack.filters.AuthenticationFilter;
-import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
-import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
-import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
-import org.jclouds.cloudstack.options.StopVirtualMachineOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.OnlyElement;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to cloudstack via their REST API.
- * <p/>
- *
- * @see VirtualMachineClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- * @author Adrian Cole
- */
-@RequestFilters(AuthenticationFilter.class)
-@QueryParams(keys = "response", values = "json")
-public interface VirtualMachineAsyncClient {
-
- /**
- * @see VirtualMachineClient#listVirtualMachines
- */
- @Named("listVirtualMachines")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
- @SelectJson("virtualmachine")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<VirtualMachine>> listVirtualMachines(ListVirtualMachinesOptions... options);
-
- /**
- * @see VirtualMachineClient#getVirtualMachine
- */
- @Named("listVirtualMachines")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
- @SelectJson("virtualmachine")
- @OnlyElement
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<VirtualMachine> getVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#deployVirtualMachineInZone
- */
- @Named("deployVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "deployVirtualMachine")
- @SelectJson({ "deployvirtualmachine", "deployvirtualmachineresponse" })
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone(@QueryParam("zoneid") String zoneId,
- @QueryParam("serviceofferingid") String serviceOfferingId, @QueryParam("templateid") String templateId,
- DeployVirtualMachineOptions... options);
-
- /**
- * @see VirtualMachineClient#rebootVirtualMachine
- */
- @Named("rebootVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "rebootVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> rebootVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#startVirtualMachine
- */
- @Named("startVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "startVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> startVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#stopVirtualMachine
- */
- @Named("stopVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "stopVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> stopVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#stopVirtualMachine
- */
- @GET
- @QueryParams(keys = "command", values = "stopVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> stopVirtualMachine(@QueryParam("id") String id,
- StopVirtualMachineOptions options);
-
- /**
- * @see VirtualMachineClient#resetPasswordForVirtualMachine
- */
- @Named("resetPasswordForVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "resetPasswordForVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> resetPasswordForVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#getEncryptedPasswordForVirtualMachine
- */
- @Named("getVMPassword")
- @GET
- @QueryParams(keys = "command", values = "getVMPassword")
- @SelectJson("encryptedpassword")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> getEncryptedPasswordForVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#changeServiceForVirtualMachine
- */
- @Named("changeServiceForVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "changeServiceForVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> changeServiceForVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#updateVirtualMachine
- */
- @Named("updateVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "updateVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<String> updateVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#destroyVirtualMachine
- */
- @Named("destroyVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "destroyVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<String> destroyVirtualMachine(@QueryParam("id") String id);
-
- /**
- * @see VirtualMachineClient#assinVirtualMachine
- */
- @Named("assignVirtualMachine")
- @GET
- @QueryParams(keys = "command", values = "assignVirtualMachine")
- @SelectJson("jobid")
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<VirtualMachine> assignVirtualMachine(@QueryParam("virtualmachineid") String virtualMachineId,
- AssignVirtualMachineOptions... options);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineClient.java
deleted file mode 100644
index 00f20aa..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineClient.java
+++ /dev/null
@@ -1,173 +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.cloudstack.features;
-
-import java.util.Set;
-import org.jclouds.cloudstack.domain.AsyncCreateResponse;
-import org.jclouds.cloudstack.domain.VirtualMachine;
-import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
-import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
-import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
-import org.jclouds.cloudstack.options.StopVirtualMachineOptions;
-
-/**
- * Provides synchronous access to CloudStack VirtualMachine features.
- * <p/>
- *
- * @see VirtualMachineAsyncClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- * @author Adrian Cole
- */
-public interface VirtualMachineClient {
- /**
- * Lists VirtualMachines
- *
- * @param options
- * if present, how to constrain the list.
- * @return VirtualMachines matching query, or empty set, if no
- * VirtualMachines are found
- */
- Set<VirtualMachine> listVirtualMachines(ListVirtualMachinesOptions... options);
-
- /**
- * get a specific VirtualMachine by id
- *
- * @param id
- * VirtualMachine to get
- * @return VirtualMachine or null if not found
- */
- VirtualMachine getVirtualMachine(String id);
-
- /**
- * Creates and automatically starts a virtual machine based on a service
- * offering, disk offering, and template.
- *
- * @param zoneId
- * availability zone for the virtual machine
- * @param serviceOfferingId
- * the ID of the service offering for the virtual machine
- * @param templateId
- * the ID of the template for the virtual machine
- *
- * @return virtual machine
- */
- AsyncCreateResponse deployVirtualMachineInZone(String zoneId, String serviceOfferingId, String templateId,
- DeployVirtualMachineOptions... options);
-
- /**
- * Reboots a virtual machine.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String rebootVirtualMachine(String id);
-
- /**
- * Starts a virtual machine.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String startVirtualMachine(String id);
-
- /**
- * Stops a virtual machine.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String stopVirtualMachine(String id);
-
- /**
- * Stops a virtual machine.
- *
- * @param id
- * The ID of the virtual machine
- * @param options
- * If present, whether to force stop.
- * @return job id related to destroying the VM
- */
- String stopVirtualMachine(String id, StopVirtualMachineOptions options);
-
- /**
- * Resets the password for virtual machine. The virtual machine must be in a
- * "Stopped" state and the template must already support this feature for
- * this command to take effect.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String resetPasswordForVirtualMachine(String id);
-
-
- /**
- * Return an encrypted password for the virtual machine. The command
- * is asynchronous.
- *
- * @param id
- * the ID of the virtual machine
- * @return encrypted password
- */
- String getEncryptedPasswordForVirtualMachine(String id);
-
- /**
- * Changes the service offering for a virtual machine. The virtual machine
- * must be in a "Stopped" state for this command to take effect.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String changeServiceForVirtualMachine(String id);
-
- /**
- * Updates parameters of a virtual machine.
- *
- * @param id
- * The ID of the virtual machine
- * @return job id related to destroying the VM
- */
- String updateVirtualMachine(String id);
-
- /**
- * Destroys a virtual machine. Once destroyed, only the administrator can
- * recover it.
- *
- * @param id
- * vm to destroy
- * @return job id related to destroying the VM, or null if resource was not
- * found
- */
- String destroyVirtualMachine(String id);
-
-
- /**
- * Re-assign a virtual machine to a different account/domain.
- *
- * @param virtualMachineId
- * VirtualMachine to re-assign
- * @param options
- * AssignVirtualMachineOptions specifying account and domain to transfer to, and optional network and security group IDs.
- * @return VirtualMachine or null if not found
- */
- VirtualMachine assignVirtualMachine(String virtualMachineId, AssignVirtualMachineOptions... options);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeApi.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeApi.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeApi.java
new file mode 100644
index 0000000..7392925
--- /dev/null
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeApi.java
@@ -0,0 +1,171 @@
+/*
+ * 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.cloudstack.features;
+
+import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+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.cloudstack.domain.AsyncCreateResponse;
+import org.jclouds.cloudstack.domain.Volume;
+import org.jclouds.cloudstack.filters.AuthenticationFilter;
+import org.jclouds.cloudstack.options.ListVolumesOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.OnlyElement;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Unwrap;
+
+/**
+ * Provides synchronous access to cloudstack via their REST API.
+ * <p/>
+ *
+ * @author Vijay Kiran
+ * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
+ */
+@RequestFilters(AuthenticationFilter.class)
+@QueryParams(keys = "response", values = "json")
+public interface VolumeApi {
+ /**
+ * Create a volume with given name and diskOfferingId
+ *
+ * @param name name of the volume
+ * @param diskOfferingId the ID of the disk offering.
+ * @param zoneId the ID of the availability zone
+ * @return AsyncCreateResponse job response used to track creation
+ */
+ @Named("listVolumes")
+ @GET
+ @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
+ @SelectJson("volume")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<Volume> listVolumes(ListVolumesOptions... options);
+
+ /**
+ * Create a volume with given name, size and diskOfferingId
+ *
+ * @param name name of the volume
+ * @param diskOfferingId the ID of the disk offering (the offering should have the custom disk size flag set)
+ * @param zoneId the ID of the availability zone
+ * @param size the size of volume required (in GB)
+ * @return AsyncCreateResponse job response used to track creation
+ */
+ @Named("listVolumes")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
+ @SelectJson("volume")
+ @OnlyElement
+ @Fallback(NullOnNotFoundOr404.class)
+ Volume getVolume(@QueryParam("id") String id);
+
+
+ /**
+ * Create a volume with given name and snapshotId
+ *
+ * @param name name of the volume
+ * @param snapshotId Snapshot id to be used while creating the volume
+ * @param zoneId the ID of the availability zone
+ * @return AsyncCreateResponse job response used to track creation
+ */
+ @Named("createVolume")
+ @GET
+ @QueryParams(keys = "command", values = "createVolume")
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse createVolumeFromDiskOfferingInZone(@QueryParam("name") String name,
+ @QueryParam("diskofferingid") String diskOfferingId,
+ @QueryParam("zoneid") String zoneId);
+
+ /**
+ * List volumes
+ *
+ * @return volume list, empty if not found
+ */
+ @GET
+ @QueryParams(keys = "command", values = "createVolume")
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse createVolumeFromCustomDiskOfferingInZone(@QueryParam("name") String name,
+ @QueryParam("diskofferingid") String diskOfferingId,
+ @QueryParam("zoneid") String zoneId,
+ @QueryParam("size") int size);
+
+ /**
+ * Get volume by id
+ *
+ * @param id the volume id to retrieve
+ * @return volume or null if not found
+ */
+ @Named("createVolume")
+ @GET
+ @QueryParams(keys = "command", values = "createVolume")
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse createVolumeFromSnapshotInZone(@QueryParam("name") String name,
+ @QueryParam("snapshotid") String snapshotId,
+ @QueryParam("zoneid") String zoneId);
+
+ /**
+ * Deletes a attached disk volume
+ *
+ * @param id id of the volume
+ */
+ @Named("attachVolume")
+ @GET
+ @QueryParams(keys = "command", values = "attachVolume")
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse attachVolume(@QueryParam("id") String volumeId,
+ @QueryParam("virtualmachineid") String virtualMachineId);
+
+ /**
+ * Attaches a disk volume to a virtual machine.
+ *
+ * @param volumeId the ID of the disk volume
+ * @param virtualMachineId the ID of the virtual machine
+ * @return AsyncCreateResponse job response used to track creation
+ */
+ @Named("detachVolume")
+ @GET
+ @QueryParams(keys = "command", values = "detachVolume")
+ @Unwrap
+ @Consumes(MediaType.APPLICATION_JSON)
+ AsyncCreateResponse detachVolume(@QueryParam("id") String volumeId);
+
+ /**
+ * Detaches a disk volume to a virtual machine.
+ *
+ * @param volumeId the ID of the disk volume
+ * @return AsyncCreateResponse job response used to track creation
+ */
+ @Named("deleteVolume")
+ @GET
+ @QueryParams(keys = "command", values = "deleteVolume")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void deleteVolume(@QueryParam("id") String id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java
deleted file mode 100644
index 64f2eef..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java
+++ /dev/null
@@ -1,144 +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.cloudstack.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-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.cloudstack.domain.AsyncCreateResponse;
-import org.jclouds.cloudstack.domain.Volume;
-import org.jclouds.cloudstack.filters.AuthenticationFilter;
-import org.jclouds.cloudstack.options.ListVolumesOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.OnlyElement;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Unwrap;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to cloudstack via their REST API.
- * <p/>
- *
- * @author Vijay Kiran
- * @see org.jclouds.cloudstack.features.VolumeClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- */
-@RequestFilters(AuthenticationFilter.class)
-@QueryParams(keys = "response", values = "json")
-public interface VolumeAsyncClient {
- /**
- * @see VolumeClient#listVolumes(org.jclouds.cloudstack.options.ListVolumesOptions...)
- */
- @Named("listVolumes")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
- @SelectJson("volume")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Volume>> listVolumes(ListVolumesOptions... options);
-
- /**
- * @see VolumeClient#getVolume(String)
- */
- @Named("listVolumes")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
- @SelectJson("volume")
- @OnlyElement
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Volume> getVolume(@QueryParam("id") String id);
-
-
- /**
- * @see VolumeClient#createVolumeFromDiskOfferingInZone(String, String, String)
- */
- @Named("createVolume")
- @GET
- @QueryParams(keys = "command", values = "createVolume")
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> createVolumeFromDiskOfferingInZone(@QueryParam("name") String name,
- @QueryParam("diskofferingid") String diskOfferingId,
- @QueryParam("zoneid") String zoneId);
-
- /**
- * @see VolumeClient#createVolumeFromCustomDiskOfferingInZone(String, String, String, int)
- */
- @GET
- @QueryParams(keys = "command", values = "createVolume")
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> createVolumeFromCustomDiskOfferingInZone(@QueryParam("name") String name,
- @QueryParam("diskofferingid") String diskOfferingId,
- @QueryParam("zoneid") String zoneId,
- @QueryParam("size") int size);
-
- /**
- * @see VolumeClient#createVolumeFromSnapshotInZone(String, String, String)
- */
- @Named("createVolume")
- @GET
- @QueryParams(keys = "command", values = "createVolume")
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> createVolumeFromSnapshotInZone(@QueryParam("name") String name,
- @QueryParam("snapshotid") String snapshotId,
- @QueryParam("zoneid") String zoneId);
-
- /**
- * @see VolumeClient#attachVolume(String, String)
- */
- @Named("attachVolume")
- @GET
- @QueryParams(keys = "command", values = "attachVolume")
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> attachVolume(@QueryParam("id") String volumeId,
- @QueryParam("virtualmachineid") String virtualMachineId);
-
- /**
- * @see VolumeClient#detachVolume(String)
- */
- @Named("detachVolume")
- @GET
- @QueryParams(keys = "command", values = "detachVolume")
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- ListenableFuture<AsyncCreateResponse> detachVolume(@QueryParam("id") String volumeId);
-
- /**
- * @see VolumeClient#deleteVolume(String)
- */
- @Named("deleteVolume")
- @GET
- @QueryParams(keys = "command", values = "deleteVolume")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteVolume(@QueryParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeClient.java
deleted file mode 100644
index 4f6894b..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeClient.java
+++ /dev/null
@@ -1,104 +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.cloudstack.features;
-
-import java.util.Set;
-import org.jclouds.cloudstack.domain.AsyncCreateResponse;
-import org.jclouds.cloudstack.domain.Volume;
-import org.jclouds.cloudstack.options.ListVolumesOptions;
-
-/**
- * Provides synchronous access to CloudStack Event features.
- * <p/>
- *
- * @author Vijay Kiran
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- */
-public interface VolumeClient {
-
- /**
- * Create a volume with given name and diskOfferingId
- *
- * @param name name of the volume
- * @param diskOfferingId the ID of the disk offering.
- * @param zoneId the ID of the availability zone
- * @return AsyncCreateResponse job response used to track creation
- */
- AsyncCreateResponse createVolumeFromDiskOfferingInZone(String name, String diskOfferingId, String zoneId);
-
-
- /**
- * Create a volume with given name, size and diskOfferingId
- *
- * @param name name of the volume
- * @param diskOfferingId the ID of the disk offering (the offering should have the custom disk size flag set)
- * @param zoneId the ID of the availability zone
- * @param size the size of volume required (in GB)
- * @return AsyncCreateResponse job response used to track creation
- */
- AsyncCreateResponse createVolumeFromCustomDiskOfferingInZone(String name, String diskOfferingId, String zoneId, int size);
-
- /**
- * Create a volume with given name and snapshotId
- *
- * @param name name of the volume
- * @param snapshotId Snapshot id to be used while creating the volume
- * @param zoneId the ID of the availability zone
- * @return AsyncCreateResponse job response used to track creation
- */
- AsyncCreateResponse createVolumeFromSnapshotInZone(String name, String snapshotId, String zoneId);
-
- /**
- * List volumes
- *
- * @return volume list, empty if not found
- */
- Set<Volume> listVolumes(ListVolumesOptions... options);
-
- /**
- * Get volume by id
- *
- * @param id the volume id to retrieve
- * @return volume or null if not found
- */
- Volume getVolume(String id);
-
- /**
- * Deletes a attached disk volume
- *
- * @param id id of the volume
- */
- void deleteVolume(String id);
-
- /**
- * Attaches a disk volume to a virtual machine.
- *
- * @param volumeId the ID of the disk volume
- * @param virtualMachineId the ID of the virtual machine
- * @return AsyncCreateResponse job response used to track creation
- */
- AsyncCreateResponse attachVolume(String volumeId, String virtualMachineId);
-
- /**
- * Detaches a disk volume to a virtual machine.
- *
- * @param volumeId the ID of the disk volume
- * @return AsyncCreateResponse job response used to track creation
- */
- AsyncCreateResponse detachVolume(String volumeId);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneApi.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneApi.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneApi.java
new file mode 100644
index 0000000..448c06d
--- /dev/null
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneApi.java
@@ -0,0 +1,80 @@
+/*
+ * 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.cloudstack.features;
+
+import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.cloudstack.domain.Zone;
+import org.jclouds.cloudstack.filters.AuthenticationFilter;
+import org.jclouds.cloudstack.options.ListZonesOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.OnlyElement;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides synchronous access to cloudstack via their REST API.
+ * <p/>
+ *
+ * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
+ * @author Adrian Cole
+ */
+@RequestFilters(AuthenticationFilter.class)
+@QueryParams(keys = "response", values = "json")
+public interface ZoneApi {
+
+ /**
+ * Lists zones
+ *
+ * @param options
+ * if present, how to constrain the list.
+ * @return zones matching query, or empty set, if no zones are found
+ */
+ @Named("listZones")
+ @GET
+ @QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
+ @SelectJson("zone")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<Zone> listZones(ListZonesOptions... options);
+
+ /**
+ * get a specific zone by id
+ *
+ * @param id
+ * zone to get
+ * @return zone or null if not found
+ */
+ @Named("listZones")
+ @GET
+ @QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
+ @SelectJson("zone")
+ @OnlyElement
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ Zone getZone(@QueryParam("id") String id);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java
deleted file mode 100644
index 8ba69c3..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java
+++ /dev/null
@@ -1,75 +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.cloudstack.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.cloudstack.domain.Zone;
-import org.jclouds.cloudstack.filters.AuthenticationFilter;
-import org.jclouds.cloudstack.options.ListZonesOptions;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.OnlyElement;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to cloudstack via their REST API.
- * <p/>
- *
- * @see ZoneClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- * @author Adrian Cole
- */
-@RequestFilters(AuthenticationFilter.class)
-@QueryParams(keys = "response", values = "json")
-public interface ZoneAsyncClient {
-
- /**
- * @see ZoneClient#listZones
- */
- @Named("listZones")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
- @SelectJson("zone")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Set<Zone>> listZones(ListZonesOptions... options);
-
- /**
- * @see ZoneClient#getZone
- */
- @Named("listZones")
- @GET
- @QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
- @SelectJson("zone")
- @OnlyElement
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Zone> getZone(@QueryParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneClient.java
deleted file mode 100644
index 89cbed4..0000000
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneClient.java
+++ /dev/null
@@ -1,49 +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.cloudstack.features;
-
-import java.util.Set;
-import org.jclouds.cloudstack.domain.Zone;
-import org.jclouds.cloudstack.options.ListZonesOptions;
-
-/**
- * Provides synchronous access to CloudStack zone features.
- * <p/>
- *
- * @see ZoneAsyncClient
- * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
- * @author Adrian Cole
- */
-public interface ZoneClient {
- /**
- * Lists zones
- *
- * @param options
- * if present, how to constrain the list.
- * @return zones matching query, or empty set, if no zones are found
- */
- Set<Zone> listZones(ListZonesOptions... options);
-
- /**
- * get a specific zone by id
- *
- * @param id
- * zone to get
- * @return zone or null if not found
- */
- Zone getZone(String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateFirewallRulesForIP.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateFirewallRulesForIP.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateFirewallRulesForIP.java
index 3fe14ef..56fcf6c 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateFirewallRulesForIP.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateFirewallRulesForIP.java
@@ -26,7 +26,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.domain.PublicIPAddress;
@@ -51,12 +51,12 @@ public class CreateFirewallRulesForIP {
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- private final CloudStackClient client;
+ private final CloudStackApi client;
private final BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult;
private final LoadingCache<String, Set<FirewallRule>> getFirewallRulesByVirtualMachine;
@Inject
- public CreateFirewallRulesForIP(CloudStackClient client,
+ public CreateFirewallRulesForIP(CloudStackApi client,
BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult,
LoadingCache<String, Set<FirewallRule>> getFirewallRulesByVirtualMachine) {
this.client = checkNotNull(client, "client");
@@ -77,7 +77,7 @@ public class CreateFirewallRulesForIP {
return ImmutableSet.<FirewallRule> of();
Builder<AsyncCreateResponse> responses = ImmutableSet.builder();
for (int port : ports) {
- AsyncCreateResponse response = client.getFirewallClient().createFirewallRuleForIpAndProtocol(ip.getId(), FirewallRule.Protocol.fromValue(protocol),
+ AsyncCreateResponse response = client.getFirewallApi().createFirewallRuleForIpAndProtocol(ip.getId(), FirewallRule.Protocol.fromValue(protocol),
CreateFirewallRuleOptions.Builder.startPort(port).endPort(port));
logger.debug(">> creating firewall rule IPAddress(%s) for protocol(%s), port(%s); response(%s)",
ip.getId(), protocol, port, response);
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreatePortForwardingRulesForIP.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreatePortForwardingRulesForIP.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreatePortForwardingRulesForIP.java
index beb8db6..16567f9 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreatePortForwardingRulesForIP.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreatePortForwardingRulesForIP.java
@@ -26,7 +26,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.IPForwardingRule;
import org.jclouds.cloudstack.domain.PublicIPAddress;
@@ -50,12 +50,12 @@ public class CreatePortForwardingRulesForIP {
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- private final CloudStackClient client;
+ private final CloudStackApi client;
private final BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult;
private final LoadingCache<String, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine;
@Inject
- public CreatePortForwardingRulesForIP(CloudStackClient client,
+ public CreatePortForwardingRulesForIP(CloudStackApi client,
BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult,
LoadingCache<String, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine) {
this.client = checkNotNull(client, "client");
@@ -76,7 +76,7 @@ public class CreatePortForwardingRulesForIP {
return ImmutableSet.<IPForwardingRule> of();
Builder<AsyncCreateResponse> responses = ImmutableSet.builder();
for (int port : ports) {
- AsyncCreateResponse response = client.getNATClient().createIPForwardingRule(ip.getId(), protocol, port);
+ AsyncCreateResponse response = client.getNATApi().createIPForwardingRule(ip.getId(), protocol, port);
logger.debug(">> creating IP forwarding rule IPAddress(%s) for protocol(%s), port(%s); response(%s)",
ip.getId(), protocol, port, response);
responses.add(response);
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateSecurityGroupIfNeeded.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateSecurityGroupIfNeeded.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateSecurityGroupIfNeeded.java
index b6a2a98..656d164 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateSecurityGroupIfNeeded.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CreateSecurityGroupIfNeeded.java
@@ -35,7 +35,7 @@ import javax.inject.Singleton;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.IngressRule;
import org.jclouds.cloudstack.domain.SecurityGroup;
import org.jclouds.cloudstack.domain.Zone;
@@ -59,12 +59,12 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- protected final CloudStackClient client;
+ protected final CloudStackApi client;
protected final Supplier<LoadingCache<String, Zone>> zoneIdToZone;
protected final Predicate<String> jobComplete;
@Inject
- public CreateSecurityGroupIfNeeded(CloudStackClient client,
+ public CreateSecurityGroupIfNeeded(CloudStackApi client,
Predicate<String> jobComplete,
Supplier<LoadingCache<String, Zone>> zoneIdToZone) {
this.client = checkNotNull(client, "client");
@@ -84,7 +84,7 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
logger.debug(">> creating securityGroup %s", input);
try {
- SecurityGroup securityGroup = client.getSecurityGroupClient().createSecurityGroup(input.getName());
+ SecurityGroup securityGroup = client.getSecurityGroupApi().createSecurityGroup(input.getName());
logger.debug("<< created securityGroup(%s)", securityGroup);
ImmutableSet<String> cidrs;
@@ -99,20 +99,20 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
return securityGroup;
} catch (IllegalStateException e) {
logger.trace("<< trying to find securityGroup(%s): %s", input, e.getMessage());
- SecurityGroup group = client.getSecurityGroupClient().getSecurityGroupByName(input.getName());
+ SecurityGroup group = client.getSecurityGroupApi().getSecurityGroupByName(input.getName());
logger.debug("<< reused securityGroup(%s)", group.getId());
return group;
}
}
- private void authorizeGroupToItselfAndToTCPPortAndCidr(CloudStackClient client,
+ private void authorizeGroupToItselfAndToTCPPortAndCidr(CloudStackApi client,
SecurityGroup securityGroup,
int port,
Set<String> cidrs) {
for (String cidr : cidrs) {
logger.debug(">> authorizing securityGroup(%s) permission to %s on port %d", securityGroup, cidr, port);
if (!portInRangeForCidr(port, cidr).apply(securityGroup)) {
- jobComplete.apply(client.getSecurityGroupClient().authorizeIngressPortsToCIDRs(securityGroup.getId(),
+ jobComplete.apply(client.getSecurityGroupApi().authorizeIngressPortsToCIDRs(securityGroup.getId(),
"TCP",
port,
port,
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetFirewallRulesByVirtualMachine.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetFirewallRulesByVirtualMachine.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetFirewallRulesByVirtualMachine.java
index 4a71201..3fc73ab 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetFirewallRulesByVirtualMachine.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetFirewallRulesByVirtualMachine.java
@@ -22,16 +22,16 @@ import com.google.common.collect.ImmutableSet;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.options.ListFirewallRulesOptions;
@Singleton
public class GetFirewallRulesByVirtualMachine extends CacheLoader<String, Set<FirewallRule>> {
- private final CloudStackClient client;
+ private final CloudStackApi client;
@Inject
- public GetFirewallRulesByVirtualMachine(CloudStackClient client) {
+ public GetFirewallRulesByVirtualMachine(CloudStackApi client) {
this.client = checkNotNull(client, "client");
}
@@ -41,8 +41,8 @@ public class GetFirewallRulesByVirtualMachine extends CacheLoader<String, Set<Fi
*/
@Override
public Set<FirewallRule> load(String input) {
- String publicIPId = client.getVirtualMachineClient().getVirtualMachine(input).getPublicIPId();
- Set<FirewallRule> rules = client.getFirewallClient()
+ String publicIPId = client.getVirtualMachineApi().getVirtualMachine(input).getPublicIPId();
+ Set<FirewallRule> rules = client.getFirewallApi()
.listFirewallRules(ListFirewallRulesOptions.Builder.ipAddressId(publicIPId));
return rules != null ? rules : ImmutableSet.<FirewallRule>of();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetIPForwardingRulesByVirtualMachine.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetIPForwardingRulesByVirtualMachine.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetIPForwardingRulesByVirtualMachine.java
index 5d0178a..02e6fa1 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetIPForwardingRulesByVirtualMachine.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/GetIPForwardingRulesByVirtualMachine.java
@@ -23,17 +23,17 @@ import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.IPForwardingRule;
import com.google.common.cache.CacheLoader;
@Singleton
public class GetIPForwardingRulesByVirtualMachine extends CacheLoader<String, Set<IPForwardingRule>> {
- private final CloudStackClient client;
+ private final CloudStackApi client;
@Inject
- public GetIPForwardingRulesByVirtualMachine(CloudStackClient client) {
+ public GetIPForwardingRulesByVirtualMachine(CloudStackApi client) {
this.client = checkNotNull(client, "client");
}
@@ -43,6 +43,6 @@ public class GetIPForwardingRulesByVirtualMachine extends CacheLoader<String, Se
*/
@Override
public Set<IPForwardingRule> load(String input) {
- return client.getNATClient().getIPForwardingRulesForVirtualMachine(input);
+ return client.getNATApi().getIPForwardingRulesForVirtualMachine(input);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ReuseOrAssociateNewPublicIPAddress.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ReuseOrAssociateNewPublicIPAddress.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ReuseOrAssociateNewPublicIPAddress.java
index e27f299..eafa3e1 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ReuseOrAssociateNewPublicIPAddress.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ReuseOrAssociateNewPublicIPAddress.java
@@ -32,11 +32,11 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.Network;
import org.jclouds.cloudstack.domain.PublicIPAddress;
-import org.jclouds.cloudstack.features.AddressClient;
+import org.jclouds.cloudstack.features.AddressApi;
import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
import org.jclouds.logging.Logger;
@@ -48,14 +48,14 @@ import com.google.common.base.Function;
*/
@Singleton
public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, PublicIPAddress> {
- private final CloudStackClient client;
+ private final CloudStackApi client;
private final BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult;
@Resource
@Named(COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
@Inject
- public ReuseOrAssociateNewPublicIPAddress(CloudStackClient client,
+ public ReuseOrAssociateNewPublicIPAddress(CloudStackApi client,
BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult) {
this.client = checkNotNull(client, "client");
this.blockUntilJobCompletesAndReturnResult = checkNotNull(blockUntilJobCompletesAndReturnResult,
@@ -74,14 +74,14 @@ public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, Pub
* @throws NoSuchElementException
* if there's no existing ip address that is free for use
*/
- public static PublicIPAddress findAvailableAndAssociatedWithNetwork(String networkId, AddressClient client) {
+ public static PublicIPAddress findAvailableAndAssociatedWithNetwork(String networkId, AddressApi client) {
return find(client.listPublicIPAddresses(allocatedOnly(true).networkId(networkId)),
and(associatedWithNetwork(networkId), available()));
}
- public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client,
+ public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackApi client,
BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult) {
- AsyncCreateResponse job = client.getAddressClient().associateIPAddressInZone(network.getZoneId(),
+ AsyncCreateResponse job = client.getAddressApi().associateIPAddressInZone(network.getZoneId(),
networkId(network.getId()));
PublicIPAddress ip = blockUntilJobCompletesAndReturnResult.<PublicIPAddress> apply(job);
assert ip.getZoneId().equals(network.getZoneId());
@@ -92,7 +92,7 @@ public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, Pub
public PublicIPAddress apply(Network input) {
try {
logger.debug(">> looking for existing address in network(%s)", input.getId());
- PublicIPAddress returnVal = findAvailableAndAssociatedWithNetwork(input.getId(), client.getAddressClient());
+ PublicIPAddress returnVal = findAvailableAndAssociatedWithNetwork(input.getId(), client.getAddressApi());
logger.debug("<< reused address(%s)", returnVal.getId());
return returnVal;
} catch (NoSuchElementException e) {
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetwork.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetwork.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetwork.java
index ef764d9..6a77613 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetwork.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetwork.java
@@ -23,7 +23,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.Network;
import org.jclouds.cloudstack.domain.PublicIPAddress;
import org.jclouds.cloudstack.domain.VirtualMachine;
@@ -47,12 +47,12 @@ public class StaticNATVirtualMachineInNetwork implements Function<VirtualMachine
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- private final CloudStackClient client;
+ private final CloudStackApi client;
private final ReuseOrAssociateNewPublicIPAddress reuseOrAssociate;
private final Network network;
@Inject
- public StaticNATVirtualMachineInNetwork(CloudStackClient client,
+ public StaticNATVirtualMachineInNetwork(CloudStackApi client,
ReuseOrAssociateNewPublicIPAddress reuseOrAssociate, @Assisted Network network) {
this.client = checkNotNull(client, "client");
this.reuseOrAssociate = checkNotNull(reuseOrAssociate, "reuseOrAssociate");
@@ -68,8 +68,8 @@ public class StaticNATVirtualMachineInNetwork implements Function<VirtualMachine
continue;
try {
logger.debug(">> static NATing IPAddress(%s) to virtualMachine(%s)", ip.getId(), vm.getId());
- client.getNATClient().enableStaticNATForVirtualMachine(vm.getId(), ip.getId());
- ip = client.getAddressClient().getPublicIPAddress(ip.getId());
+ client.getNATApi().enableStaticNATForVirtualMachine(vm.getId(), ip.getId());
+ ip = client.getAddressApi().getPublicIPAddress(ip.getId());
if (ip.isStaticNAT() && ip.getVirtualMachineId().equals(vm.getId()))
break;
} catch (IllegalStateException e) {
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ZoneIdToZone.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ZoneIdToZone.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ZoneIdToZone.java
index c0857b1..328d5f9 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ZoneIdToZone.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/ZoneIdToZone.java
@@ -18,9 +18,9 @@ package org.jclouds.cloudstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.domain.Zone;
-import org.jclouds.cloudstack.features.ZoneClient;
+import org.jclouds.cloudstack.features.ZoneApi;
import com.google.common.cache.CacheLoader;
import com.google.inject.Inject;
@@ -32,12 +32,12 @@ import com.google.inject.Inject;
*/
public class ZoneIdToZone extends CacheLoader<String, Zone> {
- private final ZoneClient zoneClient;
+ private final ZoneApi zoneClient;
@Inject
- public ZoneIdToZone(CloudStackClient client) {
+ public ZoneIdToZone(CloudStackApi client) {
checkNotNull(client, "client");
- this.zoneClient = client.getZoneClient();
+ this.zoneClient = client.getZoneApi();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnClose.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnClose.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnClose.java
index 16d462d..9937b36 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnClose.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnClose.java
@@ -22,7 +22,7 @@ import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import org.jclouds.cloudstack.domain.LoginResponse;
-import org.jclouds.cloudstack.features.SessionClient;
+import org.jclouds.cloudstack.features.SessionApi;
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpCommand;
import org.jclouds.http.HttpResponse;
@@ -44,11 +44,11 @@ public class InvalidateSessionAndRetryOn401AndLogoutOnClose extends BackoffLimit
protected Logger logger = Logger.NULL;
private final LoadingCache<Credentials, LoginResponse> authenticationResponseCache;
- private final SessionClient sessionClient;
+ private final SessionApi sessionClient;
@Inject
protected InvalidateSessionAndRetryOn401AndLogoutOnClose(LoadingCache<Credentials, LoginResponse> authenticationResponseCache,
- SessionClient sessionClient) {
+ SessionApi sessionClient) {
this.authenticationResponseCache = authenticationResponseCache;
this.sessionClient = sessionClient;
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java
index e2b8f10..156f909 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java
@@ -20,16 +20,15 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.Context;
-import org.jclouds.cloudstack.CloudStackClient;
+import org.jclouds.cloudstack.CloudStackApi;
import org.jclouds.cloudstack.CloudStackContext;
-import org.jclouds.cloudstack.CloudStackDomainAsyncClient;
-import org.jclouds.cloudstack.CloudStackDomainClient;
-import org.jclouds.cloudstack.CloudStackGlobalAsyncClient;
-import org.jclouds.cloudstack.CloudStackGlobalClient;
+import org.jclouds.cloudstack.CloudStackDomainApi;
+import org.jclouds.cloudstack.CloudStackGlobalApi;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.Utils;
import org.jclouds.compute.internal.ComputeServiceContextImpl;
import org.jclouds.location.Provider;
+import org.jclouds.rest.ApiContext;
import com.google.common.reflect.TypeToken;
@@ -38,15 +37,15 @@ import com.google.common.reflect.TypeToken;
*/
@Singleton
public class CloudStackContextImpl extends ComputeServiceContextImpl implements CloudStackContext {
- private final CloudStackClient client;
- private final org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext;
- private final org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
+ private final CloudStackApi client;
+ private final ApiContext<CloudStackDomainApi> domainContext;
+ private final ApiContext<CloudStackGlobalApi> globalContext;
@Inject
CloudStackContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
- ComputeService computeService, Utils utils, CloudStackClient client,
- org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
- org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
+ ComputeService computeService, Utils utils, CloudStackApi client,
+ ApiContext<CloudStackDomainApi> domainContext,
+ ApiContext<CloudStackGlobalApi> globalContext) {
super(backend, backendType, computeService, utils);
this.client = client;
this.domainContext = domainContext;
@@ -54,27 +53,18 @@ public class CloudStackContextImpl extends ComputeServiceContextImpl implements
}
@Override
- public CloudStackClient getApi() {
+ public CloudStackApi getApi() {
return client;
}
@Override
- public CloudStackDomainClient getDomainApi() {
+ public CloudStackDomainApi getDomainApi() {
return domainContext.getApi();
}
@Override
- public CloudStackGlobalClient getGlobalApi() {
+ public CloudStackGlobalApi getGlobalApi() {
return globalContext.getApi();
}
- @Override
- public org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext() {
- return domainContext;
- }
-
- @Override
- public org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext() {
- return globalContext;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentials.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentials.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentials.java
index a418e9b..da99182 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentials.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentials.java
@@ -24,17 +24,17 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.cloudstack.domain.LoginResponse;
-import org.jclouds.cloudstack.features.SessionClient;
+import org.jclouds.cloudstack.features.SessionApi;
import org.jclouds.domain.Credentials;
import com.google.common.cache.CacheLoader;
@Singleton
public class LoginWithPasswordCredentials extends CacheLoader<Credentials, LoginResponse> {
- private final SessionClient client;
+ private final SessionApi client;
@Inject
- public LoginWithPasswordCredentials(SessionClient client) {
+ public LoginWithPasswordCredentials(SessionApi client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddClusterOptions.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddClusterOptions.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddClusterOptions.java
index 81388ca..8ed353d 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddClusterOptions.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddClusterOptions.java
@@ -22,7 +22,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
import com.google.common.collect.ImmutableSet;
/**
- * Options to the GlobalHostClient.addHost() API call
+ * Options to the GlobalHostApi.addHost() API call
*
* @author Richard Downer
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddHostOptions.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddHostOptions.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddHostOptions.java
index a2224cd..60d3425 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddHostOptions.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/AddHostOptions.java
@@ -25,7 +25,7 @@ import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableSet;
/**
- * Options to the GlobalHostClient.addHost() API call
+ * Options to the GlobalHostApi.addHost() API call
*
* @author Richard Downer
*/