client

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.10.0

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

Cache is a thread-safe cache for vault queries

func NewCache added in v0.10.0

func NewCache(vaultClient *api.Client) *Cache

NewCache create a new thread-safe cache object

func (*Cache) Clear added in v0.10.0

func (cache *Cache) Clear()

Clear removes all entries from the cache

func (*Cache) List added in v0.10.0

func (cache *Cache) List(path string) (result *api.Secret, err error)

List tries to get path from cache. If path is not available in cache, it uses the vault client to query and update cache.

type Client

type Client struct {
	Vault      *api.Client
	Name       string
	Pwd        string
	KVBackends map[string]int
	// contains filtered or unexported fields
}

Client wrapper for Vault API client

func NewClient

func NewClient(conf *VaultConfig) (*Client, error)

NewClient creates a new Client Vault wrapper

func (*Client) ClearCache added in v0.5.0

func (client *Client) ClearCache()

ClearCache clears the list cache

func (*Client) Delete

func (client *Client) Delete(absolutePath string) (err error)

Delete deletes secret at given absolutePath, using given client

func (*Client) GetType

func (client *Client) GetType(absolutePath string) (kind PathKind)

GetType returns the file type the given absolutePath points to. Possible return values are BACKEND, NODE, LEAF or NONE

func (*Client) List

func (client *Client) List(absolutePath string) (result []string, err error)

List elements at the given absolutePath, using the given client

func (*Client) Read

func (client *Client) Read(absolutePath string) (secret *Secret, err error)

Read returns secret at given path, using given Client

func (*Client) SubpathsForPath added in v0.9.0

func (client *Client) SubpathsForPath(path string, shallow bool) (filePaths []string, err error)

SubpathsForPath will return an array of absolute paths at or below path

func (*Client) Traverse

func (client *Client) Traverse(absolutePath string, shallow bool) (paths []string)

Traverse traverses given absolutePath via DFS and returns sub-paths in array

func (*Client) Write

func (client *Client) Write(absolutePath string, secret *Secret) (err error)

Write writes secret to given path, using given Client

type PathKind

type PathKind int

PathKind describes the type of a path

const (
	BACKEND PathKind = iota
	NODE
	LEAF
	NONE
)

types of paths

type Secret added in v0.9.0

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

Secret holds vault secret and offers operations to simplify KV abstraction

func NewSecret added in v0.9.0

func NewSecret(vaultSecret *api.Secret) *Secret

NewSecret create a new Secret object

func (*Secret) GetAPISecret added in v0.9.0

func (secret *Secret) GetAPISecret() *api.Secret

GetAPISecret getter method for vault secret in Secret object

func (*Secret) GetData added in v0.9.0

func (secret *Secret) GetData() map[string]interface{}

GetData returns the secret data as a map and is KV agnostic

func (*Secret) SetData added in v0.9.0

func (secret *Secret) SetData(data map[string]interface{})

SetData set given data as vault secret data and is KV agnostic

type VaultConfig

type VaultConfig struct {
	Addr      string
	Token     string
	StartPath string
}

VaultConfig container to keep parameters for Client configuration

Jump to

Keyboard shortcuts

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