properties

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConf added in v0.79.0

func LoadConf(raw map[string]any) (properties *confmap.Conf, warning, fatal error)

Types

type ComponentID

type ComponentID struct {
	Type string `parser:"@~(ForwardSlash | (Dot (?= ('config'|'enabled'))))+"`
	Name string `parser:"(ForwardSlash @(~(Dot (?= ('config'|'enabled')))+)*)?"`
}

type Entry added in v0.79.0

type Entry struct {
	Config  *map[string]any `mapstructure:"config"`
	Enabled *bool           `mapstructure:"enabled"`
	Unknown map[any]any     `mapstructure:",remain"`
}

type EnvVarComponentID

type EnvVarComponentID struct {
	Type string `parser:"@~(Underscore (?= ('CONFIG'|'ENABLED')))+"`
	// _x2f_ -> '/'
	Name string `parser:"(Underscore 'x2f' Underscore @(~(?= Underscore (?= ('CONFIG'|'ENABLED')))+|''))?"`
}

type EnvVarProperty

type EnvVarProperty struct {
	ComponentType string            `parser:"'SPLUNK' Underscore 'DISCOVERY' Underscore @('RECEIVERS' | 'EXTENSIONS') Underscore"`
	Component     EnvVarComponentID `parser:"@@"`
	Type          string            `parser:"Underscore @('CONFIG'|'ENABLED')"`
	Key           string            `parser:"(Underscore @(String|Underscore)+)*"`
	Val           string
}

func NewEnvVarProperty

func NewEnvVarProperty(property, val string) (*EnvVarProperty, error)

type File added in v0.79.0

type File struct {
	Mapping `mapstructure:"splunk.discovery"`
	Entries map[string]any `mapstructure:",remain"`
}

File is loaded from properties.discovery.yaml and can consist of --set discovery property entries as well as a splunk.discovery: property mapping

type Mapping added in v0.79.0

type Mapping struct {
	Receivers  map[string]Entry `mapstructure:"receivers"`
	Extensions map[string]Entry `mapstructure:"extensions"`
	Unknown    map[any]any      `mapstructure:",remain"`
}

type Property

type Property struct {
	ComponentType string      `parser:"'splunk' Dot 'discovery' Dot @('receivers' | 'extensions') Dot"`
	Component     ComponentID `parser:"@@ Dot"`
	Type          string      `parser:"((@'config' Dot)|@('enabled'))"`
	Key           string      `parser:"@(String|Dot|ForwardSlash)*"`
	Val           string
	Input         string
	// contains filtered or unexported fields
}

Property is the ast for a parsed property. TODO: support rules and resource_attributes instead of just embedded config

func NewProperty

func NewProperty(property, val string) (*Property, error)

func NewPropertyFromEnvVar

func NewPropertyFromEnvVar(envVar, val string) (*Property, bool, error)

func (*Property) ToEnvVar

func (p *Property) ToEnvVar() string

ToEnvVar will output the equivalent env var property for informational purposes.

func (*Property) ToStringMap

func (p *Property) ToStringMap() map[string]any

ToStringMap() will return a map[string]any equivalent to the property's root-level confmap.ToStringMap()

Jump to

Keyboard shortcuts

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