com.elastisys.scale.cloudpool.api.restapi

## Class StartStopHandler

- java.lang.Object
- - com.elastisys.scale.cloudpool.api.restapi.StartStopHandler

    @Path(value="/")
    public class StartStopHandler
    extends Object

A REST response handler that handles requests to start `POST /start`, stop `POST /stop`, and get the execution status of `GET /status` a `CloudPool`.

### Constructor Summary

Constructors
Constructor and Description
`StartStopHandler(CloudPool cloudPool)` Creates a `StartStopHandler` for a given `CloudPool`.

### Method Summary

All Methods Instance Methods Concrete Methods
`javax.ws.rs.core.Response` `getStatus()` Retrieves the execution status for the cloud pool.
`javax.ws.rs.core.Response` `start()` Starts the cloud pool.
`javax.ws.rs.core.Response` `stop()` Stops the cloud pool.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### StartStopHandler

    public StartStopHandler(CloudPool cloudPool)

Creates a `StartStopHandler` for a given `CloudPool`.

Parameters:
  `cloudPool` - The back-end `CloudPool` to manage.

### Method Detail

#### start

    @POST
     @Path(value="/start")
    public javax.ws.rs.core.Response start()

Starts the cloud pool.

This will set the cloud pool in an activated state where it will start to accept requests to query or modify the machine pool.

If the cloud pool has not been configured the method should fail. If the cloud pool is already started this is a no-op.

Returns:
  - On success: HTTP response code 200.
  - On error: HTTP response 400 (Bad Request) with an `ErrorType` message on an attempt to start an unconfigured `CloudPool`. On other errors: HTTP response code 500 with an `ErrorType` message.

#### stop

    @POST
     @Path(value="/stop")
    public javax.ws.rs.core.Response stop()

Stops the cloud pool.

A stopped cloud pool is in a passivated state and will not accept any requests to query or modify the machine pool.

If the cloud pool is already in a stopped state this is a no-op.

Returns:
  - On success: HTTP response code 200.
  - On error: HTTP response code 500 with an `ErrorType` message.

#### getStatus

    @GET
     @Path(value="/status")
    public javax.ws.rs.core.Response getStatus()

Retrieves the execution status for the cloud pool.

Returns:
  - On success: HTTP response code 200 with a `CloudPoolStatus` message.
  - On error: HTTP response code 500 with an `ErrorType` message.