CompositeConnectionResolver

Helper class that resolves connection and credential parameters, validates them and generates connection options.

Description

The CompositeConnectionResolver class allows you to resolve connection and credential parameters, validate them and generates connection options.

Configuration parameters

connection(s):

  • discovery_key: (optional) key to retrieve the connection from IDiscovery
  • protocol: communication protocol
  • host: host name or IP address
  • port: port number
  • uri: resource URI or connection string with all parameters in it

credential(s):

  • store_key: (optional) key to retrieve the credentials from ICredentialStore
  • username: user name
  • password: user password

References

  • *:discovery:*:*:1.0 - (optional) IDiscovery services to resolve connections
  • *:credential-store:*:*:1.0 - (optional) Credential stores to resolve credentials ICredentialStore

Fields

Options

Connection options

Options: ConfigParams

ConnectionResolver

Connections resolver.

ConnectionResolver: ConnectionResolver

CredentialResolver

Credentials resolver.

CredentialResolver: CredentialResolver

ClusterSupported

Cluster support (multiple connections)

ClusterSupported: bool

DefaultProtocol

Default protocol

DefaultProtocol: string

DefaultPort

Default port

DefaultPort: int

SupportedProtocols

List of supported protocols

SupportedProtocols: []string

Methods

Compose

Composes Composite connection options from connection and credential parameters.

(c *CompositeConnectionResolver) Compose(correlationId string, connections []*ConnectionParams, credential *auth.CredentialParams, parameters *config.ConfigParams) (options *config.ConfigParams, err error)

ComposeOptions

A composite of several merger options

(c *CompositeConnectionResolver) ComposeOptions(connections []*ConnectionParams, credential *auth.CredentialParams, parameters *config.ConfigParams) *config.ConfigParams

Configure

Configures component by passing configuration parameters.

(c *CompositeConnectionResolver) Configure(ctx context.Context, config *config.ConfigParams)

  • ctx: context.Context - operation context.
  • config: *config.ConfigParams - configuration parameters to be set.

FinalizeOptions

Finalize merged options. This method can be overriden in child classes.

(c *CompositeConnectionResolver) FinalizeOptions(options *config.ConfigParams) *config.ConfigParams

MergeConnection

Merges connection options with connection parameters. This method can be overriden in child classes.

(c *CompositeConnectionResolver) MergeConnection(options *config.ConfigParams, connection *ConnectionParams) *config.ConfigParams

MergeCredential

Merges connection options with credential parameters. This method can be overriden in child classes.

(c *CompositeConnectionResolver) MergeCredential(options *config.ConfigParams, credential *auth.CredentialParams) *config.ConfigParams

MergeOptional

Merges connection options with optional parameters. This method can be overriden in child classes.

(c *CompositeConnectionResolver) MergeOptional(options *config.ConfigParams, parameters *config.ConfigParams) *config.ConfigParams

Resolve

Resolves connection options from connection and credential parameters.

(c *CompositeConnectionResolver) Resolve(correlationId string) (options *config.ConfigParams, err error)

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • returns: (options *config.ConfigParams, err error) - resolved options or error

SetReferences

Sets references to dependent components.

(c *CompositeConnectionResolver) SetReferences(ctx context.Context, references refer.IReferences)

  • ctx: context.Context - operation context.
  • references: refer.IReferences - references to locate the component dependencies.

ValidateConnection

Validates connection parameters. Throws error if validation failed. This method can be overriden in child classes.

(c *CompositeConnectionResolver) ValidateConnection(correlationId string, connection *ConnectionParams) error

  • correlationId: string - (optional) transaction id usedd to trace execution through the call chain.
  • connection: *ConnectionParams - connection parameters to be validated
  • returns: error - returns error if validation failed

ValidateCredential

Validates credential parameters. This method can be overriden in child classes.

(c *CompositeConnectionResolver) ValidateCredential(correlationId string, credential *auth.CredentialParams) error

  • correlationId: string - (optional) transaction id used to trace execution through the call chain.
  • credential: *auth.CredentialParams - credential parameters to be validated
  • returns: error - returns error if validation failed