...

Package genericwebhook

import "github.com/chaos-mesh/chaos-mesh/api/genericwebhook"
Overview
Index

Overview ▾

func Aggregate

func Aggregate(errs field.ErrorList) error

func Default

func Default(obj interface{}) field.ErrorList

Default would walk through all the fields of target struct recursively, and set the default value which declared with struct tag "default".

Parameter obj should be a pointer to a data struct.

Default should return an empty field.ErrorList.

func Register

func Register(name string, obj reflect.Type)

func Validate

func Validate(obj interface{}) field.ErrorList

Validate would walk through all the fields of target struct recursively, and validate the value with validator declared with struct tag "webhook".

Parameter obj should be a pointer to a data struct.

Validate should return an empty field.ErrorList if all the fields are valid, or return each field.Error for every invalid values.

type Defaulter

type Defaulter interface {
    Default(root interface{}, field *reflect.StructField)
}

type FieldValidator

type FieldValidator interface {
    Validate(root interface{}, path *field.Path) field.ErrorList
}

type FieldWalker

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

func NewFieldWalker

func NewFieldWalker(obj interface{}, callback fieldCallback) *FieldWalker

func (*FieldWalker) Walk

func (w *FieldWalker) Walk()