kv

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// CustomMetadataKeyLimit defines the key count limit for custom metadata.
	CustomMetadataKeyLimit = 64
	// CustomMetadataKeySizeLimit defines the key size limit in bytes for
	// custom metadata.
	CustomMetadataKeySizeLimit = 128
	// CustomMetadataValueSizeLimit defines the value size limit in bytes for
	// custom metadata.
	CustomMetadataValueSizeLimit = 512
)

Variables

View Source
var (
	// ErrPathNotFound is raised when given secret path doesn't exists.
	ErrPathNotFound = errors.New("path not found")
	// ErrNoData is raised when gievn secret path doesn't contains data.
	ErrNoData = errors.New("no data")
	// ErrCustomMetadataDisabled is raised when trying to write a custom
	// metadata with globally disabled feature.
	ErrCustomMetadataDisabled = errors.New("custom metadata is disabled")
)
View Source
var VaultMetadataDataKey = "www.vaultproject.io/kv/metadata"

VaultMetadataDataKey represents the secret data key used to store metadata.

Functions

func SecretGetter

func SecretGetter(client *api.Client) func(string) (map[string]interface{}, error)

SecretGetter pull a secret from Vault using given path.

To be used of template function.

Types

type Option added in v0.2.0

type Option func(opts *Options)

Option defines the functional option pattern.

func WithVaultMetatadata added in v0.2.0

func WithVaultMetatadata(value bool) Option

WithVaultMetatadata enable/disable the custom metadata storage strategy (requires Vault >=1.9).

type Options added in v0.2.0

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

Options defiens the default option value.

type SecretData added in v0.1.10

type SecretData map[string]interface{}

SecretData is a secret body

type SecretLister

type SecretLister interface {
	List(ctx context.Context, path string) ([]string, error)
}

SecretLister repesents secret key listing feature contract.

type SecretMetadata added in v0.1.10

type SecretMetadata map[string]interface{}

SecretMetadata is secret data attached metadata

type SecretReader

type SecretReader interface {
	Read(ctx context.Context, path string) (SecretData, SecretMetadata, error)
	ReadVersion(ctx context.Context, path string, version uint32) (SecretData, SecretMetadata, error)
}

SecretReader represents secret reader feature contract.

type SecretWriter

type SecretWriter interface {
	Write(ctx context.Context, path string, secrets SecretData) error
	WriteWithMeta(ctx context.Context, path string, secrets SecretData, meta SecretMetadata) error
}

SecretWriter represents secret writer feature contract.

type Service

type Service interface {
	SecretLister
	SecretReader
	SecretWriter
}

Service declares vault service contract.

func New

func New(client *api.Client, path string, opts ...Option) (Service, error)

New build a KV service according to mountPath version.

func V1

func V1(l logical.Logical, mountPath string) Service

V1 returns a K/V v1 backend service instance.

func V2

func V2(l logical.Logical, mountPath string, customMetadataEnabled bool) Service

V2 returns a K/V v2 backend service instance.

Jump to

Keyboard shortcuts

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