plugin

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParsePattern     = secrets.ParsePattern
	MustParsePattern = secrets.MustParsePattern
	NewVersion       = api.NewVersion
)
View Source
var EnvelopeErr = secrets.EnvelopeErr

Functions

This section is empty.

Types

type Config

type Config struct {
	// Version of the plugin in semver format.
	Version Version
	// Pattern to control which IDs should match this plugin. Set to `**` to match any ID.
	Pattern Pattern
	// Logger to be used within plugin side SDK code. If nil, a default logger will be created and used.
	Logger Logger
}

func (*Config) Valid added in v0.0.6

func (c *Config) Valid() error

type Envelope added in v0.0.8

type Envelope = secrets.Envelope

type Logger added in v0.0.8

type Logger = logging.Logger

type ManualLaunchOption

type ManualLaunchOption func(c *cfg) error

ManualLaunchOption to apply to a plugin during its creation when it's manually launched (not by the secrets engine).

func WithConnection

func WithConnection(conn net.Conn) ManualLaunchOption

WithConnection sets an existing secrets engine connection to use.

func WithPluginName

func WithPluginName(name string) ManualLaunchOption

WithPluginName sets the name to use in plugin registration.

func WithRegistrationTimeout

func WithRegistrationTimeout(timeout time.Duration) ManualLaunchOption

WithRegistrationTimeout sets custom registration timeout.

type Pattern added in v0.0.8

type Pattern = secrets.Pattern

type Plugin

type Plugin interface {
	Resolver
}

type Request added in v0.0.8

type Request = secrets.Request

type Resolver added in v0.0.8

type Resolver = secrets.Resolver

type Stub

type Stub interface {
	// Run starts the plugin then waits for the plugin service to exit, either due to a
	// critical error or by cancelling the context. Calling Run() while the plugin is running,
	// will result in an error. After the plugin service exits, Run() can safely be called again.
	Run(context.Context) error

	// RegistrationTimeout returns the registration timeout for the stub.
	// This is the default timeout if the plugin has not been started or
	// the timeout received in the Configure request otherwise.
	RegistrationTimeout() time.Duration

	// RequestTimeout returns the request timeout for the stub.
	// This is the default timeout if the plugin has not been started or
	// the timeout received in the Configure request otherwise.
	RequestTimeout() time.Duration
}

Stub is the interface the stub provides for the plugin implementation.

func New

func New(p Plugin, config Config, opts ...ManualLaunchOption) (Stub, error)

New creates a stub with the given plugin and options. ManualLaunchOption only apply when the plugin is launched manually. If launched by the secrets engine, they are ignored. If logger is nil, a default logger will be created and used.

type Version added in v0.0.8

type Version = api.Version

Jump to

Keyboard shortcuts

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