validators

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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