node.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package v1
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. "github.com/gogf/gf/v2/os/gcron"
  5. "nodeMonitor/internal/model/entity"
  6. )
  7. type NodeReq struct {
  8. g.Meta `path:"/add" tags:"add" method:"post" summary:"增加节点"`
  9. Name string `p:"name" v:"required#节点名称不能为空"`
  10. Host string `p:"host" v:"required#节点不能为空"`
  11. Port int `p:"port"`
  12. Url string `p:"url"`
  13. PingType int `p:"pingType"`
  14. }
  15. type NodeRes struct {
  16. //g.Meta `mime:"application/json"`
  17. }
  18. type NodeDelReq struct {
  19. g.Meta `path:"/del" tags:"del" method:"post" summary:"删除节点"`
  20. Host string `p:"host" v:"required#节点不能为空"`
  21. }
  22. type NodeDelRes struct {
  23. //g.Meta `mime:"application/json"`
  24. }
  25. type NodeAllReq struct {
  26. g.Meta `path:"/all" tags:"all" method:"get" summary:"获取全部节点"`
  27. }
  28. type NodeALlRes struct {
  29. g.Meta `mime:"application/json"`
  30. NodeList []*entity.Node `json:"nodeList"`
  31. }
  32. type NodeCronStartReq struct {
  33. g.Meta `path:"/start" tags:"start" method:"post" summary:"开始PING任务"`
  34. StartTime int `p:"startTime"`
  35. }
  36. type NodeCronStartRes struct {
  37. g.Meta `mime:"application/json"`
  38. RetEntry []*gcron.Entry
  39. RetCronCount int
  40. Status bool
  41. }
  42. type NodeCronStopReq struct {
  43. g.Meta `path:"/stop" tags:"stop" method:"post" summary:"停止PING任务"`
  44. Remove bool `p:"remove"`
  45. }
  46. type NodeCronStopRes struct {
  47. g.Meta `mime:"application/json"`
  48. RetCronCount int
  49. Status bool
  50. }
  51. type NodeCronStatusReq struct {
  52. g.Meta `path:"/task" tags:"task" method:"get" summary:"查看任务状态"`
  53. }
  54. type NodeCronStatusRes struct {
  55. g.Meta `mime:"application/json"`
  56. RetEntry []*gcron.Entry
  57. RetCronCount int
  58. }