vault

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadCheck = 1 << iota
	WriteCheck
	ListCheck
	DeleteCheck
	StdCheck = ReadCheck | WriteCheck | ListCheck | DeleteCheck
)

Variables

View Source
var (
	ErrInitialize   = fmt.Errorf("cannot initialize vault client")
	ErrInvalidToken = fmt.Errorf("check token permission")
	ErrConnection   = fmt.Errorf("vault connection refused")
	ErrInvalidPath  = fmt.Errorf("invalid path")
	ErrCastPathData = fmt.Errorf("type cast errors on data from path")
)

Functions

func GetDataPath

func GetDataPath(p string) string

GetDataPath is similar to GetMetaPath but replaces first metadata with data

func GetMetaPath

func GetMetaPath(s string) string

GetMetaString will place metadata in the string as the second word after mount secret -> secret/metadata secret/ -> secret/metadata /secret/metadata -> secret/metadata secret/metadata/ -> secret/metadata secret/platform -> secret/metadata/platform

func GetMount

func GetMount(p string) string

GetMount returns the first portion of path assuming its the mount

func ParentPath

func ParentPath(s string) string

ParentPath return the parent of key path by removing the part after last /

Types

type Client

type Client struct {
	*api.Client
	Address string
}

func NewClient

func NewClient(address string, token string) (*Client, error)

func (*Client) CheckTokenPermissions

func (v *Client) CheckTokenPermissions(p string, checks int, name string) error

Check if we can create, list, read, delete in data paths assumes kv v2

func (*Client) DataPathChecks

func (v *Client) DataPathChecks(dataPath string, checks int, name string) error

func (*Client) DeepListPaths

func (v *Client) DeepListPaths(path string) ([]string, []string, error)

DeepListPaths returns set of paths and folders path is a single path which has key value pairs folder is a parent set of individual paths, it can have more folders and paths

func (*Client) GetAllPaths

func (v *Client) GetAllPaths(metaPaths []string) ([]string, []error)

GetAllSecretPaths recursively lists all absolute paths given a root vault kv v2 path Note: do not convert this into go routines as we dont know how to kill the goroutine

func (*Client) GetMount

func (v *Client) GetMount(p string) (*api.MountOutput, error)

func (*Client) IsSecretKvV2

func (v *Client) IsSecretKvV2(p string) error

func (*Client) TokenRenewer

func (v *Client) TokenRenewer(ctx context.Context, errCh chan error)

renews origin token

Jump to

Keyboard shortcuts

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