module

package
v0.25.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MPL-2.0 Imports: 16 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

func GetProviderModule added in v0.23.0

func GetProviderModule(ctx context.Context, pm *plugin.Manager, opts *GetModuleOptions) (*cqproto.GetModuleResponse, error)

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 RunParams
	// Providers is the list of providers to process
	Schemas []*core.ProviderSchema
	// Conn is the db connection to use
	Conn execution.QueryExecer
}

type ExecutionOptions added in v0.23.0

type ExecutionOptions 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 RunParams
	// Providers is the list of providers to process
	Providers registry.Providers
}

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 GetModuleOptions added in v0.23.0

type GetModuleOptions struct {
	Provider registry.Provider
	Request  cqproto.GetModuleRequest
}

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 Manager

type Manager interface {
	// Register is used to register a module into the manager.
	Register(mod Module)
	// Execute executes the given module, validating the given module name and config first.
	Execute(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(storage database.Storage, pm *plugin.Manager) *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) Execute added in v0.23.0

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

func (*ManagerImpl) Register added in v0.23.0

func (m *ManagerImpl) Register(mod Module)

Register is used to register a module into the manager.

type ModExecutionRequest added in v0.23.0

type ModExecutionRequest struct {

	// Conn is the db connection to use
	Conn execution.QueryExecer
}

type Module

type Module interface {
	// ID returns the name of the module
	ID() string
	// ProtocolVersions are supported module protocol versions, in order of preference
	ProtocolVersions() []uint32
	// Configure configures the module to run
	Configure(context.Context, Info, RunParams) 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 RunParams added in v0.23.0

type RunParams interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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