store

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPageSize = 100

Variables

This section is empty.

Functions

func EnforcePrefix

func EnforcePrefix(prefix any, listOpts *ListOpts)

func EqualGVK

func EqualGVK(expected, actual schema.GroupVersionKind) problems.Problem

func ParseLimit

func ParseLimit(s string) int

ParseLimit parses a string into an integer, returning DefaultPageSize if the string is empty or cannot be parsed.

Types

type Filter

type Filter struct {
	Path  string   `json:"path"`
	Op    FilterOp `json:"op"`
	Value string   `json:"value"`
}

func ParseFilter

func ParseFilter(s string) (Filter, error)

func (Filter) String

func (f Filter) String() string

type FilterOp

type FilterOp string
const (
	OpEqual    FilterOp = "=="
	OpNotEqual FilterOp = "!="
	OpRegex    FilterOp = "=~"
	OpFullText FilterOp = "~~"
)

func (FilterOp) IsValid

func (op FilterOp) IsValid() bool

func (FilterOp) String

func (op FilterOp) String() string

type ListOpts

type ListOpts struct {
	Filters []Filter
	Sorters []Sorter
	Prefix  string
	Cursor  string
	Limit   int
}

func NewListOpts

func NewListOpts() ListOpts

func (ListOpts) UrlEncoded

func (o ListOpts) UrlEncoded() string

type ListResponse

type ListResponse[T Object] struct {
	Links ListResponseLinks `json:"_links"`
	Items []T               `json:"items"`
}
type ListResponseLinks struct {
	Self string `json:"self"`
	Next string `json:"next"`
}

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

type ObjectStore

type ObjectStore[T Object] interface {
	Info() (schema.GroupVersionResource, schema.GroupVersionKind)
	Ready() bool
	Get(ctx context.Context, namespace, name string) (T, error)
	List(ctx context.Context, opts ListOpts) (*ListResponse[T], error)
	Delete(ctx context.Context, namespace, name string) error
	CreateOrReplace(ctx context.Context, obj T) error
	Patch(ctx context.Context, namespace, name string, ops ...Patch) (T, error)
}

type Patch

type Patch struct {
	Path  string  `json:"path"`
	Op    PatchOp `json:"op"`
	Value any     `json:"value"`
}

type PatchOp

type PatchOp string

According to https://datatracker.ietf.org/doc/html/rfc6902

const (
	OpAdd     PatchOp = "add"
	OpRemove  PatchOp = "remove"
	OpReplace PatchOp = "replace"
	OpMove    PatchOp = "move"
	OpCopy    PatchOp = "copy"
	OpTest    PatchOp = "test"
)

func (PatchOp) IsValid

func (op PatchOp) IsValid() bool

func (PatchOp) String

func (op PatchOp) String() string

type SortOrder

type SortOrder string
const (
	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

func (SortOrder) IsValid

func (o SortOrder) IsValid() bool

type Sorter

type Sorter struct {
	Path  string
	Order SortOrder
}

func ParseSorter

func ParseSorter(s string) (Sorter, error)

func (Sorter) String

func (s Sorter) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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