Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFlags ¶
func InitFlags(flagSet *flag.FlagSet, cfg *BasicConfig)
InitFlags tries to initialize Script-Based SoftwareUpdatable and Log configurations. Returns true if version flag is specified for print version and exit. Returns error if JSON configuration file cannot be read properly or missing config file is specified with flag.
func LoadConfigFromFile ¶
LoadConfigFromFile reads the file contents and unmarshal them into the given config structure.
func ParseConfigFilePath ¶
func ParseConfigFilePath() string
ParseConfigFilePath returns the value for configuration file path if set.
Types ¶
type BasicConfig ¶
type BasicConfig struct {
ScriptBasedSoftwareUpdatableConfig
logger.LogConfig
ConfigFile string `json:"configFile,omitempty"`
}
BasicConfig combine ScriptBaseSoftwareUpdatable configuration and Log configuration
func LoadConfig ¶
func LoadConfig(version string) (*BasicConfig, error)
LoadConfig loads a new configuration instance using flags and config file (if set).
func NewDefaultConfig ¶
func NewDefaultConfig() *BasicConfig
NewDefaultConfig returns a default mqtt client connection config instance
type EdgeConnector ¶
type EdgeConnector struct {
// contains filtered or unexported fields
}
EdgeConnector listens for Edge Thing configuration changes and notifies the corresponding edgeClient. It is used in the main package.
func InitScriptBasedSU ¶
func InitScriptBasedSU(scriptSUPConfig *ScriptBasedSoftwareUpdatableConfig) (*EdgeConnector, error)
InitScriptBasedSU creates a new Script-Based SoftwareUpdatable instance, listening for edge configuration.
type ScriptBasedSoftwareUpdatable ¶
type ScriptBasedSoftwareUpdatable struct {
// contains filtered or unexported fields
}
ScriptBasedSoftwareUpdatable is the Script-Based SoftwareUpdatable actual implementation.
func (*ScriptBasedSoftwareUpdatable) Connect ¶
func (f *ScriptBasedSoftwareUpdatable) Connect(client MQTT.Client, scriptSUPConfig *ScriptBasedSoftwareUpdatableConfig, edgeCfg *edgeConfiguration) error
Connect the client to the configured Ditto endpoint. If any error occurs during the connection's initiation - it's returned here.
func (*ScriptBasedSoftwareUpdatable) Disconnect ¶
func (f *ScriptBasedSoftwareUpdatable) Disconnect(closeStorage bool)
Disconnect the client from the configured Ditto endpoint.
type ScriptBasedSoftwareUpdatableConfig ¶
type ScriptBasedSoftwareUpdatableConfig struct {
Broker string `json:"broker,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
CACert string `json:"caCert,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty"`
StorageLocation string `json:"storageLocation,omitempty"`
FeatureID string `json:"featureId,omitempty"`
ModuleType string `json:"moduleType,omitempty"`
ArtifactType string `json:"artifactType,omitempty"`
ServerCert string `json:"serverCert,omitempty"`
DownloadRetryCount int `json:"downloadRetryCount,omitempty"`
DownloadRetryInterval durationTime `json:"downloadRetryInterval,omitempty"`
InstallDirs []string `json:"installDirs,omitempty"`
Mode string `json:"mode,omitempty"`
InstallCommand command `json:"install,omitempty"`
}
ScriptBasedSoftwareUpdatableConfig provides the Script-Based SoftwareUpdatable configuration.
func (*ScriptBasedSoftwareUpdatableConfig) Validate ¶
func (scriptSUPConfig *ScriptBasedSoftwareUpdatableConfig) Validate() error
Validate the software updatable configuration