external_host_plugins

package
v0.0.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	MagicCookieKey:   "HASHICORP_BOUNDARY_HOST_PLUGIN",
	MagicCookieValue: hostServicePluginSetName,
}

HandshakeConfig is a shared config that can be used regardless of plugin, to avoid having to know type-specific things about each plugin

Functions

func CreateHostPlugin

func CreateHostPlugin(
	ctx context.Context,
	pluginType string,
	opt ...Option,
) (
	hp pb.HostPluginServiceClient,
	cleanup func() error,
	retErr error,
)

CreateHostPlugin takes in a type, parses the various options to look for a plugin matching that name, and returns a host plugin client, a cleanup function to execute on shutdown of the enclosing program, and an error.

func NewHostPluginClient

func NewHostPluginClient(pluginPath string, opt ...Option) (*plugin.Client, error)

func NewHostPluginServiceServer

func NewHostPluginServiceServer(impl pb.HostPluginServiceServer) (*hostPlugin, error)

func ServeHostPlugin

func ServeHostPlugin(svc pb.HostPluginServiceServer, opt ...Option) error

ServeHostPlugin is a generic function to start serving a host plugin service as a plugin

Types

type Option

type Option func(*options) error

Option - a type that wraps an interface for compile-time safety but can contain an option for this package or for wrappers implementing this interface.

func WithHostPluginExecutionDir

func WithHostPluginExecutionDir(dir string) Option

WithHostPluginExecutionDir allows setting a specific directory for writing out and executing plugins; if not set, os.TempDir will be used to create a suitable directory.

func WithHostPluginsFilesystem

func WithHostPluginsFilesystem(prefix string, plugins fs.FS) Option

WithHostPluginsFilesystem provides an fs.FS containing plugins that can be executed to provide Host functionality. This can be specified multiple times; all FSes will be scanned. If there are conflicts, the last one wins (this property is shared with WithHostPluginsMap). The prefix will be stripped from each entry when determining the plugin type.

func WithHostPluginsMap

func WithHostPluginsMap(plugins map[string]func() (pb.HostPluginServiceClient, error)) Option

WithHostPluginsMap provides a map containing functions that can be called to provide implementations of the server. This can be specified multiple times; all FSes will be scanned. If there are conflicts, the last one wins (this property is shared with WithHostPluginsFilesystem).

func WithLogger

func WithLogger(logger hclog.Logger) Option

WithLogger allows passing a logger to the plugin library for debugging

Jump to

Keyboard shortcuts

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