controller

package
v0.0.0-...-fc1dba9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index

func Index(c *gin.Context)

@Summary Home @Produce html @Tags home @Router /index [get]

Types

type AuthController

type AuthController struct {
	// contains filtered or unexported fields
}

func (*AuthController) Login

func (ac *AuthController) Login(c *gin.Context)

@Summary Login @Description User login @Accept json @Produce json @Tags auth @Param user body model.AuthUser true "auth user info" @Success 200 {object} common.Response{data=model.JWTToken} @Router /api/v1/auth/token [post]

func (*AuthController) Logout

func (ac *AuthController) Logout(c *gin.Context)

@Summary Logout @Description User logout @Produce json @Tags auth @Success 200 {object} common.Response @Router /api/v1/auth/token [delete]

func (*AuthController) Name

func (ac *AuthController) Name() string

func (*AuthController) Register

func (ac *AuthController) Register(c *gin.Context)

@Summary Register user @Description Create user and storage @Accept json @Produce json @Tags auth @Param user body model.CreatedUser true "user info" @Success 200 {object} common.Response{data=model.User} @Router /api/v1/auth/user [post]

func (*AuthController) RegisterRoute

func (ac *AuthController) RegisterRoute(api *gin.RouterGroup)

type ContainerController

type ContainerController struct {
	// contains filtered or unexported fields
}

func (*ContainerController) Create

func (con *ContainerController) Create(c *gin.Context)

@Summary Create container @Description Create container @Accept json @Produce json @Tags container @Security JWT @Param container body model.CreatedContainer true "container info" @Success 200 {object} common.Response{data=model.Container} @Router /api/v1/containers [post]

func (*ContainerController) Delete

func (con *ContainerController) Delete(c *gin.Context)

@Summary Delete container @Description Delete container @Produce json @Tags container @Security JWT @Param id path string true "container id" @Success 200 {object} common.Response @Router /api/v1/containers/{id} [delete]

func (*ContainerController) Exec

func (con *ContainerController) Exec(c *gin.Context)

@Summary Exec container @Description exec container @Tags container @Security JWT @Param id path string true "container id" @Param shell query string false "shell, sh or bash" @Success 200 {string} string "" @Router /api/v1/containers/{id}/exec [get]

func (*ContainerController) Get

func (con *ContainerController) Get(c *gin.Context)

@Summary Get container @Description Get container @Produce json @Tags container @Security JWT @Param id path string true "container id" @Success 200 {object} common.Response{data=model.Container} @Router /api/v1/containers/{id} [get]

func (*ContainerController) List

func (con *ContainerController) List(c *gin.Context)

@Summary List container @Description List container @Produce json @Tags container @Security JWT @Success 200 {object} common.Response{data=[]model.Container} @Router /api/v1/containers [get]

func (*ContainerController) Log

func (con *ContainerController) Log(c *gin.Context)

@Summary Get container log @Description Get container log @Produce json @Tags container @Security JWT @Param id path string true "container id" @Success 200 {string} string "" @Param follow query bool false "follow log" @Param tail query string false "tail log all or number" @Router /api/v1/containers/{id}/log [get]

func (*ContainerController) Name

func (con *ContainerController) Name() string

func (*ContainerController) Operate

func (con *ContainerController) Operate(c *gin.Context)

@Summary Operate container @Description Operate container @Produce json @Tags container @Security JWT @Param id path string true "container id" @Param verb query string true "verb: start/stop/restart" @Success 200 {object} common.Response @Router /api/v1/containers/{id} [post]

func (*ContainerController) Proxy

func (con *ContainerController) Proxy(c *gin.Context)

@Summary Proxy container @Description proxy container @Tags container @Security JWT @Param id path string true "container id" @Param shell query string false "shell, sh or bash" @Success 200 {string} string "" @Router /api/v1/containers/{id}/proxy [get]

func (*ContainerController) RegisterRoute

func (con *ContainerController) RegisterRoute(api *gin.RouterGroup)

func (*ContainerController) Update

func (con *ContainerController) Update(c *gin.Context)

@Summary Update container @Description Update container @Accept json @Produce json @Tags container @Security JWT @Param container body model.CreatedContainer true "container info" @Param id path string true "container id" @Success 200 {object} common.Response{data=model.Container} @Router /api/v1/containers/:id [put]

type Controller

type Controller interface {
	Name() string
	RegisterRoute(*gin.RouterGroup)
}

func NewAuthController

func NewAuthController(userService service.UserService, jwtService *authentication.JWTService, oauthManager *oauth.OAuthManager) Controller

func NewContainerController

func NewContainerController(client *docker.Client) Controller

func NewGroupController

func NewGroupController(groupService service.GroupService) Controller

func NewPostController

func NewPostController(postService service.PostService) Controller

func NewRbacController

func NewRbacController(rbacService service.RBACService) Controller

func NewUserController

func NewUserController(userService service.UserService) Controller

type GroupController

type GroupController struct {
	// contains filtered or unexported fields
}

func (*GroupController) AddRole

func (g *GroupController) AddRole(c *gin.Context)

@Summary Add role @Description Add role to group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Param rid path int true "role id" @Success 200 {object} common.Response @Router /api/v1/groups/{id}/roles/{rid} [post]

func (*GroupController) AddUser

func (g *GroupController) AddUser(c *gin.Context)

@Summary Add user @Description Add user to group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Param user body model.User true "user info" @Success 200 {object} common.Response @Router /api/v1/groups/{id}/users [post]

func (*GroupController) Create

func (g *GroupController) Create(c *gin.Context)

@Summary Create group @Description Create group and storage @Accept json @Produce json @Tags group @Security JWT @Param group body model.CreatedGroup true "group info" @Success 200 {object} common.Response{data=model.Group} @Router /api/v1/groups [post]

func (*GroupController) DelRole

func (g *GroupController) DelRole(c *gin.Context)

@Summary Delete role @Description delete role from group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Param rid path int true "role id" @Success 200 {object} common.Response @Router /api/v1/groups/{id}/roles/{rid} [delete]

func (*GroupController) DelUser

func (g *GroupController) DelUser(c *gin.Context)

@Summary Delete user @Description Delete user from group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Param user body model.User true "user info" @Param name query string true "user name" @Param name query string true "user role" @Success 200 {object} common.Response @Router /api/v1/groups/{id}/users [delete]

func (*GroupController) Delete

func (g *GroupController) Delete(c *gin.Context)

@Summary Delete group @Description Delete group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Success 200 {object} common.Response @Router /api/v1/groups/{id} [delete]

func (*GroupController) Get

func (g *GroupController) Get(c *gin.Context)

@Summary Get group @Description Get group @Produce json @Tags group @Security JWT @Param id path int true "group id" @Success 200 {object} common.Response{data=model.Group} @Router /api/v1/groups/{id} [get]

func (*GroupController) GetUsers

func (g *GroupController) GetUsers(c *gin.Context)

@Summary Get users @Description Get users @Produce json @Tags group @Security JWT @Param id path int true "group id" @Success 200 {object} common.Response @Router /api/v1/groups/{id}/users [get]

func (*GroupController) List

func (g *GroupController) List(c *gin.Context)

@Summary List group @Description List group @Produce json @Tags group @Security JWT @Success 200 {object} common.Response{data=[]model.Group} @Router /api/v1/groups [get]

func (*GroupController) Name

func (g *GroupController) Name() string

func (*GroupController) RegisterRoute

func (g *GroupController) RegisterRoute(api *gin.RouterGroup)

func (*GroupController) Update

func (g *GroupController) Update(c *gin.Context)

@Summary Update group @Description Update group and storage @Accept json @Produce json @Tags group @Security JWT @Param group body model.UpdatedUser true "group info" @Param id path int true "group id" @Success 200 {object} common.Response{data=model.Group} @Router /api/v1/groups/{id} [put]

type PostController

type PostController struct {
	// contains filtered or unexported fields
}

func (*PostController) AddComment

func (p *PostController) AddComment(c *gin.Context)

@Summary Add Comment @Description Add Comment @Produce json @Tags post @Security JWT @Param id path int true "post id" @Success 200 {object} common.Response @Router /api/v1/posts/{id}/comment [post]

func (*PostController) AddLike

func (p *PostController) AddLike(c *gin.Context)

@Summary Add Like @Description Add Like @Produce json @Tags post @Security JWT @Param id path int true "post id" @Success 200 {object} common.Response @Router /api/v1/posts/{id}/like [post]

func (*PostController) Create

func (p *PostController) Create(c *gin.Context)

@Summary Create post @Description Create post and storage @Accept json @Produce json @Tags post @Security JWT @Param post body model.Post true "post info" @Success 200 {object} common.Response{data=model.Post} @Router /api/v1/posts [post]

func (*PostController) DelComment

func (p *PostController) DelComment(c *gin.Context)

@Summary Delete Comment @Description Delete Comment @Produce json @Tags post @Security JWT @Param id path int true "post id" @Param cid path int true "comment id" @Success 200 {object} common.Response @Router /api/v1/posts/{id}/comment/${cid} [delete]

func (*PostController) DelLike

func (p *PostController) DelLike(c *gin.Context)

@Summary Delete Like @Description Delete Like @Produce json @Tags post @Security JWT @Param id path int true "post id" @Success 200 {object} common.Response @Router /api/v1/posts/{id}/like [delete]

func (*PostController) Delete

func (p *PostController) Delete(c *gin.Context)

@Summary Delete post @Description Delete post @Produce json @Tags post @Security JWT @Param id path int true "post id" @Success 200 {object} common.Response @Router /api/v1/posts/{id} [delete]

func (*PostController) Get

func (p *PostController) Get(c *gin.Context)

@Summary Get post @Description Get post @Produce json @Tags post @Security JWT @Param id path int true "post id" @Success 200 {object} common.Response{data=model.Post} @Router /api/v1/posts/{id} [get]

func (*PostController) List

func (p *PostController) List(c *gin.Context)

@Summary List post @Description List post @Produce json @Tags post @Security JWT @Success 200 {object} common.Response{data=[]model.Post} @Router /api/v1/posts [get]

func (*PostController) Name

func (p *PostController) Name() string

func (*PostController) RegisterRoute

func (p *PostController) RegisterRoute(api *gin.RouterGroup)

func (*PostController) Update

func (p *PostController) Update(c *gin.Context)

@Summary Update post @Description Update post and storage @Accept json @Produce json @Tags post @Security JWT @Param post body model.UpdatedUser true "post info" @Param id path int true "post id" @Success 200 {object} common.Response{data=model.Post} @Router /api/v1/posts/{id} [put]

type RBACController

type RBACController struct {
	// contains filtered or unexported fields
}

func (*RBACController) Create

func (rbac *RBACController) Create(c *gin.Context)

@Summary Create rbac role @Description Create rbac role @Accept json @Produce json @Tags rbac @Security JWT @Param role body model.Role true "rbac role info" @Success 200 {object} common.Response @Router /api/v1/roles [post]

func (*RBACController) Delete

func (rbac *RBACController) Delete(c *gin.Context)

@Summary Delete role @Description Delete role @Produce json @Tags rbac @Security JWT @Param id path int true "role id" @Success 200 {object} common.Response @Router /api/v1/roles/{id} [delete]

func (*RBACController) Get

func (rbac *RBACController) Get(c *gin.Context)

@Summary Get role @Description Get role @Produce json @Tags rbac @Security JWT @Param id path int true "role id" @Success 200 {object} common.Response{data=model.Role} @Router /api/v1/roles/{id} [get]

func (*RBACController) List

func (rbac *RBACController) List(c *gin.Context)

@Summary List rbac role @Description List rbac role @Produce json @Tags rbac @Security JWT @Success 200 {object} common.Response{data=[]model.Role} @Router /api/v1/roles [get]

func (*RBACController) ListOperations

func (rbac *RBACController) ListOperations(c *gin.Context)

@Summary List operations @Description List operations @Produce json @Tags rbac @Security JWT @Success 200 {object} common.Response{data=[]model.Operation} @Router /api/v1/operations [get]

func (*RBACController) ListResources

func (rbac *RBACController) ListResources(c *gin.Context)

@Summary List resources @Description List resources @Produce json @Tags rbac @Security JWT @Success 200 {object} common.Response{data=[]model.Resource} @Router /api/v1/resources [get]

func (*RBACController) Name

func (rbac *RBACController) Name() string

func (*RBACController) RegisterRoute

func (rbac *RBACController) RegisterRoute(api *gin.RouterGroup)

func (*RBACController) Update

func (rbac *RBACController) Update(c *gin.Context)

@Summary Update rbac role @Description Update rbac role @Accept json @Produce json @Tags rbac @Security JWT @Param role body model.Role true "rbac role info" @Success 200 {object} common.Response @Param id path int true "role id" @Router /api/v1/roles/:id [put]

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

func (*UserController) AddRole

func (u *UserController) AddRole(c *gin.Context)

@Summary Add role @Description Add role to user @Produce json @Tags user @Security JWT @Param id path int true "user id" @Param rid path int true "role id" @Success 200 {object} common.Response @Router /api/v1/users/{id}/roles/{rid} [post]

func (*UserController) Create

func (u *UserController) Create(c *gin.Context)

@Summary Create user @Description Create user and storage @Accept json @Produce json @Tags user @Security JWT @Param user body model.CreatedUser true "user info" @Success 200 {object} common.Response{data=model.User} @Router /api/v1/users [post]

func (*UserController) DelRole

func (u *UserController) DelRole(c *gin.Context)

@Summary Delete role @Description delete role from user @Produce json @Tags user @Security JWT @Param id path int true "user id" @Param rid path int true "role id" @Success 200 {object} common.Response @Router /api/v1/users/{id}/roles/{rid} [delete]

func (*UserController) Delete

func (u *UserController) Delete(c *gin.Context)

@Summary Delete user @Description Delete user and storage @Produce json @Tags user @Security JWT @Param id path int true "user id" @Success 200 {object} common.Response @Router /api/v1/users/{id} [delete]

func (*UserController) Get

func (u *UserController) Get(c *gin.Context)

@Summary Get user @Description Get user and storage @Produce json @Tags user @Security JWT @Param id path int true "user id" @Success 200 {object} common.Response{data=model.User} @Router /api/v1/users/{id} [get]

func (*UserController) GetGroups

func (u *UserController) GetGroups(c *gin.Context)

@Summary Get groups @Description Get groups @Produce json @Tags group @Security JWT @Param id path int true "user id" @Success 200 {object} common.Response @Router /api/v1/users/{id}/groups [get]

func (*UserController) List

func (u *UserController) List(c *gin.Context)

@Summary List user @Description List user and storage @Produce json @Tags user @Security JWT @Success 200 {object} common.Response{data=model.Users} @Router /api/v1/users [get]

func (*UserController) Name

func (u *UserController) Name() string

func (*UserController) RegisterRoute

func (u *UserController) RegisterRoute(api *gin.RouterGroup)

func (*UserController) Update

func (u *UserController) Update(c *gin.Context)

@Summary Update user @Description Update user and storage @Accept json @Produce json @Tags user @Security JWT @Param user body model.UpdatedUser true "user info" @Param id path int true "user id" @Success 200 {object} common.Response{data=model.User} @Router /api/v1/users/{id} [put]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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