controller

package
v0.0.0-...-a297e19 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTimestamp = "X-Timestamp"
	HeaderSignature = "X-Signature"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Guard

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

func New

func New(svc service.Guard) *Guard

func (*Guard) AddNodeToRole

func (g *Guard) AddNodeToRole(c *gin.Context)

@Summary AddNodeToRole @Description Add node to role @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Param body body service.RoleNodeListRequest true "node list" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/role/{roleID}/node [post]

func (*Guard) AddUserToRole

func (g *Guard) AddUserToRole(c *gin.Context)

@Summary AddUserToRole @Description Add user to role @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Param body body []int64 true "User IDs" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/role/{roleID}/user [post]

func (*Guard) BanUser

func (g *Guard) BanUser(c *gin.Context)

@Summary BanUser @Description Ban user @Tags user @Param userID path int true "User ID" @Success 200 {object} nil @Router /api/v1/guard/user/{userID}/ban [post]

func (*Guard) BatchRemoveNodeFromRole

func (g *Guard) BatchRemoveNodeFromRole(c *gin.Context)

@Summary BatchRemoveNodeFromRole @Description Batch remove node from role @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Param body body []int64 true "Node IDs" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/role/{roleID}/node/batch/delete [post]

func (*Guard) BatchRemoveUserFromRole

func (g *Guard) BatchRemoveUserFromRole(c *gin.Context)

@Summary BatchRemoveUserFromRole @Description Batch remove user from role @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Param body body []int64 true "User IDs" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/role/{roleID}/user/batch/delete [post]

func (*Guard) CreateNode

func (g *Guard) CreateNode(c *gin.Context)

@Summary CreateNode @Description Create node @Tags node @Param spaceID path int true "Space ID" @Param body body service.CreateNodeRequest true "Create node request" @Success 200 {object} service.CreateNodeResponse @Router /api/v1/guard/space/{spaceID}/node [post]

func (*Guard) CreateRole

func (g *Guard) CreateRole(c *gin.Context)

@Summary CreateRole @Description Create role @Tags role @Param spaceID path int true "Space ID" @Param body body service.CreateRoleRequest true "Create role request" @Success 200 {object} nil

func (*Guard) CreateSpace

func (g *Guard) CreateSpace(c *gin.Context)

@Summary CreateSpace @Description Create space @Tags space @Param body body service.CreateSpaceRequest true "Create space request" @Success 200 {object} nil @Router /api/v1/guard/space [post]

func (*Guard) CreateUser

func (g *Guard) CreateUser(c *gin.Context)

@Summary CreateUser @Description Create user @Tags user @Router /api/v1/guard/user [post] @Param body body service.CreateUserRequest true "Create user request" @Success 200 {object} nil

func (*Guard) DeleteNode

func (g *Guard) DeleteNode(c *gin.Context)

@Summary DeleteNode @Description Delete node @Tags node @Param spaceID path int true "Space ID" @Param nodeID path int true "Node ID" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/node/{nodeID} [delete]

func (*Guard) DeleteRole

func (g *Guard) DeleteRole(c *gin.Context)

@Summary DeleteRole @Description Delete role @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Success 200 {object} nil @Router /api/v1/guard/space/{spaceID}/role/{roleID} [delete]

func (*Guard) GetAuthorizedKeys

func (g *Guard) GetAuthorizedKeys(c *gin.Context)

@Summary GetAuthorizedKeys @Description Get authorized keys @Tags Guard @Param node_id query string true "Node ID" @Param X-Timestamp header string true "unix timestamp, seconds" @Param X-Signature header string true "signature" @Success 200 {object} []string "Authorized keys" @Router /api/v1/guard/authorizedKeys [get]

func (*Guard) GetCA

func (g *Guard) GetCA(c *gin.Context)

@Summary GetCA @Description Get CA certificate @Tags Guard @Param node_id query string true "Node ID" @Param X-Timestamp header string true "unix timestamp, seconds" @Param X-Signature header string true "signature" @Router /api/v1/guard/ca [get] @Router /api/v1/guard/ca [get] @Success 200 {string} string "CA certificate"

func (*Guard) GetKRL

func (g *Guard) GetKRL(c *gin.Context)

@Summary GetKRL @Description Get revoked key list (KRL) @Tags Guard @Param node_id query string true "Node ID" @Param X-Timestamp header string true "unix timestamp, seconds" @Param X-Signature header string true "signature" @Success 200 {object} []byte "KRL" @Router /api/v1/guard/krl [get]

func (*Guard) GetPrincipals

func (g *Guard) GetPrincipals(c *gin.Context)

@Summary GetPrincipals @Description Get principals @Tags Guard @Param node_id query string true "Node ID" @Param X-Timestamp header string true "unix timestamp, seconds" @Param X-Signature header string true "signature" @Success 200 {object} service.PrincipalList "principals" @Router /api/v1/guard/principals [get]

func (*Guard) GetUser

func (g *Guard) GetUser(c *gin.Context)

@Summary GetUser @Description Get user @Tags user @Param userID path int true "User ID" @Success 200 {object} service.UserVO @Router /api/v1/guard/user/{userID} [get]

func (*Guard) GrantCert

func (g *Guard) GrantCert(c *gin.Context)

@Summary GrantCert @Description Grant certificate @Tags user @Param userID path int true "User ID" @Param body body service.GrantCertRequest true "Grant certificate request" @Success 200 {object} service.GrantCertResponse @Router /api/v1/guard/user/{userID}/cert [post]

func (*Guard) IsAllowedNode

func (g *Guard) IsAllowedNode(c *gin.Context)

func (*Guard) ListNode

func (g *Guard) ListNode(c *gin.Context)

@Summary ListNode @Description List nodes @Tags node @Param spaceID path int true "Space ID" @Param page query int true "page" @Param limit query int true "limit" @Success 200 {object} service.ListNodeResponse @Router /api/v1/guard/space/{spaceID}/node [get]

func (*Guard) ListRole

func (g *Guard) ListRole(c *gin.Context)

@Summary ListRole @Description List roles @Tags role @Param spaceID path int true "Space ID" @Success 200 {object} service.ListRoleResponse @Router /api/v1/guard/space/{spaceID}/role [get]

func (*Guard) ListRoleNode

func (g *Guard) ListRoleNode(c *gin.Context)

@Summary ListRoleNode @Description List role nodes @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Success 200 {object} service.ListRoleNodeResponse @Router /api/v1/guard/space/{spaceID}/role/{roleID}/node [get]

func (*Guard) ListRoleUser

func (g *Guard) ListRoleUser(c *gin.Context)

@Summary ListRoleUser @Description List role users @Tags role @Param spaceID path int true "Space ID" @Param roleID path int true "Role ID" @Success 200 {object} service.ListRoleUserResponse @Router /api/v1/guard/space/{spaceID}/role/{roleID}/user [get]

func (*Guard) ListSpace

func (g *Guard) ListSpace(c *gin.Context)

@Summary ListSpace @Description List spaces @Tags space @Success 200 {object} service.ListSpaceResponse @Router /api/v1/guard/space [get]

func (*Guard) ListUser

func (g *Guard) ListUser(c *gin.Context)

@Summary ListUser @Description List users @Tags user @Param page query int true "page" @Param limit query int tue "limit" @Success 200 {object} service.ListUserResponse @Router /api/v1/guard/user [get]

func (*Guard) QueryUser

func (g *Guard) QueryUser(c *gin.Context)

@Summary QueryUser @Description Query user @Tags user @Param email query string true "Email" @Success 200 {object} service.UserVO @Router /api/v1/guard/user [get]

func (*Guard) Signature

func (g *Guard) Signature(c *gin.Context)

Signature is a middleware to sign the response with the secret of the node

func (*Guard) UpdateNodeLastHeartbeat

func (g *Guard) UpdateNodeLastHeartbeat(c *gin.Context)

func (*Guard) UpdateUserPublicKey

func (g *Guard) UpdateUserPublicKey(c *gin.Context)

@Summary UpdateUserPublicKey @Description Update user public key @Tags user @Param userID path int true "User ID" @Param body body string true "Public key" @Success 200 {object} nil @Router /api/v1/guard/user/{userID}/publicKey [put]

Jump to

Keyboard shortcuts

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