webhooks

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UnknownErrorType                   = "UnknownError"
	UnknownErrorMessage                = "An unknown error has occurred"
	ImmutableFieldErrorType            = "ImmutableFieldError"
	ImmutableFieldErrorMessageTemplate = "'%s' field is immutable"
)
View Source
const (
	OrgPlacementErrorType      = "OrgPlacementError"
	OrgPlacementErrorMessage   = "Organization '%s' must be placed in the root 'cf' namespace"
	SpacePlacementErrorType    = "SpacePlacementError"
	SpacePlacementErrorMessage = "Organization '%s' does not exist for Space '%s'"
)
View Source
const DuplicateNameErrorType = "DuplicateNameError"

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateValidator

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

func NewDuplicateValidator

func NewDuplicateValidator(nameRegistry NameRegistry) *DuplicateValidator

func (DuplicateValidator) ValidateCreate

func (v DuplicateValidator) ValidateCreate(ctx context.Context, logger logr.Logger, namespace, newName, duplicateNameError string) *ValidationError

func (DuplicateValidator) ValidateDelete

func (v DuplicateValidator) ValidateDelete(ctx context.Context, logger logr.Logger, namespace, oldName string) *ValidationError

func (DuplicateValidator) ValidateUpdate

func (v DuplicateValidator) ValidateUpdate(ctx context.Context, logger logr.Logger, namespace, oldName, newName, duplicateNameError string) *ValidationError

type NameRegistry

type NameRegistry interface {
	RegisterName(ctx context.Context, namespace, name string) error
	DeregisterName(ctx context.Context, namespace, name string) error
	TryLockName(ctx context.Context, namespace, name string) error
	UnlockName(ctx context.Context, namespace, name string) error
}

type NameValidator added in v0.2.0

type NameValidator interface {
	ValidateCreate(ctx context.Context, logger logr.Logger, namespace, newName, duplicateNameError string) *ValidationError
	ValidateUpdate(ctx context.Context, logger logr.Logger, namespace, oldName, newName, duplicateNameError string) *ValidationError
	ValidateDelete(ctx context.Context, logger logr.Logger, namespace, oldName string) *ValidationError
}

type NamespaceValidator added in v0.2.0

type NamespaceValidator interface {
	ValidateOrgCreate(org korifiv1alpha1.CFOrg) *ValidationError
	ValidateSpaceCreate(space korifiv1alpha1.CFSpace) *ValidationError
}

type PlacementValidator

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

func NewPlacementValidator

func NewPlacementValidator(client client.Client, rootNamespace string) *PlacementValidator

func (PlacementValidator) ValidateOrgCreate

func (v PlacementValidator) ValidateOrgCreate(org korifiv1alpha1.CFOrg) *ValidationError

func (PlacementValidator) ValidateSpaceCreate

func (v PlacementValidator) ValidateSpaceCreate(space korifiv1alpha1.CFSpace) *ValidationError

type ValidationError

type ValidationError struct {
	Type    string `json:"validationErrorType"`
	Message string `json:"message"`
}

func WebhookErrorToValidationError

func WebhookErrorToValidationError(err error) (ValidationError, bool)

func (ValidationError) Error

func (v ValidationError) Error() string

func (ValidationError) ExportJSONError added in v0.2.0

func (v ValidationError) ExportJSONError() error

func (ValidationError) GetMessage added in v0.2.0

func (v ValidationError) GetMessage() string

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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