validate

package
v0.0.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileValidator

type FileValidator interface {
	Validate(data []byte) []ValidationResult
}

type OpenApiValidator

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

OpenApiValidator validates Kubernetes manifests using OpenApi schemas

func NewOpenApi2Validator

func NewOpenApi2Validator(openApi2SpecsBytes []byte) (*OpenApiValidator, error)

func (OpenApiValidator) AddCrdSchemas

func (oeValidator OpenApiValidator) AddCrdSchemas(crdResource kubernetes.Resource) error

AddCrdSchemas adds additional schemas from a CustomResourceDefinition that can be used to validate other resources TODO: <09-08-20, @fllaca> // more generic way of handling CRDs? :thinking:

func (OpenApiValidator) Validate

func (oeValidator OpenApiValidator) Validate(input map[string]interface{}) ValidationResult

type ResourceValidator

type ResourceValidator interface {
	Validate(resource map[string]interface{}) ValidationResult
}

type Severity

type Severity string
const (
	SeverityError   Severity = "ERROR"
	SeverityWarning Severity = "WARN"
	SeverityOK      Severity = "OK"
)

type ValidationResult

type ValidationResult struct {
	// Message holds a brief description of the validation result
	Message string
	// Severity specifies if the validation is OK/ERROR/WARNING
	Severity Severity
	// Name of the validated resourcce
	Name string
	// Namespace of the validated resourcce
	Namespace string
	// Kind of the validated resourcce
	Kind string
}

type YamlFileValidator

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

func NewYamlFileValidator

func NewYamlFileValidator(resourceValidator ResourceValidator) YamlFileValidator

func (YamlFileValidator) Validate

func (yamlValidator YamlFileValidator) Validate(fileBytes []byte) []ValidationResult

Jump to

Keyboard shortcuts

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