Documentation
¶
Overview ¶
Package filters contains core implementations of the ComponentFilterStrategy interface.
Package filters contains core implementations of the ComponentFilterStrategy interface.
Package filters contains core implementations of the ComponentFilterStrategy interface.
Package filters contains core implementations of the ComponentFilterStrategy interface.
Package filters contains core implementations of the ComponentFilterStrategy interface.
Package filters contains core implementations of the ComponentFilterStrategy interface.
Index ¶
- Variables
- func Apply(definition api.Package, filter ComponentFilterStrategy) (api.Package, error)
- func NormalizeComponentSelectorList(selectors []string) ([]string, error)
- func NormalizeComponentSelectors(selectors string) (string, error)
- func ParseComponentSelectors(selectors string) ([]string, error)
- type ComponentFilterStrategy
- func ByComponentSelectors(selectors []string) ComponentFilterStrategy
- func ByLocalOS(localOS string) ComponentFilterStrategy
- func BySelectState(optionalComponents string) ComponentFilterStrategy
- func Combine(filters ...ComponentFilterStrategy) ComponentFilterStrategy
- func Empty() ComponentFilterStrategy
- func ForDeploy(optionalComponents string) ComponentFilterStrategy
Constants ¶
This section is empty.
Variables ¶
var ( ErrMultipleSameGroup = fmt.Errorf("cannot specify multiple components from the same group") ErrNoDefaultOrSelection = fmt.Errorf("no default or selected component found") ErrNotFound = fmt.Errorf("no compatible components found") )
Errors for the deployment filter.
var ErrLocalOSRequired = errors.New("localOS is required")
ErrLocalOSRequired is returned when localOS is not set.
Functions ¶
func Apply ¶ added in v0.84.0
Apply returns a filtered package, retaining existing provenance and recording selectors from a successful ForDeploy application, including within Combine.
func NormalizeComponentSelectorList ¶ added in v1.0.0
NormalizeComponentSelectorList returns a detached, normalized selector list. Entries are individual patterns, not comma-separated strings. Order and repetitions are preserved, and empty entries are discarded.
func NormalizeComponentSelectors ¶ added in v1.0.0
NormalizeComponentSelectors normalizes selectors while preserving their order and repetitions.
func ParseComponentSelectors ¶ added in v1.0.0
ParseComponentSelectors parses comma-separated selectors into a normalized, ordered list, preserving repetitions.
Types ¶
type ComponentFilterStrategy ¶
type ComponentFilterStrategy interface {
// Apply returns the components to keep, in order.
// Use the package-level Apply function to retain deployment selection provenance.
Apply(api.Package) ([]api.Component, error)
}
ComponentFilterStrategy is a strategy interface for filtering components.
func ByComponentSelectors ¶ added in v1.0.0
func ByComponentSelectors(selectors []string) ComponentFilterStrategy
ByComponentSelectors selects components using an ordered list of names, globs, and exclusions. It takes a detached snapshot; invalid patterns fail on Apply.
func ByLocalOS ¶
func ByLocalOS(localOS string) ComponentFilterStrategy
ByLocalOS creates a new filter that filters components based on local (runtime) OS.
func BySelectState ¶
func BySelectState(optionalComponents string) ComponentFilterStrategy
BySelectState creates a new simple included filter.
func Combine ¶
func Combine(filters ...ComponentFilterStrategy) ComponentFilterStrategy
Combine creates a new filter that applies a sequence of filters.
func ForDeploy ¶
func ForDeploy(optionalComponents string) ComponentFilterStrategy
ForDeploy creates a noninteractive deployment filter using explicit selectors, required components, and legacy v1alpha1 defaults and choice groups. An explicit group selection replaces other group members. Selectors are normalized when applied: case and surrounding whitespace are ignored, empty entries are discarded, and invalid glob patterns return an error. Use the package-level Apply function or a package layout's Filter method to record the selectors for deployment. A second deployment selection on the same package is rejected rather than replacing its provenance.