validations

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapHasKey

func MapHasKey(key string, m map[string]string) bool

MapHasKey is a small helper function to check if a map has an key (key)

Types

type Check

type Check func(base *core.Laforge) bool

Check is a type alias to describe a method that validates a laforge context

func All

func All(funcs ...Check) Check

All returns a meta-Check that requires all supplied Checks evaluate to true

func And

func And(a, b Check) Check

And creates a meta Check for requiring a logical AND between supplied Checks

func Any

func Any(funcs ...Check) Check

Any creates a meta Check for any possible hits against a set of Checks

func AtLeastN

func AtLeastN(n int, funcs ...Check) Check

AtLeastN creates an at least n rule against a set of Checks

func ExistsInPath

func ExistsInPath(progname string) Check

ExistsInPath checks to see if a command line tool is installed and in the current user's path

func FieldEquals

func FieldEquals(obj interface{}, fieldname string, equals interface{}) Check

FieldEquals allows for comparison of various fields within the Laforge state during builder validation

func FieldNotEmpty

func FieldNotEmpty(obj interface{}, fieldname string) Check

FieldNotEmpty checks a type in the context state for a nil/zero value field and fails if it is so.

func HasConfigKey

func HasConfigKey(obj interface{}, key string) Check

HasConfigKey checks configurable types (Competition, DNS, Environment) for configuration values.

func HasVarDefined

func HasVarDefined(obj interface{}, varname string) Check

HasVarDefined checks types supporting variable assignment to see if they have a variable of a specific name assigned. valid object classes: Command, Host, Identity, Network, RemoteFile, Script

func Not

func Not(f Check) Check

Not is the logical negation of a Check

func Or

func Or(a, b Check) Check

Or creates a meta Check for performing a logical OR on two Checks

type Requirement

type Requirement struct {
	Name       string
	Resolution string
	Check      Check
}

Requirement defines a named requirement that must be met for a builder to continue

type Validations

type Validations []Requirement

Validations is suppose to be a sequence of validations that must pass for a builder

Jump to

Keyboard shortcuts

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