You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cluster.go 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package http
  2. import (
  3. "context"
  4. "fmt"
  5. "net/http"
  6. "time"
  7. "github.com/gin-gonic/gin"
  8. "gitlink.org.cn/cloudream/common/pkgs/logger"
  9. "gitlink.org.cn/cloudream/jcs-pub/client/internal/http/types"
  10. cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1"
  11. "gitlink.org.cn/cloudream/jcs-pub/common/ecode"
  12. clirpc "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc/client"
  13. )
  14. type ClusterService struct {
  15. *Server
  16. }
  17. func (s *Server) Cluster() *ClusterService {
  18. return &ClusterService{
  19. Server: s,
  20. }
  21. }
  22. func (s *ClusterService) Status(ctx *gin.Context) {
  23. log := logger.WithField("HTTP", "Cluster.Status")
  24. var req cliapi.ClusterStatus
  25. if err := ctx.ShouldBindQuery(&req); err != nil {
  26. log.Warnf("binding query: %s", err.Error())
  27. ctx.JSON(http.StatusBadRequest, types.Failed(ecode.BadArgument, "missing argument or invalid argument"))
  28. return
  29. }
  30. _, cerr := s.svc.Cluster.MasterClient().ClusterApplyLog(context.TODO(), &clirpc.ClusterApplyLog{
  31. Data: fmt.Sprintf("%v: %v", s.svc.Cluster.ID(), time.Now()),
  32. })
  33. if cerr != nil {
  34. ctx.JSON(http.StatusOK, types.Failed(ecode.ErrorCode(cerr.Code), "%v", cerr.Message))
  35. return
  36. }
  37. ctx.JSON(http.StatusOK, types.OK(cliapi.ClusterStatus{}))
  38. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。