routes.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. rest.WithPrefix("/api/v1"),
  111. )
  112. server.AddRoutes(
  113. []rest.Route{
  114. {
  115. // 添加应用凭证
  116. Method: http.MethodPost,
  117. Path: "/addApplication",
  118. Handler: application.AddApplicationHandler(serverCtx),
  119. },
  120. {
  121. // 应用凭证列表
  122. Method: http.MethodPost,
  123. Path: "/applicationList",
  124. Handler: application.ApplicationListHandler(serverCtx),
  125. },
  126. {
  127. // 删除应用凭证
  128. Method: http.MethodPost,
  129. Path: "/deleteApplication",
  130. Handler: application.DeleteApplicationHandler(serverCtx),
  131. },
  132. {
  133. // 下发应用凭证密钥
  134. Method: http.MethodPost,
  135. Path: "/distributeApiSecret",
  136. Handler: application.DistributeApiSecretHandler(serverCtx),
  137. },
  138. {
  139. // 重置应用凭证密钥
  140. Method: http.MethodPost,
  141. Path: "/resetApplication",
  142. Handler: application.ResetApplicationHandler(serverCtx),
  143. },
  144. {
  145. // 切换应用凭证状态(启用/禁用互换)
  146. Method: http.MethodPost,
  147. Path: "/updateApplicationStatus",
  148. Handler: application.UpdateApplicationStatusHandler(serverCtx),
  149. },
  150. },
  151. rest.WithPrefix("/api/v1/applicationCredentials"),
  152. )
  153. server.AddRoutes(
  154. []rest.Route{
  155. {
  156. // 日志归档
  157. Method: http.MethodPost,
  158. Path: "/archive",
  159. Handler: systemlog.LogArchiveHandler(serverCtx),
  160. },
  161. {
  162. // 日志审计(校验Hmac防篡改)
  163. Method: http.MethodPost,
  164. Path: "/audit",
  165. Handler: systemlog.LogAuditHandler(serverCtx),
  166. },
  167. {
  168. // 日志详情
  169. Method: http.MethodPost,
  170. Path: "/detail",
  171. Handler: systemlog.LogDetailHandler(serverCtx),
  172. },
  173. {
  174. // 查看完整链路
  175. Method: http.MethodPost,
  176. Path: "/link",
  177. Handler: systemlog.LogLinkHandler(serverCtx),
  178. },
  179. {
  180. // 日志分页列表
  181. Method: http.MethodPost,
  182. Path: "/list",
  183. Handler: systemlog.LogListHandler(serverCtx),
  184. },
  185. },
  186. rest.WithPrefix("/api/v1/systemLog"),
  187. )
  188. server.AddRoutes(
  189. []rest.Route{
  190. {
  191. // 归档打包下载(zip)
  192. Method: http.MethodPost,
  193. Path: "/download",
  194. Handler: systemlog.LogArchiveDownloadHandler(serverCtx),
  195. },
  196. {
  197. // 归档列表
  198. Method: http.MethodPost,
  199. Path: "/list",
  200. Handler: systemlog.LogArchiveListHandler(serverCtx),
  201. },
  202. {
  203. // 归档恢复
  204. Method: http.MethodPost,
  205. Path: "/restore",
  206. Handler: systemlog.LogArchiveRestoreHandler(serverCtx),
  207. },
  208. },
  209. rest.WithPrefix("/api/v1/logArchive"),
  210. )
  211. server.AddRoutes(
  212. []rest.Route{
  213. {
  214. // 恢复记录列表
  215. Method: http.MethodPost,
  216. Path: "/list",
  217. Handler: systemlog.LogRestoreListHandler(serverCtx),
  218. },
  219. },
  220. rest.WithPrefix("/api/v1/logRestore"),
  221. )
  222. }