connector

package
v0.0.0-...-f99fb5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The Configurations for providers to be used.
	Providers map[string]interface{}
	// The configuration for Logging System in CSP
	// Connector.
	Logger LoggerConfig
}

func LoadConfig

func LoadConfig(filepath string) (Config, error)

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector(ctx context.Context, logger *logrus.Logger, config *Config) (*Connector, error)

func (*Connector) Close

func (c *Connector) Close() error

func (*Connector) Connect

func (c *Connector) Connect(ctx context.Context, request types.Request) error

func (*Connector) Disconnect

func (c *Connector) Disconnect(ctx context.Context, request types.Request) error

func (*Connector) ListConnections

func (c *Connector) ListConnections() ([]db.Connection, error)

func (*Connector) ListGateways

func (c *Connector) ListGateways(ctx context.Context) []types.Gateway

type Initializer

type Initializer func(ctx context.Context, logger *logrus.Entry, config string) (provider.Provider, error)

type LogLevel

type LogLevel string
const (
	LogLevelTrace    LogLevel = "TRACE"
	LogLevelDebug    LogLevel = "DEBUG"
	LogLevelInfo     LogLevel = "INFO"
	LogLevelWarn     LogLevel = "WARN"
	LogLevelError    LogLevel = "ERROR"
	LogLevelCritical LogLevel = "CRITICAL"
	LogLevelNone     LogLevel = "NONE"
)

type LoggerConfig

type LoggerConfig struct {
	// The global Log Level inherited by every
	// component which has no explicit level configured.
	Level LogLevel
	// The map of Log Levels per given Component.
	// The Component name is picked as follows:
	// <PROVIDER NAME>:<LOGGER NAME>
	// So, for example for AWS Provider with Client
	// component, the name will be as follows
	ComponentLevels map[string]LogLevel
	// Configuring where the logs should be presented
	// or directed.
	Output LoggerOutputConfig
}

type LoggerOutputConfig

type LoggerOutputConfig struct {
	// If set to true, the Logger will print logs to
	// standard output.
	StdOut bool
	// The FilePath of an output logger file.
	//
	// If the FilePath is empty, there will be no
	// attempt to log to any file.
	//
	// Invalid FilePath will result in an error of the
	// CLI.
	FilePath string
}

type ProviderManager

type ProviderManager struct {
	// contains filtered or unexported fields
}

func NewProviderManager

func NewProviderManager(logger *logrus.Entry) (ProviderManager, error)

func (*ProviderManager) Close

func (p *ProviderManager) Close() error

func (*ProviderManager) InitializeAvailableProviders

func (p *ProviderManager) InitializeAvailableProviders(
	ctx context.Context,
	logger *logrus.Entry,
	configs map[string]interface{},
)

InitializeAvailableProviders initializes all providers which implementation was found or provided to the connector.

This function doesn't break if any provider fails to initialize but will log the error.

func (*ProviderManager) InitializeProvider

func (p *ProviderManager) InitializeProvider(
	ctx context.Context,
	logger *logrus.Entry,
	providerName string,
	config interface{},
) (provider.Provider, error)

func (*ProviderManager) Provider

func (p *ProviderManager) Provider(name string) (provider.Provider, error)

func (*ProviderManager) Providers

func (p *ProviderManager) Providers() []provider.Provider

Directories

Path Synopsis
aws
gcp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL