kv

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 24 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CertsCert_filesDcidevpublicPem

func CertsCert_filesDcidevpublicPem() (*asset, error)

func CertsCert_filesDcidevpublicPemBytes

func CertsCert_filesDcidevpublicPemBytes() ([]byte, error)

func CertsCert_filesDcipublicPem

func CertsCert_filesDcipublicPem() (*asset, error)

func CertsCert_filesDcipublicPemBytes

func CertsCert_filesDcipublicPemBytes() ([]byte, error)

func CreateHTTPClient

func CreateHTTPClient(insecure bool, address string, env string, scan bool) (client *http.Client, err error)

CreateHTTPClient reads from several .pem files to get the necessary keys and certs to configure the http client and returns the client.

func CreateHTTPClientAllowNonLocal

func CreateHTTPClientAllowNonLocal(insecure bool, address string, env string, scan bool, allowNonLocal bool) (client *http.Client, err error)

CreateHTTPClient reads from several .pem files to get the necessary keys and certs to configure the http client and returns the client.

func IsUrlIp

func IsUrlIp(address string) (bool, error)

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func PreCheckEnvironment

func PreCheckEnvironment(environment string) (string, string, bool, error)

PreCheckEnvironment Returns: env, parts, true if parts is path, false if part of file name, error

func PruneCache

func PruneCache(env string, addr string, limit uint64)

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Modifier

type Modifier struct {
	Insecure bool // Indicates if connections to vault should be secure
	Direct   bool // Bypass vault and utilize alternative source when possible.

	SecretDictionary *api.Secret // Current Secret Dictionary Cache -- populated by mod.List("templates"

	Env             string // Environment (local/dev/QA; Initialized to secrets)
	RawEnv          string
	Regions         []string // Supported regions
	Version         string   // Version for data
	VersionFilter   []string // Used to filter vault paths
	TemplatePath    string   // Path to template we are processing.
	ProjectIndex    []string // Which projects are indexed.
	SectionKey      string   // The section key: Index or Restricted.
	SectionName     string   // The name of the actual section.
	SubSectionName  string   // The name of the actual subsection.
	SubSectionValue string   // The actual value for the sub section.
	SectionPath     string   // The path to the Index (both seed and vault)
	// contains filtered or unexported fields
}

Modifier maintains references to the active client and respective logical needed to write to the vault. Path can be changed to alter where in the vault the key,value pair is stored

func NewModifier

func NewModifier(insecure bool, token string, address string, env string, regions []string, useCache bool, logger *log.Logger) (*Modifier, error)

NewModifier Constructs a new modifier struct and connects to the vault @param token The access token needed to connect to the vault @param address The address of the API endpoint for the server @param env The environment currently connecting to. @param regions Regions we want @param useCache Whether to use the modcache or not. @return A pointer to the newly contstructed modifier object (Note: path set to default),

Any errors generated in creating the client

func (*Modifier) AdjustValue

func (m *Modifier) AdjustValue(path string, data map[string]interface{}, n int, logger *log.Logger) ([]string, error)

AdjustValue adjusts the value at the given path/key by n

func (*Modifier) CleanCache

func (m *Modifier) CleanCache(limit uint64)

func (*Modifier) Close

func (m *Modifier) Close()

Proper shutdown of modifier.

func (*Modifier) Exists

func (m *Modifier) Exists(path string) bool

func (*Modifier) FindIndexForService

func (m *Modifier) FindIndexForService(project string, service string, logger *log.Logger) (string, error)

Given Project and Service, looks for a key index and returns it.

func (*Modifier) GetProjectServicesMap

func (m *Modifier) GetProjectServicesMap(logger *log.Logger) (map[string][]string, error)

GetProjectServiceMap - returns a map of all projects with list of their available services.

func (*Modifier) GetTemplateFilePaths

func (m *Modifier) GetTemplateFilePaths(pathName string, logger *log.Logger) ([]string, error)

func (*Modifier) GetVersionValues

func (m *Modifier) GetVersionValues(mod *Modifier, wantCerts bool, enginePath string, logger *log.Logger) (map[string]map[string]interface{}, error)

GetVersionValues gets filepath for values and grabs metadata for those paths.

func (*Modifier) HardDelete

func (m *Modifier) HardDelete(path string, logger *log.Logger) (map[string]interface{}, error)

func (*Modifier) List

func (m *Modifier) List(path string, logger *log.Logger) (*api.Secret, error)

List lists the paths underneath this one

func (*Modifier) ListEnv

func (m *Modifier) ListEnv(path string, logger *log.Logger) (*api.Secret, error)

List lists the paths underneath this one

func (*Modifier) ListSubsection

func (m *Modifier) ListSubsection(sectionKey string, project string, indexName string, logger *log.Logger) ([]string, error)

func (*Modifier) ReadData

func (m *Modifier) ReadData(path string) (map[string]interface{}, error)

ReadData Reads the most recent data from the path referenced by this Modifier @return A Secret pointer that contains key,value pairs and metadata

errors generated from reading

func (*Modifier) ReadMapValue

func (m *Modifier) ReadMapValue(valueMap map[string]interface{}, path string, key string) (string, error)

ReadMapValue takes a valueMap, path, and a key and returns the corresponding value from the vault

func (*Modifier) ReadMetadata

func (m *Modifier) ReadMetadata(path string, logger *log.Logger) (map[string]interface{}, error)

ReadMetadata Reads the Metadata from the path referenced by this Modifier @return A Secret pointer that contains key,value pairs and metadata

errors generated from reading

func (*Modifier) ReadValue

func (m *Modifier) ReadValue(path string, key string) (string, error)

ReadValue takes a path and a key and returns the corresponding value from the vault

func (*Modifier) ReadVersionMetadata

func (m *Modifier) ReadVersionMetadata(path string, logger *log.Logger) (map[string]interface{}, error)

ReadVersionMetadata Reads the Metadata of all versions from the path referenced by this Modifier

func (*Modifier) Release

func (m *Modifier) Release()

func (*Modifier) RemoveFromCache

func (m *Modifier) RemoveFromCache()

func (*Modifier) SoftDelete

func (m *Modifier) SoftDelete(path string, logger *log.Logger) (map[string]interface{}, error)

func (*Modifier) ValidateEnvironment

func (m *Modifier) ValidateEnvironment(environment string, init bool, policySuffix string, logger *log.Logger) (bool, string, error)

ValidateEnvironment Ensures token has access to requested data.

func (*Modifier) Write

func (m *Modifier) Write(path string, data map[string]interface{}, logger *log.Logger) ([]string, error)

Writes the key,value pairs in data to the vault

@param data A set of key,value pairs to be written

@return Warnings (if any) generated from the vault,

errors generated by writing

Jump to

Keyboard shortcuts

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