twinapi

package
Version: v0.0.0-...-1a7bac6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: AGPL-3.0 Imports: 11 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
	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
}

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

func (*ClientAdapter) DeviceUsersAction

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

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

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 DeviceUser

type DeviceUser struct {
	Action       string `json:"action,omitempty"`
	Email        string `json:"email,omitempty"`
	ForceManaged bool   `json:"force-managed,omitempty"`
	Sudoer       bool   `json:"sudoer,omitempty"`
	Username     string `json:"username,omitempty"`
}

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

func (m *MockClient) DeviceLogs(orgID, deviceID, body []byte) web.StandardResponse

DeviceLogs mocks a device create logs request

func (*MockClient) DeviceUsersAction

func (m *MockClient) DeviceUsersAction(orgID, deviceID, body []byte) web.StandardResponse

DeviceUsersAction mocks a device create user request

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

func (m *MockClient) SnapSnapshot(orgID, deviceID, snap, body []byte) web.StandardResponse

SnapUpdate mocks a snap update request

func (*MockClient) SnapUpdate

func (m *MockClient) SnapUpdate(orgID, deviceID, snap, action string, body []byte) 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