JCS-pub/client/internal/http/mount.go

37 lines
825 B
Go

package http
import (
"net/http"
"github.com/gin-gonic/gin"
"gitlink.org.cn/cloudream/common/consts/errorcode"
"gitlink.org.cn/cloudream/common/pkgs/logger"
cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api"
)
type MountService struct {
*Server
}
func (s *Server) Mount() *MountService {
return &MountService{
Server: s,
}
}
func (m *MountService) DumpStatus(ctx *gin.Context) {
log := logger.WithField("HTTP", "Object.ListByPath")
var req cliapi.MountDumpStatus
if err := ctx.ShouldBindQuery(&req); err != nil {
log.Warnf("binding body: %s", err.Error())
ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument"))
return
}
dumpStatus := m.svc.Mount.Dump()
ctx.JSON(http.StatusOK, cliapi.MountDumpStatusPathResp{
MountStatus: dumpStatus,
})
}