types

package
v0.0.0-...-22d8ab2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Equals      = "=="
	Exists      = "Exists"
	LessThan    = "lt"
	GreaterThan = "gt"
	NotEquals   = "!="
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event[T any, PT Object[T]] struct {
	Type   EventType `json:"type"`
	Object T         `json:"object"`
}

Event represents a single event to a watched resource.

type EventType

type EventType string
const (
	EventTypeAdded    EventType = "ADDED"
	EventTypeModified EventType = "MODIFIED"
	EventTypeDeleted  EventType = "DELETED"
	EventTypeError    EventType = "ERROR"
)

type GetOptions

type GetOptions struct {
}

GetOptions is reserved to be implemented.

type GroupVersionResource

type GroupVersionResource struct {
	Group    string
	Version  string
	Resource string
}

type LabelSelector

type LabelSelector struct {
	Label    string
	Value    string
	Operator string
}

type List

type List[T any, PT Object[T]] struct {
	metav1.ListMeta `json:"metadata"`
	Items           []T `json:"items"`
}

type ListOptions

type ListOptions struct {
	LabelSelector   []LabelSelector
	ResourceVersion string
}

ListOptions is reserved to be implemented.

type Object

type Object[T any] interface {
	*T
	GetName() string
	GetNamespace() string
	GetResourceVersion() string
	GetLabels() map[string]string
}

type ObjectAPI

type ObjectAPI[T any, PT Object[T]] interface {
	Get(namespace, name string, _ GetOptions) (T, error)
	Watch(namespace, name string, _ ListOptions) (WatchInterface[T, PT], error)
	List(namespace string, _ ListOptions) (*List[T, PT], error)
	Apply(namespace, name, fieldManager string, force bool, item T) (T, error, EventType)
	Patch(namespace, name, fieldManager string, item T) (T, error)
	Create(namespace string, item T) (T, error)
	Delete(namespace, name string, force bool) (T, error)
	Subresource(subresource string) ObjectAPI[T, PT]
	Status() ObjectAPI[T, PT]
}

ObjectAPI wraps all operations on object.

type WatchInterface

type WatchInterface[T any, PT Object[T]] interface {
	// Stop stops watching. Will close the channel returned by ResultChan(). Releases
	// any resources used by the Watch.
	Stop()

	// ResultChan returns a chan which will receive all the events. If an error occurs
	// or Stop() is called, this channel will be closed, in which case the
	// Watch should be completely cleaned up.
	ResultChan() <-chan Event[T, PT]
}

WatchInterface can be implemented by anything that knows how to Watch and report changes.

Jump to

Keyboard shortcuts

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