Documentation
¶
Index ¶
- type Manage
- type Management
- func (srv *Management) ActionList(orgID, username string, role int, deviceID string) web.ActionsResponse
- func (srv *Management) CreateUser(user domain.User) error
- func (srv *Management) DeviceGet(orgID, username string, role int, deviceID string) web.DeviceResponse
- func (srv *Management) DeviceList(orgID, username string, role int) web.DevicesResponse
- func (srv *Management) GetUser(username string) (domain.User, error)
- func (srv *Management) GroupCreate(orgID, username string, role int, body []byte) web.StandardResponse
- func (srv *Management) GroupDeviceLink(orgID, username string, role int, name, deviceID string) web.StandardResponse
- func (srv *Management) GroupDeviceUnlink(orgID, username string, role int, name, deviceID string) web.StandardResponse
- func (srv *Management) GroupDevices(orgID, username string, role int, name string) web.DevicesResponse
- func (srv *Management) GroupExcludedDevices(orgID, username string, role int, name string) web.DevicesResponse
- func (srv *Management) GroupList(orgID, username string, role int) web.GroupsResponse
- func (srv *Management) OpenIDNonceStore() openid.NonceStore
- func (srv *Management) OrganizationCreate(org domain.OrganizationCreate) error
- func (srv *Management) OrganizationForUserToggle(orgID, username string) error
- func (srv *Management) OrganizationGet(orgID string) (domain.Organization, error)
- func (srv *Management) OrganizationUpdate(org domain.Organization) error
- func (srv *Management) OrganizationsForUser(username string) ([]domain.Organization, error)
- func (srv *Management) RegDeviceGet(orgID, username string, role int, deviceID string) web.EnrollResponse
- func (srv *Management) RegDeviceList(orgID, username string, role int) web.DevicesResponse
- func (srv *Management) RegDeviceUpdate(orgID, username string, role int, deviceID string, body []byte) idweb.StandardResponse
- func (srv *Management) RegisterDevice(orgID, username string, role int, body []byte) web.RegisterResponse
- func (srv *Management) SnapConfigSet(orgID, username string, role int, deviceID, snap string, config []byte) web.StandardResponse
- func (srv *Management) SnapInstall(orgID, username string, role int, deviceID, snap string) web.StandardResponse
- func (srv *Management) SnapList(orgID, username string, role int, deviceID string) web.SnapsResponse
- func (srv *Management) SnapListOnDevice(orgID, username string, role int, deviceID string) web.StandardResponse
- func (srv *Management) SnapRemove(orgID, username string, role int, deviceID, snap string) web.StandardResponse
- func (srv *Management) SnapUpdate(orgID, username string, role int, deviceID, snap, action string) web.StandardResponse
- func (srv *Management) UserDelete(username string) error
- func (srv *Management) UserList() ([]domain.User, error)
- func (srv *Management) UserUpdate(user domain.User) error
- type MockManage
- func (m *MockManage) ActionList(orgID, username string, role int, deviceID string) web.ActionsResponse
- func (m *MockManage) CreateUser(user domain.User) error
- func (m *MockManage) DeviceGet(orgID, username string, role int, deviceID string) web.DeviceResponse
- func (m *MockManage) DeviceList(orgID, username string, role int) web.DevicesResponse
- func (m *MockManage) GetUser(username string) (domain.User, error)
- func (m *MockManage) GroupCreate(orgID, username string, role int, body []byte) web.StandardResponse
- func (m *MockManage) GroupDeviceLink(orgID, username string, role int, name, deviceID string) web.StandardResponse
- func (m *MockManage) GroupDeviceUnlink(orgID, username string, role int, name, deviceID string) web.StandardResponse
- func (m *MockManage) GroupDevices(orgID, username string, role int, name string) web.DevicesResponse
- func (m *MockManage) GroupExcludedDevices(orgID, username string, role int, name string) web.DevicesResponse
- func (m *MockManage) GroupList(orgID, username string, role int) web.GroupsResponse
- func (m *MockManage) OpenIDNonceStore() openid.NonceStore
- func (m *MockManage) OrganizationCreate(org domain.OrganizationCreate) error
- func (m *MockManage) OrganizationForUserToggle(orgID, username string) error
- func (m *MockManage) OrganizationGet(orgID string) (domain.Organization, error)
- func (m *MockManage) OrganizationUpdate(org domain.Organization) error
- func (m *MockManage) OrganizationsForUser(username string) ([]domain.Organization, error)
- func (m *MockManage) RegDeviceGet(orgID, username string, role int, deviceID string) idweb.EnrollResponse
- func (m *MockManage) RegDeviceList(orgID, username string, role int) idweb.DevicesResponse
- func (m *MockManage) RegDeviceUpdate(orgID, username string, role int, deviceID string, body []byte) idweb.StandardResponse
- func (m *MockManage) RegisterDevice(orgID, username string, role int, body []byte) idweb.RegisterResponse
- func (m *MockManage) SnapConfigSet(orgID, username string, role int, deviceID, snap string, config []byte) web.StandardResponse
- func (m *MockManage) SnapInstall(orgID, username string, role int, deviceID, snap string) web.StandardResponse
- func (m *MockManage) SnapList(orgID, username string, role int, deviceID string) web.SnapsResponse
- func (m *MockManage) SnapListOnDevice(orgID, username string, role int, deviceID string) web.StandardResponse
- func (m *MockManage) SnapRemove(orgID, username string, role int, deviceID, snap string) web.StandardResponse
- func (m *MockManage) SnapUpdate(orgID, username string, role int, deviceID, snap, action string) web.StandardResponse
- func (m *MockManage) UserDelete(username string) error
- func (m *MockManage) UserList() ([]domain.User, error)
- func (m *MockManage) UserUpdate(user domain.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manage ¶
type Manage interface { OpenIDNonceStore() openid.NonceStore CreateUser(user domain.User) error GetUser(username string) (domain.User, error) UserList() ([]domain.User, error) UserUpdate(user domain.User) error UserDelete(username string) error RegDeviceList(orgID, username string, role int) idweb.DevicesResponse RegisterDevice(orgID, username string, role int, body []byte) idweb.RegisterResponse RegDeviceGet(orgID, username string, role int, deviceID string) idweb.EnrollResponse RegDeviceUpdate(orgID, username string, role int, deviceID string, body []byte) idweb.StandardResponse DeviceList(orgID, username string, role int) web.DevicesResponse DeviceGet(orgID, username string, role int, deviceID string) web.DeviceResponse ActionList(orgID, username string, role int, deviceID string) web.ActionsResponse SnapList(orgID, username string, role int, deviceID string) web.SnapsResponse SnapListOnDevice(orgID, username string, role int, deviceID string) web.StandardResponse SnapInstall(orgID, username string, role int, deviceID, snap string) web.StandardResponse SnapRemove(orgID, username string, role int, deviceID, snap string) web.StandardResponse SnapUpdate(orgID, username string, role int, deviceID, snap, action string) web.StandardResponse SnapConfigSet(orgID, username string, role int, deviceID, snap string, config []byte) web.StandardResponse GroupList(orgID, username string, role int) web.GroupsResponse GroupCreate(orgID, username string, role int, body []byte) web.StandardResponse GroupDevices(orgID, username string, role int, name string) web.DevicesResponse GroupExcludedDevices(orgID, username string, role int, name string) web.DevicesResponse GroupDeviceLink(orgID, username string, role int, name, deviceID string) web.StandardResponse GroupDeviceUnlink(orgID, username string, role int, name, deviceID string) web.StandardResponse OrganizationsForUser(username string) ([]domain.Organization, error) OrganizationForUserToggle(orgID, username string) error OrganizationGet(orgID string) (domain.Organization, error) OrganizationCreate(org domain.OrganizationCreate) error OrganizationUpdate(org domain.Organization) error }
Manage interface for the service
type Management ¶
type Management struct { Settings *config.Settings DB datastore.DataStore TwinAPI twinapi.Client IdentityAPI identityapi.Client }
Management implementation of the management service use cases
func NewManagement ¶
func NewManagement(settings *config.Settings, db datastore.DataStore, api twinapi.Client, id identityapi.Client) *Management
NewManagement creates an implementation of the management use cases
func (*Management) ActionList ¶
func (srv *Management) ActionList(orgID, username string, role int, deviceID string) web.ActionsResponse
ActionList gets the actions for a device
func (*Management) CreateUser ¶
func (srv *Management) CreateUser(user domain.User) error
CreateUser creates a new user
func (*Management) DeviceGet ¶
func (srv *Management) DeviceGet(orgID, username string, role int, deviceID string) web.DeviceResponse
DeviceGet gets the device for an organization
func (*Management) DeviceList ¶
func (srv *Management) DeviceList(orgID, username string, role int) web.DevicesResponse
DeviceList gets the devices a user can access for an organization
func (*Management) GetUser ¶
func (srv *Management) GetUser(username string) (domain.User, error)
GetUser fetches a user from the database
func (*Management) GroupCreate ¶
func (srv *Management) GroupCreate(orgID, username string, role int, body []byte) web.StandardResponse
GroupCreate creates a device group
func (*Management) GroupDeviceLink ¶
func (srv *Management) GroupDeviceLink(orgID, username string, role int, name, deviceID string) web.StandardResponse
GroupDeviceLink links a device to a group
func (*Management) GroupDeviceUnlink ¶
func (srv *Management) GroupDeviceUnlink(orgID, username string, role int, name, deviceID string) web.StandardResponse
GroupDeviceUnlink unlinks a device from a group
func (*Management) GroupDevices ¶
func (srv *Management) GroupDevices(orgID, username string, role int, name string) web.DevicesResponse
GroupDevices lists the devices for a groups
func (*Management) GroupExcludedDevices ¶
func (srv *Management) GroupExcludedDevices(orgID, username string, role int, name string) web.DevicesResponse
GroupExcludedDevices lists the devices for a groups
func (*Management) GroupList ¶
func (srv *Management) GroupList(orgID, username string, role int) web.GroupsResponse
GroupList lists the device groups
func (*Management) OpenIDNonceStore ¶
func (srv *Management) OpenIDNonceStore() openid.NonceStore
OpenIDNonceStore fetches the OpenID nonce store
func (*Management) OrganizationCreate ¶
func (srv *Management) OrganizationCreate(org domain.OrganizationCreate) error
OrganizationCreate creates a new organization
func (*Management) OrganizationForUserToggle ¶
func (srv *Management) OrganizationForUserToggle(orgID, username string) error
OrganizationForUserToggle toggles organization access for a user
func (*Management) OrganizationGet ¶
func (srv *Management) OrganizationGet(orgID string) (domain.Organization, error)
OrganizationGet fetches an organization
func (*Management) OrganizationUpdate ¶
func (srv *Management) OrganizationUpdate(org domain.Organization) error
OrganizationUpdate updates an organization
func (*Management) OrganizationsForUser ¶
func (srv *Management) OrganizationsForUser(username string) ([]domain.Organization, error)
OrganizationsForUser fetches the organizations for a user
func (*Management) RegDeviceGet ¶
func (srv *Management) RegDeviceGet(orgID, username string, role int, deviceID string) web.EnrollResponse
RegDeviceGet fetches a device registration
func (*Management) RegDeviceList ¶
func (srv *Management) RegDeviceList(orgID, username string, role int) web.DevicesResponse
RegDeviceList gets the registered devices a user can access for an organization
func (*Management) RegDeviceUpdate ¶
func (srv *Management) RegDeviceUpdate(orgID, username string, role int, deviceID string, body []byte) idweb.StandardResponse
RegDeviceUpdate updates a device registration
func (*Management) RegisterDevice ¶
func (srv *Management) RegisterDevice(orgID, username string, role int, body []byte) web.RegisterResponse
RegisterDevice registers a new device
func (*Management) SnapConfigSet ¶
func (srv *Management) SnapConfigSet(orgID, username string, role int, deviceID, snap string, config []byte) web.StandardResponse
SnapConfigSet updates a snap config on a device
func (*Management) SnapInstall ¶
func (srv *Management) SnapInstall(orgID, username string, role int, deviceID, snap string) web.StandardResponse
SnapInstall installs a snap on a device
func (*Management) SnapList ¶
func (srv *Management) SnapList(orgID, username string, role int, deviceID string) web.SnapsResponse
SnapList lists the snaps for a device
func (*Management) SnapListOnDevice ¶
func (srv *Management) SnapListOnDevice(orgID, username string, role int, deviceID string) web.StandardResponse
SnapListOnDevice lists snaps on a device
func (*Management) SnapRemove ¶
func (srv *Management) SnapRemove(orgID, username string, role int, deviceID, snap string) web.StandardResponse
SnapRemove uninstalls a snap on a device
func (*Management) SnapUpdate ¶
func (srv *Management) SnapUpdate(orgID, username string, role int, deviceID, snap, action string) web.StandardResponse
SnapUpdate enables/disables/refreshes a snap on a device
func (*Management) UserDelete ¶
func (srv *Management) UserDelete(username string) error
UserDelete removes a user
func (*Management) UserList ¶
func (srv *Management) UserList() ([]domain.User, error)
UserList fetches the existing users
func (*Management) UserUpdate ¶
func (srv *Management) UserUpdate(user domain.User) error
UserUpdate updates a new user
type MockManage ¶
MockManage mocks the management service
func NewMockManagement ¶
func NewMockManagement(db datastore.DataStore) *MockManage
NewMockManagement creates an implementation of the management use cases
func (*MockManage) ActionList ¶
func (m *MockManage) ActionList(orgID, username string, role int, deviceID string) web.ActionsResponse
ActionList mocks fetching action list
func (*MockManage) CreateUser ¶
func (m *MockManage) CreateUser(user domain.User) error
CreateUser mocks creating a user
func (*MockManage) DeviceGet ¶
func (m *MockManage) DeviceGet(orgID, username string, role int, deviceID string) web.DeviceResponse
DeviceGet mocks fetching a device
func (*MockManage) DeviceList ¶
func (m *MockManage) DeviceList(orgID, username string, role int) web.DevicesResponse
DeviceList mocks fetching devices
func (*MockManage) GetUser ¶
func (m *MockManage) GetUser(username string) (domain.User, error)
GetUser mocks fetching a user
func (*MockManage) GroupCreate ¶
func (m *MockManage) GroupCreate(orgID, username string, role int, body []byte) web.StandardResponse
GroupCreate mocks creating a group
func (*MockManage) GroupDeviceLink ¶
func (m *MockManage) GroupDeviceLink(orgID, username string, role int, name, deviceID string) web.StandardResponse
GroupDeviceLink mocks linking a device to a group
func (*MockManage) GroupDeviceUnlink ¶
func (m *MockManage) GroupDeviceUnlink(orgID, username string, role int, name, deviceID string) web.StandardResponse
GroupDeviceUnlink mocks unlinking a device from a group
func (*MockManage) GroupDevices ¶
func (m *MockManage) GroupDevices(orgID, username string, role int, name string) web.DevicesResponse
GroupDevices mocks listing devices for a group
func (*MockManage) GroupExcludedDevices ¶
func (m *MockManage) GroupExcludedDevices(orgID, username string, role int, name string) web.DevicesResponse
GroupExcludedDevices mocks listing devices not in a group
func (*MockManage) GroupList ¶
func (m *MockManage) GroupList(orgID, username string, role int) web.GroupsResponse
GroupList mocks listing groups
func (*MockManage) OpenIDNonceStore ¶
func (m *MockManage) OpenIDNonceStore() openid.NonceStore
OpenIDNonceStore mocks the openid nonce store
func (*MockManage) OrganizationCreate ¶
func (m *MockManage) OrganizationCreate(org domain.OrganizationCreate) error
OrganizationCreate mocks creating an organization
func (*MockManage) OrganizationForUserToggle ¶
func (m *MockManage) OrganizationForUserToggle(orgID, username string) error
OrganizationForUserToggle mocks toggling user access to an organization
func (*MockManage) OrganizationGet ¶
func (m *MockManage) OrganizationGet(orgID string) (domain.Organization, error)
OrganizationGet mocks fetching an organization
func (*MockManage) OrganizationUpdate ¶
func (m *MockManage) OrganizationUpdate(org domain.Organization) error
OrganizationUpdate mocks updating an organization
func (*MockManage) OrganizationsForUser ¶
func (m *MockManage) OrganizationsForUser(username string) ([]domain.Organization, error)
OrganizationsForUser mocks organizations for a user
func (*MockManage) RegDeviceGet ¶
func (m *MockManage) RegDeviceGet(orgID, username string, role int, deviceID string) idweb.EnrollResponse
RegDeviceGet mocks fetching a registered device
func (*MockManage) RegDeviceList ¶
func (m *MockManage) RegDeviceList(orgID, username string, role int) idweb.DevicesResponse
RegDeviceList mocks listing registered devices
func (*MockManage) RegDeviceUpdate ¶
func (m *MockManage) RegDeviceUpdate(orgID, username string, role int, deviceID string, body []byte) idweb.StandardResponse
RegDeviceUpdate mocks updating a registered device
func (*MockManage) RegisterDevice ¶
func (m *MockManage) RegisterDevice(orgID, username string, role int, body []byte) idweb.RegisterResponse
RegisterDevice mocks registering a device
func (*MockManage) SnapConfigSet ¶
func (m *MockManage) SnapConfigSet(orgID, username string, role int, deviceID, snap string, config []byte) web.StandardResponse
SnapConfigSet mocks updating a snap config
func (*MockManage) SnapInstall ¶
func (m *MockManage) SnapInstall(orgID, username string, role int, deviceID, snap string) web.StandardResponse
SnapInstall mocks installing a snap
func (*MockManage) SnapList ¶
func (m *MockManage) SnapList(orgID, username string, role int, deviceID string) web.SnapsResponse
SnapList mocks listing snaps
func (*MockManage) SnapListOnDevice ¶
func (m *MockManage) SnapListOnDevice(orgID, username string, role int, deviceID string) web.StandardResponse
SnapListOnDevice mocks listing snaps
func (*MockManage) SnapRemove ¶
func (m *MockManage) SnapRemove(orgID, username string, role int, deviceID, snap string) web.StandardResponse
SnapRemove mocks uninstalling a snap
func (*MockManage) SnapUpdate ¶
func (m *MockManage) SnapUpdate(orgID, username string, role int, deviceID, snap, action string) web.StandardResponse
SnapUpdate mocks updating a snap
func (*MockManage) UserDelete ¶
func (m *MockManage) UserDelete(username string) error
UserDelete mocks removing a user
func (*MockManage) UserList ¶
func (m *MockManage) UserList() ([]domain.User, error)
UserList mocks fetching users
func (*MockManage) UserUpdate ¶
func (m *MockManage) UserUpdate(user domain.User) error
UserUpdate mocks updating a user