secretbackend

package
v0.0.0-...-76050e6 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, factory RegistryFactory)

Register SecretBackend driver, should be call be driver when package import init, the name should be unique. Driver will be overwritten when register with same name, and the last registration will win.

Types

type Holder

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

Holder is container that help you manager your secret driver.

func NewHolder

func NewHolder() *Holder

func (*Holder) Add

func (h *Holder) Add(name string, secretBackend SecretDriver)

func (*Holder) Close

func (h *Holder) Close(name string)

func (*Holder) CloseAll

func (h *Holder) CloseAll()

func (*Holder) Get

func (h *Holder) Get(name string) SecretDriver

func (*Holder) Init

func (h *Holder) Init(name string, driverName string, config map[string]any) error

type RegistryFactory

type RegistryFactory func(config map[string]any) (SecretDriver, error)

type SecretDriver

type SecretDriver interface {
	// Set store confId/value to actual Secret Backend, Secret Backend may convert confId/value to another form.
	Set(confID string, value string) error
	// Get lookup value for confId, Secret Backend may reconvert value if it converts value to another form when Set.
	Get(confID string) (string, error)
	// GetByParams lookup value for confId, Secret Backend may reconvert value if it converts value to another form when Set.
	GetByParams(confID string, params map[string]any) (string, error)
	// Close should free the SecretBackend resources.
	Close() error
}

SecretDriver is actual secret manager system. It may be Vault, KMS, etc.

func NewSecretBackendWith

func NewSecretBackendWith(name string, config map[string]any) (SecretDriver, error)

NewSecretBackendWith return a SecretBackend driver named params name. With a not-exist name, will return err.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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