swagger.json 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "title": "go-common api",
  5. "description": "api",
  6. "version": "1.0",
  7. "contact": {
  8. "email": "lintanghui@bilibili.com"
  9. },
  10. "license": {
  11. "name": "Apache 2.0",
  12. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  13. }
  14. },
  15. "paths": {
  16. "/x/admin/cache/cluster": {
  17. "get": {
  18. "operationId": "/x/admin/cache/cluster",
  19. "parameters": [
  20. {
  21. "in": "query",
  22. "name": "app_id",
  23. "description": "关联的appid",
  24. "required": true,
  25. "type": "string"
  26. }
  27. ],
  28. "responses": {
  29. "200": {
  30. "description": "服务成功响应内容",
  31. "schema": {
  32. "type": "object",
  33. "properties": {
  34. "code": {
  35. "description": "错误码描述",
  36. "type": "integer"
  37. },
  38. "data": {
  39. "type": "array",
  40. "items": {
  41. "$ref": "#/definitions/Cluster",
  42. "type": "object"
  43. }
  44. },
  45. "message": {
  46. "description": "错误码文本描述",
  47. "type": "string"
  48. },
  49. "ttl": {
  50. "description": "客户端限速时间",
  51. "type": "integer",
  52. "format": "int64"
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. },
  60. "/x/admin/cache/cluster/add": {
  61. "post": {
  62. "operationId": "/x/admin/cache/cluster/add",
  63. "parameters": [
  64. {
  65. "in": "query",
  66. "name": "hash_tag",
  67. "description": "key hash 标识",
  68. "required": true,
  69. "type": "string"
  70. },
  71. {
  72. "in": "query",
  73. "name": "name",
  74. "description": "集群名字",
  75. "required": true,
  76. "type": "string"
  77. },
  78. {
  79. "in": "query",
  80. "name": "node_conn",
  81. "description": "集群内及诶单连接数 默认值 10",
  82. "required": true,
  83. "type": "integer",
  84. "format": "int32"
  85. },
  86. {
  87. "in": "query",
  88. "name": "type",
  89. "description": "缓存类型(memcache,redis,redis-cluster)",
  90. "required": true,
  91. "type": "string"
  92. },
  93. {
  94. "in": "query",
  95. "name": "hash_method",
  96. "description": "哈希方法 默认fvn1a_64 默认值 fnv1a_64",
  97. "required": true,
  98. "type": "string"
  99. },
  100. {
  101. "in": "query",
  102. "name": "ping_fail_limit",
  103. "description": "节点失败检测次数",
  104. "required": true,
  105. "type": "integer",
  106. "format": "int32"
  107. },
  108. {
  109. "in": "query",
  110. "name": "dail_timeout",
  111. "description": "dial 超时 默认值 100",
  112. "required": true,
  113. "type": "integer",
  114. "format": "int32"
  115. },
  116. {
  117. "in": "query",
  118. "name": "read_timeout",
  119. "description": "read 超时 默认值 100",
  120. "required": true,
  121. "type": "integer",
  122. "format": "int32"
  123. },
  124. {
  125. "in": "query",
  126. "name": "listen_proto",
  127. "description": "协议 默认值 tcp",
  128. "required": true,
  129. "type": "string"
  130. },
  131. {
  132. "in": "query",
  133. "name": "listen_addr",
  134. "description": "监听地址",
  135. "required": true,
  136. "type": "string"
  137. },
  138. {
  139. "in": "query",
  140. "name": "app_id",
  141. "description": "集群关联的appid",
  142. "required": true,
  143. "type": "string"
  144. },
  145. {
  146. "in": "query",
  147. "name": "write_timeout",
  148. "description": "write 超时 默认值 100",
  149. "required": true,
  150. "type": "integer",
  151. "format": "int32"
  152. },
  153. {
  154. "in": "query",
  155. "name": "ping_auto_reject",
  156. "description": "是否自动剔除节点",
  157. "required": true,
  158. "type": "boolean"
  159. },
  160. {
  161. "in": "query",
  162. "name": "id",
  163. "description": "主键id 更新的时候使用",
  164. "required": true,
  165. "type": "integer",
  166. "format": "int64"
  167. },
  168. {
  169. "in": "query",
  170. "name": "hash_distribution",
  171. "description": "key分布策略 默认为ketama一致性hash 默认值 ketama",
  172. "required": true,
  173. "type": "string"
  174. }
  175. ],
  176. "responses": {
  177. "200": {
  178. "description": "服务成功响应内容",
  179. "schema": {
  180. "type": "object",
  181. "properties": {
  182. "code": {
  183. "description": "错误码描述",
  184. "type": "integer"
  185. },
  186. "data": {
  187. "$ref": "#/definitions/EmpResp",
  188. "type": "object"
  189. },
  190. "message": {
  191. "description": "错误码文本描述",
  192. "type": "string"
  193. },
  194. "ttl": {
  195. "description": "客户端限速时间",
  196. "type": "integer",
  197. "format": "int64"
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. },
  205. "/x/admin/cache/cluster/detail": {
  206. "get": {
  207. "operationId": "/x/admin/cache/cluster/detail",
  208. "parameters": [
  209. {
  210. "in": "query",
  211. "name": "id",
  212. "description": "集群id",
  213. "required": true,
  214. "type": "integer",
  215. "format": "int64"
  216. },
  217. {
  218. "in": "query",
  219. "name": "Name",
  220. "description": "集群名字",
  221. "type": "string"
  222. }
  223. ],
  224. "responses": {
  225. "200": {
  226. "description": "服务成功响应内容",
  227. "schema": {
  228. "type": "object",
  229. "properties": {
  230. "code": {
  231. "description": "错误码描述",
  232. "type": "integer"
  233. },
  234. "data": {
  235. "$ref": "#/definitions/ClusterDtlResp",
  236. "type": "object"
  237. },
  238. "message": {
  239. "description": "错误码文本描述",
  240. "type": "string"
  241. },
  242. "ttl": {
  243. "description": "客户端限速时间",
  244. "type": "integer",
  245. "format": "int64"
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. },
  253. "/x/admin/cache/cluster/modify": {
  254. "post": {
  255. "operationId": "/x/admin/cache/cluster/modify",
  256. "parameters": [
  257. {
  258. "in": "query",
  259. "name": "Nodes",
  260. "description": "节点信息 json数组 [{\"id\":11,\"addr\":\"11\",\"weight\":1,\"alias\":\"alias\"}]",
  261. "type": "string"
  262. },
  263. {
  264. "in": "query",
  265. "name": "id",
  266. "description": "集群id",
  267. "required": true,
  268. "type": "integer",
  269. "format": "int64"
  270. },
  271. {
  272. "in": "query",
  273. "name": "action",
  274. "description": "操作(1 添加节点,2 删除节点;删除节点时只需要传alias)",
  275. "required": true,
  276. "type": "integer",
  277. "format": "int32"
  278. }
  279. ],
  280. "responses": {
  281. "200": {
  282. "description": "服务成功响应内容",
  283. "schema": {
  284. "type": "object",
  285. "properties": {
  286. "code": {
  287. "description": "错误码描述",
  288. "type": "integer"
  289. },
  290. "data": {
  291. "$ref": "#/definitions/EmpResp",
  292. "type": "object"
  293. },
  294. "message": {
  295. "description": "错误码文本描述",
  296. "type": "string"
  297. },
  298. "ttl": {
  299. "description": "客户端限速时间",
  300. "type": "integer",
  301. "format": "int64"
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. },
  309. "/x/admin/cache/clusters": {
  310. "get": {
  311. "operationId": "/x/admin/cache/clusters",
  312. "parameters": [
  313. {
  314. "in": "query",
  315. "name": "PN",
  316. "description": " 默认值 1",
  317. "type": "integer",
  318. "format": "int64"
  319. },
  320. {
  321. "in": "query",
  322. "name": "PS",
  323. "description": " 默认值 20",
  324. "type": "integer",
  325. "format": "int64"
  326. }
  327. ],
  328. "responses": {
  329. "200": {
  330. "description": "服务成功响应内容",
  331. "schema": {
  332. "type": "object",
  333. "properties": {
  334. "code": {
  335. "description": "错误码描述",
  336. "type": "integer"
  337. },
  338. "data": {
  339. "$ref": "#/definitions/ClustersResp",
  340. "type": "object"
  341. },
  342. "message": {
  343. "description": "错误码文本描述",
  344. "type": "string"
  345. },
  346. "ttl": {
  347. "description": "客户端限速时间",
  348. "type": "integer",
  349. "format": "int64"
  350. }
  351. }
  352. }
  353. }
  354. }
  355. }
  356. }
  357. },
  358. "definitions": {
  359. "Cluster": {
  360. "title": "Cluster",
  361. "description": "Cluster resp result of clusters.",
  362. "required": [
  363. "id",
  364. "name",
  365. "type",
  366. "app_id",
  367. "hash_method",
  368. "hash_distribution",
  369. "hash_tag",
  370. "dail_timeout",
  371. "read_timeout",
  372. "write_timeout",
  373. "node_conn",
  374. "ping_fail_limit",
  375. "ping_auto_reject",
  376. "listen_proto",
  377. "listen_addr",
  378. "hit",
  379. "qps",
  380. "state",
  381. "mem_ratio",
  382. "nodes"
  383. ],
  384. "type": "object",
  385. "properties": {
  386. "app_id": {
  387. "type": "string"
  388. },
  389. "dail_timeout": {
  390. "description": "dial 超时",
  391. "type": "integer",
  392. "format": "int32"
  393. },
  394. "hash_distribution": {
  395. "description": "key分布策略 默认为ketama一致性hash",
  396. "type": "string"
  397. },
  398. "hash_method": {
  399. "description": "哈希方法 默认sha1",
  400. "type": "string"
  401. },
  402. "hash_tag": {
  403. "description": "key hash 标识",
  404. "type": "string"
  405. },
  406. "hit": {
  407. "description": "集群命中率",
  408. "type": "integer",
  409. "format": "int64"
  410. },
  411. "id": {
  412. "type": "integer",
  413. "format": "int64"
  414. },
  415. "listen_addr": {
  416. "type": "string"
  417. },
  418. "listen_proto": {
  419. "type": "string"
  420. },
  421. "mem_ratio": {
  422. "description": "内存使用率",
  423. "type": "integer",
  424. "format": "int64"
  425. },
  426. "name": {
  427. "description": "集群名字",
  428. "type": "string"
  429. },
  430. "node_conn": {
  431. "description": "集群内节点连接数",
  432. "type": "integer",
  433. "format": "int32"
  434. },
  435. "nodes": {
  436. "type": "array",
  437. "items": {
  438. "$ref": "#/definitions/NodeDtl",
  439. "type": "object"
  440. }
  441. },
  442. "ping_auto_reject": {
  443. "description": "是否自动剔除节点",
  444. "type": "boolean"
  445. },
  446. "ping_fail_limit": {
  447. "description": "节点失败检测次数",
  448. "type": "integer",
  449. "format": "int32"
  450. },
  451. "qps": {
  452. "description": "集群qps",
  453. "type": "integer",
  454. "format": "int64"
  455. },
  456. "read_timeout": {
  457. "type": "integer",
  458. "format": "int32"
  459. },
  460. "state": {
  461. "description": "集群状态 (0-online ;1-offline)",
  462. "type": "integer",
  463. "format": "int64"
  464. },
  465. "type": {
  466. "description": "缓存类型. (memcache,redis,redis-cluster)",
  467. "type": "string"
  468. },
  469. "write_timeout": {
  470. "description": "read 超时",
  471. "type": "integer",
  472. "format": "int32"
  473. }
  474. }
  475. },
  476. "ClusterDtlResp": {
  477. "title": "ClusterDtlResp",
  478. "description": "ClusterDtlResp resp result of cluster detail.",
  479. "required": [
  480. "nodes"
  481. ],
  482. "type": "object",
  483. "properties": {
  484. "nodes": {
  485. "type": "array",
  486. "items": {
  487. "$ref": "#/definitions/NodeDtl",
  488. "type": "object"
  489. }
  490. }
  491. }
  492. },
  493. "ClustersResp": {
  494. "title": "ClustersResp",
  495. "description": "ClustersResp resp result of clusters.",
  496. "required": [
  497. "clusters",
  498. "total"
  499. ],
  500. "type": "object",
  501. "properties": {
  502. "clusters": {
  503. "type": "array",
  504. "items": {
  505. "$ref": "#/definitions/Cluster",
  506. "type": "object"
  507. }
  508. },
  509. "total": {
  510. "description": "总数量",
  511. "type": "integer",
  512. "format": "int64"
  513. }
  514. }
  515. },
  516. "EmpResp": {
  517. "title": "EmpResp",
  518. "description": "EmpResp is empty resp.",
  519. "type": "object"
  520. },
  521. "NodeDtl": {
  522. "title": "NodeDtl",
  523. "description": "NodeDtl cluster node detaiwl",
  524. "required": [
  525. "id",
  526. "cid",
  527. "addr",
  528. "weight",
  529. "alias",
  530. "state",
  531. "qps",
  532. "mem_use",
  533. "mem_toal"
  534. ],
  535. "type": "object",
  536. "properties": {
  537. "addr": {
  538. "type": "string"
  539. },
  540. "alias": {
  541. "type": "string"
  542. },
  543. "cid": {
  544. "type": "integer",
  545. "format": "int64"
  546. },
  547. "id": {
  548. "type": "integer",
  549. "format": "int64"
  550. },
  551. "mem_toal": {
  552. "type": "number",
  553. "format": "float"
  554. },
  555. "mem_use": {
  556. "type": "number",
  557. "format": "float"
  558. },
  559. "qps": {
  560. "type": "integer",
  561. "format": "int64"
  562. },
  563. "state": {
  564. "type": "integer",
  565. "format": "int32"
  566. },
  567. "weight": {
  568. "type": "integer",
  569. "format": "int32"
  570. }
  571. }
  572. }
  573. }
  574. }