Documentation ¶
Index ¶
- Constants
- type APIState
- type AgentInfo
- type CallbackFunc
- type Client
- func (c *Client) AbortDownload() (*APIState, error)
- func (c *Client) GetInfo() (*AgentInfo, error)
- func (c *Client) GetLogs() (*Log, error)
- func (c *Client) LocalInstall(filePath string) (*APIState, error)
- func (c *Client) Probe(serverAddress string) (*ProbeResponse, error)
- func (c *Client) RemoteInstall(serverAddress string) (*APIState, error)
- type DeviceAttributes
- type DeviceIdentity
- type Entry
- type Firmware
- type Handler
- type Log
- type Metadata
- type Network
- type Polling
- type PollingLog
- type ProbeResponse
- type RuntimeSettings
- type ServerAddress
- type Settings
- type State
- type StateChange
- type Storage
- type Update
- type UpdatePackage
Constants ¶
View Source
const ( Updating = "updating" NoUpdate = "no_update" TryAgain = "try_again" )
View Source
const ( Park = "park" EntryPoint = "entry_point" Poll = "poll" Validation = "validation" Download = "download" Install = "install" Reboot = "reboot" DirectDownload = "direct_download" PrepareLocalInstall = "prepare_local_install" Error = "error" )
View Source
const ( StateProbe = "probe" StateDownload = "download" StateInstall = "install" StateReboot = "reboot" StateError = "error" )
View Source
const SDKTriggerFilename string = "/usr/share/updatehub/state-change-callbacks.d/10-updatehub-sdk-statechange-trigger"
View Source
const SocketPath string = "/run/updatehub-statechange.sock"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentInfo ¶
type AgentInfo struct { Config Settings `json:"config"` Firmware Firmware `json:"firmware"` RuntimeSettings RuntimeSettings `json:"runtime_settings"` State APIState `json:"state"` Version string `json:"version"` }
type CallbackFunc ¶
type CallbackFunc func(handler *Handler)
CallbackFunc the type of the callbacks.
type Client ¶
type Client struct { }
func (*Client) AbortDownload ¶
func (*Client) LocalInstall ¶
LocalInstall trigger the installation of a local package
type DeviceAttributes ¶
type DeviceIdentity ¶
type Firmware ¶
type Firmware struct { DeviceAttributes DeviceAttributes `json:"device_attributes"` DeviceIdentity DeviceIdentity `json:"device_identity"` Hardware string `json:"hardware"` PubKey string `json:"pub_key"` Version string `json:"version"` }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
/ Handler used to communicate with UpdateHub / to call commands on the state callbacks.
type PollingLog ¶
type PollingLog struct { Last string `json:"last"` Now bool `json:"now"` Retries int64 `json:"retries"` ServerAddress ServerAddress `json:"server_address"` }
type ProbeResponse ¶
type ProbeResponse interface{}
type RuntimeSettings ¶
type RuntimeSettings struct { Path string `json:"path"` Persistent bool `json:"persistent"` Polling PollingLog `json:"polling"` Update UpdatePackage `json:"update"` }
type ServerAddress ¶
type ServerAddress struct {
Custom string `json:"custom"`
}
type StateChange ¶
type StateChange struct {
Listeners map[string][]CallbackFunc
}
StateChange struct that store the callbacks for a state.
func NewStateChange ¶
func NewStateChange() *StateChange
NewStateChange instantiates a new StateChange.
func (*StateChange) Listen ¶
func (sc *StateChange) Listen() error
/ Listen start the agent to listen for messages on the socket.
func (*StateChange) OnState ¶
func (sc *StateChange) OnState(state State, f CallbackFunc)
OnState register the callbacks for a state passed as argument.
type UpdatePackage ¶
Click to show internal directories.
Click to hide internal directories.