2024-04-27 01:35:21 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"mayfly-go/internal/machine/api"
|
2024-11-23 17:23:18 +08:00
|
|
|
"mayfly-go/internal/machine/imsg"
|
2024-04-27 01:35:21 +08:00
|
|
|
"mayfly-go/pkg/biz"
|
|
|
|
|
"mayfly-go/pkg/ioc"
|
|
|
|
|
"mayfly-go/pkg/req"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func InitMachineCmdConfRouter(router *gin.RouterGroup) {
|
|
|
|
|
mccs := router.Group("machine/security/cmd-confs")
|
|
|
|
|
|
|
|
|
|
mcc := new(api.MachineCmdConf)
|
|
|
|
|
biz.ErrIsNil(ioc.Inject(mcc))
|
|
|
|
|
|
|
|
|
|
reqs := [...]*req.Conf{
|
|
|
|
|
req.NewGet("", mcc.MachineCmdConfs),
|
|
|
|
|
|
2024-11-23 17:23:18 +08:00
|
|
|
req.NewPost("", mcc.Save).Log(req.NewLogSaveI(imsg.LogMachineSecurityCmdSave)).RequiredPermissionCode("cmdconf:save"),
|
2024-04-27 01:35:21 +08:00
|
|
|
|
2024-11-23 17:23:18 +08:00
|
|
|
req.NewDelete(":id", mcc.Delete).Log(req.NewLogSaveI(imsg.LogMachineSecurityCmdDelete)).RequiredPermissionCode("cmdconf:del"),
|
2024-04-27 01:35:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
req.BatchSetGroup(mccs, reqs[:])
|
|
|
|
|
}
|