1 Star 0 Fork 0

MinKo-U/keyauth

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
http.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
MinKo-U 提交于 2022-11-25 18:51 . 添加审计功能
package api
import (
"gitee.com/MinKo-U/keyauth/apps/audit"
restfulspec "github.com/emicklei/go-restful-openapi"
"github.com/emicklei/go-restful/v3"
"github.com/infraboard/mcube/app"
"github.com/infraboard/mcube/http/response"
"github.com/infraboard/mcube/logger"
"github.com/infraboard/mcube/logger/zap"
)
var (
h = &handler{}
)
type handler struct {
service audit.Service
log logger.Logger
}
func (h *handler) Config() error {
h.log = zap.L().Named(audit.AppName)
h.service = app.GetInternalApp(audit.AppName).(audit.Service)
return nil
}
func (h *handler) Name() string {
return audit.AppName
}
func (h *handler) Version() string {
return "v1"
}
func (h *handler) Registry(ws *restful.WebService) {
tags := []string{"audit"}
ws.Route(ws.GET("/").To(h.QueryOperator).
Doc("get all audits").
Metadata(restfulspec.KeyOpenAPITags, tags).
Metadata("action", "list").
Reads(audit.CreateOperatorRequest{}).
Writes(response.NewData(audit.OperatorSet{})).
Returns(200, "OK", audit.OperatorSet{}))
}
func init() {
app.RegistryRESTfulApp(h)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/MinKo-U/keyauth.git
git@gitee.com:MinKo-U/keyauth.git
MinKo-U
keyauth
keyauth
v1.4.0

搜索帮助

0d507c66 1850385 C8b1a773 1850385