vault

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package vault is a source implementation that retrieves cache data from a path in a Hashicorp Vault key/value store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSource added in v1.1.0

func CreateSource(prefix string, fpath string) (source.Source, error)

CreateSource returns a vault source with a client associated to work with

func CreateVaultClient

func CreateVaultClient(fpath string) (*api.Client, error)

CreateVaultClient returns a Vault Client with a valid Token provided by the Vault Agent assigned to it.

`fpath` indicates the path of the file to read from. This file is where the token provided by the agent is stored.

func ReadToken

func ReadToken(fpath string) ([]byte, error)

ReadToken returns a byte array containing data from the designated file.

`fpath` indicates the path where the file is located at.

Types

type Option

type Option func(*Source)

Option represents a function which will make some change to the source during initialization.

func Client

func Client(c *api.Client) Option

Client is an option function which will set the source's client to the one that is provided.

func MountPath

func MountPath(m string) Option

MountPath is an option function which will set the source's mountpath for the key/value store to the one provided.

func Prefix

func Prefix(p string) Option

Prefix is an option function which will set the source's prefix to the value provided.

type Source added in v1.1.0

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

Source contains the Vault API client and complete path to the cache data within the vault.

func NewSource

func NewSource(opts ...Option) (*Source, error)

NewSource creates a new Vault source using the options provided. If no options are provided a client is initialized with the default values.

func (*Source) Client added in v1.1.0

func (s *Source) Client() *api.Client

Client is a convenience function to retrieve the Vault API client from the source.

func (*Source) FillGroupCache added in v1.1.0

func (s *Source) FillGroupCache(c *cache.Cache) error

FillGroupCache reads entries from the Vault and uses them to fill the group cache.

func (*Source) FillPasswdCache added in v1.1.0

func (s *Source) FillPasswdCache(c *cache.Cache) error

FillPasswdCache reads entries from the Vault and uses them to fill the passwd cache.

func (*Source) FillShadowCache added in v1.1.0

func (s *Source) FillShadowCache(c *cache.Cache) error

FillShadowCache reads entries from the Vault and uses them to fill the shadow cache.

Jump to

Keyboard shortcuts

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