validators

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainsValidator

type ContainsValidator struct {
	Path    string
	Content interface{}
}

ContainsValidator validate whether value of Path is an array and contains Content

func (ContainsValidator) Validate

func (v ContainsValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type EqualValidator

type EqualValidator struct {
	Path  string
	Value interface{}
}

EqualValidator validate whether the value of Path equal to Value

func (EqualValidator) Validate

func (a EqualValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type HasDocumentsValidator

type HasDocumentsValidator struct {
	Count int
}

HasDocumentsValidator validate whether the count of manifests rendered form template is Count

func (HasDocumentsValidator) Validate

func (v HasDocumentsValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type IsAPIVersionValidator

type IsAPIVersionValidator struct {
	Of string
}

IsAPIVersionValidator validate apiVersion of manifest is Of

func (IsAPIVersionValidator) Validate

func (v IsAPIVersionValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type IsEmptyValidator

type IsEmptyValidator struct {
	Path string
}

IsEmptyValidator validate value of Path is empty

func (IsEmptyValidator) Validate

func (v IsEmptyValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type IsKindValidator

type IsKindValidator struct {
	Of string
}

IsKindValidator validate kind of manifest is Of

func (IsKindValidator) Validate

func (v IsKindValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type IsNullValidator

type IsNullValidator struct {
	Path string
}

IsNullValidator validate value of Path id kind

func (IsNullValidator) Validate

func (v IsNullValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type MatchRegexValidator

type MatchRegexValidator struct {
	Path    string
	Pattern string
}

MatchRegexValidator validate value of Path match Pattern

func (MatchRegexValidator) Validate

func (v MatchRegexValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type MatchSnapshotValidator

type MatchSnapshotValidator struct {
	Path string
}

MatchSnapshotValidator validate snapshot of value of Path the same as cached

func (MatchSnapshotValidator) Validate

func (v MatchSnapshotValidator) Validate(context *ValidateContext) (bool, []string)

Validate implement Validatable

type SnapshotComparer

type SnapshotComparer interface {
	CompareToSnapshot(content interface{}) *snapshot.CompareResult
}

SnapshotComparer provide CompareToSnapshot utility to validator

type Validatable

type Validatable interface {
	Validate(context *ValidateContext) (bool, []string)
}

Validatable all validators must implement Validate method

type ValidateContext

type ValidateContext struct {
	Docs     []common.K8sManifest
	Index    int
	Negative bool
	SnapshotComparer
}

ValidateContext the context passed to validators

Jump to

Keyboard shortcuts

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