routes.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. // Code generated by goctl. DO NOT EDIT.
  2. // goctl 1.10.2
  3. package handler
  4. import (
  5. "net/http"
  6. application "udeServer/internal/handler/application"
  7. systemlog "udeServer/internal/handler/systemlog"
  8. "udeServer/internal/svc"
  9. "github.com/zeromicro/go-zero/rest"
  10. )
  11. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  12. server.AddRoutes(
  13. []rest.Route{
  14. {
  15. Method: http.MethodGet,
  16. Path: "/db/ping",
  17. Handler: DbPingHandler(serverCtx),
  18. },
  19. {
  20. Method: http.MethodPost,
  21. Path: "/directories",
  22. Handler: CreateDirectoryHandler(serverCtx),
  23. },
  24. {
  25. Method: http.MethodGet,
  26. Path: "/directories",
  27. Handler: ListDirectoriesHandler(serverCtx),
  28. },
  29. {
  30. Method: http.MethodGet,
  31. Path: "/directories/:id",
  32. Handler: GetDirectoryHandler(serverCtx),
  33. },
  34. {
  35. Method: http.MethodPut,
  36. Path: "/directories/:id",
  37. Handler: UpdateDirectoryHandler(serverCtx),
  38. },
  39. {
  40. Method: http.MethodDelete,
  41. Path: "/directories/:id",
  42. Handler: DeleteDirectoryHandler(serverCtx),
  43. },
  44. {
  45. Method: http.MethodGet,
  46. Path: "/dirs/children",
  47. Handler: ListDirChildrenHandler(serverCtx),
  48. },
  49. {
  50. Method: http.MethodGet,
  51. Path: "/from/:name",
  52. Handler: UdeServerHandler(serverCtx),
  53. },
  54. {
  55. Method: http.MethodPost,
  56. Path: "/keys/create",
  57. Handler: CreateKeyHandler(serverCtx),
  58. },
  59. {
  60. Method: http.MethodPost,
  61. Path: "/keys/delete",
  62. Handler: DeleteKeyHandler(serverCtx),
  63. },
  64. {
  65. Method: http.MethodPost,
  66. Path: "/keys/detail",
  67. Handler: GetKeyHandler(serverCtx),
  68. },
  69. {
  70. Method: http.MethodPost,
  71. Path: "/keys/list",
  72. Handler: ListKeysHandler(serverCtx),
  73. },
  74. {
  75. Method: http.MethodPost,
  76. Path: "/keys/update",
  77. Handler: UpdateKeyHandler(serverCtx),
  78. },
  79. {
  80. Method: http.MethodPost,
  81. Path: "/services",
  82. Handler: CreateServiceHandler(serverCtx),
  83. },
  84. {
  85. Method: http.MethodGet,
  86. Path: "/services",
  87. Handler: ListServicesHandler(serverCtx),
  88. },
  89. {
  90. Method: http.MethodGet,
  91. Path: "/services/:id",
  92. Handler: GetServiceHandler(serverCtx),
  93. },
  94. {
  95. Method: http.MethodPut,
  96. Path: "/services/:id",
  97. Handler: UpdateServiceHandler(serverCtx),
  98. },
  99. {
  100. Method: http.MethodDelete,
  101. Path: "/services/:id",
  102. Handler: DeleteServiceHandler(serverCtx),
  103. },
  104. {
  105. Method: http.MethodPost,
  106. Path: "/services/:id/brush",
  107. Handler: BrushServiceHandler(serverCtx),
  108. },
  109. {
  110. // 启用服务联动挂载(状态开关拨向"启用")
  111. Method: http.MethodPost,
  112. Path: "/services/:id/mount",
  113. Handler: MountServiceHandler(serverCtx),
  114. },
  115. {
  116. // 停用服务联动卸载(状态开关拨向"停用")
  117. Method: http.MethodPost,
  118. Path: "/services/:id/unmount",
  119. Handler: UnmountServiceHandler(serverCtx),
  120. },
  121. },
  122. rest.WithPrefix("/api/v1"),
  123. )
  124. server.AddRoutes(
  125. []rest.Route{
  126. {
  127. // 添加应用凭证
  128. Method: http.MethodPost,
  129. Path: "/addApplication",
  130. Handler: application.AddApplicationHandler(serverCtx),
  131. },
  132. {
  133. // 应用凭证列表
  134. Method: http.MethodPost,
  135. Path: "/applicationList",
  136. Handler: application.ApplicationListHandler(serverCtx),
  137. },
  138. {
  139. // 删除应用凭证
  140. Method: http.MethodPost,
  141. Path: "/deleteApplication",
  142. Handler: application.DeleteApplicationHandler(serverCtx),
  143. },
  144. {
  145. // 下发应用凭证密钥
  146. Method: http.MethodPost,
  147. Path: "/distributeApiSecret",
  148. Handler: application.DistributeApiSecretHandler(serverCtx),
  149. },
  150. {
  151. // 重置应用凭证密钥
  152. Method: http.MethodPost,
  153. Path: "/resetApplication",
  154. Handler: application.ResetApplicationHandler(serverCtx),
  155. },
  156. {
  157. // 切换应用凭证状态(启用/禁用互换)
  158. Method: http.MethodPost,
  159. Path: "/updateApplicationStatus",
  160. Handler: application.UpdateApplicationStatusHandler(serverCtx),
  161. },
  162. },
  163. rest.WithPrefix("/api/v1/applicationCredentials"),
  164. )
  165. server.AddRoutes(
  166. []rest.Route{
  167. {
  168. // 日志归档
  169. Method: http.MethodPost,
  170. Path: "/archive",
  171. Handler: systemlog.LogArchiveHandler(serverCtx),
  172. },
  173. {
  174. // 日志审计(校验Hmac防篡改)
  175. Method: http.MethodPost,
  176. Path: "/audit",
  177. Handler: systemlog.LogAuditHandler(serverCtx),
  178. },
  179. {
  180. // 日志详情
  181. Method: http.MethodPost,
  182. Path: "/detail",
  183. Handler: systemlog.LogDetailHandler(serverCtx),
  184. },
  185. {
  186. // 查看完整链路
  187. Method: http.MethodPost,
  188. Path: "/link",
  189. Handler: systemlog.LogLinkHandler(serverCtx),
  190. },
  191. {
  192. // 日志分页列表
  193. Method: http.MethodPost,
  194. Path: "/list",
  195. Handler: systemlog.LogListHandler(serverCtx),
  196. },
  197. },
  198. rest.WithPrefix("/api/v1/systemLog"),
  199. )
  200. server.AddRoutes(
  201. []rest.Route{
  202. {
  203. // 归档打包下载(zip)
  204. Method: http.MethodPost,
  205. Path: "/download",
  206. Handler: systemlog.LogArchiveDownloadHandler(serverCtx),
  207. },
  208. {
  209. // 归档列表
  210. Method: http.MethodPost,
  211. Path: "/list",
  212. Handler: systemlog.LogArchiveListHandler(serverCtx),
  213. },
  214. {
  215. // 归档恢复
  216. Method: http.MethodPost,
  217. Path: "/restore",
  218. Handler: systemlog.LogArchiveRestoreHandler(serverCtx),
  219. },
  220. },
  221. rest.WithPrefix("/api/v1/logArchive"),
  222. )
  223. server.AddRoutes(
  224. []rest.Route{
  225. {
  226. // 恢复记录列表
  227. Method: http.MethodPost,
  228. Path: "/list",
  229. Handler: systemlog.LogRestoreListHandler(serverCtx),
  230. },
  231. },
  232. rest.WithPrefix("/api/v1/logRestore"),
  233. )
  234. }