com.elastisys.scale.commons.openstack

## Class OSClientFactory

- java.lang.Object
- - com.elastisys.scale.commons.openstack.OSClientFactory

    public class OSClientFactory
    extends Object

A factory for creating authenticated `OSClient` objects ready for use.

### Constructor Summary

Constructors
Constructor and Description
`OSClientFactory(ApiAccessConfig apiAccessConfig)` Creates an `OSClientFactory` with a `StandardOSClientCreator` creating clients according to the given configuration.
`OSClientFactory(ApiAccessConfig apiAccessConfig, com.elastisys.scale.commons.openstack.OSClientFactory.OSClientCreator creator)` Creates an `OSClientFactory` with a custom `OSClientCreator`.

### Method Summary

All Methods Instance Methods Concrete Methods
`org.openstack4j.api.OSClient<?>` `authenticatedClient()` Returns an OpenStack API client, authenticated and configured according to the `ApiAccessConfig` provided at construction-time.
`ApiAccessConfig` `getApiAccessConfig()` Returns the API access configuration that describes how to authenticate with and communicate over the OpenStack API.

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

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

### Constructor Detail

#### OSClientFactory

    public OSClientFactory(ApiAccessConfig apiAccessConfig)

Creates an `OSClientFactory` with a `StandardOSClientCreator` creating clients according to the given configuration.

Parameters:
  `apiAccessConfig` - API access configuration that describes how to authenticate with and communicate over the OpenStack API.

#### OSClientFactory

    public OSClientFactory(ApiAccessConfig apiAccessConfig,
                           com.elastisys.scale.commons.openstack.OSClientFactory.OSClientCreator creator)

Creates an `OSClientFactory` with a custom `OSClientCreator`.

Parameters:
  `apiAccessConfig` - API access configuration that describes how to authenticate with and communicate over the OpenStack API.

### Method Detail

#### authenticatedClient

    public org.openstack4j.api.OSClient<?> authenticatedClient()

Returns an OpenStack API client, authenticated and configured according to the `ApiAccessConfig` provided at construction-time.

Note: the returned `OSClient` is bound to the calling thread (since Openstack4j uses thread-scoped sessions) and should therefore never be used by a different thread. If another thread needs to make use of an `OSClient`, pass the `OSClientFactory` to that thread and make a new call to `authenticatedClient()`.

Returns:
  An authenticated `OSClient` ready for use.

#### getApiAccessConfig

    public ApiAccessConfig getApiAccessConfig()

Returns the API access configuration that describes how to authenticate with and communicate over the OpenStack API.

Returns: