twinapi

package
v0.0.0-...-88bcfc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	DeviceList(orgID string) web.DevicesResponse
	DeviceGet(orgID, deviceID string) web.DeviceResponse
	ActionList(orgID, deviceID string) web.ActionsResponse
	SnapList(orgID, deviceID string) web.SnapsResponse

	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) web.StandardResponse
	SnapConfigSet(orgID, deviceID, snap string, config []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
}

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) 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) GroupCreate

func (a *ClientAdapter) GroupCreate(orgID string, body []byte) web.StandardResponse

GroupCreate creates a device group

func (a *ClientAdapter) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse

GroupDeviceLink links a device with a group

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) SnapUpdate

func (a *ClientAdapter) SnapUpdate(orgID, deviceID, snap, action string) web.StandardResponse

SnapUpdate enables/disables/refreshes a snap on a device

type MockClient

type MockClient struct{}

MockClient mocks the device twin client

func NewMockClient

func NewMockClient(body string) *MockClient

NewMockClient creates a mock client instance

func (*MockClient) ActionList

func (m *MockClient) ActionList(orgID, deviceID string) web.ActionsResponse

ActionList mocks the action list

func (*MockClient) DeviceGet

func (m *MockClient) DeviceGet(orgID, deviceID string) web.DeviceResponse

DeviceGet mocks the device fetch

func (*MockClient) DeviceList

func (m *MockClient) DeviceList(orgID string) web.DevicesResponse

DeviceList mocks the device list call

func (*MockClient) GroupCreate

func (m *MockClient) GroupCreate(orgID string, body []byte) web.StandardResponse

GroupCreate mocks creating a device groups

func (m *MockClient) GroupDeviceLink(orgID, name, deviceID string) web.StandardResponse

GroupDeviceLink mocks linking a device to a group

func (m *MockClient) GroupDeviceUnlink(orgID, name, deviceID string) web.StandardResponse

GroupDeviceUnlink mocks unlinking a device from a group

func (*MockClient) GroupDevices

func (m *MockClient) GroupDevices(orgID, name string) web.DevicesResponse

GroupDevices mocks listing devices for a groups

func (*MockClient) GroupExcludedDevices

func (m *MockClient) GroupExcludedDevices(orgID, name string) web.DevicesResponse

GroupExcludedDevices mocks listing devices not in a groups

func (*MockClient) GroupList

func (m *MockClient) GroupList(orgID string) web.GroupsResponse

GroupList mocks listing device groups

func (*MockClient) SnapConfigSet

func (m *MockClient) SnapConfigSet(orgID, deviceID, snap string, config []byte) web.StandardResponse

SnapConfigSet mocks a snap config update

func (*MockClient) SnapInstall

func (m *MockClient) SnapInstall(orgID, deviceID, snap string) web.StandardResponse

SnapInstall mocks a snap installation

func (*MockClient) SnapList

func (m *MockClient) SnapList(orgID, deviceID string) web.SnapsResponse

SnapList mocks the snap list

func (*MockClient) SnapListOnDevice

func (m *MockClient) SnapListOnDevice(orgID, deviceID string) web.StandardResponse

SnapListOnDevice mocks the snap list

func (*MockClient) SnapRemove

func (m *MockClient) SnapRemove(orgID, deviceID, snap string) web.StandardResponse

SnapRemove mocks a snap removal

func (*MockClient) SnapUpdate

func (m *MockClient) SnapUpdate(orgID, deviceID, snap, action string) web.StandardResponse

SnapUpdate mocks a snap update request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL