client

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDestinationFilePerms are the default file permissions for destination file rendered into
	// disk when a specific file permission has not already been specified.
	DefaultDestinationFilePerms = 0644
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Backend interface
	Backend backend.BackendAPI
	// contains filtered or unexported fields
}

Client is the client that performs all operations against a treasury backend

func New

func New(options *Options) (*Client, error)

New initializes a new client for the given AWS account with S3 bucket

func (*Client) Export

func (c *Client) Export(key, singleKeyExportFormat string, appendMap map[string]string) (string, error)

Export returns secrets in given format format should be provided in singleKeyExportFormat e.g.: singleKeyExportFormat = "export %s='%s'\n"

func (*Client) ExportMap

func (c *Client) ExportMap(key string) (map[string]string, error)

ExportMap returns map of Key=Value secrets (Key is without full path)

func (*Client) ExportToTemplate

func (c *Client) ExportToTemplate(key string, appendMap map[string]string) (string, error)

func (*Client) Import

func (c *Client) Import(prefix, secretsFilePath string, force bool) error

Import imports secrets from file into treasury store, if value does not change it is not overridden

func (*Client) Read

func (c *Client) Read(key string) (*Secret, error)

Read returns decrypted secret for given key

func (*Client) ReadFromEnv added in v0.8.0

func (c *Client) ReadFromEnv(env, key string) (string, error)

ReadFromEnv returns value of given key in specified env.

func (*Client) ReadGroup

func (c *Client) ReadGroup(keyPrefix string) ([]*Secret, error)

ReadGroup returns list of secrets for given key prefix

func (*Client) ReadValue

func (c *Client) ReadValue(key string) (string, error)

ReadValue returns secret as a string for given key.

func (*Client) Template

func (c *Client) Template(sourceFilePath, destinationFilePath string, perms os.FileMode, appendMap, envMap map[string]string) error

Template generates a file with secrets from given template

func (*Client) Write

func (c *Client) Write(key, secret string, force bool) error

Write secret to Treasure

func (*Client) WriteFile

func (c *Client) WriteFile(key, file string, force bool) error

type Options

type Options struct {
	Version string
	// backend region where we keep secrets
	Region       string
	S3BucketName string
	Backend      backend.BackendAPI
	AWSConfig    aws.Config
}

Options for client

type Secret

type Secret struct {
	Key         string
	Value       string
	BucketName  string
	Application string
	Environment string
}

Secret struct

Jump to

Keyboard shortcuts

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