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

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

Go to latest
Published: Jun 23, 2021 License: AGPL-3.0 Imports: 27 Imported by: 0




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

JSONHeader is the content-type header for JSON responses


This section is empty.


func Logger

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

Logger Handle logging for the web web

func Middleware

func Middleware(inner http.Handler) http.Handler

Middleware to pre-process web web requests


type OrganizationResponse

type OrganizationResponse struct {
	Organization domain.Organization `json:"organization"`

OrganizationResponse defines the response to list users

type OrganizationsResponse

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

OrganizationsResponse defines the response to list users

type Page

type Page struct {
	Title string

Page is the page details for the web application

type Service

type Service struct {
	Settings *config.Settings
	Manage   manage.Manage

Service is the implementation of the web API

func NewService

func NewService(settings *config.Settings, srv manage.Manage) *Service

NewService returns a new web controller

func (Service) ActionListHandler

func (wb Service) ActionListHandler(w http.ResponseWriter, r *http.Request)

ActionListHandler is the API method to get actions for a device

func (Service) DeviceDeleteHandler

func (wb Service) DeviceDeleteHandler(w http.ResponseWriter, r *http.Request)

DeviceDeleteHandler is the API method to delete a registered device

func (Service) DeviceGetHandler

func (wb Service) DeviceGetHandler(w http.ResponseWriter, r *http.Request)

DeviceGetHandler is the API method to get a registered device

func (Service) DeviceLogsHandler

func (wb Service) DeviceLogsHandler(w http.ResponseWriter, r *http.Request)

DeviceLogsHandler is the API method to get logs for a device

func (Service) DeviceUsersActionHandler

func (wb Service) DeviceUsersActionHandler(w http.ResponseWriter, r *http.Request)

DeviceUsersActionHandler is the API method to create a user for a device

func (Service) DevicesListHandler

func (wb Service) DevicesListHandler(w http.ResponseWriter, r *http.Request)

DevicesListHandler is the API method to list the registered devices

func (Service) GroupCreateHandler

func (wb Service) GroupCreateHandler(w http.ResponseWriter, r *http.Request)

GroupCreateHandler is the API method to create a group

func (Service) GroupDeviceLinkHandler

func (wb Service) GroupDeviceLinkHandler(w http.ResponseWriter, r *http.Request)

GroupDeviceLinkHandler is the API method to link a device to a group

func (Service) GroupDeviceUnlinkHandler

func (wb Service) GroupDeviceUnlinkHandler(w http.ResponseWriter, r *http.Request)

GroupDeviceUnlinkHandler is the API method to unlink a device from a group

func (Service) GroupDevicesHandler

func (wb Service) GroupDevicesHandler(w http.ResponseWriter, r *http.Request)

GroupDevicesHandler is the API method to list the devices for a group

func (Service) GroupExcludedDevicesHandler

func (wb Service) GroupExcludedDevicesHandler(w http.ResponseWriter, r *http.Request)

GroupExcludedDevicesHandler is the API method to list the devices not in a group

func (Service) GroupListHandler

func (wb Service) GroupListHandler(w http.ResponseWriter, r *http.Request)

GroupListHandler is the API method to list the groups

func (Service) IndexHandler

func (wb Service) IndexHandler(w http.ResponseWriter, r *http.Request)

IndexHandler is the front page of the web application

func (Service) JWTCheck

func (wb Service) JWTCheck(w http.ResponseWriter, r *http.Request) (*jwt.Token, error)

JWTCheck extracts the JWT from the request, validates it and returns the token

func (Service) LoginHandler

func (wb Service) LoginHandler(w http.ResponseWriter, r *http.Request)

LoginHandler processes the login for Ubuntu SSO

func (Service) LogoutHandler

func (wb Service) LogoutHandler(w http.ResponseWriter, r *http.Request)

LogoutHandler logs the user out by removing the cookie and the JWT authorization header

func (Service) OrganizationCreateHandler

func (wb Service) OrganizationCreateHandler(w http.ResponseWriter, r *http.Request)

OrganizationCreateHandler creates a new organization

func (Service) OrganizationGetHandler

func (wb Service) OrganizationGetHandler(w http.ResponseWriter, r *http.Request)

OrganizationGetHandler fetches an organization

func (Service) OrganizationListHandler

func (wb Service) OrganizationListHandler(w http.ResponseWriter, r *http.Request)

OrganizationListHandler returns the list of accounts

func (Service) OrganizationUpdateForUserHandler

func (wb Service) OrganizationUpdateForUserHandler(w http.ResponseWriter, r *http.Request)

OrganizationUpdateForUserHandler fetches the organizations for a user

func (Service) OrganizationUpdateHandler

func (wb Service) OrganizationUpdateHandler(w http.ResponseWriter, r *http.Request)

OrganizationUpdateHandler updates an organization

func (Service) OrganizationsForUserHandler

func (wb Service) OrganizationsForUserHandler(w http.ResponseWriter, r *http.Request)

OrganizationsForUserHandler fetches the organizations for a user

func (Service) RegDeviceGet

func (wb Service) RegDeviceGet(w http.ResponseWriter, r *http.Request)

RegDeviceGet is the API method to get a registered device

func (Service) RegDeviceGetDownload

func (wb Service) RegDeviceGetDownload(w http.ResponseWriter, r *http.Request)

RegDeviceGetDownload provides the download of the device data

func (Service) RegDeviceList

func (wb Service) RegDeviceList(w http.ResponseWriter, r *http.Request)

RegDeviceList is the API method to list the registered devices

func (Service) RegDeviceUpdate

func (wb Service) RegDeviceUpdate(w http.ResponseWriter, r *http.Request)

RegDeviceUpdate is the API method to update a registered device status

func (Service) RegisterDevice

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

RegisterDevice registers a new device with the Identity service

func (Service) Router

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

Router returns the application route handler for administrating the application

func (Service) Run

func (wb Service) Run() error

Run starts the web service

func (Service) SnapConfigUpdateHandler

func (wb Service) SnapConfigUpdateHandler(w http.ResponseWriter, r *http.Request)

SnapConfigUpdateHandler gets the config for a snap on a device

func (Service) SnapDeleteHandler

func (wb Service) SnapDeleteHandler(w http.ResponseWriter, r *http.Request)

SnapDeleteHandler uninstalls a snap from the device

func (Service) SnapInstallHandler

func (wb Service) SnapInstallHandler(w http.ResponseWriter, r *http.Request)

SnapInstallHandler installs a snap on the device

func (Service) SnapListHandler

func (wb Service) SnapListHandler(w http.ResponseWriter, r *http.Request)

SnapListHandler fetches the list of installed snaps from the device

func (Service) SnapListOnDevice

func (wb Service) SnapListOnDevice(w http.ResponseWriter, r *http.Request)

SnapListOnDevice lists snaps on the device

func (Service) SnapServiceAction

func (wb Service) SnapServiceAction(w http.ResponseWriter, r *http.Request)

SnapServiceAction start/stop/restart a snap on device

func (Service) SnapSnapshotHandler

func (wb Service) SnapSnapshotHandler(w http.ResponseWriter, r *http.Request)

func (Service) SnapUpdateHandler

func (wb Service) SnapUpdateHandler(w http.ResponseWriter, r *http.Request)

SnapUpdateHandler updates a snap on the device Permitted actions are: enable, disable, refresh, or switch

func (Service) StoreSearchHandler

func (wb Service) StoreSearchHandler(w http.ResponseWriter, r *http.Request)

StoreSearchHandler fetches the available snaps from the store

func (Service) TokenHandler

func (wb Service) TokenHandler(w http.ResponseWriter, r *http.Request)

TokenHandler returns CSRF protection new token in a X-CSRF-Token response header This method is also used by the /authtoken endpoint to return the JWT. The method indicates to the UI whether OpenID user auth is enabled

func (Service) UserCreateHandler

func (wb Service) UserCreateHandler(w http.ResponseWriter, r *http.Request)

UserCreateHandler handles user creation

func (Service) UserDeleteHandler

func (wb Service) UserDeleteHandler(w http.ResponseWriter, r *http.Request)

UserDeleteHandler handles user deletion

func (Service) UserGetHandler

func (wb Service) UserGetHandler(w http.ResponseWriter, r *http.Request)

UserGetHandler is the API method to fetch a user

func (Service) UserListHandler

func (wb Service) UserListHandler(w http.ResponseWriter, r *http.Request)

UserListHandler is the API method to list the users

func (Service) UserUpdateHandler

func (wb Service) UserUpdateHandler(w http.ResponseWriter, r *http.Request)

UserUpdateHandler handles user update

func (Service) VersionHandler

func (wb Service) VersionHandler(w http.ResponseWriter, r *http.Request)

VersionHandler is the API method to return the version of the web

type UserOrganization

type UserOrganization struct {
	Selected bool `json:"selected"`

UserOrganization defines an organization and whether it is selected for a user

type UserOrganizationsResponse

type UserOrganizationsResponse struct {
	Organizations []UserOrganization `json:"organizations"`

UserOrganizationsResponse defines the response to list users

type UserResponse

type UserResponse struct {
	User domain.User `json:"user"`

UserResponse defines the response to get a user

type UsersResponse

type UsersResponse struct {
	Users []domain.User `json:"users"`

UsersResponse defines the response to list users

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`

VersionResponse is the JSON response from the API Version method


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL