match

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Mode:            ModeAllow,
	Matcher:         MatcherRegex,
	Pattern:         `^.*$`,
	ExactArrayMatch: pointer.Bool(true),
}

Functions

func MatcherTypeSliceContains

func MatcherTypeSliceContains(enums []MatcherType, sunEnums ...MatcherType) bool

MatcherTypeSliceContains reports whether sunEnums is within enums.

func MatcherTypeSliceContainsAny

func MatcherTypeSliceContainsAny(enums []MatcherType, sunEnums ...MatcherType) bool

MatcherTypeSliceContainsAny reports whether any sunEnum is within enums.

func ModeTypeSliceContains

func ModeTypeSliceContains(enums []ModeType, sunEnums ...ModeType) bool

ModeTypeSliceContains reports whether sunEnums is within enums.

func ModeTypeSliceContainsAny

func ModeTypeSliceContainsAny(enums []ModeType, sunEnums ...ModeType) bool

ModeTypeSliceContainsAny reports whether any sunEnum is within enums.

Types

type Config

type Config struct {
	Mode            ModeType    `json:"mode,omitempty"`
	Matcher         MatcherType `json:"matcher,omitempty"`
	Pattern         interface{} `json:"pattern,omitempty"`
	ExactArrayMatch *bool       `json:"exactArrayMatch,omitempty"`
}

Config can be passed into NewFilter() in order to configure the behavior of the sender.

func NewConfig

func NewConfig(config interface{}) (*Config, error)

func (*Config) FromJSON

func (c *Config) FromJSON(in string) error

func (*Config) FromYAML

func (c *Config) FromYAML(in string) error

func (*Config) JSON

func (c *Config) JSON() (string, error)

func (*Config) String

func (c *Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

func (Config) WithDefaults

func (c Config) WithDefaults() *Config

func (*Config) YAML

func (c *Config) YAML() (string, error)

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault) (*Filter, error)

func (*Filter) Config

func (f *Filter) Config() interface{}

func (*Filter) Filter

func (f *Filter) Filter(evt event.Event) []event.Event

func (*Filter) Name added in v0.2.1

func (f *Filter) Name() string

func (*Filter) Plugin added in v0.2.1

func (f *Filter) Plugin() string

func (*Filter) Tenant added in v0.3.0

func (f *Filter) Tenant() tenant.Id

type Matcher

type Matcher interface {
	Match(event event.Event) bool
}

type MatcherType

type MatcherType int
const (
	MatcherUnknown      MatcherType = iota // unknown
	MatcherRegex                           // regex
	MatcherPattern                         // pattern
	MatcherPatternRegex                    // patternregex
)

func MatcherTypeValues

func MatcherTypeValues() []MatcherType

MatcherTypeValues returns all values of the enum

func ParseMatcherTypeString

func ParseMatcherTypeString(s string) (MatcherType, error)

ParseMatcherTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func (MatcherType) MarshalBinary

func (i MatcherType) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface for MatcherType

func (MatcherType) MarshalJSON

func (i MatcherType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for MatcherType

func (MatcherType) MarshalText

func (i MatcherType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for MatcherType

func (MatcherType) MarshalYAML

func (i MatcherType) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for MatcherType

func (MatcherType) New

func (i MatcherType) New() *MatcherType

New returns a pointer to a new addr filled with the MatcherType value passed in.

func (MatcherType) Registered

func (i MatcherType) Registered() bool

IsAMatcherType returns "true" if the value is listed in the enum definition. "false" otherwise

func (MatcherType) String

func (i MatcherType) String() string

func (*MatcherType) UnmarshalBinary

func (i *MatcherType) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for MatcherType

func (*MatcherType) UnmarshalJSON

func (i *MatcherType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for MatcherType

func (*MatcherType) UnmarshalText

func (i *MatcherType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for MatcherType

func (*MatcherType) UnmarshalYAML

func (i *MatcherType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for MatcherType

type ModeType

type ModeType int
const (
	ModeUnknown ModeType = iota // unknown
	ModeAllow                   // allow
	ModeDeny                    // deny
)

func ModeTypeValues

func ModeTypeValues() []ModeType

ModeTypeValues returns all values of the enum

func ParseModeTypeString

func ParseModeTypeString(s string) (ModeType, error)

ParseModeTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func (ModeType) MarshalBinary

func (i ModeType) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface for ModeType

func (ModeType) MarshalJSON

func (i ModeType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ModeType

func (ModeType) MarshalText

func (i ModeType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for ModeType

func (ModeType) MarshalYAML

func (i ModeType) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for ModeType

func (ModeType) New

func (i ModeType) New() *ModeType

New returns a pointer to a new addr filled with the ModeType value passed in.

func (ModeType) Registered

func (i ModeType) Registered() bool

IsAModeType returns "true" if the value is listed in the enum definition. "false" otherwise

func (ModeType) String

func (i ModeType) String() string

func (*ModeType) UnmarshalBinary

func (i *ModeType) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for ModeType

func (*ModeType) UnmarshalJSON

func (i *ModeType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ModeType

func (*ModeType) UnmarshalText

func (i *ModeType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for ModeType

func (*ModeType) UnmarshalYAML

func (i *ModeType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for ModeType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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