webhook

package
v0.0.0-...-82486e6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admission

type Admission interface {
	Name() string

	Kind() meta.GroupVersionKind
	Resource() meta.GroupVersionResource

	Validate(goHttp.ResponseWriter, *goHttp.Request)
	Mutate(goHttp.ResponseWriter, *goHttp.Request)
}

func NewAdmissionHandler

func NewAdmissionHandler[T meta.Object](name, group, version, kind, resource string, handlers ...Handler[T]) Admission

type AdmissionRequestType

type AdmissionRequestType int
const (
	AdmissionRequestValidate AdmissionRequestType = iota
	AdmissionRequestMutate
)

type Admissions

type Admissions []Admission

func (Admissions) Register

func (a Admissions) Register() util.Mod[goHttp.ServeMux]

type CanHandleFunc

type CanHandleFunc[T meta.Object] func(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) bool

type Handler

type Handler[T meta.Object] interface {
	CanHandle(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) bool
}

type MutateFunc

type MutateFunc[T meta.Object] func(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) (MutationResponse, error)

type MutationHandler

type MutationHandler[T meta.Object] interface {
	Handler[T]

	Mutate(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) (MutationResponse, error)
}

type MutationResponse

type MutationResponse struct {
	ValidationResponse

	Patch patch.Items
}

func (MutationResponse) AsResponse

type ValidateFunc

type ValidateFunc[T meta.Object] func(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) (ValidationResponse, error)

type ValidationHandler

type ValidationHandler[T meta.Object] interface {
	Handler[T]

	Validate(ctx context.Context, log logging.Logger, t AdmissionRequestType, request *admission.AdmissionRequest, old, new T) (ValidationResponse, error)
}

type ValidationResponse

type ValidationResponse struct {
	Allowed  bool
	Message  string
	Warnings []string
}

func NewValidationResponse

func NewValidationResponse(allowed bool, msg string, args ...any) ValidationResponse

func (ValidationResponse) AsResponse

Jump to

Keyboard shortcuts

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