client

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client communicates with Vault

func New

func New(addr string, token string, insecure bool) *Client

New creates a new Client

func (Client) Get

func (c Client) Get(path string, keyMap []SecretKeyMapEntry, fetcher VaultResponseFetcher) (map[string]interface{}, error)

Get gets required

type SecretKeyMapEntry

type SecretKeyMapEntry struct {
	VaultKey string `yaml:"vaultKey" validate:"required"`
	LocalKey string `yaml:"localKey" validate:"required"`
}

SecretKeyMapEntry represents details about one KEY:VALUE secret pair VaultKey represent name of the key under data are stored in Vault LocalKey represents name of the local key e.g. KEY becomes results['KEY']

type VaultFetcher

type VaultFetcher struct{}

VaultFetcher implements VaultResponseFetcher

func (VaultFetcher) Fetch

func (VaultFetcher) Fetch(token string, url string) (*VaultResponse, error)

Fetch wrapt resty GET request

type VaultResponse

type VaultResponse struct {
	RequestID     string            `json:"request_id"`
	LeaseID       string            `json:"lease_id"`
	Renewable     bool              `json:"renewable"`
	LeaseDuration int               `json:"lease_duration"`
	Data          VaultResponseData `json:"data"`
	Errors        []string          `json:"errors"`
}

VaultResponse represents the actual Vault response

type VaultResponseData

type VaultResponseData struct {
	Data map[string]interface{} `json:"data"`
}

VaultResponseData represents the actual secrets stored in Vault

type VaultResponseFetcher

type VaultResponseFetcher interface {
	Fetch(token string, url string) (*VaultResponse, error)
}

VaultResponseFetcher is an interface which wraps http library

type VaultResponseMetadata

type VaultResponseMetadata struct {
	CreatedTime  string `json:"created_time"`
	DeletionTime string `json:"deletion_time"`
	Destroyed    bool   `json:"destroyed"`
	Version      int    `json:"version"`
}

VaultResponseMetadata represens secret's metadata

Jump to

Keyboard shortcuts

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