com.elastisys.scale.cloudpool.openstack.driver.client

## Interface OpenstackClient

All Known Implementing Classes:
  StandardOpenstackClient

    public interface OpenstackClient

A simplified client interface towards the OpenStack API, which only provides the functionality needed by the `OpenStackPoolDriver`.

The `configure(com.elastisys.scale.cloudpool.openstack.driver.config.CloudApiSettings)` method must be called before calling any other methods.

### Method Summary

All Methods Instance Methods Abstract Methods
`String` `assignFloatingIp(String serverId)` Allocate a floating IP address and associate it with a given server.
`void` `configure(CloudApiSettings config)` Configures this `OpenstackClient` with cloud API access credentials and settings.
`org.openstack4j.model.compute.Server` `getServer(String serverId)` Return meta data about a particular `Server` instance.
`List<org.openstack4j.model.compute.Server>` `getServers(String tag, String tagValue)` Retrieves all servers that match a given tag.
`org.openstack4j.model.compute.Server` `launchServer(String name, ProvisioningTemplate provisioningDetails, Map<String,String> tags)` Launch a new server.
`void` `tagServer(String serverId, Map<String,String> tags)` Adds meta data tags to a given server.
`void` `terminateServer(String serverId)` Terminates a particular server.
`void` `untagServer(String serverId, List<String> tagKeys)` Removes a collection of meta data tags from a given server.

### Method Detail

#### configure

    void configure(CloudApiSettings config)

Configures this `OpenstackClient` with cloud API access credentials and settings.

Parameters:
  `config` - API access credentials and settings.

#### getServers

    List<org.openstack4j.model.compute.Server> getServers(String tag,
                                                          String tagValue)

Retrieves all servers that match a given tag.

Parameters:
  `tag` - A meta data tag that must be present on returned servers.
  `tagValue` - The value for the meta data tag that must be present on returned servers.
Returns:
  All `Server`s matching the filters.

#### getServer

    org.openstack4j.model.compute.Server getServer(String serverId)
                                            throws NotFoundException

Return meta data about a particular `Server` instance.

Parameters:
  `serverId` - The identifier of the requested server.
Returns:
  `Server` meta data.
Throws:
  `NotFoundException` - if the server doesn't exist.

#### launchServer

    org.openstack4j.model.compute.Server launchServer(String name,
                                                      ProvisioningTemplate provisioningDetails,
                                                      Map<String,String> tags)

Launch a new server.

Parameters:
  `name` - The name to assign to the created server.
  `provisioningDetails` - The provisioning details on how to launch the new server.
  `tags` - Meta data tags to set on the launched server.
Returns:
  The launched `Server`.

#### assignFloatingIp

    String assignFloatingIp(String serverId)

Allocate a floating IP address and associate it with a given server.

Parameters:
  `serverId` - The identifier of the server that will be assigned a floating IP address.
Returns:
  The IP address that was assigned to the server.

#### terminateServer

    void terminateServer(String serverId)
                  throws NotFoundException

Terminates a particular server.

Parameters:
  `serverId` - Identifier of the server to be terminated.
Throws:
  `NotFoundException` - if the server doesn't exist.

#### tagServer

    void tagServer(String serverId,
                   Map<String,String> tags)
            throws NotFoundException

Adds meta data tags to a given server.

Parameters:
  `serverId` - Identifier of the server to be tagged.
  `tags` - Meta data tags to set on the server.
Throws:
  `NotFoundException` - if the server doesn't exist.

#### untagServer

    void untagServer(String serverId,
                     List<String> tagKeys)
              throws NotFoundException

Removes a collection of meta data tags from a given server.

Parameters:
  `serverId` - Identifier of the server to be untagged.
  `tags` - The meta data tag keys to remove from the server.
Throws:
  `NotFoundException` - if the server doesn't exist.