module

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCombinedHCL added in v0.21.0

func GetCombinedHCL(mi cqproto.ModuleInfo) (hcl.Body, hcl.Diagnostics)

GetCombinedHCL loosely parses all files specified inside cqproto.ModuleInfo and combines them into a single hcl.Body

Types

type ExecuteRequest

type ExecuteRequest struct {
	// Module to execute
	Module string
	// ProfileConfig is the config from the user
	ProfileConfig hcl.Body
	// Params are the invocation parameters specific to the module
	Params ModuleRunParams

	// Providers is the list of providers to process
	Providers []*cqproto.GetProviderSchemaResponse
	// Conn is the db connection to use
	Conn execution.QueryExecer
}

type ExecutionResult

type ExecutionResult struct {
	Result   interface{} `json:"result"`
	Error    error       `json:"-"`
	ErrorMsg string      `json:"error,omitempty"`
}

type ExitCoder added in v0.15.11

type ExitCoder interface {
	ExitCode() int
}

type Info added in v0.21.0

type Info struct {
	// UserConfig is the config supplied by the user in config.hcl
	UserConfig hcl.Body
	// ProtocolVersion of the provider supplied module info, negotiated/equalized for the module
	ProtocolVersion uint32
	// ProviderData is the provider supplied module info: Provider vs. data from the provider
	ProviderData map[string]cqproto.ModuleInfo
}

Info about user supplied configs and provider supplied module info

type LowLevelQueryExecer added in v0.21.0

type LowLevelQueryExecer interface {
	execution.Copier
	execution.QueryExecer
}

type Manager

type Manager interface {
	// RegisterModule is used to register a module into the manager.
	RegisterModule(mod Module)

	// ExecuteModule executes the given module, validating the given module name and config first.
	ExecuteModule(ctx context.Context, execReq *ExecuteRequest) (*ExecutionResult, error)

	// ExampleConfigs returns a list of example module configs from loaded modules
	ExampleConfigs(providers []string) []string
}

Manager is the interface that describes the interaction with the module manager. Implemented by ManagerImpl.

type ManagerImpl

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

ManagerImpl is the manager implementation struct.

func NewManager

func NewManager(pool LowLevelQueryExecer, logger hclog.Logger, r moduleInfoRequester) *ManagerImpl

NewManager returns a new manager instance.

func (*ManagerImpl) ExampleConfigs added in v0.15.11

func (m *ManagerImpl) ExampleConfigs(providers []string) []string

ExampleConfigs returns a list of example module configs from loaded modules

func (*ManagerImpl) ExecuteModule

func (m *ManagerImpl) ExecuteModule(ctx context.Context, execReq *ExecuteRequest) (*ExecutionResult, error)

ExecuteModule executes the given module, validating the given module name and config first.

func (*ManagerImpl) RegisterModule

func (m *ManagerImpl) RegisterModule(mod Module)

RegisterModule is used to register a module into the manager.

type Module

type Module interface {
	// ID returns the name of the module
	ID() string
	// Supported module protocol versions, in order of preference
	ProtocolVersions() []uint32
	// Configure configures the module to run
	Configure(context.Context, Info, ModuleRunParams) error
	// Execute executes the module, using given args in ExecuteRequest
	Execute(context.Context, *ExecuteRequest) *ExecutionResult
	// ExampleConfig returns an example configuration to be put in config.hcl
	ExampleConfig(providers []string) string
}

type ModuleRunParams added in v0.15.11

type ModuleRunParams interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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