Documentation
¶
Index ¶
- type DeviceTwin
- type MockDeviceTwin
- func (twin *MockDeviceTwin) ActionCreate(orgID, deviceID string, act domain.SubscribeAction) error
- func (twin *MockDeviceTwin) ActionList(orgID, clientID string) ([]domain.Action, error)
- func (twin *MockDeviceTwin) ActionResponse(clientID, actionID, action string, payload []byte) error
- func (twin *MockDeviceTwin) ActionUpdate(actionID, status, message string) error
- func (twin *MockDeviceTwin) DeviceGet(orgID, clientID string) (domain.Device, error)
- func (twin *MockDeviceTwin) DeviceList(orgID string) ([]domain.Device, error)
- func (twin *MockDeviceTwin) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
- func (twin *MockDeviceTwin) GroupCreate(orgID, name string) error
- func (twin *MockDeviceTwin) GroupGet(orgID, name string) (domain.Group, error)
- func (twin *MockDeviceTwin) GroupGetDevices(orgID, name string) ([]domain.Device, error)
- func (twin *MockDeviceTwin) GroupGetExcludedDevices(orgID, name string) ([]domain.Device, error)
- func (twin *MockDeviceTwin) GroupLinkDevice(orgID, name, clientID string) error
- func (twin *MockDeviceTwin) GroupList(orgID string) ([]domain.Group, error)
- func (twin *MockDeviceTwin) GroupUnlinkDevice(orgID, name, clientID string) error
- func (twin *MockDeviceTwin) HealthHandler(payload domain.Health) error
- type Service
- func (srv *Service) ActionCreate(orgID, deviceID string, action domain.SubscribeAction) error
- func (srv *Service) ActionList(orgID, deviceID string) ([]domain.Action, error)
- func (srv *Service) ActionResponse(clientID, actionID, action string, payload []byte) error
- func (srv *Service) ActionUpdate(actionID, status, message string) error
- func (srv *Service) DeviceGet(orgID, clientID string) (domain.Device, error)
- func (srv *Service) DeviceList(orgID string) ([]domain.Device, error)
- func (srv *Service) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, 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) ([]domain.Device, error)
- func (srv *Service) GroupGetExcludedDevices(orgID, name string) ([]domain.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(payload domain.Health) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceTwin ¶
type DeviceTwin interface {
HealthHandler(payload domain.Health) error
ActionResponse(clientID, actionID, action string, payload []byte) error // process a response from a device
ActionCreate(orgID, deviceID string, act domain.SubscribeAction) error
ActionUpdate(actionID, status, message string) error
ActionList(orgID, deviceID string) ([]domain.Action, error)
DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
DeviceList(orgID string) ([]domain.Device, error)
DeviceGet(orgID, clientID string) (domain.Device, 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) ([]domain.Device, error)
GroupGetExcludedDevices(orgID, name string) ([]domain.Device, error)
}
DeviceTwin interface for the service
type MockDeviceTwin ¶
type MockDeviceTwin struct {
Actions []string
}
MockDeviceTwin mocks a device twin service
func (*MockDeviceTwin) ActionCreate ¶
func (twin *MockDeviceTwin) ActionCreate(orgID, deviceID string, act domain.SubscribeAction) error
ActionCreate mocks the action log creation
func (*MockDeviceTwin) ActionList ¶
func (twin *MockDeviceTwin) ActionList(orgID, clientID string) ([]domain.Action, error)
ActionList mocks the action log list
func (*MockDeviceTwin) ActionResponse ¶
func (twin *MockDeviceTwin) ActionResponse(clientID, actionID, action string, payload []byte) error
ActionResponse mocks the action handler
func (*MockDeviceTwin) ActionUpdate ¶
func (twin *MockDeviceTwin) ActionUpdate(actionID, status, message string) error
ActionUpdate mocks the action log update
func (*MockDeviceTwin) DeviceGet ¶
func (twin *MockDeviceTwin) DeviceGet(orgID, clientID string) (domain.Device, error)
DeviceGet mocks fetching a device
func (*MockDeviceTwin) DeviceList ¶
func (twin *MockDeviceTwin) DeviceList(orgID string) ([]domain.Device, error)
DeviceList mocks fetching devices for an organization
func (*MockDeviceTwin) DeviceSnaps ¶
func (twin *MockDeviceTwin) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
DeviceSnaps mocks the snap list
func (*MockDeviceTwin) GroupCreate ¶
func (twin *MockDeviceTwin) GroupCreate(orgID, name string) error
GroupCreate mocks creating a group
func (*MockDeviceTwin) GroupGet ¶
func (twin *MockDeviceTwin) GroupGet(orgID, name string) (domain.Group, error)
GroupGet mocks fetching a group
func (*MockDeviceTwin) GroupGetDevices ¶
func (twin *MockDeviceTwin) GroupGetDevices(orgID, name string) ([]domain.Device, error)
GroupGetDevices mocks retrieving the devices for a group
func (*MockDeviceTwin) GroupGetExcludedDevices ¶
func (twin *MockDeviceTwin) GroupGetExcludedDevices(orgID, name string) ([]domain.Device, error)
GroupGetExcludedDevices mocks retrieving the devices not in a group
func (*MockDeviceTwin) GroupLinkDevice ¶
func (twin *MockDeviceTwin) GroupLinkDevice(orgID, name, clientID string) error
GroupLinkDevice mocks linking a device to a group
func (*MockDeviceTwin) GroupList ¶
func (twin *MockDeviceTwin) GroupList(orgID string) ([]domain.Group, error)
GroupList mocks listing groups
func (*MockDeviceTwin) GroupUnlinkDevice ¶
func (twin *MockDeviceTwin) GroupUnlinkDevice(orgID, name, clientID string) error
GroupUnlinkDevice mocks unlinking a device from a group
func (*MockDeviceTwin) HealthHandler ¶
func (twin *MockDeviceTwin) HealthHandler(payload domain.Health) error
HealthHandler mocks the health handler
type Service ¶
Service implementation of the identity use cases
func NewService ¶
NewService creates an implementation of the device twin use cases
func (*Service) ActionCreate ¶
func (srv *Service) ActionCreate(orgID, deviceID string, action domain.SubscribeAction) error
ActionCreate logs an action
func (*Service) ActionList ¶
ActionList lists actions for a device
func (*Service) ActionResponse ¶
ActionResponse handles action response from a device
func (*Service) ActionUpdate ¶
ActionUpdate updates action
func (*Service) DeviceList ¶
DeviceList fetches devices from the database cache
func (*Service) DeviceSnaps ¶
func (srv *Service) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
DeviceSnaps fetches the snaps for 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