Class ConnectionBuilder

    • Constructor Detail

      • ConnectionBuilder

        public ConnectionBuilder()
    • Method Detail

      • connection

        public static ConnectionBuilder connection()
        Creates a new connection builder.
      • url

        public ConnectionBuilder url​(String url)
        Set a Url of connection.
        Parameters:
        url - A string containing the base URL of the server, usually something like 'https://server.example.com/ovirt-engine/api'
      • password

        public ConnectionBuilder password​(String password)
        Set password
        Parameters:
        password - The password of the user
      • token

        public ConnectionBuilder token​(String token)
        The token to be used to access API. Optionally, user can use token, instead of username and password to access API. If user don't specify `token` parameter, SDK will automatically create one.
      • insecure

        public ConnectionBuilder insecure​(boolean insecure)
        Set insecure flag
        Parameters:
        insecure - A boolean flag that indicates if the server TLS certificate and host name should be checked.
      • kerberos

        public ConnectionBuilder kerberos​(boolean kerberos)
        Set kerberos flag
        Parameters:
        kerberos - A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication. Default is false.
      • timeout

        public ConnectionBuilder timeout​(int timeout)
        Set timeout
        Parameters:
        timeout - The maximum total time to wait for the response, in seconds. A value of zero (the default) means wait for ever. If the timeout expires before the response is received an exception will be raised.
      • compress

        public ConnectionBuilder compress​(boolean compress)
        Set a compress flag
        Parameters:
        compress - A flag indicating if the SDK should ask the server to send compressed responses. The default is `true`. Note that this is a hint for the server, and that it may return uncompressed data even when this parameter is set to `true`.
      • trustStorePassword

        public ConnectionBuilder trustStorePassword​(String trustStorePassword)
        Set the password that is required to open the file containing the CA certificates. Note that for Java key store files the password is used only to check the integrity of the file, so it is optional.
      • trustStoreFile

        public ConnectionBuilder trustStoreFile​(String trustStoreFile)
        Set the path of the file containing the trusted CA certificates. This file must be a valid Java key store, using the Java `JKS` format, usually contained within files ending with the `.jks` extension. If `trustStoreFile` parameter is not set, then default Java trust store location is used, which is defined by `javax.net.ssl.trustStore` system property.
      • ssoUrl

        public ConnectionBuilder ssoUrl​(String ssoUrl)
        Set SSO url
        Parameters:
        ssoUrl - A string containing the base SSO URL of the server, usually something like `\https://server.example.com/ovirt-engine/sso/oauth/token?` `\grant_type=password&scope=ovirt-app-api` for password authentication or `\https://server.example.com/ovirt-engine/sso/oauth/token-http-auth?` `\grant_type=urn:ovirt:params:oauth:grant-type:http&scope=ovirt-app-api` for kerberos authentication Default SSO url is computed from the `url` if no `sso_url` is provided.
      • ssoRevokeUrl

        public ConnectionBuilder ssoRevokeUrl​(String ssoRevokeUrl)
        Set SSO revoke url
        Parameters:
        ssoRevokeUrl - A string containing the base URL of the SSO revoke service. This needs to be specified only when using an external authentication service. By default this URL is automatically calculated from the value of the `url` parameter, so that SSO token revoke will be performed using the SSO service that is part of the engine.
      • ssoTokenName

        public ConnectionBuilder ssoTokenName​(String ssoTokenName)
        Set SSO token name
        Parameters:
        ssoTokenName - The token name in the JSON SSO response returned from the SSO server. Default value is `access_token`.
      • header

        public ConnectionBuilder header​(String name,
                                        String value)
        Custom HTTP headers to send with all requests. The keys of the map can be strings of symbols, and they will be used as the names of the headers. The values of the map will be used as the names of the headers. If the same header is provided here and in the `headers` parameter of a specific method call, then the `headers` parameter of the specific method call will have precedence.
      • build

        public Connection build()
        Checks the values of the parameters given so far, checks that they are valid, and builds a connection using them.
        Returns:
        the new connection
      • createHttpClient

        protected abstract HttpClient createHttpClient()
      • getHost

        protected String getHost()
      • getProtocol

        protected String getProtocol()
      • getPort

        protected int getPort()
      • getUrl

        public String getUrl()
        Returns:
        entry point URI