Class Config


  • public final class Config
    extends Object
    OpenStack4j Configuration - options that are configured with OpenStack4j clients.
    Author:
    Jeremy Unruh
    • Field Detail

      • DEFAULT

        public static final Config DEFAULT
    • Method Detail

      • newConfig

        public static Config newConfig()
        Returns:
        A new client configuration
      • withResolver

        public Config withResolver​(ServiceVersionResolver resolver)
        Sets the Service version resolver to use in determining which API version to use with a particular OpenStack service
        Parameters:
        resolver - the version 2 version resolver
        Returns:
        Config
      • withEndpointURLResolver

        public Config withEndpointURLResolver​(EndpointURLResolver endpointURLResolver)
        Sets the Endpoint URL resolver for providing the URL resolution strategy
        Parameters:
        endpointURLResolver - the endpoint URL resolver
        Returns:
        Config
      • withConnectionTimeout

        public Config withConnectionTimeout​(int connectTimeout)
        Sets the connection timeout in milliseconds
        Parameters:
        connectTimeout - timeout in milliseconds
        Returns:
        Config
      • withReadTimeout

        public Config withReadTimeout​(int readTimeout)
        Sets the read timeout in milliseconds
        Parameters:
        readTimeout - timeout in milliseconds
        Returns:
        Config
      • withSSLContext

        public Config withSSLContext​(SSLContext sslContext)
        Associates the initialized SSL Context to use when querying secure endpoints
        Returns:
        Config
      • withMaxConnections

        public Config withMaxConnections​(int maxConnections)
        This sets the max allowed connections for connectors who are using a connection pool. This option if set will be a no-op to connectors that don't offer this setting.
        Parameters:
        maxConnections - the max connections allowed
        Returns:
        Config
      • withMaxConnectionsPerRoute

        public Config withMaxConnectionsPerRoute​(int maxConnectionsPerRoute)
        This sets the max allowed connections per routefor connectors who are using a connection pool. This option if set will be a no-op to connectors that don't offer this setting.
        Parameters:
        maxConnectionsPerRoute - the max connections per route
        Returns:
        Config
      • withProxy

        public Config withProxy​(ProxyHost proxy)
        Indicates the connector should be using a Proxy host

        (ex: ProxyHost.of("http://myproxy", 8080)) );

        Parameters:
        proxy - the proxy host
        Returns:
        Config
      • withEndpointNATResolution

        public Config withEndpointNATResolution​(String natHostOrIP)
        If connecting to an OpenStack deployment is in front of a NAT or Proxy then this option can be provided to dynamically change the service endpoints hostname/IP to the one NAT is using.

        Example:
        Setting NAT IP to: 24.24.24.24

        Would be substitued in any endpoint for any service. Let's assume we're looking for Heat endpoint which is returning 192.168.0.2:8000

        The result would be translated dynamically to 24.24.24.24:8000 so we can access via NAT

        Parameters:
        natHostOrIP - the FQDN Host or IP Address
        Returns:
        Config
      • withHostnameVerifier

        public Config withHostnameVerifier​(HostnameVerifier hostnameVerifier)
        Sets the Hostname Verifier to use with SSL
        Parameters:
        hostnameVerifier - the hostname verifier
        Returns:
        Config
      • withSSLVerificationDisabled

        public Config withSSLVerificationDisabled()
        If no SSL Context has been specified and this SSL Verification is disabled we will by pass certificate checks (useful for self signed certificates).

        NOTE: This property used to be known as "useNonStrictSSL" in previous releases

        Returns:
        Config
      • getConnectTimeout

        public int getConnectTimeout()
      • getReadTimeout

        public int getReadTimeout()
      • getSslContext

        public SSLContext getSslContext()
      • isIgnoreSSLVerification

        public boolean isIgnoreSSLVerification()
      • getEndpointNATResolution

        public String getEndpointNATResolution()
      • isBehindNAT

        public boolean isBehindNAT()
      • getMaxConnections

        public int getMaxConnections()
      • getMaxConnectionsPerRoute

        public int getMaxConnectionsPerRoute()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object