validate

package
v1.5.5-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Rules = []rule{
	checkDiscoveryURL,
	checkEncoding,
	checkStructure,
	checkValidity,
	checkWriteFiles,
	checkWriteFilesUnderCoreos,
}

Rules contains all of the validation rules.

Functions

This section is empty.

Types

type Context

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

Context represents the current position within a newline-delimited string. Each line is loaded, one by one, into currentLine (newline omitted) and lineNumber keeps track of its position within the original string.

func NewContext

func NewContext(content []byte) Context

NewContext creates a Context from the provided data. It strips out all carriage returns and moves to the first line (if available).

func (*Context) Increment

func (c *Context) Increment()

Increment moves the Context to the next line (if available).

type Entry

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

Entry represents a single generic item in the report.

func (Entry) MarshalJSON

func (e Entry) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface, returning the entry encoded as a JSON object.

func (Entry) String

func (e Entry) String() string

String returns a human-readable representation of the entry.

type Node

type Node struct {
	reflect.Value
	// contains filtered or unexported fields
}

func NewNode

func NewNode(value interface{}, context Context) Node

NewNode returns the Node representation of the given value. The context will be used in an attempt to determine line numbers for the given value.

func (Node) Child

func (n Node) Child(name string) Node

Child attempts to find the child with the given name in the Node's list of children. If no such child is found, an invalid Node is returned.

func (Node) HumanType

func (n Node) HumanType() string

HumanType returns the human-consumable string representation of the type of the Node.

type Report

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

Report represents the list of entries resulting from validation.

func Validate

func Validate(userdataBytes []byte) (Report, error)

Validate runs a series of validation tests against the given userdata and returns a report detailing all of the issues. Presently, only cloud-configs can be validated.

func (*Report) Entries

func (r *Report) Entries() []Entry

Entries returns the list of entries in the report.

func (*Report) Error

func (r *Report) Error(line int, message string)

Error adds an error entry to the report.

func (*Report) Info

func (r *Report) Info(line int, message string)

Info adds an info entry to the report.

func (*Report) Warning

func (r *Report) Warning(line int, message string)

Warning adds a warning entry to the report.

Jump to

Keyboard shortcuts

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