openapi.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # When you made a change to this YAML, please validate with https://editor.swagger.io
  2. openapi: 3.0.3
  3. info:
  4. version: 1.1.1
  5. title: RootlessKit API
  6. servers:
  7. - url: 'http://rootlesskit/v1'
  8. description: Local UNIX socket server. The host part of the URL is ignored.
  9. paths:
  10. # /info: API >= 1.1.0
  11. /info:
  12. get:
  13. responses:
  14. '200':
  15. description: Info. Available since API 1.1.0.
  16. content:
  17. application/json:
  18. schema:
  19. $ref: '#/components/schemas/Info'
  20. /ports:
  21. get:
  22. responses:
  23. '200':
  24. description: An array of PortStatus
  25. content:
  26. application/json:
  27. schema:
  28. $ref: '#/components/schemas/PortStatuses'
  29. post:
  30. requestBody:
  31. required: true
  32. content:
  33. application/json:
  34. schema:
  35. $ref: '#/components/schemas/PortSpec'
  36. responses:
  37. '201':
  38. description: PortStatus with ID
  39. content:
  40. application/json:
  41. schema:
  42. $ref: '#/components/schemas/PortStatus'
  43. '/ports/{id}':
  44. delete:
  45. parameters:
  46. - name: id
  47. in: path
  48. required: true
  49. schema:
  50. type: integer
  51. format: int64
  52. responses:
  53. '200':
  54. description: Null response
  55. components:
  56. schemas:
  57. Proto:
  58. type: string
  59. description: "protocol for listening. Corresponds to Go's net.Listen. The strings with \"4\" and \"6\" suffixes were introduced in API 1.1.0."
  60. enum:
  61. - tcp
  62. - tcp4
  63. - tcp6
  64. - udp
  65. - udp4
  66. - udp6
  67. - sctp
  68. - sctp4
  69. - sctp6
  70. PortSpec:
  71. required:
  72. - proto
  73. properties:
  74. proto:
  75. $ref: '#/components/schemas/Proto'
  76. parentIP:
  77. type: string
  78. parentPort:
  79. type: integer
  80. format: int32
  81. minimum: 1
  82. maximum: 65535
  83. childIP:
  84. type: string
  85. # future version may support requests with parentPort<=0 for automatic port assignment
  86. childPort:
  87. type: integer
  88. format: int32
  89. minimum: 1
  90. maximum: 65535
  91. PortStatus:
  92. required:
  93. - id
  94. properties:
  95. id:
  96. type: integer
  97. format: int64
  98. spec:
  99. $ref: '#/components/schemas/PortSpec'
  100. PortStatuses:
  101. type: array
  102. items:
  103. $ref: '#/components/schemas/PortStatus'
  104. # Info: API >= 1.1.0
  105. Info:
  106. required:
  107. - apiVersion
  108. - version
  109. - stateDir
  110. - childPID
  111. properties:
  112. apiVersion:
  113. type: string
  114. description: "API version, without \"v\" prefix"
  115. example: "1.1.0"
  116. version:
  117. type: string
  118. description: "Implementation version, without \"v\" prefix"
  119. example: "0.42.0-beta.1+dev"
  120. stateDir:
  121. type: string
  122. description: "state dir"
  123. example: "/run/user/1000/rootlesskit"
  124. childPID:
  125. type: integer
  126. description: "child PID"
  127. example: 10042
  128. networkDriver:
  129. $ref: '#/components/schemas/NetworkDriverInfo'
  130. portDriver:
  131. $ref: '#/components/schemas/PortDriverInfo'
  132. NetworkDriverInfo:
  133. required:
  134. - driver
  135. properties:
  136. driver:
  137. type: string
  138. description: "network driver. Empty when --net=host."
  139. example: "slirp4netns"
  140. # TODO: return TAP info
  141. dns:
  142. type: array
  143. description: "DNS addresses"
  144. items:
  145. type: string
  146. example: ["10.0.2.3"]
  147. childIP:
  148. type: string
  149. description: "Child IP (v4)"
  150. example: "10.0.2.100"
  151. dynamicChildIP:
  152. type: boolean
  153. description: "Child IP may change"
  154. PortDriverInfo:
  155. required:
  156. - driver
  157. - supportedProtos
  158. properties:
  159. driver:
  160. type: string
  161. description: "port driver"
  162. example: "builtin"
  163. protos:
  164. type: array
  165. description: "The supported protocol strings for listening ports"
  166. example: ["tcp","udp"]
  167. items:
  168. $ref: '#/components/schemas/Proto'
  169. disallowLoopbackChildIP:
  170. type: boolean
  171. description: "If this field is set to true, loopback IP such as 127.0.0.1 cannot be specified as a child IP"