Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMQP ¶
type AMQP struct {
BrokerURL string `mapstructure:"broker_url"`
ConsumerTag string `mapstructure:"consumer_tag"`
PrefetchCount int `mapstructure:"prefetch_count"`
AllowedVHosts []string `mapstructure:"allowed_vhosts"`
ReconnectDelay time.Duration `mapstructure:"reconnect_delay"`
}
AMQP contains RabbitMQ configuration
type Config ¶
type Config struct {
Server Server `mapstructure:"server"`
AMQP AMQP `mapstructure:"amqp"`
OrgEvents OrgEvents `mapstructure:"org_events"`
Db Db `mapstructure:"db"`
}
Config represents the service configuration
func LoadConfig ¶
LoadConfig loads configuration from file and environment variables
type Db ¶
type Db struct {
Name string `mapstructure:"name"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
BatchSize int `mapstructure:"batch_size"`
FlushInterval time.Duration `mapstructure:"flush_interval"`
MaxConnections int `mapstructure:"max_connections"`
MaxIdleConns int `mapstructure:"max_idle_conns"`
}
Db contains Db configuration
type DeviceModelRules ¶
type DeviceModelRules struct {
DeviceModel string `yaml:"device_model"`
DisplayName string `yaml:"display_name"`
Rules []EventRuleConfig `yaml:"rules"`
}
DeviceModelRules represents event rules for a specific device model
type EventRuleConfig ¶
type EventRuleConfig struct {
RuleKey string `yaml:"rule_key"`
Operator string `yaml:"operator"`
Operand string `yaml:"operand"`
EventType string `yaml:"event_type"`
EventLevel string `yaml:"event_level"`
Description string `yaml:"description"`
Status string `yaml:"status"`
IsActive bool `yaml:"is_active"`
}
EventRuleConfig represents a single event rule configuration
type EventRulesConfig ¶
type EventRulesConfig struct {
DeviceModels []DeviceModelRules `yaml:"device_models"`
}
EventRulesConfig represents the aggregated event rules configuration
func LoadEventRulesConfig ¶
func LoadEventRulesConfig(path string) (*EventRulesConfig, error)
LoadEventRulesConfig loads event rules from a YAML file
func LoadEventRulesFromDir ¶
func LoadEventRulesFromDir(dir string) (*EventRulesConfig, error)
LoadEventRulesFromDir loads all event rule YAML files from a directory Each file should contain a single device model's rules
Click to show internal directories.
Click to hide internal directories.