Documentation ¶
Index ¶
- func EchoServer(settings types.APISettings) *echo.Echo
- func IsBlacklisted(kv types.Store) echo.MiddlewareFunc
- func IsManager(next echo.HandlerFunc) echo.HandlerFunc
- func IsReader(db *gorm.DB) echo.MiddlewareFunc
- func IsUpdater(next echo.HandlerFunc) echo.HandlerFunc
- type Handler
- func (h *Handler) AddGroupMembers(c echo.Context) error
- func (h *Handler) AddMembers(g *models.Group, members []string) error
- func (h *Handler) AddMembersOf(u *models.User, memberOf []string) error
- func (h *Handler) DeleteGroup(c echo.Context) error
- func (h *Handler) DeleteUser(c echo.Context) error
- func (h *Handler) FindAllGroups(c echo.Context) error
- func (h *Handler) FindAllUsers(c echo.Context) error
- func (h *Handler) FindGIDFromGroupName(c echo.Context) error
- func (h *Handler) FindGroupByID(c echo.Context) error
- func (h *Handler) FindUIDFromUsername(c echo.Context) error
- func (h *Handler) FindUserByID(c echo.Context) error
- func (h *Handler) GuacamoleSupport(c echo.Context) error
- func (h *Handler) Healthz(c echo.Context) error
- func (h *Handler) Login(c echo.Context, settings types.APISettings) error
- func (h *Handler) Logout(c echo.Context, settings types.APISettings) error
- func (h *Handler) Passwd(c echo.Context) error
- func (h *Handler) Readyz(c echo.Context) error
- func (h *Handler) Refresh(c echo.Context, settings types.APISettings) error
- func (h *Handler) RemoveGroupMembers(c echo.Context) error
- func (h *Handler) RemoveMembersOf(u *models.User, memberOf []string) error
- func (h *Handler) SaveGroup(c echo.Context) error
- func (h *Handler) SaveUser(c echo.Context) error
- func (h *Handler) UpdateGroup(c echo.Context) error
- func (h *Handler) UpdateUser(c echo.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EchoServer ¶
func EchoServer(settings types.APISettings) *echo.Echo
func IsBlacklisted ¶
IsBlacklisted - TODO comment
Types ¶
type Handler ¶
EchoServer - TODO command @title Glim REST API @version 1.0 @description Glim REST API for login/logout, user and group operations. Users and groups require a Bearer Token (JWT) that you can retrieve using login. Please use the project's README for full information about how you can use this token with Swagger. @contact.name Miguel Cabrerizo @contact.url https://github.com/doncicuto/glim/issues @contact.email support@sologitops.com @license.name Apache 2.0 @license.url http://www.apache.org/licenses/LICENSE-2.0.html @BasePath /v1 @securityDefinitions.apikey Bearer @in header @name Authorization
func (*Handler) AddGroupMembers ¶
AddGroupMembers - TODO comment @Summary Add members to a group @Description Add members to a group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Param members body models.GroupMembers true "Group members body. The members property expect a comma-separated list of usernames e.g 'bob,sally' to be added to the group" @Success 200 {object} models.GroupInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{id}/members [post] @Security Bearer
func (*Handler) AddMembers ¶
AddMembers - TODO comment
func (*Handler) AddMembersOf ¶
AddMembersOf - TODO comment
func (*Handler) DeleteGroup ¶
DeleteGroup - TODO comment @Summary Delete a group @Description Delete a group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Success 204 @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{id} [delete] @Security Bearer
func (*Handler) DeleteUser ¶
DeleteUser - TODO comment @Summary Delete user account @Description Delete user account @Tags users @Accept json @Produce json @Param id path int true "User Account ID" @Success 204 @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /users/{id} [delete] @Security Bearer
func (*Handler) FindAllGroups ¶
FindAllGroups - TODO comment @Summary Find all groups @Description Find all groups @Tags groups @Accept json @Produce json @Success 200 {object} models.GroupInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups [get] @Security Bearer
func (*Handler) FindAllUsers ¶
FindAllUsers - TODO comment @Summary Find all users @Description Find all users @Tags users @Accept json @Produce json @Success 200 {object} models.UserInfo @Failure 500 {object} types.ErrorResponse @Router /users [get] @Security Bearer
func (*Handler) FindGIDFromGroupName ¶
FindGIDFromGroupName - TODO comment @Summary Find user by group @Description Find user by group @Tags users @Accept json @Produce json @Param group path string true "group" @Success 200 {object} models.GroupID @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{group}/gid [get] @Security Bearer
func (*Handler) FindGroupByID ¶
FindGroupByID - TODO comment @Summary Find group by id @Description Find group by id @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Success 200 {object} models.GroupInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{id} [get] @Security Bearer
func (*Handler) FindUIDFromUsername ¶
FindUIDFromUsername - TODO comment @Summary Find user by username @Description Find user by username @Tags users @Accept json @Produce json @Param username path string true "username" @Success 200 {object} models.UserID @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /users/{username}/uid [get] @Security Bearer
func (*Handler) FindUserByID ¶
FindUserByID - TODO comment @Summary Find user by id @Description Find user by id @Tags users @Accept json @Produce json @Param id path int true "User Account ID" @Success 200 {object} models.UserInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /users/{id} [get] @Security Bearer
func (*Handler) GuacamoleSupport ¶
GuacamoleSupport - Check if Apache Guacamole support is enabled @Summary Check if Apache Guacamole support is enabled @Description Get a boolean showing if Apache Guacamole support is enabled @Produce json @Success 200 {object} types.GuacamoleSupport @Failure 400 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /guacamole [get]
func (*Handler) Healthz ¶
Healthz - Liveness probe @Summary Check if Glim is running @Description Get a boolean showing if Apache Guacamole support is enabled @Produce json @Success 204 @Failure 503 {object} types.ErrorResponse @Router /healthz [get]
func (*Handler) Login ¶
func (h *Handler) Login(c echo.Context, settings types.APISettings) error
Login - TODO comment @Summary Log in to the API @Description Log in to the API and get JWT access and refresh tokens @Tags authentication @Accept json @Produce json @Param authentication body types.LoginBody true "Username and password" @Success 200 {object} types.TokenAuthentication @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /login [post]
func (*Handler) Logout ¶
func (h *Handler) Logout(c echo.Context, settings types.APISettings) error
Logout - TODO comment @Summary Delete authentication tokens @Description Log out from the API @Tags authentication @Accept json @Produce json @Param tokens body types.Tokens true "Access and Refresh JWT tokens" @Success 204 @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /login/refresh_token [delete]
func (*Handler) Passwd ¶
Passwd - TODO comment @Summary Change user account password @Description Change user account password @Tags users @Accept json @Produce json @Param id path int true "User Account ID" @Param password body models.JSONPasswdBody true "Password body" @Success 204 @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 403 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Router /users/{id}/passwd [post] @Security Bearer
func (*Handler) Readyz ¶
Healthz - Readiness probe @Summary Check if Glim is running @Description Get a boolean showing if Apache Guacamole support is enabled @Produce json @Success 204 @Router /readyz [get]
func (*Handler) Refresh ¶
func (h *Handler) Refresh(c echo.Context, settings types.APISettings) error
Refresh API tokens @Summary Refresh authentication tokens @Description Get new JWT access and refresh tokens @Tags authentication @Accept json @Produce json @Param tokens body types.Tokens true "Access and Refresh JWT tokens" @Success 200 {object} types.TokenAuthentication @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /login/refresh_token [post]
func (*Handler) RemoveGroupMembers ¶
RemoveGroupMembers - TODO comment @Summary Remove members from a group @Description Remove members from a group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Param members body models.GroupMembers true "Group members body. The members property expect a comma-separated list of usernames e.g 'bob,sally' to be removed from the group" @Success 204 @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{id}/members [delete] @Security Bearer
func (*Handler) RemoveMembersOf ¶
RemoveMembersOf - TODO comment
func (*Handler) SaveGroup ¶
SaveGroup - TODO comment @Summary Create a new group @Description Create a new group @Tags groups @Accept json @Produce json @Param group body models.JSONGroupBody true "Group body. Name is required. The members property expect a comma-separated list of usernames e.g 'bob,sally'. The replace property is not used in this command." @Success 200 {object} models.GroupInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups [post] @Security Bearer
func (*Handler) SaveUser ¶
SaveUser - TODO comment @Summary Create a new user @Description Create a new user in our database @Tags users @Accept json @Produce json @Param user body models.JSONUserBody true "User account body. Username is required. The members property expect a comma-separated list of group names e.g 'admin,devel' that you want the user be member of. Password property is optional, if set it will be the password for that user, if no password is sent the user account will be locked (user can not log in). Manager property if true will assign the Manager role. Readonly property if true will set this user for read-only usage (queries). Locked property if true will disable log in for that user. Remove and replace properties are not currently used." @Success 200 {object} models.UserInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /users [post] @Security Bearer
func (*Handler) UpdateGroup ¶
UpdateGroup - TODO comment @Summary Update group @Description Update group @Tags groups @Accept json @Produce json @Param id path int true "Group ID" @Param group body models.JSONGroupBody true "Group body. All properties are optional. The members property expect a comma-separated list of usernames e.g 'bob,sally'. The replace property if true will replace all members by those selected by the members property, if replace is false the member will be added to current members." @Success 200 {object} models.UserInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 406 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /groups/{id} [put] @Security Bearer
func (*Handler) UpdateUser ¶
UpdateUser - TODO comment @Summary Update user account information @Description Update user account information @Tags users @Accept json @Produce json @Param id path int true "User Account ID" @Param user body models.JSONUserBody true "User account body. Username is required. The members property expect a comma-separated list of group names e.g 'admin,devel'. Password property is optional, if set it will be the password for that user, if no password is sent the user account will be locked (user can not log in). Manager property if true will assign the Manager role. Readonly property if true will set this user for read-only usage (queries). Locked property if true will disable log in for that user. Remove property if true will remove group membership from those specified in the members property. Remove property if true will replace group membership from those specified in the members property. Name property is not used" @Success 200 {object} models.UserInfo @Failure 400 {object} types.ErrorResponse @Failure 401 {object} types.ErrorResponse @Failure 404 {object} types.ErrorResponse @Failure 500 {object} types.ErrorResponse @Router /users/{id} [put] @Security Bearer
Source Files ¶
- blacklisted.go
- group_add_members.go
- group_create.go
- group_delete.go
- group_read.go
- group_remove_members.go
- group_update.go
- guacamole.go
- healthz.go
- login.go
- logout.go
- manager.go
- reader.go
- readyz.go
- refresh.go
- server.go
- updater.go
- user_create.go
- user_delete.go
- user_passwd.go
- user_read.go
- user_update.go