2
0

release.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. package router
  2. import (
  3. "github.com/go-chi/chi"
  4. "github.com/porter-dev/porter/api/server/handlers/release"
  5. "github.com/porter-dev/porter/api/server/shared"
  6. "github.com/porter-dev/porter/api/server/shared/config"
  7. "github.com/porter-dev/porter/api/types"
  8. )
  9. func NewReleaseScopedRegisterer(children ...*Registerer) *Registerer {
  10. return &Registerer{
  11. GetRoutes: GetReleaseScopedRoutes,
  12. Children: children,
  13. }
  14. }
  15. func GetReleaseScopedRoutes(
  16. r chi.Router,
  17. config *config.Config,
  18. basePath *types.Path,
  19. factory shared.APIEndpointFactory,
  20. children ...*Registerer,
  21. ) []*Route {
  22. routes, projPath := getReleaseRoutes(r, config, basePath, factory)
  23. if len(children) > 0 {
  24. r.Route(projPath.RelativePath, func(r chi.Router) {
  25. for _, child := range children {
  26. childRoutes := child.GetRoutes(r, config, basePath, factory, child.Children...)
  27. routes = append(routes, childRoutes...)
  28. }
  29. })
  30. }
  31. return routes
  32. }
  33. func getReleaseRoutes(
  34. r chi.Router,
  35. config *config.Config,
  36. basePath *types.Path,
  37. factory shared.APIEndpointFactory,
  38. ) ([]*Route, *types.Path) {
  39. relPath := "/releases/{name}/{version}"
  40. newPath := &types.Path{
  41. Parent: basePath,
  42. RelativePath: relPath,
  43. }
  44. routes := make([]*Route, 0)
  45. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version} -> release.NewReleaseGetHandler
  46. getEndpoint := factory.NewAPIEndpoint(
  47. &types.APIRequestMetadata{
  48. Verb: types.APIVerbGet,
  49. Method: types.HTTPVerbGet,
  50. Path: &types.Path{
  51. Parent: basePath,
  52. RelativePath: relPath,
  53. },
  54. Scopes: []types.PermissionScope{
  55. types.UserScope,
  56. types.ProjectScope,
  57. types.ClusterScope,
  58. types.NamespaceScope,
  59. types.ReleaseScope,
  60. },
  61. },
  62. )
  63. getHandler := release.NewReleaseGetHandler(
  64. config,
  65. factory.GetResultWriter(),
  66. )
  67. routes = append(routes, &Route{
  68. Endpoint: getEndpoint,
  69. Handler: getHandler,
  70. Router: r,
  71. })
  72. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/controllers -> release.NewGetControllersHandler
  73. getControllersEndpoint := factory.NewAPIEndpoint(
  74. &types.APIRequestMetadata{
  75. Verb: types.APIVerbGet,
  76. Method: types.HTTPVerbGet,
  77. Path: &types.Path{
  78. Parent: basePath,
  79. RelativePath: relPath + "/controllers",
  80. },
  81. Scopes: []types.PermissionScope{
  82. types.UserScope,
  83. types.ProjectScope,
  84. types.ClusterScope,
  85. types.NamespaceScope,
  86. types.ReleaseScope,
  87. },
  88. },
  89. )
  90. getControllersHandler := release.NewGetControllersHandler(
  91. config,
  92. factory.GetResultWriter(),
  93. )
  94. routes = append(routes, &Route{
  95. Endpoint: getControllersEndpoint,
  96. Handler: getControllersHandler,
  97. Router: r,
  98. })
  99. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/components -> release.NewGetComponentsHandler
  100. getComponentsEndpoint := factory.NewAPIEndpoint(
  101. &types.APIRequestMetadata{
  102. Verb: types.APIVerbGet,
  103. Method: types.HTTPVerbGet,
  104. Path: &types.Path{
  105. Parent: basePath,
  106. RelativePath: relPath + "/components",
  107. },
  108. Scopes: []types.PermissionScope{
  109. types.UserScope,
  110. types.ProjectScope,
  111. types.ClusterScope,
  112. types.NamespaceScope,
  113. types.ReleaseScope,
  114. },
  115. },
  116. )
  117. getComponentsHandler := release.NewGetComponentsHandler(
  118. config,
  119. factory.GetResultWriter(),
  120. )
  121. routes = append(routes, &Route{
  122. Endpoint: getComponentsEndpoint,
  123. Handler: getComponentsHandler,
  124. Router: r,
  125. })
  126. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/history -> release.NewGetHistoryHandler
  127. getHistoryEndpoint := factory.NewAPIEndpoint(
  128. &types.APIRequestMetadata{
  129. Verb: types.APIVerbGet,
  130. Method: types.HTTPVerbGet,
  131. Path: &types.Path{
  132. Parent: basePath,
  133. RelativePath: "/releases/{name}/history",
  134. },
  135. Scopes: []types.PermissionScope{
  136. types.UserScope,
  137. types.ProjectScope,
  138. types.ClusterScope,
  139. types.NamespaceScope,
  140. },
  141. },
  142. )
  143. getHistoryHandler := release.NewGetReleaseHistoryHandler(
  144. config,
  145. factory.GetDecoderValidator(),
  146. factory.GetResultWriter(),
  147. )
  148. routes = append(routes, &Route{
  149. Endpoint: getHistoryEndpoint,
  150. Handler: getHistoryHandler,
  151. Router: r,
  152. })
  153. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/pods/all -> release.NewGetAllPodsHandler
  154. getAllPodsEndpoint := factory.NewAPIEndpoint(
  155. &types.APIRequestMetadata{
  156. Verb: types.APIVerbGet,
  157. Method: types.HTTPVerbGet,
  158. Path: &types.Path{
  159. Parent: basePath,
  160. RelativePath: relPath + "/pods/all",
  161. },
  162. Scopes: []types.PermissionScope{
  163. types.UserScope,
  164. types.ProjectScope,
  165. types.ClusterScope,
  166. types.NamespaceScope,
  167. types.ReleaseScope,
  168. },
  169. },
  170. )
  171. getAllPodsHandler := release.NewGetAllPodsHandler(
  172. config,
  173. factory.GetResultWriter(),
  174. )
  175. routes = append(routes, &Route{
  176. Endpoint: getAllPodsEndpoint,
  177. Handler: getAllPodsHandler,
  178. Router: r,
  179. })
  180. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/notifications -> release.NewUpdateNotificationHandler
  181. updateNotifsEndpoint := factory.NewAPIEndpoint(
  182. &types.APIRequestMetadata{
  183. Verb: types.APIVerbUpdate,
  184. Method: types.HTTPVerbPost,
  185. Path: &types.Path{
  186. Parent: basePath,
  187. RelativePath: "/releases/{name}/notifications",
  188. },
  189. Scopes: []types.PermissionScope{
  190. types.UserScope,
  191. types.ProjectScope,
  192. types.ClusterScope,
  193. types.NamespaceScope,
  194. },
  195. },
  196. )
  197. updateNotifsHandler := release.NewUpdateNotificationHandler(
  198. config,
  199. factory.GetDecoderValidator(),
  200. factory.GetResultWriter(),
  201. )
  202. routes = append(routes, &Route{
  203. Endpoint: updateNotifsEndpoint,
  204. Handler: updateNotifsHandler,
  205. Router: r,
  206. })
  207. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/notifications -> release.NewGetNotificationHandler
  208. getNotifsEndpoint := factory.NewAPIEndpoint(
  209. &types.APIRequestMetadata{
  210. Verb: types.APIVerbGet,
  211. Method: types.HTTPVerbGet,
  212. Path: &types.Path{
  213. Parent: basePath,
  214. RelativePath: "/releases/{name}/notifications",
  215. },
  216. Scopes: []types.PermissionScope{
  217. types.UserScope,
  218. types.ProjectScope,
  219. types.ClusterScope,
  220. types.NamespaceScope,
  221. },
  222. },
  223. )
  224. getNotifsHandler := release.NewGetNotificationHandler(
  225. config,
  226. factory.GetResultWriter(),
  227. )
  228. routes = append(routes, &Route{
  229. Endpoint: getNotifsEndpoint,
  230. Handler: getNotifsHandler,
  231. Router: r,
  232. })
  233. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/webhook -> release.NewGetWebhookHandler
  234. getWebhookEndpoint := factory.NewAPIEndpoint(
  235. &types.APIRequestMetadata{
  236. Verb: types.APIVerbGet,
  237. Method: types.HTTPVerbGet,
  238. Path: &types.Path{
  239. Parent: basePath,
  240. RelativePath: "/releases/{name}/webhook",
  241. },
  242. Scopes: []types.PermissionScope{
  243. types.UserScope,
  244. types.ProjectScope,
  245. types.ClusterScope,
  246. types.NamespaceScope,
  247. },
  248. },
  249. )
  250. getWebhookHandler := release.NewGetWebhookHandler(
  251. config,
  252. factory.GetResultWriter(),
  253. )
  254. routes = append(routes, &Route{
  255. Endpoint: getWebhookEndpoint,
  256. Handler: getWebhookHandler,
  257. Router: r,
  258. })
  259. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/webhook -> release.NewCreateWebhookHandler
  260. createWebhookEndpoint := factory.NewAPIEndpoint(
  261. &types.APIRequestMetadata{
  262. Verb: types.APIVerbCreate,
  263. Method: types.HTTPVerbPost,
  264. Path: &types.Path{
  265. Parent: basePath,
  266. RelativePath: relPath + "/webhook",
  267. },
  268. Scopes: []types.PermissionScope{
  269. types.UserScope,
  270. types.ProjectScope,
  271. types.ClusterScope,
  272. types.NamespaceScope,
  273. types.ReleaseScope,
  274. },
  275. },
  276. )
  277. createWebhookHandler := release.NewCreateWebhookHandler(
  278. config,
  279. factory.GetResultWriter(),
  280. )
  281. routes = append(routes, &Route{
  282. Endpoint: createWebhookEndpoint,
  283. Handler: createWebhookHandler,
  284. Router: r,
  285. })
  286. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/steps -> release.NewGetReleaseStepsHandler
  287. getStepsEndpoint := factory.NewAPIEndpoint(
  288. &types.APIRequestMetadata{
  289. Verb: types.APIVerbGet,
  290. Method: types.HTTPVerbGet,
  291. Path: &types.Path{
  292. Parent: basePath,
  293. RelativePath: "/releases/{name}/steps",
  294. },
  295. Scopes: []types.PermissionScope{
  296. types.UserScope,
  297. types.ProjectScope,
  298. types.ClusterScope,
  299. types.NamespaceScope,
  300. },
  301. },
  302. )
  303. getStepsHandler := release.NewGetReleaseStepsHandler(
  304. config,
  305. factory.GetDecoderValidator(),
  306. factory.GetResultWriter(),
  307. )
  308. routes = append(routes, &Route{
  309. Endpoint: getStepsEndpoint,
  310. Handler: getStepsHandler,
  311. Router: r,
  312. })
  313. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/steps -> release.NewUpdateReleaseStepsHandler
  314. updateStepsEndpoint := factory.NewAPIEndpoint(
  315. &types.APIRequestMetadata{
  316. Verb: types.APIVerbCreate,
  317. Method: types.HTTPVerbPost,
  318. Path: &types.Path{
  319. Parent: basePath,
  320. RelativePath: "/releases/{name}/steps",
  321. },
  322. Scopes: []types.PermissionScope{
  323. types.UserScope,
  324. types.ProjectScope,
  325. types.ClusterScope,
  326. types.NamespaceScope,
  327. },
  328. },
  329. )
  330. updateStepsHandler := release.NewUpdateReleaseStepsHandler(
  331. config,
  332. factory.GetDecoderValidator(),
  333. factory.GetResultWriter(),
  334. )
  335. routes = append(routes, &Route{
  336. Endpoint: updateStepsEndpoint,
  337. Handler: updateStepsHandler,
  338. Router: r,
  339. })
  340. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases -> release.NewCreateReleaseHandler
  341. createReleaseEndpoint := factory.NewAPIEndpoint(
  342. &types.APIRequestMetadata{
  343. Verb: types.APIVerbCreate,
  344. Method: types.HTTPVerbPost,
  345. Path: &types.Path{
  346. Parent: basePath,
  347. RelativePath: "/releases",
  348. },
  349. Scopes: []types.PermissionScope{
  350. types.UserScope,
  351. types.ProjectScope,
  352. types.ClusterScope,
  353. types.NamespaceScope,
  354. },
  355. },
  356. )
  357. createReleaseHandler := release.NewCreateReleaseHandler(
  358. config,
  359. factory.GetDecoderValidator(),
  360. factory.GetResultWriter(),
  361. )
  362. routes = append(routes, &Route{
  363. Endpoint: createReleaseEndpoint,
  364. Handler: createReleaseHandler,
  365. Router: r,
  366. })
  367. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/addons -> release.NewCreateAddonHandler
  368. createAddonEndpoint := factory.NewAPIEndpoint(
  369. &types.APIRequestMetadata{
  370. Verb: types.APIVerbCreate,
  371. Method: types.HTTPVerbPost,
  372. Path: &types.Path{
  373. Parent: basePath,
  374. RelativePath: "/addons",
  375. },
  376. Scopes: []types.PermissionScope{
  377. types.UserScope,
  378. types.ProjectScope,
  379. types.ClusterScope,
  380. types.NamespaceScope,
  381. },
  382. },
  383. )
  384. createAddonHandler := release.NewCreateAddonHandler(
  385. config,
  386. factory.GetDecoderValidator(),
  387. factory.GetResultWriter(),
  388. )
  389. routes = append(routes, &Route{
  390. Endpoint: createAddonEndpoint,
  391. Handler: createAddonHandler,
  392. Router: r,
  393. })
  394. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/gha_template -> release.NewGetGHATemplateHandler
  395. getGHATemplateEndpoint := factory.NewAPIEndpoint(
  396. &types.APIRequestMetadata{
  397. Verb: types.APIVerbGet,
  398. Method: types.HTTPVerbPost,
  399. Path: &types.Path{
  400. Parent: basePath,
  401. RelativePath: "/releases/gha_template",
  402. },
  403. Scopes: []types.PermissionScope{
  404. types.UserScope,
  405. types.ProjectScope,
  406. types.ClusterScope,
  407. types.NamespaceScope,
  408. },
  409. },
  410. )
  411. getGHATemplateHandler := release.NewGetGHATemplateHandler(
  412. config,
  413. factory.GetDecoderValidator(),
  414. factory.GetResultWriter(),
  415. )
  416. routes = append(routes, &Route{
  417. Endpoint: getGHATemplateEndpoint,
  418. Handler: getGHATemplateHandler,
  419. Router: r,
  420. })
  421. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/rollback ->
  422. // release.NewRollbackReleaseHandler
  423. rollbackEndpoint := factory.NewAPIEndpoint(
  424. &types.APIRequestMetadata{
  425. Verb: types.APIVerbUpdate,
  426. Method: types.HTTPVerbPost,
  427. Path: &types.Path{
  428. Parent: basePath,
  429. RelativePath: relPath + "/rollback",
  430. },
  431. Scopes: []types.PermissionScope{
  432. types.UserScope,
  433. types.ProjectScope,
  434. types.ClusterScope,
  435. types.NamespaceScope,
  436. types.ReleaseScope,
  437. },
  438. },
  439. )
  440. rollbackHandler := release.NewRollbackReleaseHandler(
  441. config,
  442. factory.GetDecoderValidator(),
  443. factory.GetResultWriter(),
  444. )
  445. routes = append(routes, &Route{
  446. Endpoint: rollbackEndpoint,
  447. Handler: rollbackHandler,
  448. Router: r,
  449. })
  450. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/upgrade ->
  451. // release.NewUpgradeReleaseHandler
  452. upgradeEndpoint := factory.NewAPIEndpoint(
  453. &types.APIRequestMetadata{
  454. Verb: types.APIVerbUpdate,
  455. Method: types.HTTPVerbPost,
  456. Path: &types.Path{
  457. Parent: basePath,
  458. RelativePath: relPath + "/upgrade",
  459. },
  460. Scopes: []types.PermissionScope{
  461. types.UserScope,
  462. types.ProjectScope,
  463. types.ClusterScope,
  464. types.NamespaceScope,
  465. types.ReleaseScope,
  466. },
  467. },
  468. )
  469. upgradeHandler := release.NewUpgradeReleaseHandler(
  470. config,
  471. factory.GetDecoderValidator(),
  472. factory.GetResultWriter(),
  473. )
  474. routes = append(routes, &Route{
  475. Endpoint: upgradeEndpoint,
  476. Handler: upgradeHandler,
  477. Router: r,
  478. })
  479. // DELETE /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version} ->
  480. // release.NewDeleteReleaseHandler
  481. deleteEndpoint := factory.NewAPIEndpoint(
  482. &types.APIRequestMetadata{
  483. Verb: types.APIVerbDelete,
  484. Method: types.HTTPVerbDelete,
  485. Path: &types.Path{
  486. Parent: basePath,
  487. RelativePath: relPath,
  488. },
  489. Scopes: []types.PermissionScope{
  490. types.UserScope,
  491. types.ProjectScope,
  492. types.ClusterScope,
  493. types.NamespaceScope,
  494. types.ReleaseScope,
  495. },
  496. },
  497. )
  498. deleteHandler := release.NewDeleteReleaseHandler(
  499. config,
  500. factory.GetDecoderValidator(),
  501. factory.GetResultWriter(),
  502. )
  503. routes = append(routes, &Route{
  504. Endpoint: deleteEndpoint,
  505. Handler: deleteHandler,
  506. Router: r,
  507. })
  508. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/image/batch ->
  509. // release.NewUpdateImageBatchHandler
  510. updateImageBatchEndpoint := factory.NewAPIEndpoint(
  511. &types.APIRequestMetadata{
  512. Verb: types.APIVerbUpdate,
  513. Method: types.HTTPVerbPost,
  514. Path: &types.Path{
  515. Parent: basePath,
  516. RelativePath: "/releases/image/batch",
  517. },
  518. Scopes: []types.PermissionScope{
  519. types.UserScope,
  520. types.ProjectScope,
  521. types.ClusterScope,
  522. types.NamespaceScope,
  523. },
  524. },
  525. )
  526. updateImageBatchHandler := release.NewUpdateImageBatchHandler(
  527. config,
  528. factory.GetDecoderValidator(),
  529. factory.GetResultWriter(),
  530. )
  531. routes = append(routes, &Route{
  532. Endpoint: updateImageBatchEndpoint,
  533. Handler: updateImageBatchHandler,
  534. Router: r,
  535. })
  536. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/jobs ->
  537. // release.NewGetJobsHandler
  538. getJobsEndpoint := factory.NewAPIEndpoint(
  539. &types.APIRequestMetadata{
  540. Verb: types.APIVerbGet,
  541. Method: types.HTTPVerbGet,
  542. Path: &types.Path{
  543. Parent: basePath,
  544. RelativePath: relPath + "/jobs",
  545. },
  546. Scopes: []types.PermissionScope{
  547. types.UserScope,
  548. types.ProjectScope,
  549. types.ClusterScope,
  550. types.NamespaceScope,
  551. types.ReleaseScope,
  552. },
  553. },
  554. )
  555. getJobsHandler := release.NewGetJobsHandler(
  556. config,
  557. factory.GetResultWriter(),
  558. )
  559. routes = append(routes, &Route{
  560. Endpoint: getJobsEndpoint,
  561. Handler: getJobsHandler,
  562. Router: r,
  563. })
  564. // GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/{version}/jobs/status ->
  565. // release.NewGetJobsHandler
  566. getJobsStatusEndpoint := factory.NewAPIEndpoint(
  567. &types.APIRequestMetadata{
  568. Verb: types.APIVerbGet,
  569. Method: types.HTTPVerbGet,
  570. Path: &types.Path{
  571. Parent: basePath,
  572. RelativePath: relPath + "/jobs/status",
  573. },
  574. Scopes: []types.PermissionScope{
  575. types.UserScope,
  576. types.ProjectScope,
  577. types.ClusterScope,
  578. types.NamespaceScope,
  579. types.ReleaseScope,
  580. },
  581. },
  582. )
  583. getJobsStatusHandler := release.NewGetJobsStatusHandler(
  584. config,
  585. factory.GetResultWriter(),
  586. )
  587. routes = append(routes, &Route{
  588. Endpoint: getJobsStatusEndpoint,
  589. Handler: getJobsStatusHandler,
  590. Router: r,
  591. })
  592. // POST /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases/{name}/subdomain -> release.NewCreateSubdomainHandler
  593. createSubdomainEndpoint := factory.NewAPIEndpoint(
  594. &types.APIRequestMetadata{
  595. Verb: types.APIVerbCreate,
  596. Method: types.HTTPVerbPost,
  597. Path: &types.Path{
  598. Parent: basePath,
  599. RelativePath: "/releases/{name}/subdomain",
  600. },
  601. Scopes: []types.PermissionScope{
  602. types.UserScope,
  603. types.ProjectScope,
  604. types.ClusterScope,
  605. types.NamespaceScope,
  606. },
  607. },
  608. )
  609. createSubdomainHandler := release.NewCreateSubdomainHandler(
  610. config,
  611. factory.GetResultWriter(),
  612. )
  613. routes = append(routes, &Route{
  614. Endpoint: createSubdomainEndpoint,
  615. Handler: createSubdomainHandler,
  616. Router: r,
  617. })
  618. return routes, newPath
  619. }