Documentation
¶
Overview ¶
Package filter provides a way to filter resources based on a set of criteria.
Index ¶
- Constants
- type Filter
- type FilterWithScope
- type Filters
- func (f Filters) Append(f2 Filters)
- func (f Filters) Get(resourceType string) []Filter
- func (f Filters) GetByGroup(resourceType string) map[string][]FilterWithScope
- func (f Filters) Match(resourceType string, p Property, log *logrus.Entry) (bool, error)
- func (f Filters) Merge(f2 Filters)
- func (f Filters) Validate() error
- type OpType
- type Property
- type Type
Constants ¶
const ( Empty Type = "" Exact Type = "exact" Glob Type = "glob" Regex Type = "regex" Contains Type = "contains" DateOlderThan Type = "dateOlderThan" DateOlderThanNow Type = "dateOlderThanNow" Suffix Type = "suffix" Prefix Type = "prefix" NotIn Type = "NotIn" In Type = "In" And OpType = "and" Or OpType = "or" Global = "__global__" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// Group is the name of the group of filters, all filters in a group are ANDed together
Group string `yaml:"group" json:"group"`
// Type is the type of filter to apply
Type Type `yaml:"type" json:"type"`
// Property is the name of the property to filter on
Property string `yaml:"property" json:"property"`
// Value is the value to filter on
Value string `yaml:"value" json:"value"`
// Values allows for multiple values to be specified for a filter
Values []string `yaml:"values" json:"values"`
// Invert is a flag to invert the filter
Invert bool `yaml:"invert" json:"invert"`
}
Filter is a filter to apply to a resource
func NewExactFilter ¶
NewExactFilter creates a new filter that matches the exact value
func (*Filter) UnmarshalYAML ¶
UnmarshalYAML unmarshals a filter from YAML data
type FilterWithScope ¶ added in v0.24.4
type Filters ¶
func (Filters) Append ¶ added in v0.10.0
Append appends the filters from f2 to f. This is primarily used to append filters from a preset to a set of filters that were defined on a resource type.
func (Filters) Get ¶ added in v0.10.0
Get returns the filters for a specific resource type or the global filters if they exist. If there are no filters it returns nil
func (Filters) GetByGroup ¶ added in v0.20.0
func (f Filters) GetByGroup(resourceType string) map[string][]FilterWithScope
GetByGroup returns the filters grouped by the group name for a specific resource type or the global filters if they exist. If there are no filters it returns nil
func (Filters) Match ¶ added in v0.20.0
Match checks if the filters match the given property which is actually a queue item that meats the property interface requirements