com.elastisys.scale.cloudpool.openstack.requests

## Class CreateServerRequest

- java.lang.Object
- - com.elastisys.scale.cloudpool.openstack.requests.AbstractOpenstackRequest<org.openstack4j.model.compute.Server>
  - - com.elastisys.scale.cloudpool.openstack.requests.CreateServerRequest

All Implemented Interfaces:
  Callable<org.openstack4j.model.compute.Server>

    public class CreateServerRequest
    extends AbstractOpenstackRequest<org.openstack4j.model.compute.Server>

An request that, when executed, creates a new server instance.

### Constructor Summary

Constructors
Constructor and Description
`CreateServerRequest(com.elastisys.scale.commons.openstack.OSClientFactory clientFactory, String serverName, String flavorName, String imageName, String keyPair, List<String> securityGroups, List<String> networks, String encodedUserData, Map<String,String> metadata)` Creates a new `CreateServerRequest`.

### Method Summary

All Methods Instance Methods Concrete Methods
`org.openstack4j.model.compute.Server` `doRequest(org.openstack4j.api.OSClient api)` Carries out the request and returns the response.

### Methods inherited from class com.elastisys.scale.cloudpool.openstack.requests.AbstractOpenstackRequest

`call, getApiAccessConfig, getClientFactory`

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

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

### Constructor Detail

#### CreateServerRequest

    public CreateServerRequest(com.elastisys.scale.commons.openstack.OSClientFactory clientFactory,
                               String serverName,
                               String flavorName,
                               String imageName,
                               String keyPair,
                               List<String> securityGroups,
                               List<String> networks,
                               String encodedUserData,
                               Map<String,String> metadata)

Creates a new `CreateServerRequest`.

Parameters:
  `clientFactory` - OpenStack API client factory.
  `serverName` - The name to assign to the new server.
  `flavorName` - The name of the machine type (flavor) to launch.
  `imageName` - The identifier of the machine image used to boot the machine.
  `keyPair` - The name of the key pair to use for the machine instance. May be `null`.
  `securityGroups` - The security group(s) to use for the new machine instance. May be `null`.
  `networks` - The names of the networks to attach the launched server to (for example, `private`). Each network creates a separate network interface controller (NIC) on the created server. Typically, this option can be left out, but in rare cases, when an account has more than one network to choose from, the OpenStack API forces us to be explicit about the network(s) we want to use.

  If set to `null` or left empty, the default behavior is to use which ever network is configured by the cloud provider for the user/project. However, if there are multiple choices, this will cause server boot requests to fail.
  `encodedUserData` - The base64-encoded user data used to contextualize the started instance. May be `null`.
  `metadata` - Any meta data tags to assign to the new server. May be `null`.

### Method Detail

#### doRequest

    public org.openstack4j.model.compute.Server doRequest(org.openstack4j.api.OSClient api)

Description copied from class: `AbstractOpenstackRequest`
Carries out the request and returns the response.

Specified by:
  `doRequest` in class `AbstractOpenstackRequest<org.openstack4j.model.compute.Server>`
Parameters:
  `api` - An authenticated OpenStack API client that is instructed to operate against the configured region.
Returns:
  The response.