docs.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. // Package classification Netmaker
  2. //
  3. // # API Usage
  4. //
  5. // Most actions that can be performed via API can be performed via UI. We recommend managing your networks using the official netmaker-ui project. However, Netmaker can also be run without the UI, and all functions can be achieved via API calls. If your use case requires using Netmaker without the UI or you need to do some troubleshooting/advanced configuration, using the API directly may help.
  6. //
  7. // # Authentication
  8. //
  9. // API calls must be authenticated via a header of the format -H “Authorization: Bearer <YOUR_SECRET_KEY>” There are two methods to obtain YOUR_SECRET_KEY: 1. Using the masterkey. By default, this value is “secret key,” but you should change this on your instance and keep it secure. This value can be set via env var at startup or in a config file (config/environments/< env >.yaml). See the [Netmaker](https://docs.netmaker.org/index.html) documentation for more details. 2. Using a JWT received for a node. This can be retrieved by calling the /api/nodes/<network>/authenticate endpoint, as documented below.
  10. //
  11. // Schemes: https
  12. // BasePath: /
  13. // Version: 0.17.0
  14. // Host: netmaker.io
  15. //
  16. // Consumes:
  17. // - application/json
  18. //
  19. // Produces:
  20. // - application/json
  21. //
  22. // Security:
  23. // - oauth
  24. //
  25. // swagger:meta
  26. package controller
  27. import (
  28. serverconfigpkg "github.com/gravitl/netmaker/config"
  29. "github.com/gravitl/netmaker/logic/acls"
  30. "github.com/gravitl/netmaker/models"
  31. )
  32. var _ = useUnused() // "use" the function to prevent "unused function" errors
  33. // swagger:parameters getNodeDNS getCustomDNS getDNS
  34. type dnsPathParams struct {
  35. // Network
  36. // in: path
  37. Network string `json:"network"`
  38. }
  39. // swagger:parameters createDNS
  40. type dnsParams struct {
  41. // Network
  42. // in: path
  43. Network string `json:"network"`
  44. // DNS Entry
  45. // in: body
  46. Body []models.DNSEntry `json:"body"`
  47. }
  48. // Success
  49. // swagger:response dnsResponse
  50. type dnsResponse struct {
  51. // in: body
  52. Body []models.DNSEntry `json:"body"`
  53. }
  54. // swagger:parameters deleteDNS
  55. type dnsDeletePathParams struct {
  56. // Network
  57. // in: path
  58. Network string `json:"network"`
  59. // Domain
  60. // in: path
  61. Domain string `json:"domain"`
  62. }
  63. // swagger:response stringJSONResponse
  64. type stringJSONResponse struct {
  65. // Response
  66. // in: body
  67. Response string `json:"response"`
  68. }
  69. // swagger:parameters getAllExtClients
  70. type getAllClientsRequest struct {
  71. // Networks
  72. // in:body
  73. Networks []string `json:"networks"`
  74. }
  75. // swagger:response extClientSliceResponse
  76. type extClientSliceResponse struct {
  77. // ExtClients
  78. // in: body
  79. ExtClients []models.ExtClient `json:"ext_clients"`
  80. }
  81. // swagger:response extClientResponse
  82. type extClientResponse struct {
  83. // ExtClient
  84. // in: body
  85. ExtClient models.ExtClient `json:"ext_client"`
  86. }
  87. // swagger:response successResponse
  88. type successResponse struct {
  89. // Success Response
  90. // in: body
  91. SuccessResponse models.SuccessResponse `json:"success_response"`
  92. }
  93. // swagger:parameters getExtClient getExtClientConf updateExtClient deleteExtClient
  94. type extClientPathParams struct {
  95. // Client ID
  96. // in: path
  97. ClientID string `json:"clientid"`
  98. // Network
  99. // in: path
  100. Network string `json:"network"`
  101. }
  102. // swagger:parameters updateExtClient
  103. type extClientBodyParam struct {
  104. // ExtClient
  105. // in: body
  106. ExtClient models.ExtClient `json:"ext_client"`
  107. }
  108. // swagger:parameters getNetworkExtClients
  109. type extClientNetworkPathParam struct {
  110. // Network
  111. // in: path
  112. Network string `json:"network"`
  113. }
  114. // swagger:parameters createExtClient
  115. type createExtClientPathParams struct {
  116. // Network
  117. // in: path
  118. Network string `json:"network"`
  119. // Node ID
  120. // in: path
  121. NodeID string `json:"node"`
  122. // Custom ExtClient
  123. // in: body
  124. CustomExtClient models.CustomExtClient `json:"custom_ext_client"`
  125. }
  126. // swagger:parameters getNode updateNode deleteNode createRelay deleteRelay createEgressGateway deleteEgressGateway createIngressGateway deleteIngressGateway uncordonNode
  127. type networkNodePathParams struct {
  128. // Network
  129. // in: path
  130. Network string `json:"network"`
  131. // Node ID
  132. // in: path
  133. NodeID string `json:"nodeid"`
  134. }
  135. // swagger:response byteArrayResponse
  136. type byteArrayResponse struct {
  137. // in: body
  138. ByteArray []byte `json:"byte_array"`
  139. }
  140. // swagger:parameters getNetworks
  141. type headerNetworks struct {
  142. // name: networks
  143. // in: header
  144. Networks []string `json:"networks"`
  145. }
  146. // swagger:response getNetworksSliceResponse
  147. type getNetworksSliceResponse struct {
  148. // Networks
  149. // in: body
  150. Networks []models.Network `json:"networks"`
  151. }
  152. // swagger:parameters createNetwork updateNetwork
  153. type networkBodyParam struct {
  154. // Network
  155. // in: body
  156. Network models.Network `json:"network"`
  157. }
  158. // swagger:parameters updateNetwork getNetwork updateNetwork updateNetworkNodeLimit deleteNetwork keyUpdate createAccessKey getAccessKeys deleteAccessKey updateNetworkACL getNetworkACL
  159. type networkPathParam struct {
  160. // Network Name
  161. // in: path
  162. NetworkName string `json:"networkname"`
  163. }
  164. // swagger:parameters deleteAccessKey
  165. type networkAccessKeyNamePathParam struct {
  166. // Access Key Name
  167. // in: path
  168. AccessKeyName string `json:"access_key_name"`
  169. }
  170. // swagger:response networkBodyResponse
  171. type networkBodyResponse struct {
  172. // Network
  173. // in: body
  174. Network models.Network `json:"network"`
  175. }
  176. // swagger:parameters createAccessKey
  177. type accessKeyBodyParam struct {
  178. // Access Key
  179. // in: body
  180. AccessKey models.AccessKey `json:"access_key"`
  181. }
  182. // swagger:response accessKeyBodyResponse
  183. type accessKeyBodyResponse struct {
  184. // Access Key
  185. // in: body
  186. AccessKey models.AccessKey `json:"access_key"`
  187. }
  188. // swagger:response accessKeySliceBodyResponse
  189. type accessKeySliceBodyResponse struct {
  190. // Access Keys
  191. // in: body
  192. AccessKey []models.AccessKey `json:"access_key"`
  193. }
  194. // swagger:parameters updateNetworkACL getNetworkACL
  195. type aclContainerBodyParam struct {
  196. // ACL Container
  197. // in: body
  198. ACLContainer acls.ACLContainer `json:"acl_container"`
  199. }
  200. // swagger:response aclContainerResponse
  201. type aclContainerResponse struct {
  202. // ACL Container
  203. // in: body
  204. ACLContainer acls.ACLContainer `json:"acl_container"`
  205. }
  206. // swagger:response nodeSliceResponse
  207. type nodeSliceResponse struct {
  208. // Nodes
  209. // in: body
  210. Nodes []models.LegacyNode `json:"nodes"`
  211. }
  212. // swagger:response nodeResponse
  213. type nodeResponse struct {
  214. // Node
  215. // in: body
  216. Node models.LegacyNode `json:"node"`
  217. }
  218. // swagger:parameters updateNode deleteNode
  219. type nodeBodyParam struct {
  220. // Node
  221. // in: body
  222. Node models.LegacyNode `json:"node"`
  223. }
  224. // swagger:parameters createRelay
  225. type relayRequestBodyParam struct {
  226. // Relay Request
  227. // in: body
  228. RelayRequest models.RelayRequest `json:"relay_request"`
  229. }
  230. // swagger:parameters createEgressGateway
  231. type egressGatewayBodyParam struct {
  232. // Egress Gateway Request
  233. // in: body
  234. EgressGatewayRequest models.EgressGatewayRequest `json:"egress_gateway_request"`
  235. }
  236. // swagger:parameters authenticate
  237. type authParamBodyParam struct {
  238. // AuthParams
  239. // in: body
  240. AuthParams models.AuthParams `json:"auth_params"`
  241. }
  242. // swagger:response serverConfigResponse
  243. type serverConfigResponse struct {
  244. // Server Config
  245. // in: body
  246. ServerConfig serverconfigpkg.ServerConfig `json:"server_config"`
  247. }
  248. // swagger:response nodeGetResponse
  249. type nodeGetResponse struct {
  250. // Node Get
  251. // in: body
  252. NodeGet models.NodeGet `json:"node_get"`
  253. }
  254. // swagger:response nodeLastModifiedResponse
  255. type nodeLastModifiedResponse struct {
  256. // Node Last Modified
  257. // in: body
  258. NodesLastModified int64 `json:"nodes_last_modified"`
  259. }
  260. // swagger:parameters register
  261. //type registerRequestBodyParam struct {
  262. // // Register Request
  263. // // in: body
  264. // RegisterRequest config.RegisterRequest `json:"register_request"`
  265. //}
  266. //
  267. //// swagger:response registerResponse
  268. //type registerResponse struct {
  269. // // Register Response
  270. // // in: body
  271. // RegisterResponse config.RegisterResponse `json:"register_response"`
  272. //}
  273. // swagger:response boolResponse
  274. type boolResponse struct {
  275. // Boolean Response
  276. // in: body
  277. BoolResponse bool `json:"bool_response"`
  278. }
  279. // swagger:parameters createAdmin updateUser updateUserNetworks createUser
  280. type userBodyParam struct {
  281. // User
  282. // in: body
  283. User models.User `json:"user"`
  284. }
  285. // swagger:response userBodyResponse
  286. type userBodyResponse struct {
  287. // User
  288. // in: body
  289. User models.User `json:"user"`
  290. }
  291. // swagger:parameters authenticateUser
  292. type userAuthBodyParam struct {
  293. // User Auth Params
  294. // in: body
  295. UserAuthParams models.UserAuthParams `json:"user_auth_params"`
  296. }
  297. // swagger:parameters updateUser updateUserNetworks updateUserAdm createUser deleteUser getUser
  298. type usernamePathParam struct {
  299. // Username
  300. // in: path
  301. Username string `json:"username"`
  302. }
  303. // prevent issues with integration tests for types just used by Swagger docs.
  304. func useUnused() bool {
  305. _ = dnsPathParams{}
  306. _ = dnsParams{}
  307. _ = dnsResponse{}
  308. _ = dnsDeletePathParams{}
  309. _ = stringJSONResponse{}
  310. _ = getAllClientsRequest{}
  311. _ = extClientSliceResponse{}
  312. _ = extClientResponse{}
  313. _ = successResponse{}
  314. _ = extClientPathParams{}
  315. _ = extClientBodyParam{}
  316. _ = extClientNetworkPathParam{}
  317. _ = createExtClientPathParams{}
  318. _ = networkNodePathParams{}
  319. _ = byteArrayResponse{}
  320. _ = headerNetworks{}
  321. _ = getNetworksSliceResponse{}
  322. _ = networkBodyParam{}
  323. _ = networkPathParam{}
  324. _ = networkAccessKeyNamePathParam{}
  325. _ = networkBodyResponse{}
  326. _ = accessKeyBodyParam{}
  327. _ = accessKeyBodyResponse{}
  328. _ = accessKeySliceBodyResponse{}
  329. _ = aclContainerBodyParam{}
  330. _ = aclContainerResponse{}
  331. _ = nodeSliceResponse{}
  332. _ = nodeResponse{}
  333. _ = nodeBodyParam{}
  334. _ = relayRequestBodyParam{}
  335. _ = egressGatewayBodyParam{}
  336. _ = authParamBodyParam{}
  337. _ = serverConfigResponse{}
  338. _ = nodeGetResponse{}
  339. _ = nodeLastModifiedResponse{}
  340. // _ = registerRequestBodyParam{}
  341. // _ = registerResponse{}
  342. _ = boolResponse{}
  343. _ = userBodyParam{}
  344. _ = userBodyResponse{}
  345. _ = userAuthBodyParam{}
  346. _ = usernamePathParam{}
  347. return false
  348. }