vault

package
v0.0.0-...-e950fe4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KvVersionAuto detects vault kv version automatically
	KvVersionAuto int = iota
	// KvVersion1 sets the vault kv version to 1
	KvVersion1
	// KvVersion2 sets the vault kv version to 2
	KvVersion2
)
View Source
const KVWarning = "Invalid path for a versioned K/V secrets engine."

KVWarning is the warning returned by the vault API when the K/V path is invalid (wrong version)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRoleProvider

type AppRoleProvider struct {
	AppRoleName, RoleID, SecretID string
}

AppRoleProvider is a provider to connect to vault using AppRole

func NewAppRoleProvider

func NewAppRoleProvider(appRoleName, roleID, secretID string) *AppRoleProvider

NewAppRoleProvider creates a pointer to a AppRoleProvider struct

func (AppRoleProvider) Login

func (a AppRoleProvider) Login(c *Config) (*vapi.Client, error)

Login authenticates to the configured vault server

type AuthProvider

type AuthProvider interface {
	Login(*Config) (*vapi.Client, error)
}

AuthProvider is an interface to abstract vault methods' connection

type CachedClient

type CachedClient struct {
	SimpleClient
	// contains filtered or unexported fields
}

CachedClient represents a vault client which caches results from vault for later use

func NewCachedClient

func NewCachedClient(client *vapi.Client) *CachedClient

NewCachedClient creates a pointer to a CachedClient struct

func (*CachedClient) Clear

func (c *CachedClient) Clear()

Clear clears the existing cache

func (*CachedClient) Read

func (c *CachedClient) Read(kvVersion int, kvPath string, secretPath string) (map[string]interface{}, error)

Read implem for CachedClient struct

type Client

type Client interface {
	Read(engine int, kvPath string, secretPath string) (map[string]interface{}, error)
}

Client is an interface to read data from vault

type Config

type Config struct {
	Address   string
	Namespace string
	Insecure  bool
}

Config is a struct to configure a vault connection

func NewConfig

func NewConfig(address string) *Config

NewConfig creates a pointer to a VaultConfig struct

type KubernetesProvider

type KubernetesProvider struct {
	// Role to use for the authentication
	Role string
	// Cluster is the path to use to call the login URL
	Cluster string
	// contains filtered or unexported fields
}

KubernetesProvider is a provider to authenticate using the Vault Kubernetes Auth Method plugin https://www.vaultproject.io/docs/auth/kubernetes

func NewKubernetesProvider

func NewKubernetesProvider(role, cluster, jwt string) *KubernetesProvider

NewKubernetesProvider creates a new KubernetesProvider object

func (KubernetesProvider) Login

func (k KubernetesProvider) Login(c *Config) (*vapi.Client, error)

Login - godoc

func (*KubernetesProvider) SetJWT

func (k *KubernetesProvider) SetJWT(jwt string)

SetJWT set the jwt token to use for authentication

type PathNotFound

type PathNotFound struct {
	Path string
}

PathNotFound represents an error when a path is not found in vault

func (*PathNotFound) Error

func (e *PathNotFound) Error() string

Error

type SimpleClient

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

SimpleClient is a simplistic client to connect to vault

func NewSimpleClient

func NewSimpleClient(client *vapi.Client) *SimpleClient

NewSimpleClient creates a pointer to a SimpleClient struct

func (*SimpleClient) Read

func (c *SimpleClient) Read(kvVersion int, kvPath string, secretPath string) (map[string]interface{}, error)

Read implem for SimpleClient struct

type TokenProvider

type TokenProvider struct {
	Token string
}

TokenProvider connects to vaut using a bare token

func NewTokenProvider

func NewTokenProvider(token string) *TokenProvider

NewTokenProvider creates a pointer to a TokenProvider

func (TokenProvider) Login

func (t TokenProvider) Login(c *Config) (*vapi.Client, error)

Login - godoc

type WrongVersionError

type WrongVersionError struct {
	Message string
}

WrongVersionError represents an error raised when the KV version is not correct

func (*WrongVersionError) Error

func (e *WrongVersionError) Error() string

Error

Jump to

Keyboard shortcuts

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