Documentation
¶
Index ¶
- Constants
- Variables
- func JSONifyFiles(paths []string, strict bool) ([]string, error)
- func JSONifyIO(in io.Reader, strict bool) (string, error)
- func Merge(l ...map[interface{}]interface{}) (map[interface{}]interface{}, error)
- func RegisterOp(name string, op Operator)
- func ResolveEnv(nodes []string) []string
- func SetupOperators(phase OperatorPhase) error
- func SilenceWarnings(should bool)
- type Action
- type AwsOperator
- type Base64DecodeOperator
- type Base64Operator
- type CalcOperator
- type CartesianProductOperator
- func (CartesianProductOperator) Dependencies(_ *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
- func (CartesianProductOperator) Phase() OperatorPhase
- func (CartesianProductOperator) Run(ev *Evaluator, args []*Expr) (*Response, error)
- func (CartesianProductOperator) Setup() error
- type ConcatOperator
- type DeferOperator
- type DiffList
- type DiffMap
- type DiffNone
- type DiffScalar
- type DiffType
- type Diffable
- type EmptyOperator
- type ErrorContext
- type Evaluator
- func (ev *Evaluator) CheckForCycles(maxDepth int) error
- func (ev *Evaluator) CherryPick(paths []string) error
- func (ev *Evaluator) DataFlow(phase OperatorPhase) ([]*Opcall, error)
- func (ev *Evaluator) Prune(paths []string) error
- func (ev *Evaluator) Run(prune []string, picks []string) error
- func (ev *Evaluator) RunOp(op *Opcall) error
- func (ev *Evaluator) RunOps(ops []*Opcall) error
- func (ev *Evaluator) RunPhase(p OperatorPhase) error
- func (ev *Evaluator) SortPaths(pathKeyMap map[string]string) error
- type Expr
- type ExprType
- type FileOperator
- type GrabOperator
- type InjectOperator
- type IpsOperator
- type JoinOperator
- type KeysOperator
- type LoadOperator
- type Merger
- type ModificationDefinition
- type MultiError
- type NegateOperator
- type NullOperator
- type Opcall
- type Operator
- type OperatorPhase
- type ParamOperator
- type PruneOperator
- type Response
- type ShuffleOperator
- type SortOperator
- type StaticIPOperator
- type StringifyOperator
- type Type
- type VaultOperator
- type WarningError
Constants ¶
const UNDEFINED_AZ = "__UNDEFINED_AZ__"
Variables ¶
var OpRegistry map[string]Operator
OpRegistry ...
var SkipAws bool
SkipAws toggles whether AwsOperator will attempt to query AWS for any value When true will always return "REDACTED"
var SkipVault bool
SkipVault toggles whether calls to the Vault operator actually cause the Vault to be contacted and the keys substituted in.
var UsedIPs map[string]string
UsedIPs ...
var VaultRefs = map[string][]string{}
VaultRefs maps secret path to paths in YAML structure which call for it
Functions ¶
func Merge ¶
func Merge(l ...map[interface{}]interface{}) (map[interface{}]interface{}, error)
Merge ...
func ResolveEnv ¶
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 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
type Base64DecodeOperator ¶
type Base64DecodeOperator struct{}
Base64DecodeOperator ...
func (Base64DecodeOperator) Dependencies ¶
func (Base64DecodeOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type Base64Operator ¶
type Base64Operator struct{}
Base64Operator ...
func (Base64Operator) Dependencies ¶
func (Base64Operator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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 ...
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 ¶
func (CartesianProductOperator) Phase() OperatorPhase
Phase ...
type ConcatOperator ¶
type ConcatOperator struct{}
ConcatOperator ...
func (ConcatOperator) Dependencies ¶
func (ConcatOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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 DiffMap ¶
type DiffScalar ¶
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 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 ...
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 ¶
CheckForCycles ...
func (*Evaluator) CherryPick ¶
Cherry-pick ...
type Expr ¶
type Expr struct {
Type ExprType
Reference *tree.Cursor
Literal interface{}
Name string
Left *Expr
Right *Expr
}
Expr ...
func (*Expr) Dependencies ¶
Dependencies ...
type FileOperator ¶
type FileOperator struct{}
FileOperator ...
func (FileOperator) Dependencies ¶
func (FileOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type GrabOperator ¶
type GrabOperator struct{}
GrabOperator ...
func (GrabOperator) Dependencies ¶
func (GrabOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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 ...
type IpsOperator ¶
type IpsOperator struct{}
IpOperator...
func (IpsOperator) Dependencies ¶
func (IpsOperator) Dependencies(_ *Evaluator, args []*Expr, locs []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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.
type KeysOperator ¶
type KeysOperator struct{}
KeysOperator ...
func (KeysOperator) Dependencies ¶
func (KeysOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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 ...
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 NegateOperator ¶
type NegateOperator struct{}
NegateOperator ...
func (NegateOperator) Dependencies ¶
func (NegateOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type NullOperator ¶
type NullOperator struct {
Missing string
}
NullOperator ...
func (NullOperator) Dependencies ¶
func (NullOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor
Dependencies ...
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 ¶
Dependencies ...
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 ...
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 ...
type PruneOperator ¶
type PruneOperator struct{}
PruneOperator ...
func (PruneOperator) Dependencies ¶
func (PruneOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type ShuffleOperator ¶
type ShuffleOperator struct{}
ShuffleOperator ...
func (ShuffleOperator) Dependencies ¶
func (ShuffleOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type SortOperator ¶
type SortOperator struct{}
SortOperator ...
func (SortOperator) Dependencies ¶
func (SortOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
type StaticIPOperator ¶
type StaticIPOperator struct{}
StaticIPOperator ...
func (StaticIPOperator) Dependencies ¶
func (StaticIPOperator) Dependencies(ev *Evaluator, _ []*Expr, _ []*tree.Cursor, _ []*tree.Cursor) []*tree.Cursor
Dependencies ...
type StringifyOperator ¶
type StringifyOperator struct{}
StringifyOperator ...
func (StringifyOperator) Dependencies ¶
func (StringifyOperator) Dependencies(_ *Evaluator, _ []*Expr, _ []*tree.Cursor, auto []*tree.Cursor) []*tree.Cursor
Dependencies ...
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
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.
Source Files
¶
- diff.go
- errors.go
- evaluator.go
- json.go
- merge.go
- op_aws.go
- op_base64.go
- op_base64_decode.go
- op_calc.go
- op_cartesian_product.go
- op_concat.go
- op_defer.go
- op_empty.go
- op_file.go
- op_grab.go
- op_inject.go
- op_ips.go
- op_join.go
- op_keys.go
- op_load.go
- op_negate.go
- op_null.go
- op_param.go
- op_prune.go
- op_shuffle.go
- op_sort.go
- op_static_ips.go
- op_stringify.go
- op_vault.go
- operator.go