Version: v0.0.0-...-6e89ea1 Latest Latest

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

Go to latest
Published: Mar 31, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0




View Source
const JSONHeader = "application/json; charset=UTF-8"

JSONHeader is the header for JSON responses


This section is empty.


func Logger

func Logger(start time.Time, r *http.Request)

Logger Handle logging for the web service

func Middleware

func Middleware(inner http.Handler) http.Handler

Middleware to pre-process web service requests


type DevicesResponse

type DevicesResponse struct {
	Devices []domain.Enrollment `json:"devices"`

DevicesResponse is the JSON response from a device list API method

type EnrollResponse

type EnrollResponse struct {
	Enrollment domain.Enrollment `json:"enrollment"`

EnrollResponse is the JSON response from an enrollment API method

type IdentityService

type IdentityService struct {
	Settings *config.Settings
	Identity service.Identity

IdentityService is the implementation of the web API

func NewIdentityService

func NewIdentityService(settings *config.Settings, id service.Identity) *IdentityService

NewIdentityService returns a new web controller

func (IdentityService) DeviceGet

func (wb IdentityService) DeviceGet(w http.ResponseWriter, r *http.Request)

DeviceGet fetches a device registration

func (IdentityService) DeviceList

func (wb IdentityService) DeviceList(w http.ResponseWriter, r *http.Request)

DeviceList fetches device registrations

func (IdentityService) DeviceUpdate

func (wb IdentityService) DeviceUpdate(w http.ResponseWriter, r *http.Request)

DeviceUpdate updates a device registration

func (IdentityService) EnrollDevice

func (wb IdentityService) EnrollDevice(w http.ResponseWriter, r *http.Request)

EnrollDevice connects an IoT device with the identity service

func (IdentityService) OrganizationList

func (wb IdentityService) OrganizationList(w http.ResponseWriter, r *http.Request)

OrganizationList fetches organizations

func (IdentityService) RegisterDevice

func (wb IdentityService) RegisterDevice(w http.ResponseWriter, r *http.Request)

RegisterDevice registers a new device with the identity service

func (IdentityService) RegisterOrganization

func (wb IdentityService) RegisterOrganization(w http.ResponseWriter, r *http.Request)

RegisterOrganization registers a new organization with the identity service

func (IdentityService) Router

func (wb IdentityService) Router() *mux.Router

Router returns the application router

func (IdentityService) Run

func (wb IdentityService) Run() error

Run starts the web service

type OrganizationsResponse

type OrganizationsResponse struct {
	Organizations []domain.Organization `json:"organizations"`

OrganizationsResponse is the JSON response from a organization list API method

type RegisterResponse

type RegisterResponse struct {
	ID string `json:"id"`

RegisterResponse is the JSON response from a registration API method

type StandardResponse

type StandardResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`

StandardResponse is the JSON response from an API method, indicating success or failure.

type Web

type Web interface {
	Run() error
	Router() *mux.Router
	RegisterOrganization(w http.ResponseWriter, r *http.Request)
	RegisterDevice(w http.ResponseWriter, r *http.Request)
	OrganizationList(w http.ResponseWriter, r *http.Request)
	DeviceList(w http.ResponseWriter, r *http.Request)

	EnrollDevice(w http.ResponseWriter, r *http.Request)

Web is the interface for the web API

Jump to

Keyboard shortcuts

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