ConnectionUtils

A set of utility functions used to process connection parameters

Description

The ConnectionUtils class provides a set of utility functions used to process connection parameters.

Static methods

compose_uri

Composes URI from config parameters. The result URI will be in the following form: protocol://username:password@host1:port1,host2:port2,…?param1=abc¶m2=xyz&…

static compose_uri(options: ConfigParams, default_protocol: str, default_port: int): str

  • options: ConfigParams - configuration parameters
  • default_protocol: str - a default protocol
  • default_port: int - a default port
  • returns: str - a composed URI

concat

Concatinates two options by combining duplicated properties into comma-separated list

static concat(options1: ConfigParams, options2: ConfigParams, *keys: str): ConfigParams

  • options1: ConfigParams - first options to merge
  • options2: ConfigParams - second options to merge
  • keys: str - when defined, it limits only to specific keys
  • returns: ConfigParams - new connection parameters to be added

exclude

Excludes specified keys from the config parameters.

static exclude(options: ConfigParams, *keys: str): ConfigParams

  • options: ConfigParams - configuration parameters to be processed.
  • keys: str - a list of keys to be excluded.
  • returns: ConfigParams - a processed config parameters.

include

Includes specified keys from the config parameters.

static include(options: ConfigParams, *keys: str): ConfigParams

  • options: ConfigParams - configuration parameters to be processed.
  • keys: str - a list of keys to be included.
  • returns: ConfigParams - a processed config parameters.

parse_uri

Parses URI into config parameters. The URI shall be in the following form: protocol://username@password@host1:port1,host2:port2,...?param1=abc¶m2=xyz&...

static parse_uri(uri: str, default_protocol: str, default_port: str): ConfigParams

  • uri: str - the URI to be parsed
  • default_protocol: str - a default protocol
  • default_port: str - a default port
  • returns: ConfigParams - a configuration parameters with URI elements