validate

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Rules contains all of the validation rules.

Functions

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 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.

Types

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 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