secret

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidFormat invalid output format.
	ErrInvalidFormat = errors.New("invalid format (valid options: base, yaml, json, export, markdown)")
)

Functions

This section is empty.

Types

type Option

type Option func(*Printer)

Option list of available options for modifying the output.

func CustomValueLength

func CustomValueLength(length int) Option

CustomValueLength option for trimming down the output of secrets.

func OnlyKeys

func OnlyKeys(b bool) Option

OnlyKeys flag for only showing secrets keys.

func OnlyPaths

func OnlyPaths(b bool) Option

OnlyPaths flag for only printing kv paths.

func ShowMetadata

func ShowMetadata(b bool) Option

ShowMetadata flag for unmasking secrets in output.

func ShowValues

func ShowValues(b bool) Option

ShowValues flag for unmasking secrets in output.

func ShowVersion

func ShowVersion(b bool) Option

ShowVersion flag for unmasking secrets in output.

func ToFormat

func ToFormat(format OutputFormat) Option

ToFormat sets the output format of the printer.

func WithTemplate

func WithTemplate(str, path string) Option

WithTemplate sets the template file.

func WithVaultClient

func WithVaultClient(v *vault.Vault) Option

WithVaultClient inject a vault client.

func WithWriter

func WithWriter(w io.Writer) Option

WithWriter option for passing a custom io.Writer.

type OutputFormat

type OutputFormat int

OutputFormat enum of valid output formats.

const (

	// MaxValueLength maximum length of passwords.
	MaxValueLength = 12

	// Base prints the secrets in the default format.
	Base OutputFormat = iota

	// YAML prints the secrets in yaml format.
	YAML

	// JSON prints the secrets in json format.
	JSON

	// Export prints the secrets in export (export "key=value") format.
	Export

	// Markdown prints the secrets in markdowntable format.
	Markdown

	// Template renders a given template string or file.
	Template

	// Policy displays the current token policy capabilities for each path in a matrix.
	Policy
)

type Printer

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

Printer struct that holds all options used for displaying the secrets.

func NewPrinter

func NewPrinter(opts ...Option) *Printer

NewPrinter return a new printer struct.

func (*Printer) Out

func (p *Printer) Out(enginePath string, secrets map[string]interface{}) error

Out prints out the secrets according all configured options. nolint: cyclop

func (*Printer) WithOption added in v0.5.1

func (p *Printer) WithOption(opt Option)

Jump to

Keyboard shortcuts

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