com.elastisys.scale.cloudpool.api.server

## Class CloudPoolServer

- java.lang.Object
- - com.elastisys.scale.cloudpool.api.server.CloudPoolServer

    public class CloudPoolServer
    extends Object

Factory methods for creating a HTTPS server that publishes a REST API for a `CloudPool` instance.

The REST API is fully covered in the elastisys:scale cloud pool REST API documentation.

### Constructor Summary

Constructors
Constructor and Description
`CloudPoolServer()`

### Method Summary

All Methods Static Methods Concrete Methods
`static org.eclipse.jetty.server.Server` `createServer(CloudPool cloudPool, CloudPoolOptions options)` Creates a HTTPS server that serves REST API requests for a given `CloudPool`.
`static void` `main(CloudPool cloudPool, String[] args)` Parse command-line arguments and start an HTTPS server that serves REST API requests for a given `CloudPool`.
`static CloudPoolOptions` `parseArgs(String[] args)` Parses command-line arguments into `CloudPoolOptions`.

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

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

### Constructor Detail

#### CloudPoolServer

    public CloudPoolServer()

### Method Detail

#### parseArgs

    public static CloudPoolOptions parseArgs(String[] args)

Parses command-line arguments into `CloudPoolOptions`. On failure to process the command-line arguments, an error will be written together with a usage string and then the program will exit with a failure code.

The `--help` will cause the uasge text to be written before exiting the program (with a zero exit code).

Parameters:
  `args` -
Returns:

#### main

    public static void main(CloudPool cloudPool,
                            String[] args)
                     throws Exception

Parse command-line arguments and start an HTTPS server that serves REST API requests for a given `CloudPool`.

A failure to parse the command-line arguments will cause the program to print a usage message and exit with an error code. The function blocks until the started server is stopped.

Parameters:
  `cloudPool` - The cloud pool that the started server will publish.
  `args` - The command-line arguments.
Throws:
  `Exception`

#### createServer

    public static org.eclipse.jetty.server.Server createServer(CloudPool cloudPool,
                                                               CloudPoolOptions options)
                                                        throws Exception

Creates a HTTPS server that serves REST API requests for a given `CloudPool`.

The created server is returned with the `CloudPool` REST API deployed, but in an unstarted state, so the client is responsible for starting the server.

The behavior of the HTTPS server is controlled via a set of `CloudPoolOptions`.

Parameters:
  `cloudPool` - The cloud pool that the `Server` will publish.
  `options` - A set of options that control the behavior of the HTTPS server.
Returns:
  The created `Server`.
Throws:
  `Exception` - Thrown on a failure to initialize the `CloudPool` or create the server.