Documentation ¶
Index ¶
- Constants
- Variables
- func SetSupportedCallExprTypes(callTypes []CallType)
- type AgentFilter
- type AgentFilterData
- type AnyExpr
- type CallExpr
- type CallType
- type ComparableValue
- type CompoundCondition
- type Condition
- type ConditionParser
- type ContainsExpr
- type Data
- type ExistsExpr
- type Filter
- type MatchRegExExpr
- type SimpleCondition
- type StringRHSValue
- type ValueExpr
Constants ¶
const ( Dash = "-" DashPlaceHolder = "__DASH__" )
Variables ¶
var ( ErrFilterConfiguration = errors.Newf(1147, "error parsing filter in configuration. Syntax error:%s") ErrFilterExpression = errors.New(1148, "error parsing filter in configuration. Unrecognized expression") ErrFilterGeneralParse = errors.New(1149, "error parsing filter in configuration") ErrFilterArgument = errors.New(1150, "error parsing filter in configuration. Invalid call argument") ErrFilterSelectorType = errors.New(1151, "error parsing filter in configuration. Invalid selector type") ErrFilterSelectorExpr = errors.New(1152, "error parsing filter in configuration. Invalid selector expression") ErrFilterOperator = errors.New(1153, "error parsing filter in configuration. Invalid operator") ErrFilterCondition = errors.New(1154, "error parsing filter in configuration. Unrecognized condition") )
Errors hit while parsing the APIMANAGER_FILTER
Functions ¶
func SetSupportedCallExprTypes ¶
func SetSupportedCallExprTypes(callTypes []CallType)
SetSupportedCallExprTypes - Overrides the list of supported condition expression
Types ¶
type AgentFilter ¶
type AgentFilter struct {
// contains filtered or unexported fields
}
AgentFilter - Represents the filter
func (*AgentFilter) Evaluate ¶
func (af *AgentFilter) Evaluate(tags interface{}) (result bool)
Evaluate - Performs the evaluation of the filter against the data
type AgentFilterData ¶
type AgentFilterData struct {
// contains filtered or unexported fields
}
AgentFilterData - Represents the data for filter evaluation
func (*AgentFilterData) GetKeys ¶
func (ad *AgentFilterData) GetKeys(ftype string) []string
GetKeys - Returns all the map keys based on the filter data type
func (*AgentFilterData) GetValue ¶
func (ad *AgentFilterData) GetValue(ftype, fName string) (val string, ok bool)
GetValue - Returns the value for map entry based on the filter data type
func (*AgentFilterData) GetValues ¶
func (ad *AgentFilterData) GetValues(ftype string) []string
GetValues - Returns all the map values based on the filter data type
type AnyExpr ¶
type AnyExpr struct {
FilterType string
}
AnyExpr - Any implementation. Returns all filter data values to be checked against
type CallExpr ¶
type CallExpr interface { GetType() CallType Execute(data Data) (interface{}, error) String() string }
CallExpr - Interface for call expression in filter condition
type CallType ¶
type CallType int
CallType - Call type for filter condition
func GetCallType ¶
GetCallType - Converts a string to its corresponding call type.
type ComparableValue ¶
type ComparableValue interface { String() string // contains filtered or unexported methods }
ComparableValue - Interface for RHS value operand
type CompoundCondition ¶
CompoundCondition - Represents group of simple conditions
func (*CompoundCondition) Evaluate ¶
func (cf *CompoundCondition) Evaluate(data Data) bool
Evaluate - evaulates the compound condition
func (*CompoundCondition) String ¶
func (cf *CompoundCondition) String() string
String - string representation for compound condition
type ConditionParser ¶
type ConditionParser struct {
// contains filtered or unexported fields
}
ConditionParser - Represents the filter condition parser
func NewConditionParser ¶
func NewConditionParser() *ConditionParser
NewConditionParser - Create a new instance of condition parser
type ContainsExpr ¶
ContainsExpr - Contains implementation. Check if the argument string is contained in value of specified filter data
func (*ContainsExpr) Execute ¶
func (e *ContainsExpr) Execute(data Data) (interface{}, error)
Execute - Returns true if the argument string is contained in value of specified filter data
func (*ContainsExpr) GetType ¶
func (e *ContainsExpr) GetType() CallType
GetType - Returns the CallType
func (*ContainsExpr) String ¶
func (e *ContainsExpr) String() string
type Data ¶
type Data interface { GetValue(filterType string, filterKey string) (string, bool) GetKeys(filterType string) []string GetValues(filterType string) []string }
Data - Interface representing the data for filter evaluation
func NewFilterData ¶
func NewFilterData(tags interface{}, attr interface{}) Data
NewFilterData - Transforms the data to flat map which is used for filter evaluation
type ExistsExpr ¶
ExistsExpr - Exists implementation. Checks the existance of the selector as key in filter data
func (*ExistsExpr) Execute ¶
func (e *ExistsExpr) Execute(data Data) (interface{}, error)
Execute - Returns true if the selector key is found in filter data
func (*ExistsExpr) String ¶
func (e *ExistsExpr) String() string
type Filter ¶
type Filter interface {
Evaluate(tags interface{}) bool
}
Filter - Interface for filter
type MatchRegExExpr ¶
MatchRegExExpr - MatchRegEx implementation. Performs a regular expression match for argument against value of specified filter data
func (*MatchRegExExpr) Execute ¶
func (e *MatchRegExExpr) Execute(data Data) (interface{}, error)
Execute - Returns true if the regular expression in argument matches the value for specified filter data
func (*MatchRegExExpr) GetType ¶
func (e *MatchRegExExpr) GetType() CallType
GetType - Returns the CallType
func (*MatchRegExExpr) String ¶
func (e *MatchRegExExpr) String() string
type SimpleCondition ¶
type SimpleCondition struct { LHSExpr CallExpr Value ComparableValue Operator string }
SimpleCondition - Identifies a simple condition
func (*SimpleCondition) Evaluate ¶
func (sf *SimpleCondition) Evaluate(data Data) (res bool)
Evaluate - evaluates a simple/call expression condition
func (*SimpleCondition) String ¶
func (sf *SimpleCondition) String() string
String - string representation for simple condition
type StringRHSValue ¶
type StringRHSValue struct {
// contains filtered or unexported fields
}
StringRHSValue - Represents the RHS value in simple condition
func (*StringRHSValue) String ¶
func (scv *StringRHSValue) String() string