Documentation
¶
Overview ¶
Package providers contains interfaces for internal system providers.
Index ¶
- type BakedRule
- type IAuthenticatedUser
- type IBusProvider
- type ICronProvider
- type IExtendedAPIProvider
- type IGroupProvider
- type IInternalFanOutProvider
- type IInternalSecret
- type ILoadedProvider
- type ILocationProvider
- type INotificationProvider
- type IPluginLoaderProvider
- type ISecurityProvider
- type IServerProvider
- type ISettingsProvider
- type IStorageProvider
- type ITriggerProvider
- type IValidatorProvider
- type KnownDevice
- type MasterDeviceUpdate
- type MasterSettings
- type PluginLoadRequest
- type RawDevice
- type RawDeviceSelector
- type RawMasterComponent
- type SecRole
- type SecRoleRule
- type SecSystem
- func (i SecSystem) IsASecSystem() bool
- func (i SecSystem) MarshalJSON() ([]byte, error)
- func (i SecSystem) MarshalText() ([]byte, error)
- func (i SecSystem) MarshalYAML() (interface{}, error)
- func (i SecSystem) String() string
- func (i *SecSystem) UnmarshalJSON(data []byte) error
- func (i *SecSystem) UnmarshalText(text []byte) error
- func (i *SecSystem) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SecVerb
- func (i SecVerb) IsASecVerb() bool
- func (i SecVerb) MarshalJSON() ([]byte, error)
- func (i SecVerb) MarshalText() ([]byte, error)
- func (i SecVerb) MarshalYAML() (interface{}, error)
- func (i SecVerb) String() string
- func (i *SecVerb) UnmarshalJSON(data []byte) error
- func (i *SecVerb) UnmarshalText(text []byte) error
- func (i *SecVerb) UnmarshalYAML(unmarshal func(interface{}) error) error
- type WorkerSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAuthenticatedUser ¶
type IAuthenticatedUser interface { Name() string DeviceGet(string) bool DeviceCommand(string) bool DeviceHistory(string) bool TriggerGet(string) bool TriggerHistory(string) bool Workers() bool Entities() bool Logs() bool }
IAuthenticatedUser describes authenticated user.
type IBusProvider ¶
type IBusProvider interface { Subscribe(channel bus.ChannelName, queue chan bus.RawMessage) error SubscribeStr(channel string, queue chan bus.RawMessage) error SubscribeToWorker(workerName string, queue chan bus.RawMessage) error Unsubscribe(channel string) Publish(channel bus.ChannelName, messages ...interface{}) PublishStr(channel string, messages ...interface{}) PublishToWorker(workerName string, messages ...interface{}) Ping() error }
IBusProvider defines service bus provider logic.
type ICronProvider ¶
ICronProvider defines cron provider logic.
type IExtendedAPIProvider ¶
type IExtendedAPIProvider interface { ILoadedProvider ID() string Routes() []string }
IExtendedAPIProvider describes extended API wrapper.
type IGroupProvider ¶
type IGroupProvider interface { ID() string Devices() []string InvokeCommand(enums.Command, map[string]interface{}) }
IGroupProvider describes group device provider.
type IInternalFanOutProvider ¶
type IInternalFanOutProvider interface { common.IFanOutProvider ChannelInDeviceUpdates() chan *common.MsgDeviceUpdate SubscribeTriggerUpdates() (int64, chan string) UnSubscribeTriggerUpdates(int64) ChannelInTriggerUpdates() chan string }
IInternalFanOutProvider defines internal interface for the fan-out channel. It extends regular IFanOutProvider which is available for plugins.
type IInternalSecret ¶
type IInternalSecret interface { common.ISecretProvider UpdateLogger(pluginLogger common.ILoggerProvider) }
IInternalSecret defines internal secret provider wrapper.
type ILoadedProvider ¶
type ILoadedProvider interface {
Unload()
}
ILoadedProvider describes loaded provider.
type ILocationProvider ¶
ILocationProvider defines UI location.
type INotificationProvider ¶
INotificationProvider defines notification provider.
type IPluginLoaderProvider ¶
type IPluginLoaderProvider interface { LoadPlugin(*PluginLoadRequest) (interface{}, error) UpdateLogger(common.ILoggerProvider) }
IPluginLoaderProvider defines plugin loader provider logic.
type ISecurityProvider ¶
type ISecurityProvider interface {
GetUser(map[string][]string) (IAuthenticatedUser, error)
}
ISecurityProvider defines security provider.
type IServerProvider ¶
type IServerProvider interface { Start() InternalCommandInvokeDeviceCommand(glob.Glob, enums.Command, map[string]interface{}) SendNotificationCommand(glob.Glob, string) GetDevice(string) *KnownDevice PushMasterDeviceUpdate(*MasterDeviceUpdate) }
IServerProvider defines server interface which is required by some other internal systems.
type ISettingsProvider ¶
type ISettingsProvider interface { SystemLogger() common.ILoggerProvider PluginLogger() common.ILoggerProvider ServiceBus() IBusProvider NodeID() string Cron() ICronProvider PluginLoader() IPluginLoaderProvider Validator() IValidatorProvider WorkerSettings() *WorkerSettings MasterSettings() *MasterSettings IsWorker() bool DevicesConfig() []*RawDevice Secrets() common.ISecretProvider Security() ISecurityProvider Triggers() []*RawMasterComponent ExtendedAPIs() []*RawMasterComponent Notifications() []*RawMasterComponent Groups() []*RawMasterComponent FanOut() IInternalFanOutProvider Storage() IStorageProvider Timezone() *time.Location }
ISettingsProvider defines settings loader provider logic.
type IStorageProvider ¶
type IStorageProvider interface { Heartbeat(string) State(*common.MsgDeviceUpdate) History(string) map[enums.Property]map[int64]interface{} }
IStorageProvider defines state history storage provider.
type ITriggerProvider ¶
ITriggerProvider defines events-trigger.
type IValidatorProvider ¶
type IValidatorProvider interface { SetLogger(logger common.ILoggerProvider) Validate(interface{}) bool }
IValidatorProvider defines yaml structures validator logic.
type KnownDevice ¶
type KnownDevice struct { Worker string Type enums.DeviceType Commands []string }
KnownDevice contains data about known device.
type MasterDeviceUpdate ¶
type MasterDeviceUpdate struct { ID string Name string State map[string]interface{} Commands []string Type enums.DeviceType }
MasterDeviceUpdate contains data required for pushing update for device running on master. Usually it's a group.
type MasterSettings ¶
type MasterSettings struct { Port int `yaml:"port" validate:"required,port" default:"8000"` DelayedStart int `yaml:"delayedStart" validate:"gte=0"` UOM enums.UOM `yaml:"units" default:"imperial"` Timezone string `yaml:"timezone" default:"Local"` Locations []*RawMasterComponent `yaml:"-"` }
MasterSettings has configured data for master node.
type PluginLoadRequest ¶
type PluginLoadRequest struct { SystemType systems.SystemType PluginProvider string RawConfig []byte InitData interface{} ExpectedType reflect.Type DownloadTimeoutSec int }
PluginLoadRequest has data required for loading a new plugin.
type RawDevice ¶
type RawDevice struct { Plugin string DeviceType enums.DeviceType Selector *RawDeviceSelector StrConfig string Name string IsAPI bool }
RawDevice has data describing data about device, loaded from config files.
type RawDeviceSelector ¶
type RawDeviceSelector struct { Name string `yaml:"name"` Selectors map[string]string `yaml:"workerSelectors"` }
RawDeviceSelector has data required for understanding which worker should be picked for the device.
type RawMasterComponent ¶
RawMasterComponent has configuration for master component.
type SecRole ¶
type SecRole struct { Name string `yaml:"name" validate:"required"` Users []string `yaml:"users" validate:"unique,min=1"` Rules []SecRoleRule `yaml:"rules" validate:"min=1"` }
SecRole has data, describing single security role.
type SecRoleRule ¶
type SecRoleRule struct { System string `yaml:"system" validate:"required,oneof=* device core"` Resources []string `yaml:"resources" validate:"unique,min=1"` Verbs []SecVerb `yaml:"-"` StrVerb []string `yaml:"verbs" validate:"unique,min=1,oneof=* get command history"` }
SecRoleRule has data, describing single security rule.
type SecSystem ¶
type SecSystem int
SecSystem describes possible role's rule system.
func SecSystemString ¶
SecSystemString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func SecSystemValues ¶
func SecSystemValues() []SecSystem
SecSystemValues returns all values of the enum
func (SecSystem) IsASecSystem ¶
IsASecSystem returns "true" if the value is listed in the enum definition. "false" otherwise
func (SecSystem) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for SecSystem
func (SecSystem) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for SecSystem
func (SecSystem) MarshalYAML ¶
MarshalYAML implements a YAML Marshaler for SecSystem
func (*SecSystem) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for SecSystem
func (*SecSystem) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for SecSystem
func (*SecSystem) UnmarshalYAML ¶
UnmarshalYAML implements a YAML Unmarshaler for SecSystem
type SecVerb ¶
type SecVerb int
SecVerb describes allowed rules for the role.
func SecVerbString ¶
SecVerbString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (SecVerb) IsASecVerb ¶
IsASecVerb returns "true" if the value is listed in the enum definition. "false" otherwise
func (SecVerb) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for SecVerb
func (SecVerb) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for SecVerb
func (SecVerb) MarshalYAML ¶
MarshalYAML implements a YAML Marshaler for SecVerb
func (*SecVerb) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for SecVerb
func (*SecVerb) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for SecVerb
func (*SecVerb) UnmarshalYAML ¶
UnmarshalYAML implements a YAML Unmarshaler for SecVerb
type WorkerSettings ¶
type WorkerSettings struct { Name string `yaml:"name"` Properties map[string]string `yaml:"properties"` MaxDevices int `yaml:"maxDevices" validate:"gte=0,lte=1000" default:"99"` Timezone string `yaml:"timezone" default:"Local"` }
WorkerSettings has configured data for worker node.