Documentation ¶
Index ¶
- type DeviceUpdateRequest
- type EnrollDeviceRequest
- type Identity
- type IdentityService
- func (id IdentityService) DeviceGet(orgID, deviceID string) (*domain.Enrollment, error)
- func (id IdentityService) DeviceList(orgID string) ([]domain.Enrollment, error)
- func (id IdentityService) DeviceUpdate(orgID, deviceID string, req *DeviceUpdateRequest) error
- func (id IdentityService) EnrollDevice(req *EnrollDeviceRequest) (*domain.Enrollment, error)
- func (id IdentityService) OrganizationList() ([]domain.Organization, error)
- func (id IdentityService) RegisterDevice(req *RegisterDeviceRequest) (string, error)
- func (id IdentityService) RegisterOrganization(req *RegisterOrganizationRequest) (string, error)
- type RegisterDeviceRequest
- type RegisterOrganizationRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceUpdateRequest ¶
type DeviceUpdateRequest struct { DeviceData string `json:"deviceData"` Status int `json:"status"` }
DeviceUpdateRequest holds request to update a device registration
type EnrollDeviceRequest ¶
EnrollDeviceRequest is the request to enroll a device via assertions
type Identity ¶
type Identity interface { RegisterOrganization(req *RegisterOrganizationRequest) (string, error) RegisterDevice(req *RegisterDeviceRequest) (string, error) OrganizationList() ([]domain.Organization, error) DeviceList(orgID string) ([]domain.Enrollment, error) DeviceGet(orgID, deviceID string) (*domain.Enrollment, error) DeviceUpdate(orgID, deviceID string, req *DeviceUpdateRequest) error EnrollDevice(req *EnrollDeviceRequest) (*domain.Enrollment, error) }
Identity interface for the service
type IdentityService ¶
IdentityService implementation of the identity use cases
func NewIdentityService ¶
func NewIdentityService(settings *config.Settings, db datastore.DataStore) *IdentityService
NewIdentityService creates an implementation of the identity use cases
func (IdentityService) DeviceGet ¶
func (id IdentityService) DeviceGet(orgID, deviceID string) (*domain.Enrollment, error)
DeviceGet fetches a device registration
func (IdentityService) DeviceList ¶
func (id IdentityService) DeviceList(orgID string) ([]domain.Enrollment, error)
DeviceList fetches the registered devices
func (IdentityService) DeviceUpdate ¶
func (id IdentityService) DeviceUpdate(orgID, deviceID string, req *DeviceUpdateRequest) error
DeviceUpdate updates an existing device with the service Status changes are limited, depending on whether the device has enrolled with the service. If it has, then it already has credentials. If a device has not enrolled: - Waiting => Disabled - Disabled => Waiting If a device has enrolled: - Enrolled => Disabled (TODO: needs to trigger the removal of credentials from MQTT broker or device or both) - Enrolled => Waiting
func (IdentityService) EnrollDevice ¶
func (id IdentityService) EnrollDevice(req *EnrollDeviceRequest) (*domain.Enrollment, error)
EnrollDevice connects an IoT device with the service
func (IdentityService) OrganizationList ¶
func (id IdentityService) OrganizationList() ([]domain.Organization, error)
OrganizationList fetches the existing organizations
func (IdentityService) RegisterDevice ¶
func (id IdentityService) RegisterDevice(req *RegisterDeviceRequest) (string, error)
RegisterDevice registers a new device with the service
func (IdentityService) RegisterOrganization ¶
func (id IdentityService) RegisterOrganization(req *RegisterOrganizationRequest) (string, error)
RegisterOrganization registers a new organization with the service
type RegisterDeviceRequest ¶
type RegisterDeviceRequest struct { OrganizationID string `json:"orgid"` Brand string `json:"brand"` Model string `json:"model"` SerialNumber string `json:"serial"` DeviceData string `json:"deviceData"` }
RegisterDeviceRequest is the request to create a new device
type RegisterOrganizationRequest ¶
type RegisterOrganizationRequest struct { Name string `json:"name"` CountryName string `json:"country"` }
RegisterOrganizationRequest is the request to create a new organization