module

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecuteRequest

type ExecuteRequest struct {
	// 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 schema.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 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, modName string, profileConfig hcl.Body, execReq *ExecuteRequest) (*ExecutionResult, error)

	// ExampleConfigs returns a list of example module configs from loaded modules
	ExampleConfigs() []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 schema.QueryExecer, logger hclog.Logger) *ManagerImpl

NewManager returns a new manager instance.

func (*ManagerImpl) ExampleConfigs added in v0.15.11

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

ExampleConfigs returns a list of example module configs from loaded modules

func (*ManagerImpl) ExecuteModule

func (m *ManagerImpl) ExecuteModule(ctx context.Context, modName string, cfg hcl.Body, 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
	// Configure configures the module to run
	Configure(context.Context, hcl.Body, 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() 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