spruce

package module
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 36 Imported by: 6

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 added in v1.0.2

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

func JSONifyIO added in v1.0.2

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

func Merge added in v0.13.0

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

Merge ...

func RegisterOp added in v0.13.0

func RegisterOp(name string, op Operator)

RegisterOp ...

func ResolveEnv added in v1.31.0

func ResolveEnv(nodes []string) []string

func SetupOperators added in v0.13.0

func SetupOperators(phase OperatorPhase) error

SetupOperators ...

func SilenceWarnings added in v1.8.14

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 added in v0.13.0

type Action int

Action ...

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

	// Inject ...
	Inject
)

type AwsOperator added in v1.22.0

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 added in v1.22.0

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

Dependencies is not used by AwsOperator

func (AwsOperator) Phase added in v1.22.0

func (AwsOperator) Phase() OperatorPhase

Phase ...

func (AwsOperator) Run added in v1.22.0

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 added in v1.22.0

func (AwsOperator) Setup() error

Setup ...

type Base64DecodeOperator added in v1.31.0

type Base64DecodeOperator struct{}

Base64DecodeOperator ...

func (Base64DecodeOperator) Dependencies added in v1.31.0

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

Dependencies ...

func (Base64DecodeOperator) Phase added in v1.31.0

Phase ...

func (Base64DecodeOperator) Run added in v1.31.0

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

Run ...

func (Base64DecodeOperator) Setup added in v1.31.0

func (Base64DecodeOperator) Setup() error

Setup ...

type Base64Operator added in v1.23.0

type Base64Operator struct{}

Base64Operator ...

func (Base64Operator) Dependencies added in v1.23.0

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

Dependencies ...

func (Base64Operator) Phase added in v1.23.0

func (Base64Operator) Phase() OperatorPhase

Phase ...

func (Base64Operator) Run added in v1.23.0

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

Run ...

func (Base64Operator) Setup added in v1.23.0

func (Base64Operator) Setup() error

Setup ...

type CalcOperator added in v1.8.7

type CalcOperator struct{}

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

func (CalcOperator) Dependencies added in v1.8.7

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

Dependencies ...

func (CalcOperator) Phase added in v1.8.7

func (CalcOperator) Phase() OperatorPhase

Phase ...

func (CalcOperator) Run added in v1.8.7

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

Run ...

func (CalcOperator) Setup added in v1.8.7

func (CalcOperator) Setup() error

Setup ...

type CartesianProductOperator added in v1.0.0

type CartesianProductOperator struct{}

CartesianProductOperator ...

func (CartesianProductOperator) Dependencies added in v1.0.0

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

Dependencies ...

func (CartesianProductOperator) Phase added in v1.0.0

Phase ...

func (CartesianProductOperator) Run added in v1.0.0

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

Run ...

func (CartesianProductOperator) Setup added in v1.0.0

Setup ...

type ConcatOperator added in v0.13.0

type ConcatOperator struct{}

ConcatOperator ...

func (ConcatOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (ConcatOperator) Phase added in v0.13.0

func (ConcatOperator) Phase() OperatorPhase

Phase ...

func (ConcatOperator) Run added in v0.13.0

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

Run ...

func (ConcatOperator) Setup added in v0.13.0

func (ConcatOperator) Setup() error

Setup ...

type DeferOperator added in v1.11.0

type DeferOperator struct{}

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

func (DeferOperator) Dependencies added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

func (DeferOperator) Setup() error

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

type DiffList added in v1.8.10

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

func (DiffList) Changed added in v1.8.10

func (d DiffList) Changed() bool

func (DiffList) String added in v1.8.10

func (d DiffList) String(key string) string

func (DiffList) Value added in v1.8.10

func (d DiffList) Value() interface{}

type DiffMap added in v1.8.10

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

func (DiffMap) Changed added in v1.8.10

func (d DiffMap) Changed() bool

func (DiffMap) String added in v1.8.10

func (d DiffMap) String(key string) string

func (DiffMap) Value added in v1.8.10

func (d DiffMap) Value() interface{}

type DiffNone added in v1.8.10

type DiffNone struct {
	Orig interface{}
}

func (DiffNone) Changed added in v1.8.10

func (d DiffNone) Changed() bool

func (DiffNone) String added in v1.8.10

func (d DiffNone) String(key string) string

func (DiffNone) Value added in v1.8.10

func (d DiffNone) Value() interface{}

type DiffScalar added in v1.8.10

type DiffScalar struct {
	Old string
	New string
}

func (DiffScalar) Changed added in v1.8.10

func (d DiffScalar) Changed() bool

func (DiffScalar) String added in v1.8.10

func (d DiffScalar) String(key string) string

func (DiffScalar) Value added in v1.8.10

func (d DiffScalar) Value() interface{}

type DiffType added in v1.8.10

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

func (DiffType) Changed added in v1.8.10

func (d DiffType) Changed() bool

func (DiffType) String added in v1.8.10

func (d DiffType) String(key string) string

func (DiffType) Value added in v1.8.10

func (d DiffType) Value() interface{}

type Diffable added in v1.8.10

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

func Diff added in v1.8.10

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

type EmptyOperator added in v1.8.0

type EmptyOperator struct{}

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

func (EmptyOperator) Dependencies added in v1.8.0

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

Dependencies ...

func (EmptyOperator) Phase added in v1.8.0

func (EmptyOperator) Phase() OperatorPhase

Phase ...

func (EmptyOperator) Run added in v1.8.0

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

Run ...

func (EmptyOperator) Setup added in v1.8.0

func (EmptyOperator) Setup() error

Setup ...

type ErrorContext added in v1.8.14

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 added in v0.13.0

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

	CheckOps []*Opcall

	Only []string
	// contains filtered or unexported fields
}

Evaluator ...

func (*Evaluator) CheckForCycles added in v0.13.0

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

CheckForCycles ...

func (*Evaluator) CherryPick added in v1.8.2

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

Cherry-pick ...

func (*Evaluator) DataFlow added in v0.13.0

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

DataFlow ...

func (*Evaluator) Prune added in v0.13.0

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

Prune ...

func (*Evaluator) Run added in v0.13.0

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

Run ...

func (*Evaluator) RunOp added in v0.13.0

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

RunOp ...

func (*Evaluator) RunOps added in v0.13.0

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

RunOps ...

func (*Evaluator) RunPhase added in v0.13.0

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

RunPhase ...

func (*Evaluator) SortPaths added in v1.18.1

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 added in v0.13.0

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

Expr ...

func (*Expr) Dependencies added in v0.13.0

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

Dependencies ...

func (*Expr) Evaluate added in v0.13.0

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

Evaluate ...

func (*Expr) Reduce added in v0.13.0

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

Reduce ...

func (*Expr) Resolve added in v0.13.0

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

Resolve ...

func (*Expr) String added in v0.13.0

func (e *Expr) String() string

type ExprType added in v0.13.0

type ExprType int

ExprType ...

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

type FileOperator added in v1.5.0

type FileOperator struct{}

FileOperator ...

func (FileOperator) Dependencies added in v1.5.0

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

Dependencies ...

func (FileOperator) Phase added in v1.5.0

func (FileOperator) Phase() OperatorPhase

Phase ...

func (FileOperator) Run added in v1.5.0

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

Run ...

func (FileOperator) Setup added in v1.5.0

func (FileOperator) Setup() error

Setup ...

type GrabOperator added in v0.13.0

type GrabOperator struct{}

GrabOperator ...

func (GrabOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (GrabOperator) Phase added in v0.13.0

func (GrabOperator) Phase() OperatorPhase

Phase ...

func (GrabOperator) Run added in v0.13.0

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

Run ...

func (GrabOperator) Setup added in v0.13.0

func (GrabOperator) Setup() error

Setup ...

type InjectOperator added in v0.13.0

type InjectOperator struct{}

InjectOperator ...

func (InjectOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (InjectOperator) Phase added in v0.13.0

func (InjectOperator) Phase() OperatorPhase

Phase ...

func (InjectOperator) Run added in v0.13.0

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

Run ...

func (InjectOperator) Setup added in v0.13.0

func (InjectOperator) Setup() error

Setup ...

type IpsOperator added in v1.13.0

type IpsOperator struct{}

IpOperator...

func (IpsOperator) Dependencies added in v1.13.0

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

Dependencies ...

func (IpsOperator) Phase added in v1.13.0

func (IpsOperator) Phase() OperatorPhase

Phase ...

func (IpsOperator) Run added in v1.13.0

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

Run ...

func (IpsOperator) Setup added in v1.13.0

func (IpsOperator) Setup() error

Setup ...

type JoinOperator added in v1.5.0

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 added in v1.5.0

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 added in v1.5.0

func (JoinOperator) Phase() OperatorPhase

Phase ...

func (JoinOperator) Run added in v1.5.0

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

Run ...

func (JoinOperator) Setup added in v1.5.0

func (JoinOperator) Setup() error

Setup ...

type KeysOperator added in v1.1.0

type KeysOperator struct{}

KeysOperator ...

func (KeysOperator) Dependencies added in v1.1.0

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

Dependencies ...

func (KeysOperator) Phase added in v1.1.0

func (KeysOperator) Phase() OperatorPhase

Phase ...

func (KeysOperator) Run added in v1.1.0

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

Run ...

func (KeysOperator) Setup added in v1.1.0

func (KeysOperator) Setup() error

Setup ...

type LoadOperator added in v1.19.0

type LoadOperator struct{}

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

func (LoadOperator) Dependencies added in v1.19.0

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

Dependencies ...

func (LoadOperator) Phase added in v1.19.0

func (LoadOperator) Phase() OperatorPhase

Phase ...

func (LoadOperator) Run added in v1.19.0

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

Run ...

func (LoadOperator) Setup added in v1.19.0

func (LoadOperator) Setup() error

Setup ...

type Merger added in v0.9.0

type Merger struct {
	AppendByDefault bool

	Errors MultiError
	// contains filtered or unexported fields
}

Merger ...

func (*Merger) Error added in v0.9.0

func (m *Merger) Error() error

Error ...

func (*Merger) Merge added in v0.9.0

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

Merge ...

type ModificationDefinition added in v1.7.0

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 added in v0.13.0

type MultiError struct {
	Errors []error
}

MultiError ...

func (*MultiError) Append added in v0.13.0

func (e *MultiError) Append(err error)

Append ...

func (*MultiError) Count added in v0.13.0

func (e *MultiError) Count() int

Count ...

func (MultiError) Error added in v0.13.0

func (e MultiError) Error() string

Error ...

type NegateOperator added in v1.29.0

type NegateOperator struct{}

NegateOperator ...

func (NegateOperator) Dependencies added in v1.29.0

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

Dependencies ...

func (NegateOperator) Phase added in v1.29.0

func (NegateOperator) Phase() OperatorPhase

Phase ...

func (NegateOperator) Run added in v1.29.0

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

Run ...

func (NegateOperator) Setup added in v1.29.0

func (NegateOperator) Setup() error

Setup ...

type NullOperator added in v0.13.0

type NullOperator struct {
	Missing string
}

NullOperator ...

func (NullOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (NullOperator) Phase added in v0.13.0

func (NullOperator) Phase() OperatorPhase

Phase ...

func (NullOperator) Run added in v0.13.0

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

Run ...

func (NullOperator) Setup added in v0.13.0

func (NullOperator) Setup() error

Setup ...

type Opcall added in v0.13.0

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

Opcall ...

func ParseOpcall added in v0.13.0

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

ParseOpcall ...

func (*Opcall) Dependencies added in v0.13.0

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

Dependencies ...

func (*Opcall) Run added in v0.13.0

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

Run ...

type Operator added in v0.13.0

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 added in v0.13.0

func OperatorFor(name string) Operator

OperatorFor ...

type OperatorPhase added in v0.13.0

type OperatorPhase int

OperatorPhase ...

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

type ParamOperator added in v0.13.0

type ParamOperator struct{}

ParamOperator ...

func (ParamOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (ParamOperator) Phase added in v0.13.0

func (ParamOperator) Phase() OperatorPhase

Phase ...

func (ParamOperator) Run added in v0.13.0

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

Run ...

func (ParamOperator) Setup added in v0.13.0

func (ParamOperator) Setup() error

Setup ...

type PruneOperator added in v1.7.0

type PruneOperator struct{}

PruneOperator ...

func (PruneOperator) Dependencies added in v1.7.0

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

Dependencies ...

func (PruneOperator) Phase added in v1.7.0

func (PruneOperator) Phase() OperatorPhase

Phase ...

func (PruneOperator) Run added in v1.7.0

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

Run ...

func (PruneOperator) Setup added in v1.7.0

func (PruneOperator) Setup() error

Setup ...

type Response added in v0.13.0

type Response struct {
	Type  Action
	Value interface{}
}

Response ...

type ShuffleOperator added in v1.27.0

type ShuffleOperator struct{}

ShuffleOperator ...

func (ShuffleOperator) Dependencies added in v1.27.0

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

Dependencies ...

func (ShuffleOperator) Phase added in v1.27.0

Phase ...

func (ShuffleOperator) Run added in v1.27.0

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

Run ...

func (ShuffleOperator) Setup added in v1.27.0

func (ShuffleOperator) Setup() error

Setup ...

type SortOperator added in v1.18.1

type SortOperator struct{}

SortOperator ...

func (SortOperator) Dependencies added in v1.18.1

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

Dependencies ...

func (SortOperator) Phase added in v1.18.1

func (SortOperator) Phase() OperatorPhase

Phase ...

func (SortOperator) Run added in v1.18.1

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

Run ...

func (SortOperator) Setup added in v1.18.1

func (SortOperator) Setup() error

Setup ...

type StaticIPOperator added in v0.13.0

type StaticIPOperator struct{}

StaticIPOperator ...

func (StaticIPOperator) Dependencies added in v0.13.0

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

Dependencies ...

func (StaticIPOperator) Phase added in v0.13.0

Phase ...

func (StaticIPOperator) Run added in v0.13.0

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

Run ...

func (StaticIPOperator) Setup added in v0.13.0

func (StaticIPOperator) Setup() error

Setup ...

type StringifyOperator added in v1.28.0

type StringifyOperator struct{}

StringifyOperator ...

func (StringifyOperator) Dependencies added in v1.28.0

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

Dependencies ...

func (StringifyOperator) Phase added in v1.28.0

Phase ...

func (StringifyOperator) Run added in v1.28.0

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

Run ...

func (StringifyOperator) Setup added in v1.28.0

func (StringifyOperator) Setup() error

Setup ...

type Type added in v1.8.10

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

func (Type) String added in v1.8.10

func (t Type) String() string

type VaultOperator added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

func (VaultOperator) Setup() error

Setup ...

type WarningError added in v1.8.14

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 added in v1.8.14

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 added in v1.8.14

func (e WarningError) Error() string

Error will return the configured warning message as a string

func (WarningError) HasContext added in v1.8.14

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 added in v1.8.14

func (e WarningError) Warn()

Warn prints the configured warning to stderr.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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