Documentation
¶
Index ¶
- Constants
- Variables
- type Cache
- type Handler
- func (h *Handler) GetCache() handler.Cache
- func (h *Handler) GetName() string
- func (h *Handler) HandleReview(obj interface{}) (bool, interface{}, error)
- func (h *Handler) MatchSchema() apiextensions.JSONSchemaProps
- func (h *Handler) ProcessData(obj interface{}) (bool, []string, interface{}, error)
- func (h *Handler) ToMatcher(constraint *unstructured.Unstructured) (constraints.Matcher, error)
- func (h *Handler) ValidateConstraint(constraint *unstructured.Unstructured) error
- type Matcher
- type Object
- type Review
Constants ¶
View Source
const TargetName = "test.target"
TargetName is the default target name.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrInvalidType = errors.New("invalid type") )
View Source
var ErrInvalidObject = errors.New("invalid object")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is a threadsafe Cache for the test Handler which keeps track of Namespaces.
type Handler ¶
type Handler struct { // Name, if set, is the name of the Handler. Otherwise defaults to TargetName. Name *string // ShouldHandle is whether Handler should handle Object. // If unset, handles all Objects. ShouldHandle func(*Object) bool ForbiddenEnforcement *string // ProcessDataError is the error to return when ProcessData is called. // If nil returns no error. ProcessDataError error Cache *Cache }
func (*Handler) HandleReview ¶
func (*Handler) MatchSchema ¶
func (h *Handler) MatchSchema() apiextensions.JSONSchemaProps
func (*Handler) ProcessData ¶
func (*Handler) ToMatcher ¶
func (h *Handler) ToMatcher(constraint *unstructured.Unstructured) (constraints.Matcher, error)
func (*Handler) ValidateConstraint ¶
func (h *Handler) ValidateConstraint(constraint *unstructured.Unstructured) error
type Matcher ¶
Matcher is a test matcher which matches Objects with a matching namespace. Checks that Namespace exists in cache before proceeding.
type Object ¶
type Object struct { // Name is the identifier of an Object within the scope of its Namespace // (if present). If unset, the Object is a special "Namespace" object. Name string `json:"name"` // Namespace is used for Constraints which apply to a subset of Objects. // If unset, the Object is not scoped to a Namespace. Namespace string `json:"namespace"` // Data is checked by "CheckData" templates. Data string `json:"data"` }
Object is a test object under review. The idea is to represent objects just complex enough to showcase (and test) the features of frameworks's Client, Drivers, and Handlers.
Click to show internal directories.
Click to hide internal directories.