config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidActionType = errors.New("invalid action type")
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Type              ActionType `yaml:"type"`
	HTTPRequestAction `yaml:",inline"`
}

Action is action definition.

type ActionType

type ActionType string

ActionType represents action type.

const (
	// ActionNone is uncategorized action type.
	ActionNone ActionType = ""
	// ActionHTTP is action type for HTTP action.
	ActionHTTP ActionType = "http"
)

func (ActionType) Validate

func (t ActionType) Validate() error

Validate validates action type.

type Config

type Config struct {
	Version  string         `yaml:"version"`
	Handlers []EventHandler `yaml:"handlers"`
}

Config represents a config.yml.

func Parse

func Parse(data []byte) (Config, error)

Parse parses config file and returns config data.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates config.

type EventHandler

type EventHandler struct {
	Subscription string `yaml:"subscription"`
	Action       Action `yaml:"action"`
}

EventHandler is event handler which contains action names.

type HTTPRequestAction

type HTTPRequestAction struct {
	Method  string        `yaml:"method"`
	Header  http.Header   `yaml:"header"`
	URL     string        `yaml:"url"`
	Payload *yamlTemplate `yaml:"payload"`
}

HTTPRequestAction is configuration of HTTP action.

Jump to

Keyboard shortcuts

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