routes.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. applicationconfig "udeServer/internal/handler/applicationconfig"
  8. custompage "udeServer/internal/handler/custompage"
  9. ops "udeServer/internal/handler/ops"
  10. systemlog "udeServer/internal/handler/systemlog"
  11. "udeServer/internal/svc"
  12. "github.com/zeromicro/go-zero/rest"
  13. )
  14. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  15. server.AddRoutes(
  16. []rest.Route{
  17. {
  18. Method: http.MethodGet,
  19. Path: "/db/ping",
  20. Handler: DbPingHandler(serverCtx),
  21. },
  22. {
  23. Method: http.MethodPost,
  24. Path: "/directories",
  25. Handler: CreateDirectoryHandler(serverCtx),
  26. },
  27. {
  28. Method: http.MethodGet,
  29. Path: "/directories",
  30. Handler: ListDirectoriesHandler(serverCtx),
  31. },
  32. {
  33. Method: http.MethodGet,
  34. Path: "/directories/:id",
  35. Handler: GetDirectoryHandler(serverCtx),
  36. },
  37. {
  38. Method: http.MethodPut,
  39. Path: "/directories/:id",
  40. Handler: UpdateDirectoryHandler(serverCtx),
  41. },
  42. {
  43. Method: http.MethodDelete,
  44. Path: "/directories/:id",
  45. Handler: DeleteDirectoryHandler(serverCtx),
  46. },
  47. {
  48. Method: http.MethodGet,
  49. Path: "/dirs/children",
  50. Handler: ListDirChildrenHandler(serverCtx),
  51. },
  52. {
  53. Method: http.MethodGet,
  54. Path: "/from/:name",
  55. Handler: UdeServerHandler(serverCtx),
  56. },
  57. {
  58. Method: http.MethodPost,
  59. Path: "/keys/create",
  60. Handler: CreateKeyHandler(serverCtx),
  61. },
  62. {
  63. Method: http.MethodPost,
  64. Path: "/keys/delete",
  65. Handler: DeleteKeyHandler(serverCtx),
  66. },
  67. {
  68. Method: http.MethodPost,
  69. Path: "/keys/detail",
  70. Handler: GetKeyHandler(serverCtx),
  71. },
  72. {
  73. Method: http.MethodPost,
  74. Path: "/keys/list",
  75. Handler: ListKeysHandler(serverCtx),
  76. },
  77. {
  78. Method: http.MethodPost,
  79. Path: "/keys/update",
  80. Handler: UpdateKeyHandler(serverCtx),
  81. },
  82. {
  83. Method: http.MethodPost,
  84. Path: "/services",
  85. Handler: CreateServiceHandler(serverCtx),
  86. },
  87. {
  88. Method: http.MethodGet,
  89. Path: "/services",
  90. Handler: ListServicesHandler(serverCtx),
  91. },
  92. {
  93. Method: http.MethodGet,
  94. Path: "/services/:id",
  95. Handler: GetServiceHandler(serverCtx),
  96. },
  97. {
  98. Method: http.MethodPut,
  99. Path: "/services/:id",
  100. Handler: UpdateServiceHandler(serverCtx),
  101. },
  102. {
  103. Method: http.MethodDelete,
  104. Path: "/services/:id",
  105. Handler: DeleteServiceHandler(serverCtx),
  106. },
  107. {
  108. Method: http.MethodPost,
  109. Path: "/services/:id/brush",
  110. Handler: BrushServiceHandler(serverCtx),
  111. },
  112. {
  113. // 启用服务联动挂载(状态开关拨向"启用")
  114. Method: http.MethodPost,
  115. Path: "/services/:id/mount",
  116. Handler: MountServiceHandler(serverCtx),
  117. },
  118. {
  119. // 停用服务联动卸载(状态开关拨向"停用")
  120. Method: http.MethodPost,
  121. Path: "/services/:id/unmount",
  122. Handler: UnmountServiceHandler(serverCtx),
  123. },
  124. },
  125. rest.WithPrefix("/api/v1"),
  126. )
  127. server.AddRoutes(
  128. []rest.Route{
  129. {
  130. // 添加应用凭证
  131. Method: http.MethodPost,
  132. Path: "/addApplication",
  133. Handler: application.AddApplicationHandler(serverCtx),
  134. },
  135. {
  136. // 应用凭证列表
  137. Method: http.MethodPost,
  138. Path: "/applicationList",
  139. Handler: application.ApplicationListHandler(serverCtx),
  140. },
  141. {
  142. // 删除应用凭证
  143. Method: http.MethodPost,
  144. Path: "/deleteApplication",
  145. Handler: application.DeleteApplicationHandler(serverCtx),
  146. },
  147. {
  148. // 下发应用凭证密钥
  149. Method: http.MethodPost,
  150. Path: "/distributeApiSecret",
  151. Handler: application.DistributeApiSecretHandler(serverCtx),
  152. },
  153. {
  154. // 重置应用凭证密钥
  155. Method: http.MethodPost,
  156. Path: "/resetApplication",
  157. Handler: application.ResetApplicationHandler(serverCtx),
  158. },
  159. {
  160. // 切换应用凭证状态(启用/禁用互换)
  161. Method: http.MethodPost,
  162. Path: "/updateApplicationStatus",
  163. Handler: application.UpdateApplicationStatusHandler(serverCtx),
  164. },
  165. },
  166. rest.WithPrefix("/api/v1/applicationCredentials"),
  167. )
  168. server.AddRoutes(
  169. []rest.Route{
  170. {
  171. // 添加配置
  172. Method: http.MethodPost,
  173. Path: "/addConfig",
  174. Handler: applicationconfig.AddConfigHandler(serverCtx),
  175. },
  176. {
  177. // 配置分页列表
  178. Method: http.MethodPost,
  179. Path: "/configList",
  180. Handler: applicationconfig.ConfigListHandler(serverCtx),
  181. },
  182. {
  183. // 删除配置
  184. Method: http.MethodPost,
  185. Path: "/deleteConfig",
  186. Handler: applicationconfig.DeleteConfigHandler(serverCtx),
  187. },
  188. {
  189. // 更新配置(默认配置 edit_flag=1 不允许改配置项名)
  190. Method: http.MethodPost,
  191. Path: "/updateConfig",
  192. Handler: applicationconfig.UpdateConfigHandler(serverCtx),
  193. },
  194. },
  195. rest.WithPrefix("/api/v1/applicationConfig"),
  196. )
  197. server.AddRoutes(
  198. []rest.Route{
  199. {
  200. // 复位自定义页面信息
  201. Method: http.MethodPost,
  202. Path: "/clear",
  203. Handler: custompage.ClearCacheHandler(serverCtx),
  204. },
  205. {
  206. // 获取自定义页面信息
  207. Method: http.MethodGet,
  208. Path: "/get",
  209. Handler: custompage.GetCacheHandler(serverCtx),
  210. },
  211. {
  212. // 设置自定义页面信息(标题/logo)
  213. Method: http.MethodPost,
  214. Path: "/set",
  215. Handler: custompage.SetCacheHandler(serverCtx),
  216. },
  217. },
  218. rest.WithPrefix("/api/v1/customPage"),
  219. )
  220. server.AddRoutes(
  221. []rest.Route{
  222. {
  223. // WebSocket 运维诊断(ping/traceroute/telnet)
  224. Method: http.MethodGet,
  225. Path: "/ws/ops",
  226. Handler: ops.OpsHandler(serverCtx),
  227. },
  228. },
  229. rest.WithPrefix("/api/v1"),
  230. )
  231. server.AddRoutes(
  232. []rest.Route{
  233. {
  234. // 日志归档
  235. Method: http.MethodPost,
  236. Path: "/archive",
  237. Handler: systemlog.LogArchiveHandler(serverCtx),
  238. },
  239. {
  240. // 日志审计(校验Hmac防篡改)
  241. Method: http.MethodPost,
  242. Path: "/audit",
  243. Handler: systemlog.LogAuditHandler(serverCtx),
  244. },
  245. {
  246. // 日志详情
  247. Method: http.MethodPost,
  248. Path: "/detail",
  249. Handler: systemlog.LogDetailHandler(serverCtx),
  250. },
  251. {
  252. // 查看完整链路
  253. Method: http.MethodPost,
  254. Path: "/link",
  255. Handler: systemlog.LogLinkHandler(serverCtx),
  256. },
  257. {
  258. // 日志分页列表
  259. Method: http.MethodPost,
  260. Path: "/list",
  261. Handler: systemlog.LogListHandler(serverCtx),
  262. },
  263. },
  264. rest.WithPrefix("/api/v1/systemLog"),
  265. )
  266. server.AddRoutes(
  267. []rest.Route{
  268. {
  269. // 归档打包下载(zip)
  270. Method: http.MethodPost,
  271. Path: "/download",
  272. Handler: systemlog.LogArchiveDownloadHandler(serverCtx),
  273. },
  274. {
  275. // 归档列表
  276. Method: http.MethodPost,
  277. Path: "/list",
  278. Handler: systemlog.LogArchiveListHandler(serverCtx),
  279. },
  280. {
  281. // 归档恢复
  282. Method: http.MethodPost,
  283. Path: "/restore",
  284. Handler: systemlog.LogArchiveRestoreHandler(serverCtx),
  285. },
  286. },
  287. rest.WithPrefix("/api/v1/logArchive"),
  288. )
  289. server.AddRoutes(
  290. []rest.Route{
  291. {
  292. // 恢复记录列表
  293. Method: http.MethodPost,
  294. Path: "/list",
  295. Handler: systemlog.LogRestoreListHandler(serverCtx),
  296. },
  297. },
  298. rest.WithPrefix("/api/v1/logRestore"),
  299. )
  300. }