v1

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValues added in v1.7.1

func GetValues(
	p singleValueProvider,
	ids ...string,
) (map[string]ProviderResponse, error)

GetValues takes in variable ids and returns their resolved values by making sequential getValueCallArgs to a singleValueProvider. This is a convenience function since most providers with batch retrieval capabilities will have need the exact same code. Note: most internal providers simply use this function in their implementation of the Provider interface's GetValues method.

Types

type ConfigurationChangedHandler

type ConfigurationChangedHandler interface {
	// ConfigurationChanged is a method that gets triggered when a ConfigurationManager
	// has a new configuration that should be loaded.
	ConfigurationChanged(string, config_v2.Config) error
}

ConfigurationChangedHandler interface specifies what method is required to support being a target of a ConfigurationManger object.

type ConfigurationManager

type ConfigurationManager interface {
	// Initialize is called to instantiate the ConfigurationManager and provide
	// a handler that will be notified of configuration object updates.
	Initialize(handler ConfigurationChangedHandler, configSpec string) error

	// GetName returns the internal name that the ConfigurationManager was
	// instantiated with.
	GetName() string
}

ConfigurationManager is the interface used to obtain configuration data and to trigger updates

type ConfigurationManagerOptions

type ConfigurationManagerOptions struct {
	// Name is the internal name that the configuraton manager will have. This
	// may be different from the name passed back from the factory.
	Name string
}

ConfigurationManagerOptions contains the configuration for the configuration manager instantiation.

type ConnectionManager

type ConnectionManager interface {
	// Initialize is called before proxy initialization
	Initialize(config_v2.Config, func(config_v2.Config) error) error

	// CloseConnect is called when a client connection is closed
	CloseConnection(net.Conn)

	// ResolveCredential is called when a provider resolves a variable
	ResolveCredential(provider Provider, id string, value []byte)

	// ClientData is called for each inbound packet from clients
	ClientData(net.Conn, []byte)

	// ServerData is called for each inbound packet from the backend
	ServerData(net.Conn, []byte)

	// Shutdown is called when secretless caught a signal to exit
	Shutdown()
}

ConnectionManager is an interface to be implemented by plugins that want to manage connections for handlers and listeners.

type EventNotifier

type EventNotifier interface {
	// ClientData is called for each inbound packet from clients
	ClientData(net.Conn, []byte)

	// ResolveCredential is called when a provider resolves a variable
	// TODO: unclear why we're reimplementing the StoredSecret functionality here...
	ResolveCredential(provider Provider, id string, value []byte)

	// ServerData is called for each inbound packet from the backend
	ServerData(net.Conn, []byte)
}

EventNotifier is the interface which is used to pass event up from handlers/ listeners/managers back up to the main plugin manager

type MockProvider added in v1.7.1

type MockProvider struct {
	GetValueCallArgs []string // keeps track of args for each call to getValue
}

MockProvider conforms to, and allows testing of, both the singleValueProvider and Provider interfaces

func (*MockProvider) GetName added in v1.7.1

func (p *MockProvider) GetName() string

GetName simply returns "mock-provider"

func (*MockProvider) GetValue added in v1.7.1

func (p *MockProvider) GetValue(id string) ([]byte, error)

GetValue returns 0. If [id] has prefix 'err_', returns (nil, errors.New(id + "_value")) 1. Otherwise, returns ([]byte(id + "_value"), nil)

func (*MockProvider) GetValues added in v1.7.1

func (p *MockProvider) GetValues(ids ...string) (
	map[string]ProviderResponse,
	error,
)

GetValues sequentially get values for unique ids by calling GetValue

If there exists any id with the prefix 'global_err_', the function will return (nil, errors.New(id + "_value"))

type Provider

type Provider interface {
	// GetName returns the name that the Provider was instantiated with
	GetName() string

	// GetValues takes in variable ids and returns their resolved values
	GetValues(ids ...string) (map[string]ProviderResponse, error)
}

Provider is the interface used to obtain values from a secret vault backend.

type ProviderOptions

type ProviderOptions struct {
	// Name is the internal name that the provider will have. This may be different from
	// the name passed back from the provider factory.
	Name string
}

ProviderOptions contains the configuration for the provider instantiation

type ProviderResponse added in v1.7.1

type ProviderResponse struct {
	Value []byte
	Error error
}

ProviderResponse is the response from the provider for a given secret request

type Resolver

type Resolver interface {
	// Provider gets back an instance of a named provider and creates it if
	// one already doesn't exist
	Provider(name string) (Provider, error)

	// Resolve accepts an array of credentials and returns a map of resolved ones
	Resolve(credentials []*config_v2.Credential) (result map[string][]byte, err error)
}

Resolver is the interface which is used to pass a generic resolver down to the Listeners/Handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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