providers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidVaultAuthConfig = errors.New("exactly one auth method options must be specified")
	ErrVaultConnection        = errors.New("error connecting to the Vault server")
	ErrVaultAuth              = errors.New("error authenticating with Vault")
	ErrVaultSecretFetch       = errors.New("error fetching secret from Vault")
	ErrVaultSecretValueType   = errors.New("error getting secret value as string")
)

Functions

This section is empty.

Types

type EnvProvider added in v1.0.0

type EnvProvider struct{}

func NewEnvProvider added in v1.0.0

func NewEnvProvider() EnvProvider

func (EnvProvider) GetValue added in v1.0.0

func (ep EnvProvider) GetValue(fieldPath []string) (string, error)

type JSONProvider added in v1.0.0

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

func NewJSONProvider added in v1.0.0

func NewJSONProvider(filePath string) (*JSONProvider, error)

func NewJSONProviderFromFs added in v1.2.0

func NewJSONProviderFromFs(fs fs.FS, filePath string) (*JSONProvider, error)

func (JSONProvider) GetValue added in v1.0.0

func (jp JSONProvider) GetValue(fieldPath []string) (string, error)

type VaultAppRoleAuthOptions added in v1.1.0

type VaultAppRoleAuthOptions struct {
	RoleId   string
	SecretId string
}

type VaultClient added in v1.1.0

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

func NewVaultClient added in v1.1.0

func NewVaultClient() *VaultClient

func (*VaultClient) AppRoleLogin added in v1.1.0

func (vc *VaultClient) AppRoleLogin(ctx context.Context, roleId string, secretId string) error

func (*VaultClient) GetValues added in v1.1.0

func (vc *VaultClient) GetValues(ctx context.Context, path string, mountPath string) (map[string]interface{}, error)

func (*VaultClient) Initialize added in v1.1.0

func (vc *VaultClient) Initialize(url string, requestTimeout time.Duration) error

func (*VaultClient) KubernetesLogin added in v1.1.0

func (vc *VaultClient) KubernetesLogin(ctx context.Context, jwt string, role string) error

type VaultClienter added in v1.1.0

type VaultClienter interface {
	Initialize(url string, requestTimeout time.Duration) error
	AppRoleLogin(ctx context.Context, roleId string, secretId string) error
	KubernetesLogin(ctx context.Context, jwt string, role string) error
	GetValues(ctx context.Context, path string, mountPath string) (map[string]interface{}, error)
}

VaultClienter Serves as an abstraction layer to the actual vault client We're using this, so we can unit test the vault provider without worrying about the Vault client

type VaultKubernetesAuthOptions added in v1.1.0

type VaultKubernetesAuthOptions struct {
	Jwt  string
	Role string
}

type VaultOptions added in v1.1.0

type VaultOptions struct {
	// The Vault Server url
	Url string

	// The request timeout for the vault client in seconds (default 1m)
	RequestTimeout int

	// Options for app role authentication
	AppRoleAuth *VaultAppRoleAuthOptions

	// Options for kubernetes authentication
	KubernetesAuth *VaultKubernetesAuthOptions

	// The KV mount path
	MountPath string

	// The path of the secret
	Path string
}

type VaultProvider

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

func NewVaultProvider added in v1.1.0

func NewVaultProvider(options VaultOptions) (*VaultProvider, error)

func (*VaultProvider) GetValue

func (vp *VaultProvider) GetValue(fieldPath []string) (string, error)

Jump to

Keyboard shortcuts

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