tagfilter

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//EntityOriginSource constant value for the EntityOrigin source
	EntityOriginSource = newEntityOrigin("src", restapi.TagFilterEntitySource)
	//EntityOriginDestination constant value for the EntityOrigin destination
	EntityOriginDestination = newEntityOrigin("dest", restapi.TagFilterEntityDestination)
	//EntityOriginNotApplicable constant value when no EntityOrigin is applicable
	EntityOriginNotApplicable = newEntityOrigin("na", restapi.TagFilterEntityNotApplicable)
)

SupportedEntityOrigins slice of supported EntityOrigins

Functions

func MapTagFilterToNormalizedString added in v1.5.3

func MapTagFilterToNormalizedString(element restapi.TagFilterExpressionElement) (*string, error)

MapTagFilterToNormalizedString maps a TagFilterExpressionElement to its normalized string. Returns nil in case an empty expression is provided and an error in case of any error occurred during mapping.

func Normalize

func Normalize(input string) (string, error)

Normalize parses the input and returns the normalized representation of the input string

Types

type BracketExpression added in v1.5.1

type BracketExpression struct {
	Bracket *LogicalOrExpression `parser:"\"(\" @@ \")\""`
	Primary *PrimaryExpression   `parser:"| @@"`
}

BracketExpression representation of a bracket expression

func (*BracketExpression) Render added in v1.5.1

func (e *BracketExpression) Render() string

Render implementation of ExpressionRenderer.Render

type ComparisonExpression

type ComparisonExpression struct {
	Entity       *EntitySpec `parser:"@@"`
	Operator     Operator    `` /* 237-byte string literal not displayed */
	NumberValue  *int64      `parser:"( @Number"`
	BooleanValue *bool       `parser:"| @( \"FALSE\" | \"TRUE\" )"`
	StringValue  *string     `parser:"| @String )"`
}

ComparisonExpression representation of a comparison expression.

func (*ComparisonExpression) Render

func (e *ComparisonExpression) Render() string

Render implementation of ExpressionRenderer.Render

type EntityOrigin

type EntityOrigin interface {
	//Key returns the key of the entity origin
	Key() string
	//TagFilterEntity returns the Instana API Ta Filter Entity
	TagFilterEntity() restapi.TagFilterEntity
}

EntityOrigin custom type for the origin (source or destination) of a entity spec

type EntityOrigins

type EntityOrigins []EntityOrigin

EntityOrigins custom type for a slice of entity origins

func (EntityOrigins) ForInstanaAPIEntity

func (origins EntityOrigins) ForInstanaAPIEntity(input restapi.TagFilterEntity) EntityOrigin

ForInstanaAPIEntity returns the EntityOrigin for its corresponding TagFilterEntity from the Instana API

func (EntityOrigins) ForKey

func (origins EntityOrigins) ForKey(input string) EntityOrigin

ForKey returns the EntityOrigin for its string representation

type EntitySpec

type EntitySpec struct {
	Identifier string  `parser:"@Ident"`
	TagKey     *string `parser:"( \":\" @Ident )?"`
	Origin     *string `parser:"( \"@\" @EntityOrigin )?"`
}

EntitySpec custom type for an entity path specification Ident (@TagKeySeparator @Ident)? (@EntityOriginOperator @EntityOrigin)? "

func (*EntitySpec) Render

func (o *EntitySpec) Render() string

Render implementation of the ExpressionRenderer interface

type ExpressionRenderer

type ExpressionRenderer interface {
	Render() string
}

ExpressionRenderer interface definition to render an expression in its normalized form

type FilterExpression

type FilterExpression struct {
	Expression *LogicalOrExpression `parser:"@@"`
}

FilterExpression representation of a tag filter expression

func (*FilterExpression) Render

func (e *FilterExpression) Render() string

Render implementation of ExpressionRenderer.Render

type LogicalAndExpression

type LogicalAndExpression struct {
	Left     *BracketExpression    `parser:"  @@"`
	Operator *Operator             `parser:"( @\"AND\""`
	Right    *LogicalAndExpression `parser:"  @@ )?"`
}

LogicalAndExpression representation of a logical AND, or as a wrapper for a PrimaryExpression. The wrapping is required to handle precedence.

func (*LogicalAndExpression) Render

func (e *LogicalAndExpression) Render() string

Render implementation of ExpressionRenderer.Render

type LogicalOrExpression

type LogicalOrExpression struct {
	Left     *LogicalAndExpression `parser:"  @@"`
	Operator *Operator             `parser:"( @\"OR\""`
	Right    *LogicalOrExpression  `parser:"  @@ )?"`
}

LogicalOrExpression representation of a logical OR, or as a wrapper for a LogicalAndExpression or a PrimaryExpression. The wrapping is required to handle precedence.

func (*LogicalOrExpression) Render

func (e *LogicalOrExpression) Render() string

Render implementation of ExpressionRenderer.Render

type Mapper

type Mapper interface {
	FromAPIModel(input restapi.TagFilterExpressionElement) (*FilterExpression, error)
	ToAPIModel(input *FilterExpression) restapi.TagFilterExpressionElement
}

Mapper interface of the tag filter expression mapper

func NewMapper

func NewMapper() Mapper

NewMapper creates a new instance of the Mapper

type Operator

type Operator string

Operator custom type for an operator

func (*Operator) Capture

func (o *Operator) Capture(values []string) error

Capture captures the string representation of an operator from the given string and converts it to upper case. Interface of participle

type Parser

type Parser interface {
	Parse(expression string) (*FilterExpression, error)
}

Parser interface for working with tag filter expressions of instana

func NewParser

func NewParser() Parser

NewParser creates a new instance of a Parser

type PrimaryExpression

type PrimaryExpression struct {
	Comparison     *ComparisonExpression     `parser:"  @@"`
	UnaryOperation *UnaryOperationExpression `parser:"| @@"`
}

PrimaryExpression wrapper for either a comparison or a unary expression

func (*PrimaryExpression) Render

func (e *PrimaryExpression) Render() string

Render implementation of ExpressionRenderer.Render

type UnaryOperationExpression

type UnaryOperationExpression struct {
	Entity   *EntitySpec `parser:"@@"`
	Operator Operator    `parser:"@( \"IS_EMPTY\" | \"IS_BLANK\"  | \"NOT_EMPTY\" | \"NOT_BLANK\" )"`
}

UnaryOperationExpression representation of a unary expression

func (*UnaryOperationExpression) Render

func (e *UnaryOperationExpression) Render() string

Render implementation of ExpressionRenderer.Render

Jump to

Keyboard shortcuts

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