bfs.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package http
  2. import (
  3. "go-common/app/admin/main/bfs/model"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func clusters(c *bm.Context) {
  7. clusters := srv.Clusters(c)
  8. c.JSON(clusters, nil)
  9. }
  10. func bfsTotal(c *bm.Context) {
  11. arg := &model.ArgCluster{}
  12. if err := c.Bind(arg); err != nil {
  13. return
  14. }
  15. c.JSON(srv.Total(c, arg))
  16. }
  17. func rackMeta(c *bm.Context) {
  18. arg := &model.ArgCluster{}
  19. if err := c.Bind(arg); err != nil {
  20. return
  21. }
  22. c.JSON(srv.Racks(c, arg))
  23. }
  24. func groupMeta(c *bm.Context) {
  25. arg := &model.ArgCluster{}
  26. if err := c.Bind(arg); err != nil {
  27. return
  28. }
  29. c.JSON(srv.Groups(c, arg))
  30. }
  31. func volumeMeta(c *bm.Context) {
  32. arg := &model.ArgCluster{}
  33. if err := c.Bind(arg); err != nil {
  34. return
  35. }
  36. c.JSON(srv.Volumes(c, arg))
  37. }
  38. func addVolume(c *bm.Context) {
  39. arg := new(model.ArgAddVolume)
  40. if err := c.Bind(arg); err != nil {
  41. return
  42. }
  43. c.JSON(nil, srv.AddVolume(c, arg))
  44. }
  45. func addFreeVolume(c *bm.Context) {
  46. arg := new(model.ArgAddFreeVolume)
  47. if err := c.Bind(arg); err != nil {
  48. return
  49. }
  50. c.JSON(nil, srv.AddFreeVolume(c, arg))
  51. }
  52. func compact(c *bm.Context) {
  53. arg := new(model.ArgCompact)
  54. if err := c.Bind(arg); err != nil {
  55. return
  56. }
  57. c.JSON(nil, srv.Compact(c, arg))
  58. }
  59. func setGroupStatus(c *bm.Context) {
  60. arg := new(model.ArgGroupStatus)
  61. if err := c.Bind(arg); err != nil {
  62. return
  63. }
  64. c.JSON(nil, srv.SetGroupStatus(c, arg))
  65. }