plugin

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package plugin provides the plugin system for extending Vault functionality. Plugins implement the base Plugin interface and optionally implement additional capability interfaces for specific subsystems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptionProvider

type EncryptionProvider interface {
	EncryptionKeyProvider() crypto.EncryptionKeyProvider
}

EncryptionProvider provides an encryption key provider.

type FlagEvaluator

type FlagEvaluator interface {
	EvaluatorName() string
	Evaluate(ctx context.Context, rule *flag.Rule, tenantID, userID string) (bool, error)
}

FlagEvaluator provides a custom flag rule evaluator.

type OnConfigChange

type OnConfigChange interface {
	OnConfigChange(ctx context.Context, key string, oldValue, newValue any) error
}

OnConfigChange is called when a config entry changes.

type OnInit

type OnInit interface {
	OnInit(ctx context.Context) error
}

OnInit is implemented by plugins that need initialization.

type OnSecretAccess

type OnSecretAccess interface {
	OnSecretAccess(ctx context.Context, key, action string) error
}

OnSecretAccess is called when a secret is accessed.

type OnShutdown

type OnShutdown interface {
	OnShutdown(ctx context.Context) error
}

OnShutdown is implemented by plugins that need cleanup.

type Plugin

type Plugin interface {
	Name() string
}

Plugin is the base interface all plugins must implement.

type Registry

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

Registry manages plugin registration and discovery. It uses type-switch discovery to categorize plugins by capability at registration time.

func NewRegistry

func NewRegistry(opts ...RegistryOption) *Registry

NewRegistry creates a plugin registry.

func (*Registry) ConfigChangeHooks

func (r *Registry) ConfigChangeHooks() []OnConfigChange

ConfigChangeHooks returns all plugins that implement OnConfigChange.

func (*Registry) EncryptionProviders

func (r *Registry) EncryptionProviders() []EncryptionProvider

EncryptionProviders returns all encryption key providers.

func (*Registry) FlagEvaluatorByName

func (r *Registry) FlagEvaluatorByName(name string) FlagEvaluator

FlagEvaluatorByName returns the flag evaluator with the given name, or nil.

func (*Registry) InitHooks

func (r *Registry) InitHooks() []OnInit

InitHooks returns all plugins that implement OnInit.

func (*Registry) Plugins

func (r *Registry) Plugins() []Plugin

Plugins returns all registered plugins.

func (*Registry) Register

func (r *Registry) Register(p Plugin)

Register adds a plugin to the registry. It discovers all implemented capability interfaces via type assertion and registers the plugin in the appropriate internal collections.

func (*Registry) RotationStrategyByName

func (r *Registry) RotationStrategyByName(name string) RotationStrategy

RotationStrategyByName returns the rotation strategy with the given name, or nil.

func (*Registry) SecretAccessHooks

func (r *Registry) SecretAccessHooks() []OnSecretAccess

SecretAccessHooks returns all plugins that implement OnSecretAccess.

func (*Registry) ShutdownHooks

func (r *Registry) ShutdownHooks() []OnShutdown

ShutdownHooks returns all plugins that implement OnShutdown.

func (*Registry) SourceProviders

func (r *Registry) SourceProviders() []SourceProvider

SourceProviders returns all source-providing plugins.

type RegistryOption

type RegistryOption func(*Registry)

RegistryOption configures the Registry.

func WithLogger

func WithLogger(l log.Logger) RegistryOption

WithLogger sets the logger for the registry.

type RotationStrategy

type RotationStrategy interface {
	RotationName() string
	Rotate(ctx context.Context, key string, current []byte) ([]byte, error)
}

RotationStrategy provides a custom secret rotation strategy.

type SourceProvider

type SourceProvider interface {
	Source() source.Source
	Priority() int
}

SourceProvider provides a configuration source with a priority.

Jump to

Keyboard shortcuts

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