plugin

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PluginTypeName

func PluginTypeName(pluginType PluginType) string

func PopulateCmdlineOptions

func PopulateCmdlineOptions(fs *flag.FlagSet) error

func ProcessConfig

func ProcessConfig(
	pluginConfig map[string]map[string]map[interface{}]interface{},
) error

func ProcessEnvVars

func ProcessEnvVars() error

func Register

func Register(pluginEntry PluginEntry)

Types

type Logger added in v0.15.0

type Logger interface {
	Infof(string, ...any)
	Warnf(string, ...any)
	Debugf(string, ...any)
	Errorf(string, ...any)
	Fatalf(string, ...any)
}

Logger provides a logging interface for plugins. This happens to match the interface of uber-go/zap

type Plugin

type Plugin interface {
	Start() error
	Stop() error
	ErrorChan() chan error
	InputChan() chan<- event.Event
	OutputChan() <-chan event.Event
}

func GetPlugin

func GetPlugin(pluginType PluginType, name string) Plugin

type PluginEntry

type PluginEntry struct {
	Type               PluginType
	Name               string
	Description        string
	Options            []PluginOption
	NewFromOptionsFunc func() Plugin
}

func GetPlugins

func GetPlugins(pluginType PluginType) []PluginEntry

type PluginOption

type PluginOption struct {
	Name         string
	Type         PluginOptionType
	CustomEnvVar string
	CustomFlag   string
	Description  string
	DefaultValue interface{}
	Dest         interface{}
}

func (*PluginOption) AddToFlagSet

func (p *PluginOption) AddToFlagSet(
	fs *flag.FlagSet,
	pluginType string,
	pluginName string,
) error

func (*PluginOption) ProcessConfig

func (p *PluginOption) ProcessConfig(
	pluginData map[interface{}]interface{},
) error

func (*PluginOption) ProcessEnvVars

func (p *PluginOption) ProcessEnvVars(envPrefix string) error

type PluginOptionType

type PluginOptionType int
const (
	PluginOptionTypeNone   PluginOptionType = 0
	PluginOptionTypeString PluginOptionType = 1
	PluginOptionTypeBool   PluginOptionType = 2
	PluginOptionTypeInt    PluginOptionType = 3
	PluginOptionTypeUint   PluginOptionType = 4
)

type PluginType

type PluginType int
const (
	PluginTypeInput  PluginType = 1
	PluginTypeOutput PluginType = 2
	PluginTypeFilter PluginType = 3
)

Jump to

Keyboard shortcuts

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