Documentation
¶
Overview ¶
Package twinapi provides the interface and implementation of Client to interact with the DeviceTwin REST API
Index ¶
- Variables
- type Client
- type ClientAdapter
- func (a *ClientAdapter) ActionList(orgID, deviceID string) web.ActionsResponse
- func (a *ClientAdapter) DeviceDelete(orgID, deviceID string) web.StandardResponse
- func (a *ClientAdapter) DeviceGet(orgID, deviceID string) web.DeviceResponse
- func (a *ClientAdapter) DeviceList(orgID string) web.DevicesResponse
- func (a *ClientAdapter) DeviceLogs(orgID, deviceID string, body []byte) web.StandardResponse
- func (a *ClientAdapter) DeviceUsersAction(orgID, deviceID string, body []byte) web.StandardResponse
- func (a *ClientAdapter) GroupCreate(orgID string, body []byte) web.StandardResponse
- func (a *ClientAdapter) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse
- func (a *ClientAdapter) GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse
- func (a *ClientAdapter) GroupDevices(orgID, name string) web.DevicesResponse
- func (a *ClientAdapter) GroupExcludedDevices(orgID, name string) web.DevicesResponse
- func (a *ClientAdapter) GroupList(orgID string) web.GroupsResponse
- func (a *ClientAdapter) SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse
- func (a *ClientAdapter) SnapInstall(orgID, deviceID, snap string) web.StandardResponse
- func (a *ClientAdapter) SnapList(orgID, deviceID string) web.SnapsResponse
- func (a *ClientAdapter) SnapListOnDevice(orgID, deviceID string) web.StandardResponse
- func (a *ClientAdapter) SnapRemove(orgID, deviceID, snap string) web.StandardResponse
- func (a *ClientAdapter) SnapServiceAction(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
- func (a *ClientAdapter) SnapSnapshot(orgID, deviceID, snap string, body []byte) web.StandardResponse
- func (a *ClientAdapter) SnapUpdate(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
- type MockClient
- func (m *MockClient) ActionList(orgID, deviceID string) web.ActionsResponse
- func (m *MockClient) DeviceDelete(orgID, deviceID string) web.StandardResponse
- func (m *MockClient) DeviceGet(orgID, deviceID string) web.DeviceResponse
- func (m *MockClient) DeviceList(orgID string) web.DevicesResponse
- func (m *MockClient) DeviceLogs(orgID, deviceID string, body []byte) web.StandardResponse
- func (m *MockClient) DeviceUsersAction(orgID, deviceID string, body []byte) web.StandardResponse
- func (m *MockClient) GroupCreate(orgID string, body []byte) web.StandardResponse
- func (m *MockClient) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse
- func (m *MockClient) GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse
- func (m *MockClient) GroupDevices(orgID, name string) web.DevicesResponse
- func (m *MockClient) GroupExcludedDevices(orgID, name string) web.DevicesResponse
- func (m *MockClient) GroupList(orgID string) web.GroupsResponse
- func (m *MockClient) SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse
- func (m *MockClient) SnapInstall(orgID, deviceID, snap string) web.StandardResponse
- func (m *MockClient) SnapList(orgID, deviceID string) web.SnapsResponse
- func (m *MockClient) SnapListOnDevice(orgID, deviceID string) web.StandardResponse
- func (m *MockClient) SnapRemove(orgID, deviceID, snap string) web.StandardResponse
- func (m *MockClient) SnapServiceAction(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
- func (m *MockClient) SnapSnapshot(orgID, deviceID, snap string, body []byte) web.StandardResponse
- func (m *MockClient) SnapUpdate(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
Constants ¶
This section is empty.
Variables ¶
var AddAuthorization = requests.DefaultAddAuthorization
AddAuthorization is a variable way to add authorization to a request with a default that checks for an explicit disabled if no other function is provided and otherwise panics
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { DeviceList(orgID string) web.DevicesResponse DeviceGet(orgID, deviceID string) web.DeviceResponse DeviceDelete(orgID, deviceID string) web.StandardResponse DeviceLogs(orgID, deviceID string, body []byte) web.StandardResponse DeviceUsersAction(orgID, deviceID string, body []byte) web.StandardResponse ActionList(orgID, deviceID string) web.ActionsResponse SnapList(orgID, deviceID string) web.SnapsResponse SnapSnapshot(orgID, deviceID, snap string, body []byte) web.StandardResponse SnapListOnDevice(orgID, deviceID string) web.StandardResponse SnapInstall(orgID, deviceID, snap string) web.StandardResponse SnapRemove(orgID, deviceID, snap string) web.StandardResponse SnapUpdate(orgID, deviceID, snap, action string, body []byte) web.StandardResponse SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse SnapServiceAction(orgID, deviceID, snap, action string, body []byte) web.StandardResponse GroupList(orgID string) web.GroupsResponse GroupCreate(orgID string, body []byte) web.StandardResponse GroupDevices(orgID, name string) web.DevicesResponse GroupExcludedDevices(orgID, name string) web.DevicesResponse GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse }
Client is a client for the device twin API
type ClientAdapter ¶
type ClientAdapter struct { URL string // contains filtered or unexported fields }
ClientAdapter adapts our expectations to device twin API
func NewClientAdapter ¶
func NewClientAdapter(u string) (*ClientAdapter, error)
NewClientAdapter creates an adapter to access the device twin service
func (*ClientAdapter) ActionList ¶
func (a *ClientAdapter) ActionList(orgID, deviceID string) web.ActionsResponse
ActionList fetches actions for a device
func (*ClientAdapter) DeviceDelete ¶
func (a *ClientAdapter) DeviceDelete(orgID, deviceID string) web.StandardResponse
DeviceDelete fetches a device for an account
func (*ClientAdapter) DeviceGet ¶
func (a *ClientAdapter) DeviceGet(orgID, deviceID string) web.DeviceResponse
DeviceGet fetches a device for an account
func (*ClientAdapter) DeviceList ¶
func (a *ClientAdapter) DeviceList(orgID string) web.DevicesResponse
DeviceList lists the devices for an account
func (*ClientAdapter) DeviceLogs ¶
func (a *ClientAdapter) DeviceLogs(orgID, deviceID string, body []byte) web.StandardResponse
DeviceLogs sends a request to the DeviceTwin REST API for a given devices logs
func (*ClientAdapter) DeviceUsersAction ¶
func (a *ClientAdapter) DeviceUsersAction(orgID, deviceID string, body []byte) web.StandardResponse
DeviceUsersAction sends a user action to a device and decodes it into a StandardResponse
func (*ClientAdapter) GroupCreate ¶
func (a *ClientAdapter) GroupCreate(orgID string, body []byte) web.StandardResponse
GroupCreate creates a device group
func (*ClientAdapter) GroupDeviceLink ¶
func (a *ClientAdapter) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse
GroupDeviceLink links a device with a group
func (*ClientAdapter) GroupDeviceUnlink ¶
func (a *ClientAdapter) GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse
GroupDeviceUnlink unlinks a device from a group
func (*ClientAdapter) GroupDevices ¶
func (a *ClientAdapter) GroupDevices(orgID, name string) web.DevicesResponse
GroupDevices lists the devices for a group
func (*ClientAdapter) GroupExcludedDevices ¶
func (a *ClientAdapter) GroupExcludedDevices(orgID, name string) web.DevicesResponse
GroupExcludedDevices lists the devices for a group
func (*ClientAdapter) GroupList ¶
func (a *ClientAdapter) GroupList(orgID string) web.GroupsResponse
GroupList lists the device groups
func (*ClientAdapter) SnapConfigSet ¶
func (a *ClientAdapter) SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse
SnapConfigSet sets a snap config on a device
func (*ClientAdapter) SnapInstall ¶
func (a *ClientAdapter) SnapInstall(orgID, deviceID, snap string) web.StandardResponse
SnapInstall installs a snap on a device
func (*ClientAdapter) SnapList ¶
func (a *ClientAdapter) SnapList(orgID, deviceID string) web.SnapsResponse
SnapList lists the snaps for a device
func (*ClientAdapter) SnapListOnDevice ¶
func (a *ClientAdapter) SnapListOnDevice(orgID, deviceID string) web.StandardResponse
SnapListOnDevice triggers snap list on a device
func (*ClientAdapter) SnapRemove ¶
func (a *ClientAdapter) SnapRemove(orgID, deviceID, snap string) web.StandardResponse
SnapRemove uninstalls a snap on a device
func (*ClientAdapter) SnapServiceAction ¶
func (a *ClientAdapter) SnapServiceAction(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
func (*ClientAdapter) SnapSnapshot ¶
func (a *ClientAdapter) SnapSnapshot(orgID, deviceID, snap string, body []byte) web.StandardResponse
SnapSnapshot sends a snap snapshot request to a device and decodes it into a StandardResponse
func (*ClientAdapter) SnapUpdate ¶
func (a *ClientAdapter) SnapUpdate(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
SnapUpdate enables/disables/refreshes/switch a snap on a device
type MockClient ¶
type MockClient struct{}
nolint
func (*MockClient) ActionList ¶
func (m *MockClient) ActionList(orgID, deviceID string) web.ActionsResponse
nolint
func (*MockClient) DeviceDelete ¶
func (m *MockClient) DeviceDelete(orgID, deviceID string) web.StandardResponse
nolint
func (*MockClient) DeviceGet ¶
func (m *MockClient) DeviceGet(orgID, deviceID string) web.DeviceResponse
nolint
func (*MockClient) DeviceList ¶
func (m *MockClient) DeviceList(orgID string) web.DevicesResponse
nolint
func (*MockClient) DeviceLogs ¶
func (m *MockClient) DeviceLogs(orgID, deviceID string, body []byte) web.StandardResponse
nolint
func (*MockClient) DeviceUsersAction ¶
func (m *MockClient) DeviceUsersAction(orgID, deviceID string, body []byte) web.StandardResponse
nolint
func (*MockClient) GroupCreate ¶
func (m *MockClient) GroupCreate(orgID string, body []byte) web.StandardResponse
nolint
func (*MockClient) GroupDeviceLink ¶
func (m *MockClient) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse
nolint
func (*MockClient) GroupDeviceUnlink ¶
func (m *MockClient) GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse
nolint
func (*MockClient) GroupDevices ¶
func (m *MockClient) GroupDevices(orgID, name string) web.DevicesResponse
nolint
func (*MockClient) GroupExcludedDevices ¶
func (m *MockClient) GroupExcludedDevices(orgID, name string) web.DevicesResponse
nolint
func (*MockClient) GroupList ¶
func (m *MockClient) GroupList(orgID string) web.GroupsResponse
nolint
func (*MockClient) SnapConfigSet ¶
func (m *MockClient) SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse
nolint
func (*MockClient) SnapInstall ¶
func (m *MockClient) SnapInstall(orgID, deviceID, snap string) web.StandardResponse
nolint
func (*MockClient) SnapList ¶
func (m *MockClient) SnapList(orgID, deviceID string) web.SnapsResponse
nolint
func (*MockClient) SnapListOnDevice ¶
func (m *MockClient) SnapListOnDevice(orgID, deviceID string) web.StandardResponse
nolint
func (*MockClient) SnapRemove ¶
func (m *MockClient) SnapRemove(orgID, deviceID, snap string) web.StandardResponse
nolint
func (*MockClient) SnapServiceAction ¶
func (m *MockClient) SnapServiceAction(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
nolint
func (*MockClient) SnapSnapshot ¶
func (m *MockClient) SnapSnapshot(orgID, deviceID, snap string, body []byte) web.StandardResponse
nolint
func (*MockClient) SnapUpdate ¶
func (m *MockClient) SnapUpdate(orgID, deviceID, snap, action string, body []byte) web.StandardResponse
nolint