config

package
v0.0.0-...-7595b48 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Engine   Engine      `yaml:"engine"`
	Handlers *HandlerMap `yaml:"handlers"`
}

func NewConfig

func NewConfig() *Config

func (*Config) ParseFromYaml

func (c *Config) ParseFromYaml(yamlData []byte) error

func (*Config) ParseFromYamlFile

func (c *Config) ParseFromYamlFile(filePath string) error

func (*Config) Validate

func (c *Config) Validate() error

type Engine

type Engine struct {
	DisableRunOnStart bool          `yaml:"disable_run_on_start"`
	Interval          time.Duration `yaml:"interval"`
	RunAt             string        `yaml:"run_at"`

	Log Log `yaml:"log"`
}

func (Engine) Validate

func (e Engine) Validate() error

type FilterHandler

type FilterHandler struct {
	ExpectFalse bool   `yaml:"expect_false"`
	Expression  string `yaml:"expression"`
}

func (FilterHandler) Validate

func (h FilterHandler) Validate() error

type HTTPHandler

type HTTPHandler struct {
	URL                  string            `yaml:"url"`
	Method               string            `yaml:"method"`
	Body                 string            `yaml:"body"`
	Headers              map[string]string `yaml:"headers"`
	QueryParams          map[string]string `yaml:"query_params"`
	Timeout              time.Duration     `yaml:"timeout"`
	ExpectedResponseCode int               `yaml:"expected_response_code"`
	Retries              int               `yaml:"retries"`
	RetryInterval        time.Duration     `yaml:"retry_interval"`
	ParallelRun          bool              `yaml:"parallel_run"`
}

func (HTTPHandler) Validate

func (h HTTPHandler) Validate() error

type Handler

type Handler struct {
	Type HandlerType `yaml:"type"`

	HTTPHandler   HTTPHandler   `yaml:"http"`
	FilterHandler FilterHandler `yaml:"filter"`
}

func (Handler) Validate

func (h Handler) Validate() error

type HandlerMap

type HandlerMap []HandlerMapItem

HandlerMap is a list of HandlerMapItem. It is used to guarantee the order of the handlers.

func (*HandlerMap) UnmarshalYAML

func (hm *HandlerMap) UnmarshalYAML(node *yaml.Node) error

type HandlerMapItem

type HandlerMapItem struct {
	Name    string
	Handler Handler
}

type HandlerType

type HandlerType string
const (
	HandlerTypeHTTP   HandlerType = "http"
	HandlerTypeFilter HandlerType = "filter"
)

type Log

type Log struct {
	Level        LogLevel          `yaml:"level"`
	StaticFields map[string]string `yaml:"static_fields"`
}

type LogLevel

type LogLevel string
const (
	LogLevelDebug    LogLevel = "debug"
	LogLevelInfo     LogLevel = "info"
	LogLevelWarn     LogLevel = "warn"
	LogLevelError    LogLevel = "error"
	LogLevelDisabled LogLevel = "disabled"
)

func (LogLevel) ToZerolog

func (l LogLevel) ToZerolog() zerolog.Level

Jump to

Keyboard shortcuts

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