constraints

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2016 License: MIT Imports: 2 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PropertyNot

func PropertyNot(prop, expected string) propertyNot

Types

type All

type All []Constraint

All is a Constraint which only passes when all of its child constraints also pass.

func (All) Describe

func (constraints All) Describe(cr CurrentResource) string

Describe returns a human-readable explanation of the constraint.

func (All) Pass

func (constraints All) Pass(cr CurrentResource) bool

Pass tests whether all child constraints have been satisfied. true means all constraints have passed and validation may continue.

type Any

type Any []Constraint

Any is a Constraint which passes when any of its child constraints pass.

func (Any) Describe

func (constraints Any) Describe(cr CurrentResource) string

Describe returns a human-readable explanation of the constraint.

func (Any) Pass

func (constraints Any) Pass(cr CurrentResource) bool

Pass tests whether any child constraint have been satisfied. true means at least one constraint has passed and validation may continue.

type BoolConstraint

type BoolConstraint bool

func (BoolConstraint) Describe

func (BoolConstraint) Pass

type Constraint

type Constraint interface {
	// Pass tests whether a constraint has been satisfied. true means this
	// constraint has passed and validation may continue.
	Pass(CurrentResource) bool

	// Describe returns a human-readable explanation of the constraint.
	Describe(CurrentResource) string
}

Constraint represents a restriction applied to property of a resource. e.g. between two or more properties, which cannot all be present on a resource at the same time.

func Not added in v0.2.0

func Not(c Constraint) Constraint

type ConstraintFunc

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

ConstraintFunc is a shorthand for defining inline functions for constraints.

func PropertyIs

func PropertyIs(prop string, expected interface{}) ConstraintFunc

PropertyIs is a constraint which passes when a property exists on a resource and has the expected value or default value.

func (ConstraintFunc) Describe

func (cf ConstraintFunc) Describe(CurrentResource) string

Describe returns the description of the ConstraintFunc.

func (ConstraintFunc) Pass

func (cf ConstraintFunc) Pass(cr CurrentResource) bool

Pass just calls the func directly.

type CurrentResource

type CurrentResource interface {
	Id() string
	AwsType() string
	Properties() []string
	PropertyDefault(string) (interface{}, bool)
	PropertyValue(string) (interface{}, bool)
	PropertyValueOrDefault(string) (interface{}, bool)
}

type PropertyExists

type PropertyExists string

PropertyExists is a constraint which will pass when a resource has a value for the property specified in the template.

func (PropertyExists) Describe

func (pe PropertyExists) Describe(CurrentResource) string

Describe returns a human-readable explanation of the constraint.

func (PropertyExists) Pass

func (pe PropertyExists) Pass(cr CurrentResource) bool

Pass returns true if the property is found.

type PropertyNotExists

type PropertyNotExists string

PropertyNotExists is a constraint which will pass when a resource doesn't have a value specified in the template.

func (PropertyNotExists) Describe

Describe returns a human-readable explanation of the constraint.

func (PropertyNotExists) Pass

Pass will return true when the property doesn't exist on the resource.

Jump to

Keyboard shortcuts

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