Help us shape the future of Go! Take the 2026 Go Developer Survey

genericvalidator

package
v1.133.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdmissionValidator

type AdmissionValidator[TObj runtime.Object] struct {
	CreateValidation Validator[TObj]
	UpdateValidation Validator[TObj]
	DeleteValidation Validator[TObj]
}

func NewGenericAdmissionValidator

func NewGenericAdmissionValidator[TObj runtime.Object](createValidator Validator[TObj], updateValidator Validator[TObj], deleteValidator Validator[TObj]) *AdmissionValidator[TObj]

func (*AdmissionValidator[TObj]) Register

func (v *AdmissionValidator[TObj]) Register(mgr manager.Manager, path string)

func (*AdmissionValidator[TObj]) ValidateCreate

func (v *AdmissionValidator[TObj]) ValidateCreate(ctx context.Context, obj TObj) (warnings admission.Warnings, err error)

func (*AdmissionValidator[TObj]) ValidateDelete

func (v *AdmissionValidator[TObj]) ValidateDelete(ctx context.Context, obj TObj) (warnings admission.Warnings, err error)

func (*AdmissionValidator[TObj]) ValidateUpdate

func (v *AdmissionValidator[TObj]) ValidateUpdate(ctx context.Context, oldObj, newObj TObj) (warnings admission.Warnings, err error)

type Validator

type Validator[TObj runtime.Object] interface {
	Validate(ctx context.Context, obj TObj) (warnings admission.Warnings, err error)
}

type ValidatorFunc

type ValidatorFunc[TObj runtime.Object] func(ctx context.Context, obj TObj) (warnings admission.Warnings, err error)

ValidatorFunc is a function type that implements the Validator interface. It can be used to create inline validators without needing to define a separate struct.

func (ValidatorFunc[TObj]) Validate

func (f ValidatorFunc[TObj]) Validate(ctx context.Context, obj TObj) (warnings admission.Warnings, err error)

Jump to

Keyboard shortcuts

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