validation

package
v0.0.0-...-5973960 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const FIFOPrefix = "tko-validation-"

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Validation              *Validation
	Package                 util.Package
	TargetResourceIdentifer util.ResourceIdentifier
	Complete                bool
}

func (*Context) GetResource

func (self *Context) GetResource() (util.Resource, bool)

func (*Context) ToPluginInput

func (self *Context) ToPluginInput(logFile string, logAddressPort string) PluginInput

type PluginInput

type PluginInput struct {
	GRPC                    PluginInputGRPC            `yaml:"grpc"`
	LogFile                 string                     `yaml:"logFile"`
	LogAddressPort          string                     `yaml:"logAddressPort"`
	Package                 tkoutil.Package            `yaml:"package"`
	TargetResourceIdentifer tkoutil.ResourceIdentifier `yaml:"targetResourceIdentifier"`
	Complete                bool                       `yaml:"complete"`
}

type PluginInputGRPC

type PluginInputGRPC struct {
	Level2Protocol string `yaml:"level2protocol"`
	Address        string `yaml:"address"`
	Port           int    `yaml:"port"`
}

type PluginOutput

type PluginOutput struct {
	Error string `yaml:"error,omitempty"`
}

type ValidateFunc

type ValidateFunc func(context contextpkg.Context, validationContext *Context) []error

func NewCommandPluginValidator

func NewCommandPluginValidator(plugin client.Plugin, logIpStack util.IPStack, logAddress string, logPort int) (ValidateFunc, error)

func NewPluginValidator

func NewPluginValidator(plugin client.Plugin, logIpStack util.IPStack, logAddress string, logPort int) (ValidateFunc, error)

type Validation

type Validation struct {
	Client     *clientpkg.Client
	Timeout    time.Duration
	Log        commonlog.Logger
	LogIPStack util.IPStack
	LogAddress string
	LogPort    int
	// contains filtered or unexported fields
}

func NewValidation

func NewValidation(client *clientpkg.Client, timeout time.Duration, log commonlog.Logger, logIpStack util.IPStack, logAddress string, logPort int) (*Validation, error)

func (*Validation) DefaultValidate

func (self *Validation) DefaultValidate(context contextpkg.Context, validationContext *Context) []error

(ValidateFunc signature)

func (*Validation) GetValidators

func (self *Validation) GetValidators(gvk tkoutil.GVK, complete bool) (Validators, error)

func (*Validation) Kubeconform

func (self *Validation) Kubeconform(resource util.Resource, complete bool) []error

func (*Validation) NewContext

func (self *Validation) NewContext(package_ util.Package, targetResourceIdentifer util.ResourceIdentifier, complete bool) *Context

func (*Validation) RegisterValidator

func (self *Validation) RegisterValidator(gvk tkoutil.GVK, validate ValidateFunc)

func (*Validation) ResetPluginCache

func (self *Validation) ResetPluginCache()

func (*Validation) ValidatePackage

func (self *Validation) ValidatePackage(package_ util.Package, complete bool) error

type Validators

type Validators []ValidateFunc

type ValidatorsMap

type ValidatorsMap map[tkoutil.GVK]Validators

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳