cubbyhole

package
v0.0.0-...-5157a32 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cubbyhole provides an API client for the Vault Cubbyhole secrets engine.

To use the default Cubbyhole secrets engine mounted at "/cubbyhole", use the DefaultClient:

// List the Cubbyhole secret keys at the path "/cubbyhole/some/nested/path".
cubbyhole.DefaultClient.ReadSecret("some/nested/path")
cubbyhole.ListSecrets("some/nested/path") // shorthand of the above line

To use a Cubbyhole secrets engine mounted at a custom path, create a new Client:

// Create a secret at the Cubbyhole path "/my-cubbyhole/some/path".
c := cubbyhole.NewClient("/my-cubbyhole", nil)
c.WriteSecret("some/path", map[string]interface{}{"foo": "bar"})

See https://www.vaultproject.io/api-docs/secret/cubbyhole for more information on the available endpoints.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyPath is returned when the secret path is an empty string.
	ErrEmptyPath = errors.New("cubbyhole: path is empty")

	// ErrNoSecretData is returned when no data is stored at the secret path.
	ErrNoSecretData = errors.New("cubbyhole: no secret data")
)
View Source
var DefaultClient = NewClient(defaultMountPath, nil)

DefaultClient is a Cubbyhole API client mounted at the default path in Vault.

Functions

func DeleteSecret

func DeleteSecret(path string) error

DeleteSecret deletes the secret at the specified path using the DefaultClient.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#delete-secret.

func ListSecrets

func ListSecrets(path string) ([]string, error)

ListSecrets lists the secret keys at the specified path using the DefaultClient.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#list-secrets.

func ReadSecret

func ReadSecret(path string) (map[string]interface{}, error)

ReadSecret reads the secret at the specified path using the DefaultClient.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#read-secret.

func WriteSecret

func WriteSecret(path string, data map[string]interface{}) error

WriteSecret creates or updates the secret at the specified path using the DefaultClient.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#create-update-secret.

Types

type Client

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

Client is an API client for the Vault Cubbyhole secrets engine.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#cubbyhole-secrets-engine-api.

func NewClient

func NewClient(path string, client vault.LogicalClient) *Client

NewClient creates a new Cubbyhole API client for the secrets engine mounted at the given path in Vault.

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(path string) error

DeleteSecret deletes the secret at the specified path.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#delete-secret.

func (*Client) ListSecrets

func (c *Client) ListSecrets(path string) ([]string, error)

ListSecrets lists the secret keys at the specified path.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#list-secrets.

func (*Client) ReadSecret

func (c *Client) ReadSecret(path string) (map[string]interface{}, error)

ReadSecret reads the secret at the specified path.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#read-secret.

func (*Client) WriteSecret

func (c *Client) WriteSecret(path string, data map[string]interface{}) error

WriteSecret creates or updates the secret at the specified path.

See https://www.vaultproject.io/api-docs/secret/cubbyhole#create-update-secret.

Jump to

Keyboard shortcuts

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