Documentation ¶
Overview ¶
Package web provides types and functionality for the REST API and web app static files
Index ¶
- Constants
- Variables
- type Account
- type OrganizationResponse
- type OrganizationsResponse
- type Page
- type Service
- func (wb Service) ActionListHandler(c *gin.Context)
- func (wb Service) DeviceDeleteHandler(c *gin.Context)
- func (wb Service) DeviceGetHandler(c *gin.Context)
- func (wb Service) DeviceLogsHandler(c *gin.Context)
- func (wb Service) DeviceUsersActionHandler(c *gin.Context)
- func (wb Service) DevicesListHandler(c *gin.Context)
- func (wb Service) GroupCreateHandler(c *gin.Context)
- func (wb Service) GroupDeviceLinkHandler(c *gin.Context)
- func (wb Service) GroupDeviceUnlinkHandler(c *gin.Context)
- func (wb Service) GroupDevicesHandler(c *gin.Context)
- func (wb Service) GroupExcludedDevicesHandler(c *gin.Context)
- func (wb Service) GroupListHandler(c *gin.Context)
- func (wb Service) IndexHandler(c *gin.Context)
- func (wb Service) JWTCheck(c *gin.Context) (*jwt.Token, error)
- func (wb Service) LoginHandler(c *gin.Context)
- func (wb Service) LoginHandlerAPIClient(c *gin.Context)
- func (wb Service) LogoutHandler(c *gin.Context)
- func (wb Service) OrganizationCreateHandler(c *gin.Context)
- func (wb Service) OrganizationGetHandler(c *gin.Context)
- func (wb Service) OrganizationListHandler(c *gin.Context)
- func (wb Service) OrganizationUpdateForUserHandler(c *gin.Context)
- func (wb Service) OrganizationUpdateHandler(c *gin.Context)
- func (wb Service) OrganizationsForUserHandler(c *gin.Context)
- func (wb Service) RegDeviceGet(c *gin.Context)
- func (wb Service) RegDeviceGetDownload(c *gin.Context)
- func (wb Service) RegDeviceList(c *gin.Context)
- func (wb Service) RegDeviceUpdate(c *gin.Context)
- func (wb Service) RegisterDevice(c *gin.Context)
- func (wb Service) Run()
- func (wb Service) SnapConfigUpdateHandler(c *gin.Context)
- func (wb Service) SnapDeleteHandler(c *gin.Context)
- func (wb Service) SnapInstallHandler(c *gin.Context)
- func (wb Service) SnapListHandler(c *gin.Context)
- func (wb Service) SnapListOnDevice(c *gin.Context)
- func (wb Service) SnapServiceAction(c *gin.Context)
- func (wb Service) SnapUpdateHandler(c *gin.Context)
- func (wb Service) StoreSearchHandler(c *gin.Context)
- func (wb Service) TokenHandler(c *gin.Context)
- func (wb Service) UserCreateHandler(c *gin.Context)
- func (wb Service) UserDeleteHandler(c *gin.Context)
- func (wb Service) UserGetHandler(c *gin.Context)
- func (wb Service) UserListHandler(c *gin.Context)
- func (wb Service) UserUpdateHandler(c *gin.Context)
- func (wb Service) VersionHandler(c *gin.Context)
- type UbuntuSingleSignOnServer
- type UserOrganization
- type UserOrganizationsResponse
- type UserResponse
- type UsersResponse
- type VersionResponse
Constants ¶
const JSONHeader = "application/json; charset=UTF-8"
JSONHeader is the content-type header for JSON responses
Variables ¶
var VerifyTokenAndUser = func(authorizationToken string, wb Service) (datastore.User, error) { return datastore.User{}, errors.New("service account authorization not configured") }
VerifyTokenAndUser is a variable function to verify the token and extract the user based on the current provider
Functions ¶
This section is empty.
Types ¶
type OrganizationResponse ¶
type OrganizationResponse struct { web.StandardResponse Organization domain.Organization `json:"organization"` }
OrganizationResponse defines the response to list users
type OrganizationsResponse ¶
type OrganizationsResponse struct { web.StandardResponse Organizations []domain.Organization `json:"organizations"` }
OrganizationsResponse defines the response to list users
type Service ¶
Service is the implementation of the web API
func NewService ¶
NewService returns a new web controller
func (Service) ActionListHandler ¶
ActionListHandler is the API method to get actions for a device
func (Service) DeviceDeleteHandler ¶
DeviceDeleteHandler is the API method to delete a registered device
func (Service) DeviceGetHandler ¶
DeviceGetHandler is the API method to get a registered device
func (Service) DeviceLogsHandler ¶
nolint DeviceLogsHandler is the API method to get logs for a device
func (Service) DeviceUsersActionHandler ¶
nolint DeviceUsersActionHandler is the API method to create a user for a device
func (Service) DevicesListHandler ¶
DevicesListHandler is the API method to list the registered devices
func (Service) GroupCreateHandler ¶
GroupCreateHandler is the API method to create a group
func (Service) GroupDeviceLinkHandler ¶
GroupDeviceLinkHandler is the API method to link a device to a group
func (Service) GroupDeviceUnlinkHandler ¶
nolint GroupDeviceUnlinkHandler is the API method to unlink a device from a group
func (Service) GroupDevicesHandler ¶
GroupDevicesHandler is the API method to list the devices for a group
func (Service) GroupExcludedDevicesHandler ¶
GroupExcludedDevicesHandler is the API method to list the devices not in a group
func (Service) GroupListHandler ¶
GroupListHandler is the API method to list the groups
func (Service) IndexHandler ¶
IndexHandler is the front page of the web application
func (Service) JWTCheck ¶
JWTCheck extracts the JWT from the request, validates it and returns the token
func (Service) LoginHandler ¶
LoginHandler processes the login for Ubuntu SSO
func (Service) LoginHandlerAPIClient ¶
LoginHandlerAPIClient processes the login for API client
func (Service) LogoutHandler ¶
LogoutHandler logs the user out by removing the cookie and the JWT authorization header
func (Service) OrganizationCreateHandler ¶
OrganizationCreateHandler creates a new organization
func (Service) OrganizationGetHandler ¶
OrganizationGetHandler fetches an organization
func (Service) OrganizationListHandler ¶
OrganizationListHandler returns the list of accounts
func (Service) OrganizationUpdateForUserHandler ¶
OrganizationUpdateForUserHandler fetches the organizations for a user
func (Service) OrganizationUpdateHandler ¶
OrganizationUpdateHandler updates an organization
func (Service) OrganizationsForUserHandler ¶
OrganizationsForUserHandler fetches the organizations for a user
func (Service) RegDeviceGet ¶
RegDeviceGet is the API method to get a registered device
func (Service) RegDeviceGetDownload ¶
RegDeviceGetDownload provides the download of the device data
func (Service) RegDeviceList ¶
RegDeviceList is the API method to list the registered devices
func (Service) RegDeviceUpdate ¶
RegDeviceUpdate is the API method to update a registered device status
func (Service) RegisterDevice ¶
RegisterDevice registers a new device with the Identity service
func (Service) SnapConfigUpdateHandler ¶
SnapConfigUpdateHandler gets the config for a snap on a device
func (Service) SnapDeleteHandler ¶
nolint SnapDeleteHandler uninstalls a snap from the device
func (Service) SnapInstallHandler ¶
SnapInstallHandler installs a snap on the device
func (Service) SnapListHandler ¶
SnapListHandler fetches the list of installed snaps from the device
func (Service) SnapListOnDevice ¶
SnapListOnDevice lists snaps on the device
func (Service) SnapServiceAction ¶
SnapServiceAction start/stop/restart a snap on device
func (Service) SnapUpdateHandler ¶
SnapUpdateHandler updates a snap on the device Permitted actions are: enable, disable, refresh, or switch
func (Service) StoreSearchHandler ¶
StoreSearchHandler fetches the available snaps from the store
func (Service) TokenHandler ¶
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 ¶
nolint UserCreateHandler handles user creation
func (Service) UserDeleteHandler ¶
UserDeleteHandler handles user deletion
func (Service) UserGetHandler ¶
UserGetHandler is the API method to fetch a user
func (Service) UserListHandler ¶
UserListHandler is the API method to list the users
func (Service) UserUpdateHandler ¶
nolint UserUpdateHandler handles user update
func (Service) VersionHandler ¶
VersionHandler is the API method to return the version of the web
type UbuntuSingleSignOnServer ¶
type UbuntuSingleSignOnServer interface { IsTokenValid(ssodata *usso.SSOData) (bool, error) GetAccounts(ssodata *usso.SSOData) (string, error) }
UbuntuSingleSignOnServer is the interface for minimal USSO functionality
type UserOrganization ¶
type UserOrganization struct { domain.Organization Selected bool `json:"selected"` }
UserOrganization defines an organization and whether it is selected for a user
type UserOrganizationsResponse ¶
type UserOrganizationsResponse struct { web.StandardResponse Organizations []UserOrganization `json:"organizations"` }
UserOrganizationsResponse defines the response to list users
type UserResponse ¶
type UserResponse struct { web.StandardResponse User domain.User `json:"user"` }
UserResponse defines the response to get a user
type UsersResponse ¶
type UsersResponse struct { web.StandardResponse Users []domain.User `json:"users"` }
UsersResponse defines the response to list users
type VersionResponse ¶
VersionResponse is the JSON response from the API Version method