store

package
v0.0.0-...-3e6aba4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilePersistenceStoreName = "filePersistenceStore"
)
View Source
const (
	KvdbPersistenceStoreName = "kvdbPersistenceStore"
)

Variables

View Source
var (
	// ErrInvalidRequest is returned when a request to get/put SecretData is made without configuring KVDB as a persistence store.
	ErrInvalidRequest = errors.New("Storing secret data is supported in Secrets only if provided with kvdb as persistence store.")
)

Functions

This section is empty.

Types

type FilePersistenceStore

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

func NewFilePersistenceStore

func NewFilePersistenceStore() *FilePersistenceStore

func (*FilePersistenceStore) Delete

func (f *FilePersistenceStore) Delete(secretId string) error

func (*FilePersistenceStore) Exists

func (f *FilePersistenceStore) Exists(secretId string) (bool, error)

func (*FilePersistenceStore) GetPublic

func (f *FilePersistenceStore) GetPublic(secretId string) ([]byte, error)

func (*FilePersistenceStore) GetSecretData

func (f *FilePersistenceStore) GetSecretData(
	secretId string,
	plain []byte,
) (map[string]interface{}, error)

func (*FilePersistenceStore) List

func (f *FilePersistenceStore) List() ([]string, error)

func (*FilePersistenceStore) Name

func (f *FilePersistenceStore) Name() string

func (*FilePersistenceStore) Set

func (f *FilePersistenceStore) Set(
	secretId string,
	cipher []byte,
	plain []byte,
	secretData map[string]interface{},
	override bool,
) error

func (*FilePersistenceStore) SetBasePath

func (f *FilePersistenceStore) SetBasePath(path string)

SetBasePath is used to set a base directory for the FilePersistenceStore. Should be used just for testing purposed as it's out of the PersistenceStore interface.

type PersistenceStore

type PersistenceStore interface {
	// GetPublic returns the persisted kms public info
	// of the given secretId
	GetPublic(secretId string) ([]byte, error)

	// GetSecretData returns the encrypted persisted secretData
	// if it exists for the given secretId
	GetSecretData(secretId string, plain []byte) (map[string]interface{}, error)

	// Exists checks if the given secretId already
	// exists
	Exists(secretId string) (bool, error)

	// Set persists the kms public info and encyrpted secretData if provided
	// for the given secretId. If the given secretId exists in the store it will return an error.
	Set(secretId string, cipher, plain []byte, secretData map[string]interface{}, override bool) error

	// Delete deletes the kms public info and the encrypted secretData if any
	// for the given secretId
	Delete(secretId string) error

	// Name returns the name of persistence store
	Name() string

	// List returns list of all the secretIds
	List() ([]string, error)
}

func NewKvdbPersistenceStore

func NewKvdbPersistenceStore(
	kv kvdb.Kvdb,
	publicBasePath string,
	dataBasePath string,
) PersistenceStore

Jump to

Keyboard shortcuts

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