spruce

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 36 Imported by: 1

README

          *          .---. ,---.  ,---.  .-. .-.  ,--,  ,---.         *
         /.\        ( .-._)| .-.\ | .-.\ | | | |.' .')  | .-'        /.\
        /..'\      (_) \   | |-' )| `-'/ | | | ||  |(_) | `-.       /..'\
        /'.'\      _  \ \  | |--' |   (  | | | |\  \    | .-'       /'.'\
       /.''.'\    ( `-'  ) | |    | |\ \ | `-')| \  `-. |  `--.    /.''.'\
       /.'.'.\     `----'  /(     |_| \)\`---(_)  \____\/( __.'    /.'.'.\
"'""""/'.''.'.\""'"'""""""(__)""""""""(__)"""""""""""""(__)""'""""/'.''.'.\""'"'"
      ^^^[_]^^^                                                   ^^^[_]^^^

Slack ( We'll be in #spruce)

Introducing Spruce

spruce is a general purpose YAML & JSON merging tool.

It is designed to be an intuitive utility for merging YAML/JSON templates together to generate complicated YAML/JSON config files in a repeatable fashion. It can be used to stitch together some generic/top level definitions for the config and pull in overrides for site-specific configurations to DRY your configs up as much as possible.

How do I get started?

spruce is available via Homebrew, just brew tap starkandwayne/cf; brew install spruce

Alternatively, you can download a prebuilt binaries for 64-bit Linux, or Mac OS X

How do I compile from source?

  1. Install Go, e.g. on Ubuntu sudo snap install --classic go
  2. Fetch sources via go get github.com/geofffranks/spruce
  3. Change current directory to the source root cd ~/go/src/github.com/geofffranks/spruce/
  4. Compile and execute tests make all

A Quick Example

# Let's build the first yaml file we will merge
$ cat <<EOF first.yml
some_data: this will be overwritten later
a_random_map:
  key1: some data
heres_an_array:
- first element
EOF

# and now build the second yaml file to merge on top of it
$ cat <<EOF second.yml
some_data: 42
a_random_map:
  key2: adding more data
heres_an_array:
- (( prepend ))
- zeroth element
more_data: 84

# what happens when we spruce merge?
$ spruce merge first.yml second.yml
a_random_map:
  key1: some data
  key2: adding more data
heres_an_array:
- zeroth element
- first element
more_data: 84
some_data: 42

The data in second.yml is overlayed on top of the data in first.yml. Check out the merge semantics and array merging for more info on how that was done. Or, check out [this example on play.spruce.cf][play.spruce-example]

Documentation

What else can Spruce do for you?

spruce doesn't just stop at merging datastructures together. It also has the following helpful subcommands:

spruce diff - Allows you to get a useful diff of two YAML files, to see where they differ semantically. This is more than a simple diff tool, as it examines the functional differences, rather than just textual (e.g. key-ordering differences would be ignored)

spruce json - Allows you to convert a YAML document into JSON, for consumption by something that requires a JSON input. spruce merge will handle both YAML + JSON documents, but produce only YAML output.

spruce vaultinfo - Takes a list of files that would be merged together, and analyzes what paths in Vault would be looked up. Useful for determining explicitly what access an automated process might need to Vault to obtain the right credentials, and nothing more. Also useful if you need to audit what credentials your configs are retrieving for a system..

License

Licensed under the MIT License

Documentation

Index

Constants

View Source
const UNDEFINED_AZ = "__UNDEFINED_AZ__"

Variables

View Source
var OpRegistry map[string]Operator

OpRegistry ...

View Source
var SkipAws bool

SkipAws toggles whether AwsOperator will attempt to query AWS for any value When true will always return "REDACTED"

View Source
var SkipVault bool

SkipVault toggles whether calls to the Vault operator actually cause the Vault to be contacted and the keys substituted in.

View Source
var UsedIPs map[string]string

UsedIPs ...

View Source
var VaultRefs = map[string][]string{}

VaultRefs maps secret path to paths in YAML structure which call for it

Functions

func JSONifyFiles

func JSONifyFiles(paths []string, strict bool) ([]string, error)

func JSONifyIO

func JSONifyIO(in io.Reader, strict bool) (string, error)

func Merge

func Merge(l ...map[interface{}]interface{}) (map[interface{}]interface{}, error)

Merge ...

func RegisterOp

func RegisterOp(name string, op Operator)

RegisterOp ...

func ResolveEnv

func ResolveEnv(nodes []string) []string

func SetupOperators

func SetupOperators(phase OperatorPhase) error

SetupOperators ...

func SilenceWarnings

func SilenceWarnings(should bool)

SilenceWarnings when called with true will make it so that warnings will not print when Warn is called. Calling it with false will make warnings visible again. Warnings will print by default.

Types

type Action

type Action int

Action ...

const (
	// Replace ...
	Replace Action = iota

	// Inject ...
	Inject
)

type AwsOperator

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

AwsOperator provides two operators; (( awsparam "path" )) and (( awssecret "name_or_arn" )) It will fetch parameters / secrets from the respective AWS service

func (AwsOperator) Dependencies

func (AwsOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies is not used by AwsOperator

func (AwsOperator) Phase

func (AwsOperator) Phase() OperatorPhase

Phase ...

func (AwsOperator) Run

func (o AwsOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run will invoke the appropriate getAws* function for each instance of the AwsOperator and extract the specified key (if provided).

func (AwsOperator) Setup

func (AwsOperator) Setup() error

Setup ...

type Base64DecodeOperator

type Base64DecodeOperator struct{}

Base64DecodeOperator ...

func (Base64DecodeOperator) Dependencies

func (Base64DecodeOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (Base64DecodeOperator) Phase

Phase ...

func (Base64DecodeOperator) Run

func (Base64DecodeOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (Base64DecodeOperator) Setup

func (Base64DecodeOperator) Setup() error

Setup ...

type Base64Operator

type Base64Operator struct{}

Base64Operator ...

func (Base64Operator) Dependencies

func (Base64Operator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (Base64Operator) Phase

func (Base64Operator) Phase() OperatorPhase

Phase ...

func (Base64Operator) Run

func (Base64Operator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (Base64Operator) Setup

func (Base64Operator) Setup() error

Setup ...

type CalcOperator

type CalcOperator struct{}

CalcOperator is invoked with (( calc <expression> ))

func (CalcOperator) Dependencies

func (CalcOperator) Dependencies(ev *Evaluator, args []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (CalcOperator) Phase

func (CalcOperator) Phase() OperatorPhase

Phase ...

func (CalcOperator) Run

func (CalcOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (CalcOperator) Setup

func (CalcOperator) Setup() error

Setup ...

type CartesianProductOperator

type CartesianProductOperator struct{}

CartesianProductOperator ...

func (CartesianProductOperator) Dependencies

func (CartesianProductOperator) Dependencies(_ *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (CartesianProductOperator) Phase

Phase ...

func (CartesianProductOperator) Run

func (CartesianProductOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (CartesianProductOperator) Setup

Setup ...

type ConcatOperator

type ConcatOperator struct{}

ConcatOperator ...

func (ConcatOperator) Dependencies

func (ConcatOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (ConcatOperator) Phase

func (ConcatOperator) Phase() OperatorPhase

Phase ...

func (ConcatOperator) Run

func (ConcatOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (ConcatOperator) Setup

func (ConcatOperator) Setup() error

Setup ...

type DeferOperator

type DeferOperator struct{}

DeferOperator sheds the "defer" command off of (( defer args args args )) and leaves (( args args args ))

func (DeferOperator) Dependencies

func (DeferOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies returns an empty slice - defer produces no deps at all.

func (DeferOperator) Phase

func (DeferOperator) Phase() OperatorPhase

Phase gives back Param phase in this case, because we don't want any following phases to pick up the operator post-deference

func (DeferOperator) Run

func (DeferOperator) Run(_ *Evaluator, args []*Expr) (*Response, error)

Run chops off "defer" and leaves the args in double parens. Need to reconstruct the operator string

func (DeferOperator) Setup

func (DeferOperator) Setup() error

Setup doesn't do anything for Defer. We're a pretty lightweight operator.

type DiffList

type DiffList struct {
	Removed map[string]Diffable
	Added   map[string]Diffable
	Common  map[string]Diffable
}

func (DiffList) Changed

func (d DiffList) Changed() bool

func (DiffList) String

func (d DiffList) String(key string) string

func (DiffList) Value

func (d DiffList) Value() interface{}

type DiffMap

type DiffMap struct {
	Removed map[string]Diffable
	Added   map[string]Diffable
	Common  map[string]Diffable
}

func (DiffMap) Changed

func (d DiffMap) Changed() bool

func (DiffMap) String

func (d DiffMap) String(key string) string

func (DiffMap) Value

func (d DiffMap) Value() interface{}

type DiffNone

type DiffNone struct {
	Orig interface{}
}

func (DiffNone) Changed

func (d DiffNone) Changed() bool

func (DiffNone) String

func (d DiffNone) String(key string) string

func (DiffNone) Value

func (d DiffNone) Value() interface{}

type DiffScalar

type DiffScalar struct {
	Old string
	New string
}

func (DiffScalar) Changed

func (d DiffScalar) Changed() bool

func (DiffScalar) String

func (d DiffScalar) String(key string) string

func (DiffScalar) Value

func (d DiffScalar) Value() interface{}

type DiffType

type DiffType struct {
	Old interface{}
	New interface{}
}

func (DiffType) Changed

func (d DiffType) Changed() bool

func (DiffType) String

func (d DiffType) String(key string) string

func (DiffType) Value

func (d DiffType) Value() interface{}

type Diffable

type Diffable interface {
	Changed() bool
	String(key string) string
	Value() interface{}
}

func Diff

func Diff(a, b interface{}) (Diffable, error)

type EmptyOperator

type EmptyOperator struct{}

EmptyOperator allows the user to emplace an empty array, hash, or string into the YAML datastructure.

func (EmptyOperator) Dependencies

func (EmptyOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (EmptyOperator) Phase

func (EmptyOperator) Phase() OperatorPhase

Phase ...

func (EmptyOperator) Run

func (EmptyOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (EmptyOperator) Setup

func (EmptyOperator) Setup() error

Setup ...

type ErrorContext

type ErrorContext uint

An ErrorContext is a flag or set of flags representing the contexts that an error should have a special meaning in.

type Evaluator

type Evaluator struct {
	Tree     map[interface{}]interface{}
	Deps     map[string][]tree.Cursor
	SkipEval bool
	Here     *tree.Cursor

	CheckOps []*Opcall

	Only []string
}

Evaluator ...

func (*Evaluator) CheckForCycles

func (ev *Evaluator) CheckForCycles(maxDepth int) error

CheckForCycles ...

func (*Evaluator) CherryPick

func (ev *Evaluator) CherryPick(paths []string) error

Cherry-pick ...

func (*Evaluator) DataFlow

func (ev *Evaluator) DataFlow(phase OperatorPhase) ([]*Opcall, error)

DataFlow ...

func (*Evaluator) Prune

func (ev *Evaluator) Prune(paths []string) error

Prune ...

func (*Evaluator) Run

func (ev *Evaluator) Run(prune []string, picks []string) error

Run ...

func (*Evaluator) RunOp

func (ev *Evaluator) RunOp(op *Opcall) error

RunOp ...

func (*Evaluator) RunOps

func (ev *Evaluator) RunOps(ops []*Opcall) error

RunOps ...

func (*Evaluator) RunPhase

func (ev *Evaluator) RunPhase(p OperatorPhase) error

RunPhase ...

func (*Evaluator) SortPaths

func (ev *Evaluator) SortPaths(pathKeyMap map[string]string) error

SortPaths sorts all paths (keys in map) using the provided sort-key (respective value)

type Expr

type Expr struct {
	Type      ExprType
	Reference *tree.Cursor
	Literal   interface{}
	Name      string
	Left      *Expr
	Right     *Expr
}

Expr ...

func (*Expr) Dependencies

func (e *Expr) Dependencies(ev *Evaluator, locs []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (*Expr) Evaluate

func (e *Expr) Evaluate(tree map[interface{}]interface{}) (interface{}, error)

Evaluate ...

func (*Expr) Reduce

func (e *Expr) Reduce() (*Expr, error)

Reduce ...

func (*Expr) Resolve

func (e *Expr) Resolve(tree map[interface{}]interface{}) (*Expr, error)

Resolve ...

func (*Expr) String

func (e *Expr) String() string

type ExprType

type ExprType int

ExprType ...

const (
	// Reference ...
	Reference ExprType = iota
	// Literal ...
	Literal
	// LogicalOr ...
	LogicalOr
	EnvVar
)

type FileOperator

type FileOperator struct{}

FileOperator ...

func (FileOperator) Dependencies

func (FileOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (FileOperator) Phase

func (FileOperator) Phase() OperatorPhase

Phase ...

func (FileOperator) Run

func (FileOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (FileOperator) Setup

func (FileOperator) Setup() error

Setup ...

type GrabOperator

type GrabOperator struct{}

GrabOperator ...

func (GrabOperator) Dependencies

func (GrabOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (GrabOperator) Phase

func (GrabOperator) Phase() OperatorPhase

Phase ...

func (GrabOperator) Run

func (GrabOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (GrabOperator) Setup

func (GrabOperator) Setup() error

Setup ...

type InjectOperator

type InjectOperator struct{}

InjectOperator ...

func (InjectOperator) Dependencies

func (InjectOperator) Dependencies(ev *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (InjectOperator) Phase

func (InjectOperator) Phase() OperatorPhase

Phase ...

func (InjectOperator) Run

func (InjectOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (InjectOperator) Setup

func (InjectOperator) Setup() error

Setup ...

type IpsOperator

type IpsOperator struct{}

IpOperator...

func (IpsOperator) Dependencies

func (IpsOperator) Dependencies(_ *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (IpsOperator) Phase

func (IpsOperator) Phase() OperatorPhase

Phase ...

func (IpsOperator) Run

func (IpsOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (IpsOperator) Setup

func (IpsOperator) Setup() error

Setup ...

type JoinOperator

type JoinOperator struct{}

JoinOperator is invoked with (( join <separator> <lists/strings>... )) and joins lists and strings into one string, separated by <separator>

func (JoinOperator) Dependencies

func (JoinOperator) Dependencies(ev *Evaluator, args []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies returns the nodes that (( join ... )) requires to be resolved before its evaluation. Returns no dependencies on error, because who cares about eval order if Run is going to bomb out anyway.

func (JoinOperator) Phase

func (JoinOperator) Phase() OperatorPhase

Phase ...

func (JoinOperator) Run

func (JoinOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (JoinOperator) Setup

func (JoinOperator) Setup() error

Setup ...

type KeysOperator

type KeysOperator struct{}

KeysOperator ...

func (KeysOperator) Dependencies

func (KeysOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (KeysOperator) Phase

func (KeysOperator) Phase() OperatorPhase

Phase ...

func (KeysOperator) Run

func (KeysOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (KeysOperator) Setup

func (KeysOperator) Setup() error

Setup ...

type LoadOperator

type LoadOperator struct{}

LoadOperator is invoked with (( load <location> ))

func (LoadOperator) Dependencies

func (LoadOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (LoadOperator) Phase

func (LoadOperator) Phase() OperatorPhase

Phase ...

func (LoadOperator) Run

func (LoadOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (LoadOperator) Setup

func (LoadOperator) Setup() error

Setup ...

type Merger

type Merger struct {
	AppendByDefault bool

	Errors MultiError
}

Merger ...

func (*Merger) Error

func (m *Merger) Error() error

Error ...

func (*Merger) Merge

func (m *Merger) Merge(a map[interface{}]interface{}, b map[interface{}]interface{}) error

Merge ...

type ModificationDefinition

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

ModificationDefinition encapsulates the details of an array modification: (1) the type of modification, e.g. insert, delete, replace (2) an optional guide to the specific part of the array to be modified,

for example the index at which an insertion should be done

(3) an optional list of entries to be added or merged into the array

type MultiError

type MultiError struct {
	Errors []error
}

MultiError ...

func (*MultiError) Append

func (e *MultiError) Append(err error)

Append ...

func (*MultiError) Count

func (e *MultiError) Count() int

Count ...

func (MultiError) Error

func (e MultiError) Error() string

Error ...

type NegateOperator

type NegateOperator struct{}

NegateOperator ...

func (NegateOperator) Dependencies

func (NegateOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (NegateOperator) Phase

func (NegateOperator) Phase() OperatorPhase

Phase ...

func (NegateOperator) Run

func (NegateOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (NegateOperator) Setup

func (NegateOperator) Setup() error

Setup ...

type NullOperator

type NullOperator struct {
	Missing string
}

NullOperator ...

func (NullOperator) Dependencies

func (NullOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (NullOperator) Phase

func (NullOperator) Phase() OperatorPhase

Phase ...

func (NullOperator) Run

func (n NullOperator) Run(ev *Evaluator, _ []*Expr) (*Response, error)

Run ...

func (NullOperator) Setup

func (NullOperator) Setup() error

Setup ...

type Opcall

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

Opcall ...

func ParseOpcall

func ParseOpcall(phase OperatorPhase, src string) (*Opcall, error)

ParseOpcall ...

func (*Opcall) Dependencies

func (op *Opcall) Dependencies(ev *Evaluator, locs []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (*Opcall) Run

func (op *Opcall) Run(ev *Evaluator) (*Response, error)

Run ...

type Operator

type Operator interface {
	// setup whatever global/static state needed -- see (( static_ips ... ))
	Setup() error

	// evaluate the tree and determine what should be done to satisfy caller
	Run(ev *Evaluator, args []*Expr) (*Response, error)

	// returns a set of implicit / inherent dependencies used by Run()
	Dependencies(ev *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

	// what phase does this operator run during?
	Phase() OperatorPhase
}

Operator ...

func OperatorFor

func OperatorFor(name string) Operator

OperatorFor ...

type OperatorPhase

type OperatorPhase int

OperatorPhase ...

const (
	// MergePhase ...
	MergePhase OperatorPhase = iota
	// EvalPhase ...
	EvalPhase
	// ParamPhase ...
	ParamPhase
)

type ParamOperator

type ParamOperator struct{}

ParamOperator ...

func (ParamOperator) Dependencies

func (ParamOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (ParamOperator) Phase

func (ParamOperator) Phase() OperatorPhase

Phase ...

func (ParamOperator) Run

func (ParamOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (ParamOperator) Setup

func (ParamOperator) Setup() error

Setup ...

type PruneOperator

type PruneOperator struct{}

PruneOperator ...

func (PruneOperator) Dependencies

func (PruneOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (PruneOperator) Phase

func (PruneOperator) Phase() OperatorPhase

Phase ...

func (PruneOperator) Run

func (PruneOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (PruneOperator) Setup

func (PruneOperator) Setup() error

Setup ...

type Response

type Response struct {
	Type  Action
	Value interface{}
}

Response ...

type ShuffleOperator

type ShuffleOperator struct{}

ShuffleOperator ...

func (ShuffleOperator) Dependencies

func (ShuffleOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (ShuffleOperator) Phase

Phase ...

func (ShuffleOperator) Run

func (ShuffleOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (ShuffleOperator) Setup

func (ShuffleOperator) Setup() error

Setup ...

type SortOperator

type SortOperator struct{}

SortOperator ...

func (SortOperator) Dependencies

func (SortOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (SortOperator) Phase

func (SortOperator) Phase() OperatorPhase

Phase ...

func (SortOperator) Run

func (SortOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (SortOperator) Setup

func (SortOperator) Setup() error

Setup ...

type StaticIPOperator

type StaticIPOperator struct{}

StaticIPOperator ...

func (StaticIPOperator) Dependencies

func (StaticIPOperator) Dependencies(ev *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (StaticIPOperator) Phase

Phase ...

func (StaticIPOperator) Run

func (s StaticIPOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (StaticIPOperator) Setup

func (StaticIPOperator) Setup() error

Setup ...

type StringifyOperator

type StringifyOperator struct{}

StringifyOperator ...

func (StringifyOperator) Dependencies

func (StringifyOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies ...

func (StringifyOperator) Phase

Phase ...

func (StringifyOperator) Run

func (StringifyOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run ...

func (StringifyOperator) Setup

func (StringifyOperator) Setup() error

Setup ...

type Type

type Type int
const (
	Scalar Type = iota
	Map
	SimpleList
	KeyedList
)

func (Type) String

func (t Type) String() string

type VaultOperator

type VaultOperator struct{}

The VaultOperator provides a means of injecting credentials and other secrets from a Vault (vaultproject.io) Secure Key Storage instance.

func (VaultOperator) Dependencies

func (VaultOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor

Dependencies collects implicit dependencies that a given `(( vault ... ))` call has. There are no dependencies other that those given as args to the command.

func (VaultOperator) Phase

func (VaultOperator) Phase() OperatorPhase

Phase identifies what phase of document management the vault operator should be evaluated in. Vault lives in the Eval phase

func (VaultOperator) Run

func (VaultOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)

Run executes the `(( vault ... ))` operator call, which entails interacting with the (unsealed) Vault instance to retrieve the given secrets.

func (VaultOperator) Setup

func (VaultOperator) Setup() error

Setup ...

type WarningError

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

WarningError should produce a warning message to stderr if the context set for the error fits the context the error was caught in.

func NewWarningError

func NewWarningError(context ErrorContext, warning string, args ...interface{}) (err WarningError)

NewWarningError returns a new WarningError object that has the given warning message and context(s) assigned. Assigning no context should mean that all contexts are active. Ansi library enabled.

func (WarningError) Error

func (e WarningError) Error() string

Error will return the configured warning message as a string

func (WarningError) HasContext

func (e WarningError) HasContext(context ErrorContext) bool

HasContext returns true if the WarningError was configured with the given context (or all). False otherwise.

func (WarningError) Warn

func (e WarningError) Warn()

Warn prints the configured warning to stderr.

Directories

Path Synopsis
cmd
spruce command

Jump to

Keyboard shortcuts

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