filters

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(obj unstructured.Unstructured, filters ...Filter) bool

Apply applies all the provided filters to a given object. Then returns if the object is filtered out or not. Returns true if this object is kept, otherwise false.

func ApplyToList

func ApplyToList(list unstructured.UnstructuredList, filters ...Filter) unstructured.UnstructuredList

ApplyToList applies all the provided filters to a UnstructuredList. It only keeps items that pass all the filters.

Types

type Filter

type Filter func(unstructured.Unstructured) bool

Filter is used to filter Unstructured objects. It is basically a func(unstructured.Unstructured) bool.

func ByAppliedWorkload

func ByAppliedWorkload(workload string) Filter

ByAppliedWorkload returns a filter that only keeps trait definitions that applies to the given workload. Empty workload name will keep everything.

func ByName

func ByName(name string) Filter

ByName returns a filter that matches the given name. Empty name will keep everything.

func ByOwnerAddon

func ByOwnerAddon(addonName string) Filter

ByOwnerAddon returns a filter that filters out what does not belong to the owner addon. Empty addon name will keep everything.

func KeepAll

func KeepAll() Filter

KeepAll returns a filter that keeps everything

func KeepNone

func KeepNone() Filter

KeepNone returns a filter that filters out everything

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳