Documentation ¶
Overview ¶
Package controller is the interface to handling with REST API actions
Index ¶
- type Controller
- type Service
- func (srv *Service) ActionHandler(client MQTT.Client, msg MQTT.Message)
- func (srv *Service) ActionList(orgID, clientID string) ([]domain.Action, error)
- func (srv *Service) DeviceDelete(deviceID string) error
- func (srv *Service) DeviceGet(orgID, clientID string) (messages.Device, error)
- func (srv *Service) DeviceList(orgID string) ([]messages.Device, error)
- func (srv *Service) DeviceLogs(orgID, clientID string, logData *messages.DeviceLogs) error
- func (srv *Service) DeviceSnapConf(orgID, clientID, snap, settings string) error
- func (srv *Service) DeviceSnapInstall(orgID, clientID, snap string) error
- func (srv *Service) DeviceSnapList(orgID, clientID string) error
- func (srv *Service) DeviceSnapRemove(orgID, clientID, snap string) error
- func (srv *Service) DeviceSnapServiceAction(orgID, clientID, snap, action string, services *messages.SnapService) error
- func (srv *Service) DeviceSnapSnapshot(orgID, clientID, snap string, snapshotData *messages.SnapSnapshot) error
- func (srv *Service) DeviceSnapUpdate(orgID, clientID, snap, action string, snapUpdate *messages.SnapUpdate) error
- func (srv *Service) DeviceSnaps(orgID, clientID string) ([]messages.DeviceSnap, error)
- func (srv *Service) DeviceUnregister(orgID, clientID string) error
- func (srv *Service) GroupCreate(orgID, name string) error
- func (srv *Service) GroupGet(orgID, name string) (domain.Group, error)
- func (srv *Service) GroupGetDevices(orgID, name string) ([]messages.Device, error)
- func (srv *Service) GroupGetExcludedDevices(orgID, name string) ([]messages.Device, error)
- func (srv *Service) GroupLinkDevice(orgID, name, clientID string) error
- func (srv *Service) GroupList(orgID string) ([]domain.Group, error)
- func (srv *Service) GroupUnlinkDevice(orgID, name, clientID string) error
- func (srv *Service) HealthHandler(client MQTT.Client, msg MQTT.Message)
- func (srv *Service) SubscribeToActions() error
- func (srv *Service) User(orgID, clientID string, user *messages.DeviceUser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // MQTT handlers HealthHandler(client MQTT.Client, msg MQTT.Message) ActionHandler(client MQTT.Client, msg MQTT.Message) // Passthrough to the device twin service DeviceSnaps(orgID, clientID string) ([]messages.DeviceSnap, error) DeviceList(orgID string) ([]messages.Device, error) DeviceDelete(deviceID string) error DeviceGet(orgID, clientID string) (messages.Device, error) DeviceUnregister(orgID, clientID string) error DeviceLogs(orgID, clientID string, logData *messages.DeviceLogs) error GroupCreate(orgID, name string) error GroupList(orgID string) ([]domain.Group, error) GroupGet(orgID, name string) (domain.Group, error) GroupLinkDevice(orgID, name, clientID string) error GroupUnlinkDevice(orgID, name, clientID string) error GroupGetDevices(orgID, name string) ([]messages.Device, error) GroupGetExcludedDevices(orgID, name string) ([]messages.Device, error) // Actions on a device DeviceSnapList(orgID, clientID string) error DeviceSnapInstall(orgID, clientID, snap string) error DeviceSnapServiceAction(orgID, clientID, snap, action string, services *messages.SnapService) error DeviceSnapRemove(orgID, clientID, snap string) error DeviceSnapUpdate(orgID, clientID, snap, action string, snapUpdate *messages.SnapUpdate) error DeviceSnapConf(orgID, clientID, snap, settings string) error DeviceSnapSnapshot(orgID, clientID, snap string, s3data *messages.SnapSnapshot) error ActionList(orgID, clientID string) ([]domain.Action, error) User(orgID, clientID string, user *messages.DeviceUser) error }
Controller interface for the service
type Service ¶
type Service struct { MQTT mqtt.Connect DeviceTwin devicetwin.DeviceTwin }
Service implementation of the devicetwin service use cases
func NewService ¶
func NewService(url, port string, connect *config.MQTTConnect, twin devicetwin.DeviceTwin) *Service
NewService creates an implementation of the devicetwin use cases
func (*Service) ActionHandler ¶
ActionHandler is the handler for the main subscription topic
func (*Service) ActionList ¶
ActionList gets the action log for a device
func (*Service) DeviceDelete ¶
DeviceDelete deletes the device from the database cache
func (*Service) DeviceList ¶
DeviceList gets the devices from the database cache
func (*Service) DeviceLogs ¶
func (srv *Service) DeviceLogs(orgID, clientID string, logData *messages.DeviceLogs) error
DeviceLogs triggers an upload of snapd logs to S3
func (*Service) DeviceSnapConf ¶
DeviceSnapConf triggers a snap settings update on a device
func (*Service) DeviceSnapInstall ¶
DeviceSnapInstall triggers installing a snap on a device
func (*Service) DeviceSnapList ¶
DeviceSnapList triggers listing snaps on a device
func (*Service) DeviceSnapRemove ¶
DeviceSnapRemove triggers uninstalling a snap on a device
func (*Service) DeviceSnapServiceAction ¶
func (srv *Service) DeviceSnapServiceAction(orgID, clientID, snap, action string, services *messages.SnapService) error
DeviceSnapServiceAction triggers stop,`start, or restart for a snap on a device
func (*Service) DeviceSnapSnapshot ¶
func (srv *Service) DeviceSnapSnapshot(orgID, clientID, snap string, snapshotData *messages.SnapSnapshot) error
DeviceSnapSnapshot triggers uploading a snapshot of a snap on a device to S3
func (*Service) DeviceSnapUpdate ¶
func (srv *Service) DeviceSnapUpdate(orgID, clientID, snap, action string, snapUpdate *messages.SnapUpdate) error
DeviceSnapUpdate triggers a snap update on a device
func (*Service) DeviceSnaps ¶
func (srv *Service) DeviceSnaps(orgID, clientID string) ([]messages.DeviceSnap, error)
DeviceSnaps gets the device's snaps from the database cache
func (*Service) DeviceUnregister ¶
DeviceUnregister triggers unregister action on a device
func (*Service) GroupCreate ¶
GroupCreate creates a device group
func (*Service) GroupGetDevices ¶
GroupGetDevices retrieves the devices from a group
func (*Service) GroupGetExcludedDevices ¶
GroupGetExcludedDevices retrieves the devices not in a group
func (*Service) GroupLinkDevice ¶
GroupLinkDevice links a device to a group
func (*Service) GroupUnlinkDevice ¶
GroupUnlinkDevice unlinks a device from a group
func (*Service) HealthHandler ¶
HealthHandler is the handler for the devices health messages
func (*Service) SubscribeToActions ¶
SubscribeToActions subscribes to the published topics from the devices