internal

package
v0.0.0-...-6bb103f Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFile = "./config.json"
	DefaultVerbosity  = 5
	DestinationTypeS3 = "S3"
	SourceTypeRestAPI = "RestAPI"
)

Variables

View Source
var LogLevels = map[syslog.Priority]string{
	syslog.LOG_EMERG:   "Emerg",
	syslog.LOG_ALERT:   "Alert",
	syslog.LOG_CRIT:    "Critical",
	syslog.LOG_ERR:     "Error",
	syslog.LOG_WARNING: "Warning",
	syslog.LOG_NOTICE:  "Notice",
	syslog.LOG_INFO:    "Info",
	syslog.LOG_DEBUG:   "Debug",
}

Functions

func RunSet

func RunSet(logger *log.Logger, source Source, destination Destination, config AppConfig) error

RunSet calls the source API and writes the result to the destination adapter

Types

type AppConfig

type AppConfig struct {
	Runtime     RuntimeConfig
	Source      SourceConfig
	Destination DestinationConfig
	Alert       alert.Config
	Sets        []Set
}

func LoadConfig

func LoadConfig(configFile string) (AppConfig, error)

LoadConfig looks for a config file if one is provided. Otherwise, it looks for a config file based on the CONFIG_PATH env var. If that is not set, it gets the default config file ("./config.json").

func (*AppConfig) MaxSetNameLength

func (a *AppConfig) MaxSetNameLength() int

type Destination

type Destination interface {
	ForSet(setName string, setJson json.RawMessage) error
	Write(data []byte, activityLog chan<- EventLogItem) error
}

type DestinationConfig

type DestinationConfig struct {
	Type          string
	AdapterConfig json.RawMessage
}

type EmptyDestination

type EmptyDestination struct{}

func (*EmptyDestination) ForSet

func (e *EmptyDestination) ForSet(setJson json.RawMessage) error

type EmptySource

type EmptySource struct{}

func (*EmptySource) ForSet

func (e *EmptySource) ForSet(setJson json.RawMessage) error

type EventLogItem

type EventLogItem struct {
	Message string
	Level   syslog.Priority
}

func (EventLogItem) String

func (l EventLogItem) String() string

type RuntimeConfig

type RuntimeConfig struct {
	DryRunMode bool
}

type Set

type Set struct {
	Name        string
	Source      json.RawMessage
	Destination json.RawMessage
}

type Source

type Source interface {
	ForSet(setName string, setJson json.RawMessage) error
	Read() ([]byte, error)
}

type SourceConfig

type SourceConfig struct {
	Type          string
	AdapterConfig json.RawMessage
}

Jump to

Keyboard shortcuts

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