filter

package
v0.10.1 Latest Latest
Warning

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

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

Documentation

Overview

Package filter contains methods for filtering bundles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter added in v0.6.1

type Filter struct {
	// ChangeInPlace controls whether to change the objects in place or to make
	// copies. By default, the Filter returns deep copies of objects.
	ChangeInPlace bool
}

Filter filters the components and objects to produce a new set of components.

func NewFilter added in v0.6.2

func NewFilter() *Filter

NewFilter creates a new Filter.

func (*Filter) Components added in v0.6.2

func (f *Filter) Components(data []*bundle.Component, o *Options) []*bundle.Component

Components filters components based on the ObjectMeta properties of the components, returning a new cluster bundle with just filtered components. By default components are removed, unless KeepOnly is set, and then the opposite is true. Filtering for components doesn't take into account the properties of the object-children of the components.

func (*Filter) Objects added in v0.6.2

func (f *Filter) Objects(data []*unstructured.Unstructured, o *Options) []*unstructured.Unstructured

Objects filters objects based on the ObjectMeta properties of the objects, returning a new list with just filtered objects. By default objects are removed, unless KeepOnly is set, and then the opposite is true.

func (*Filter) PartitionObjects added in v0.9.0

func (f *Filter) PartitionObjects(data []*unstructured.Unstructured, o *Options) ([]*unstructured.Unstructured, []*unstructured.Unstructured)

PartitionObjects splits the objects into matched and not matched sets. PartitionObjects ignores the KeepOnly option, since both matched and unmatched objects are returned. Thus, the options to partition are always treated as options for matching objects.

type Options

type Options struct {
	// Kinds represent the Kinds to filter on.
	Kinds []string

	// Names represent the names to filter on. For objects, this is the
	// metadata.name field. For components, this is the ComponentName.
	Names []string

	// Annotations contain key/value pairs to filter on. An empty string value matches
	// all annotation-values for a particular key.
	Annotations map[string]string

	// Labels contain key/value pairs to filter on. An empty string value matches
	// all label-values for a particular key.
	Labels map[string]string

	// Namespaces to filter on.
	Namespaces []string

	// KeepOnly means that instead of removing the found objects.
	KeepOnly bool
}

Options for filtering bundles. By default, if any of the options match, then the relevant component or object is removed. If KeepOnly is set, then the objects are kept instead of removed.

Jump to

Keyboard shortcuts

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