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
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)
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- connections: []*ConnectionParams - connection parameters
- credential: *auth.CredentialParams - credential parameters
- parameters: *config.ConfigParams - optional parameters
- returns: (options *config.ConfigParams, err error) - resolved options or error.
ComposeOptions
A composite of several merger options
(c *CompositeConnectionResolver) ComposeOptions(connections []*ConnectionParams, credential *auth.CredentialParams, parameters *config.ConfigParams) *config.ConfigParams
- connections: []*ConnectionParams - connection parameters
- credential: *auth.CredentialParams - credential parameters
- parameters: *config.ConfigParams - optional parameters
- returns: *config.ConfigParams - resolved options or error
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
- options: *config.ConfigParams - options: connection options
- returns: *config.ConfigParams - finalized connection options
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
- options: ConfigParams - connection options
- connection: *ConnectionParams - connection parameters to be merged
- returns: *config.ConfigParams - merged connection options.
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
- options: ConfigParams - connection options
- credential: *auth.CredentialParams - credential parameters to be merged
- returns: *config.ConfigParams - merged connection options.
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
- options: *config.ConfigParams - connection options
- parameters: *config.ConfigParams - optional parameters to be merged
- returns: *config.ConfigParams - merged connection options.
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