Documentation ¶
Index ¶
- func DeviceValidation(device Device) error
- func GetDefaultLogger() *zap.Logger
- func GetEnvInt(name string, defaultValue int) int
- func GetLogger(lcfg map[string]interface{}) *zap.Logger
- func GetVersion() string
- func SensorValidation(sensor Sensor) error
- func SetDefault(s interface{}, d interface{})
- func SetDefaultGlobal(g *Global)
- type Config
- type Database
- type Device
- type DeviceConfig
- type DeviceOptions
- type DeviceTemplate
- type Dialout
- type DialoutService
- type Discovery
- type Global
- type MemSink
- type MockConfig
- func (m *MockConfig) Databases() []Database
- func (m *MockConfig) Devices() []Device
- func (m *MockConfig) Global() *Global
- func (m *MockConfig) Informer() chan struct{}
- func (m *MockConfig) Logger() *zap.Logger
- func (m *MockConfig) Producers() []Producer
- func (m *MockConfig) Sensors() []Sensor
- func (m *MockConfig) Update() error
- type Producer
- type Sensor
- type Shards
- type Status
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeviceValidation ¶
DeviceValidation validates configured device.
func GetDefaultLogger ¶
GetDefaultLogger creates default zap logger.
func GetEnvInt ¶
GetEnvInt returns given env variable in integer if available otherwise it returns the default value.
func SensorValidation ¶
SensorValidation validates configured sensor.
func SetDefault ¶
func SetDefault(s interface{}, d interface{})
SetDefault set default value if the s == zero.
Types ¶
type Config ¶
type Config interface { Devices() []Device Producers() []Producer Databases() []Database Sensors() []Sensor Global() *Global Informer() chan struct{} Logger() *zap.Logger Update() error }
Config represets panoptes configuration
type Device ¶
type Device struct { DeviceConfig Sensors map[string][]*Sensor }
Device represents device configuration with sensors
func ConvDeviceTemplate ¶
func ConvDeviceTemplate(d DeviceTemplate) Device
ConvDeviceTemplate transforms devicetemplate to device.
type DeviceConfig ¶
type DeviceConfig struct { Host string Port int GroupID int DeviceOptions `yaml:",inline"` }
DeviceConfig represents device configuration
type DeviceOptions ¶
type DeviceOptions struct { TLSConfig TLSConfig `yaml:"tlsConfig"` Username string Password string }
DeviceOptions represents global device options
type DeviceTemplate ¶
type DeviceTemplate struct { DeviceConfig `yaml:",inline"` Sensors []string }
DeviceTemplate represents device configuration structure
type Dialout ¶
type Dialout struct { TLSConfig TLSConfig `yaml:"tlsConfig"` DefaultOutput string `yaml:"defaultOutput"` Services map[string]DialoutService }
Dialout represents dialout service
type DialoutService ¶
DialoutService represent specific dialout telemetry
type Discovery ¶
type Discovery struct { Service string Config interface{} }
Discovery represents discovery service
type Global ¶
type Global struct { Discovery Discovery Status Status Shards Shards DeviceOptions DeviceOptions `yaml:"deviceOptions"` WatcherDisabled bool `yaml:"watcherDisabled"` BufferSize int `yaml:"bufferSize"` OutputBufferSize int `yaml:"outputBufferSize"` Version string Logger map[string]interface{} Dialout Dialout }
Global represents global configuration
type MemSink ¶
MemSink represents memory destination for logging.
func (*MemSink) UnmarshalSlice ¶
UnmarshalSlice returns array of decoded logs as key value and reset the buffer.
type MockConfig ¶
type MockConfig struct { MDevices []Device MProducers []Producer MDatabases []Database MSensors []Sensor MGlobal *Global MInformer chan struct{} LogOutput *MemSink // contains filtered or unexported fields }
MockConfig represents mock configuration.
func NewMockConfig ¶
func NewMockConfig() *MockConfig
NewMockConfig constructs mock configuration it writes logs to memory and accessible from LogOutput.
func (*MockConfig) Databases ¶
func (m *MockConfig) Databases() []Database
Databases returns configured databases.
func (*MockConfig) Devices ¶
func (m *MockConfig) Devices() []Device
Devices returns configured devices.
func (*MockConfig) Global ¶
func (m *MockConfig) Global() *Global
Global returns global configuration.
func (*MockConfig) Informer ¶
func (m *MockConfig) Informer() chan struct{}
Informer returns informer channel.
func (*MockConfig) Logger ¶
func (m *MockConfig) Logger() *zap.Logger
Logger returns zap logger pointer.
func (*MockConfig) Producers ¶
func (m *MockConfig) Producers() []Producer
Producers returns configured producers.
func (*MockConfig) Sensors ¶
func (m *MockConfig) Sensors() []Sensor
Sensors returns configured sensors.
type Sensor ¶
type Sensor struct { Service string Output string Disabled bool Origin string Path string Mode string SampleInterval int `yaml:"sampleInterval"` HeartbeatInterval int `yaml:"heartbeatInterval"` SuppressRedundant bool `yaml:"suppressRedundant"` Subscription string }
Sensor represents telemetry sensor
type Shards ¶
type Shards struct { Enabled bool InitializingShards int `yaml:"initializingShards"` NumberOfNodes int `yaml:"numberOfNodes"` }
Shards represents shard service configuration