add startServer and stopServer

This commit is contained in:
Fang Sun 2012-07-03 17:53:33 -06:00
parent 493de01cfa
commit 3e710c1c7f
3 changed files with 37 additions and 1 deletions

View File

@ -60,7 +60,7 @@ public class Server extends Resource {
*/
public static enum Status {
ACTIVE, BUILD, REBUILD, SUSPENDED, PAUSED, RESIZE, VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, ERROR, UNRECOGNIZED;
ACTIVE, BUILD, REBUILD, SUSPENDED, PAUSED, RESIZE, VERIFY_RESIZE, REVERT_RESIZE, PASSWORD, REBOOT, HARD_REBOOT, DELETED, UNKNOWN, ERROR, STOPPED, UNRECOGNIZED;
public String value() {
return name();

View File

@ -107,6 +107,26 @@ public interface ServerAsyncClient {
@Path("/servers/{id}")
ListenableFuture<Boolean> deleteServer(@PathParam("id") String id);
/**
* @see ServerClient#startServer
*/
@POST
@Path("/servers/{id}/action")
@Consumes
@Produces(MediaType.APPLICATION_JSON)
@Payload("{\"os-start\":null}")
ListenableFuture<Void> startServer(@PathParam("id") String id);
/**
* @see ServerClient#stopServer
*/
@POST
@Path("/servers/{id}/action")
@Consumes
@Produces(MediaType.APPLICATION_JSON)
@Payload("{\"os-stop\":null}")
ListenableFuture<Void> stopServer(@PathParam("id") String id);
/**
* @see ServerClient#rebootServer
*/

View File

@ -91,7 +91,23 @@ public interface ServerClient {
* @return True if successful, False otherwise
*/
Boolean deleteServer(String id);
/**
* Start a server
*
* @param id
* id of the server
*/
void startServer(String id);
/**
* Stop a server
*
* @param id
* id of the server
*/
void stopServer(String id);
/**
* Reboot a server.
*