filterer

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAmbiguousError

func IsAmbiguousError(err error) bool

func IsNonexistentError

func IsNonexistentError(err error) bool

Types

type AmbiguousError

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

func NewAmbiguousError

func NewAmbiguousError(format string, data ...interface{}) *AmbiguousError

type BaseFilter

type BaseFilter interface {
	// AmbiguousError specifies what to error if
	// a single request returned multiple matches
	// The matches are given as an argument
	AmbiguousError([]Match) *AmbiguousError
	// NonexistentError specifies what to error if
	// a single request returned no matches
	NonexistentError() *NonexistentError
	// SetKind sets the kind for the filter
	SetKind(meta.Kind)
}

BaseFilter provides shared functionality for filter types

type Filterer

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

func NewFilterer

func NewFilterer(storage storage.Storage) *Filterer

func (*Filterer) Find

func (f *Filterer) Find(gvk schema.GroupVersionKind, filter BaseFilter) (meta.Object, error)

Find a single meta.Object of the given kind using the given filter

func (*Filterer) FindAll

func (f *Filterer) FindAll(gvk schema.GroupVersionKind, filter BaseFilter) ([]meta.Object, error)

Find all meta.Objects of the given kind using the given filter

type GenericMatch added in v0.4.1

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

GenericMatch is the simplest implementation of Match, carrying no additional data

func NewMatch added in v0.4.1

func NewMatch(object meta.Object, exact bool) *GenericMatch

func (*GenericMatch) Exact added in v0.4.1

func (m *GenericMatch) Exact() bool

func (*GenericMatch) Object added in v0.4.1

func (m *GenericMatch) Object() meta.Object

type Match added in v0.4.1

type Match interface {
	// Get the matched Object
	Object() meta.Object
	// Check if the match was exact
	Exact() bool
}

Match describes the result of filtering an Object If the Object to be filtered didn't match, return nil

type MetaFilter

type MetaFilter interface {
	BaseFilter
	// Every Object to be filtered is passed though FilterMeta, which should
	// return the Object on match, or nil if it doesn't match. The Objects
	// given to FilterMeta are of type meta.APIType, stripped of other contents.
	// The boolean indicates an exact match.
	FilterMeta(meta.Object) (Match, error)
}

MetaFilter implementations operate on meta.APIType objects, which are more light weight, but provide only name/UID matching.

type NonexistentError

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

func NewNonexistentError

func NewNonexistentError(format string, data ...interface{}) *NonexistentError

type ObjectFilter

type ObjectFilter interface {
	BaseFilter
	// Every Object to be filtered is passed though Filter, which should
	// return the Object on match, or nil if it doesn't match.
	// The boolean indicates an exact match.
	Filter(meta.Object) (Match, error)
}

ObjectFilter implementations filter fully loaded meta.Objects

Jump to

Keyboard shortcuts

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