validators

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainsDocumentValidator

type ContainsDocumentValidator struct {
	Kind       string
	APIVersion string
	Name       string // optional
	Namespace  string // optional
	Any        bool   // optional
}

ContainsDocumentValidator validate whether value of Path contains Content

func (ContainsDocumentValidator) Validate

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

Validate implement Validatable

type ContainsValidator

type ContainsValidator struct {
	Path    string
	Content interface{}
	Count   *int
	Any     bool
}

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 EqualRawValidator

type EqualRawValidator struct {
	Value string
}

EqualRawValidator validate whether the raw value equal to Value

func (EqualRawValidator) Validate

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

Validate implement Validatable

type EqualValidator

type EqualValidator struct {
	Path         string
	Value        interface{}
	DecodeBase64 bool `yaml:"decodeBase64"`
}

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 ExistsValidator added in v0.3.2

type ExistsValidator struct {
	Path string
}

ExistsValidator validate value of Path id kind

func (ExistsValidator) Validate added in v0.3.2

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

Validate implement Validatable

type FailedTemplateValidator

type FailedTemplateValidator struct {
	ErrorMessage string
}

FailedTemplateValidator validate whether the errorMessage equal to errorMessage

func (FailedTemplateValidator) Validate

func (a FailedTemplateValidator) 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 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 IsNullOrEmptyValidator added in v0.3.2

type IsNullOrEmptyValidator struct {
	Path string
}

IsNullOrEmptyValidator validate value of Path is empty

func (IsNullOrEmptyValidator) Validate added in v0.3.2

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

Validate implement Validatable

type IsSubsetValidator

type IsSubsetValidator struct {
	Path    string
	Content interface{}
}

IsSubsetValidator validate whether value of Path contains Content

func (IsSubsetValidator) Validate

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

Validate implement Validatable

type LengthEqualDocumentsValidator

type LengthEqualDocumentsValidator struct {
	Paths []string // optional
	Path  string   // optional
	Count int      // optional if paths defined
}

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

func (LengthEqualDocumentsValidator) Validate

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

Validate implement Validatable

type MatchRegexRawValidator

type MatchRegexRawValidator struct {
	Pattern string
}

MatchRegexRawValidator validate value of Path match Pattern

func (MatchRegexRawValidator) Validate

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

Validate implement Validatable

type MatchRegexValidator

type MatchRegexValidator struct {
	Path         string
	Pattern      string
	DecodeBase64 bool
}

MatchRegexValidator validate value of Path match Pattern

func (MatchRegexValidator) Validate

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

Validate implement Validatable

type MatchSnapshotRawValidator

type MatchSnapshotRawValidator struct{}

MatchSnapshotRawValidator validate snapshot of value of Path the same as cached

func (MatchSnapshotRawValidator) Validate

func (v MatchSnapshotRawValidator) 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
	RenderError error
}

ValidateContext the context passed to validators

Jump to

Keyboard shortcuts

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