hcgp

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessRPCMethodName = "Plugin.Process"
	InitRPCMethodName    = "Plugin.Init"
)
View Source
const PluginProcessorKey = "processor"

Variables

View Source
var (
	ErrPluginDispense       = fmt.Errorf("plugin dispense error")
	ErrPluginInitialization = fmt.Errorf("plugin initialization error")
)
View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "integration-connector-agent-plugin",
	MagicCookieValue: "rpc-plugin",
}

HandshakeConfig are used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.

Functions

func New

func New(log *logrus.Logger, cfg Config) (entities.Processor, error)

func NewLogAdapter

func NewLogAdapter(log Logger) hclog.Logger

Types

type Config

type Config struct {
	ModulePath  string          `json:"modulePath"`
	InitOptions json.RawMessage `json:"initOptions,omitempty"`
}

func (Config) Validate

func (c Config) Validate() error

type Logger

type Logger = *logrus.Logger

type Plugin

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

func (*Plugin) Close

func (p *Plugin) Close() error

func (*Plugin) Init

func (p *Plugin) Init(initOptions []byte) (entities.Processor, error)

func (*Plugin) Process

type PluginAdapter

type PluginAdapter struct {
	Impl entities.InitializableProcessor
}

func (PluginAdapter) Client

func (PluginAdapter) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*PluginAdapter) Server

func (p *PluginAdapter) Server(*plugin.MuxBroker) (interface{}, error)

type RPCClient

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

Client used by the integration connecter agent to call the plugin.

func (*RPCClient) Init

func (g *RPCClient) Init(options []byte) error

func (*RPCClient) Process

type RPCServer

type RPCServer struct {
	Impl entities.InitializableProcessor
}

Server used by the plugin to invoke the plugin processor when integration connector agent calls the plugin.

func (*RPCServer) Init

func (g *RPCServer) Init(options []byte, _ *struct{}) error

func (*RPCServer) Process

func (g *RPCServer) Process(input entities.Event, output *entities.Event) error

Jump to

Keyboard shortcuts

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