api.tsx 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870
  1. import { PolicyDocType } from "./auth/types";
  2. import { PullRequest } from "main/home/cluster-dashboard/preview-environments/types";
  3. import { baseApi } from "./baseApi";
  4. import { BuildConfig, FullActionConfigType, PorterAppOptions } from "./types";
  5. import {
  6. CreateStackBody,
  7. SourceConfig,
  8. } from "main/home/cluster-dashboard/stacks/types";
  9. import { Contract } from "@porter-dev/api-contracts";
  10. /**
  11. * Generic api call format
  12. * @param {string} token - Bearer token.
  13. * @param {Object} params - Body params.
  14. * @param {Object} pathParams - Path params.
  15. * @param {(err: Object, res: Object) => void} callback - Callback function.
  16. */
  17. const checkAuth = baseApi("GET", "/api/users/current");
  18. const connectECRRegistry = baseApi<
  19. {
  20. name: string;
  21. aws_integration_id: string;
  22. },
  23. { id: number }
  24. >("POST", (pathParams) => {
  25. return `/api/projects/${pathParams.id}/registries`;
  26. });
  27. const connectGCRRegistry = baseApi<
  28. {
  29. name: string;
  30. gcp_integration_id: string;
  31. url: string;
  32. },
  33. { id: number }
  34. >("POST", (pathParams) => {
  35. return `/api/projects/${pathParams.id}/registries`;
  36. });
  37. const connectDORegistry = baseApi<
  38. {
  39. name: string;
  40. do_integration_id: string;
  41. url: string;
  42. },
  43. { project_id: number }
  44. >("POST", (pathParams) => {
  45. return `/api/projects/${pathParams.project_id}/registries`;
  46. });
  47. const getAWSIntegration = baseApi<{}, { project_id: number }>(
  48. "GET",
  49. ({ project_id }) => `/api/projects/${project_id}/integrations/aws`
  50. );
  51. const getGCPIntegration = baseApi<{}, { project_id: number }>(
  52. "GET",
  53. ({ project_id }) => `/api/projects/${project_id}/integrations/gcp`
  54. );
  55. const getAzureIntegration = baseApi<{}, { project_id: number }>(
  56. "GET",
  57. ({ project_id }) => `/api/projects/${project_id}/integrations/azure`
  58. );
  59. const getGitlabIntegration = baseApi<{}, { project_id: number }>(
  60. "GET",
  61. ({ project_id }) => `/api/projects/${project_id}/integrations/gitlab`
  62. );
  63. const preflightCheckAWSUsage = baseApi<
  64. {
  65. target_arn: string;
  66. region: string;
  67. },
  68. { id: number }
  69. >("POST", (pathParams) => {
  70. return `/api/projects/${pathParams.id}/integrations/aws/preflight/usage`;
  71. });
  72. const createAWSIntegration = baseApi<
  73. {
  74. aws_region?: string;
  75. aws_cluster_id?: string;
  76. aws_access_key_id?: string;
  77. aws_secret_access_key?: string;
  78. aws_assume_role_arn?: string;
  79. aws_target_arn?: string;
  80. aws_external_id?: string;
  81. },
  82. { id: number }
  83. >("POST", (pathParams) => {
  84. return `/api/projects/${pathParams.id}/integrations/aws`;
  85. });
  86. const overwriteAWSIntegration = baseApi<
  87. {
  88. aws_integration_id: number;
  89. aws_access_key_id: string;
  90. aws_secret_access_key: string;
  91. cluster_id: number;
  92. },
  93. {
  94. project_id: number;
  95. }
  96. >("POST", (pathParams) => {
  97. return `/api/projects/${pathParams.project_id}/integrations/aws/overwrite`;
  98. });
  99. const updateCluster = baseApi<
  100. {
  101. name?: string;
  102. aws_cluster_id?: string;
  103. agent_integration_enabled?: boolean;
  104. preview_envs_enabled?: boolean;
  105. },
  106. {
  107. project_id: number;
  108. cluster_id: number;
  109. }
  110. >("POST", (pathParams) => {
  111. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}`;
  112. });
  113. const renameCluster = baseApi<
  114. {
  115. name: string;
  116. },
  117. {
  118. project_id: number;
  119. cluster_id: number;
  120. }
  121. >("POST", (pathParams) => {
  122. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/rename`;
  123. });
  124. const createAzureIntegration = baseApi<
  125. {
  126. azure_client_id: string;
  127. azure_subscription_id: string;
  128. azure_tenant_id: string;
  129. service_principal_key: string;
  130. },
  131. { id: number }
  132. >("POST", (pathParams) => {
  133. return `/api/projects/${pathParams.id}/integrations/azure`;
  134. });
  135. const createGitlabIntegration = baseApi<
  136. {
  137. instance_url: string;
  138. client_id: string;
  139. client_secret: string;
  140. },
  141. { id: number }
  142. >("POST", (pathParams) => {
  143. return `/api/projects/${pathParams.id}/integrations/gitlab`;
  144. });
  145. const createEmailVerification = baseApi<{}, {}>("POST", (pathParams) => {
  146. return `/api/email/verify/initiate`;
  147. });
  148. const getPorterApps = baseApi<
  149. {},
  150. {
  151. project_id: number;
  152. cluster_id: number;
  153. }
  154. >("GET", (pathParams) => {
  155. let { project_id, cluster_id } = pathParams;
  156. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks`;
  157. });
  158. const getPorterApp = baseApi<
  159. {},
  160. {
  161. project_id: number;
  162. cluster_id: number;
  163. name: string;
  164. }
  165. >("GET", (pathParams) => {
  166. let { project_id, cluster_id, name } = pathParams;
  167. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${name}`;
  168. });
  169. const createPorterApp = baseApi<
  170. PorterAppOptions,
  171. {
  172. project_id: number;
  173. cluster_id: number;
  174. stack_name: string;
  175. }
  176. >("POST", (pathParams) => {
  177. let { project_id, cluster_id, stack_name } = pathParams;
  178. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${stack_name}`;
  179. });
  180. const deletePorterApp = baseApi<
  181. {},
  182. {
  183. project_id: number;
  184. cluster_id: number;
  185. name: string;
  186. }
  187. >("DELETE", (pathParams) => {
  188. let { project_id, cluster_id, name } = pathParams;
  189. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${name}`;
  190. });
  191. const rollbackPorterApp = baseApi<
  192. {
  193. revision: number;
  194. },
  195. {
  196. project_id: number;
  197. cluster_id: number;
  198. stack_name: string;
  199. }
  200. >("POST", (pathParams) => {
  201. let { project_id, cluster_id, stack_name } = pathParams;
  202. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${stack_name}/rollback`;
  203. });
  204. const getLogsWithinTimeRange = baseApi<
  205. {
  206. chart_name?: string;
  207. limit: number;
  208. start_range?: string;
  209. end_range?: string;
  210. search_param?: string;
  211. revision?: string;
  212. namespace?: string;
  213. pod_selector?: string;
  214. },
  215. {
  216. project_id: number;
  217. cluster_id: number;
  218. }
  219. >(
  220. "GET",
  221. ({ project_id, cluster_id }) =>
  222. `/api/projects/${project_id}/clusters/${cluster_id}/stacks/logs`
  223. );
  224. const getFeedEvents = baseApi<
  225. {},
  226. {
  227. project_id: number;
  228. cluster_id: number;
  229. stack_name: string;
  230. page?: number;
  231. }
  232. >("GET", (pathParams) => {
  233. let { project_id, cluster_id, stack_name, page } = pathParams;
  234. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${stack_name}/events?page=${page || 1
  235. }`;
  236. });
  237. const createEnvironment = baseApi<
  238. {
  239. name: string;
  240. mode: "auto" | "manual";
  241. disable_new_comments: boolean;
  242. git_repo_branches: string[];
  243. namespace_labels: Record<string, string>;
  244. git_deploy_branches: string[];
  245. },
  246. {
  247. project_id: number;
  248. cluster_id: number;
  249. git_installation_id: number;
  250. git_repo_owner: string;
  251. git_repo_name: string;
  252. }
  253. >("POST", (pathParams) => {
  254. let {
  255. project_id,
  256. cluster_id,
  257. git_installation_id,
  258. git_repo_owner,
  259. git_repo_name,
  260. } = pathParams;
  261. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${git_repo_owner}/${git_repo_name}/clusters/${cluster_id}/environment`;
  262. });
  263. const updateEnvironment = baseApi<
  264. {
  265. mode: "auto" | "manual";
  266. disable_new_comments: boolean;
  267. git_repo_branches: string[]; // Array with branch names
  268. namespace_labels: Record<string, string>;
  269. git_deploy_branches: string[];
  270. },
  271. {
  272. project_id: number;
  273. cluster_id: number;
  274. environment_id: number;
  275. }
  276. >(
  277. "PATCH",
  278. ({ project_id, cluster_id, environment_id }) =>
  279. `/api/projects/${project_id}/clusters/${cluster_id}/environments/${environment_id}/settings`
  280. );
  281. const deleteEnvironment = baseApi<
  282. {
  283. name: string;
  284. },
  285. {
  286. project_id: number;
  287. cluster_id: number;
  288. git_installation_id: number;
  289. git_repo_owner: string;
  290. git_repo_name: string;
  291. }
  292. >("DELETE", (pathParams) => {
  293. let {
  294. project_id,
  295. cluster_id,
  296. git_installation_id,
  297. git_repo_owner,
  298. git_repo_name,
  299. } = pathParams;
  300. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${git_repo_owner}/${git_repo_name}/clusters/${cluster_id}/environment`;
  301. });
  302. const createPreviewEnvironmentDeployment = baseApi<
  303. PullRequest,
  304. { project_id: number; cluster_id: number }
  305. >(
  306. "POST",
  307. ({ project_id, cluster_id }) =>
  308. `/api/projects/${project_id}/clusters/${cluster_id}/deployments/pull_request`
  309. );
  310. const reenablePreviewEnvironmentDeployment = baseApi<
  311. {},
  312. {
  313. project_id: number;
  314. cluster_id: number;
  315. deployment_id: number;
  316. }
  317. >(
  318. "PATCH",
  319. ({ project_id, cluster_id, deployment_id }) =>
  320. `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}/reenable`
  321. );
  322. const listEnvironments = baseApi<
  323. {},
  324. {
  325. project_id: number;
  326. cluster_id: number;
  327. }
  328. >("GET", (pathParams) => {
  329. let { project_id, cluster_id } = pathParams;
  330. return `/api/projects/${project_id}/clusters/${cluster_id}/environments`;
  331. });
  332. const getEnvironment = baseApi<
  333. {},
  334. {
  335. project_id: number;
  336. cluster_id: number;
  337. environment_id: number;
  338. }
  339. >("GET", (pathParams) => {
  340. let { project_id, cluster_id, environment_id } = pathParams;
  341. return `/api/projects/${project_id}/clusters/${cluster_id}/environments/${environment_id}`;
  342. });
  343. const toggleNewCommentForEnvironment = baseApi<
  344. {
  345. disable: boolean;
  346. },
  347. {
  348. project_id: number;
  349. cluster_id: number;
  350. environment_id: number;
  351. }
  352. >("PATCH", (pathParams) => {
  353. let { project_id, cluster_id, environment_id } = pathParams;
  354. return `/api/projects/${project_id}/clusters/${cluster_id}/environments/${environment_id}/toggle_new_comment`;
  355. });
  356. const validatePorterYAML = baseApi<
  357. {
  358. branch?: string;
  359. },
  360. {
  361. project_id: number;
  362. cluster_id: number;
  363. environment_id: number;
  364. }
  365. >("GET", (pathParams) => {
  366. const { project_id, cluster_id, environment_id } = pathParams;
  367. return `/api/projects/${project_id}/clusters/${cluster_id}/environments/${environment_id}/validate_porter_yaml`;
  368. });
  369. const createGCPIntegration = baseApi<
  370. {
  371. gcp_key_data: string;
  372. gcp_project_id: string;
  373. },
  374. {
  375. project_id: number;
  376. }
  377. >("POST", (pathParams) => {
  378. return `/api/projects/${pathParams.project_id}/integrations/gcp`;
  379. });
  380. const createInvite = baseApi<
  381. {
  382. email: string;
  383. kind: string;
  384. },
  385. {
  386. id: number;
  387. }
  388. >("POST", (pathParams) => {
  389. return `/api/projects/${pathParams.id}/invites`;
  390. });
  391. const inviteAdmin = baseApi<{}, { project_id: number }>(
  392. "POST",
  393. (pathParams) => {
  394. return `/api/projects/${pathParams.project_id}/invite_admin`;
  395. }
  396. );
  397. const createPasswordReset = baseApi<
  398. {
  399. email: string;
  400. },
  401. {}
  402. >("POST", (pathParams) => {
  403. return `/api/password/reset/initiate`;
  404. });
  405. const createPasswordResetVerify = baseApi<
  406. {
  407. email: string;
  408. token: string;
  409. token_id: number;
  410. },
  411. {}
  412. >("POST", (pathParams) => {
  413. return `/api/password/reset/verify`;
  414. });
  415. const createPasswordResetFinalize = baseApi<
  416. {
  417. email: string;
  418. token: string;
  419. token_id: number;
  420. new_password: string;
  421. },
  422. {}
  423. >("POST", (pathParams) => {
  424. return `/api/password/reset/finalize`;
  425. });
  426. const createProject = baseApi<{ name: string }, {}>("POST", (pathParams) => {
  427. return `/api/projects`;
  428. });
  429. const createSubdomain = baseApi<
  430. {},
  431. {
  432. id: number;
  433. release_name: string;
  434. namespace: string;
  435. cluster_id: number;
  436. }
  437. >("POST", (pathParams) => {
  438. let { cluster_id, id, namespace, release_name } = pathParams;
  439. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/subdomain`;
  440. });
  441. const deleteCluster = baseApi<
  442. {},
  443. {
  444. project_id: number;
  445. cluster_id: number;
  446. }
  447. >("DELETE", (pathParams) => {
  448. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}`;
  449. });
  450. const deleteInvite = baseApi<{}, { id: number; invId: number }>(
  451. "DELETE",
  452. (pathParams) => {
  453. return `/api/projects/${pathParams.id}/invites/${pathParams.invId}`;
  454. }
  455. );
  456. const deletePod = baseApi<
  457. {},
  458. { name: string; namespace: string; id: number; cluster_id: number }
  459. >("DELETE", (pathParams) => {
  460. let { id, name, cluster_id, namespace } = pathParams;
  461. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}`;
  462. });
  463. const getPodEvents = baseApi<
  464. {},
  465. { name: string; namespace: string; id: number; cluster_id: number }
  466. >("GET", (pathParams) => {
  467. let { id, name, cluster_id, namespace } = pathParams;
  468. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}/events`;
  469. });
  470. const deleteProject = baseApi<{}, { id: number }>("DELETE", (pathParams) => {
  471. return `/api/projects/${pathParams.id}`;
  472. });
  473. const deleteRegistryIntegration = baseApi<
  474. {},
  475. {
  476. project_id: number;
  477. registry_id: number;
  478. }
  479. >("DELETE", (pathParams) => {
  480. return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}`;
  481. });
  482. const deleteSlackIntegration = baseApi<
  483. {},
  484. {
  485. project_id: number;
  486. slack_integration_id: number;
  487. }
  488. >("DELETE", (pathParams) => {
  489. return `/api/projects/${pathParams.project_id}/slack_integrations/${pathParams.slack_integration_id}`;
  490. });
  491. const updateNotificationConfig = baseApi<
  492. {
  493. payload: any;
  494. },
  495. {
  496. project_id: number;
  497. cluster_id: number;
  498. namespace: string;
  499. name: string;
  500. }
  501. >("POST", (pathParams) => {
  502. let { project_id, cluster_id, namespace, name } = pathParams;
  503. return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/notifications`;
  504. });
  505. const getPRDeploymentList = baseApi<
  506. {
  507. environment_id?: number;
  508. },
  509. {
  510. cluster_id: number;
  511. project_id: number;
  512. }
  513. >("GET", (pathParams) => {
  514. const { cluster_id, project_id } = pathParams;
  515. return `/api/projects/${project_id}/clusters/${cluster_id}/deployments`;
  516. });
  517. const getPRDeploymentByID = baseApi<
  518. {
  519. id: number;
  520. },
  521. {
  522. cluster_id: number;
  523. project_id: number;
  524. environment_id: number;
  525. }
  526. >("GET", (pathParams) => {
  527. const { cluster_id, project_id, environment_id } = pathParams;
  528. return `/api/projects/${project_id}/clusters/${cluster_id}/environments/${environment_id}/deployment`;
  529. });
  530. const deletePRDeployment = baseApi<
  531. {},
  532. {
  533. cluster_id: number;
  534. project_id: number;
  535. deployment_id: number;
  536. }
  537. >("DELETE", (pathParams) => {
  538. const { cluster_id, project_id, deployment_id } = pathParams;
  539. return `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}`;
  540. });
  541. const getNotificationConfig = baseApi<
  542. {},
  543. {
  544. project_id: number;
  545. cluster_id: number;
  546. namespace: string;
  547. name: string;
  548. }
  549. >("GET", (pathParams) => {
  550. let { project_id, cluster_id, namespace, name } = pathParams;
  551. return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/notifications`;
  552. });
  553. const getGHAWorkflowTemplate = baseApi<
  554. {
  555. release_name: string;
  556. github_action_config: FullActionConfigType;
  557. },
  558. {
  559. cluster_id: number;
  560. project_id: number;
  561. namespace: string;
  562. }
  563. >("POST", (pathParams) => {
  564. const { cluster_id, project_id, namespace } = pathParams;
  565. return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/gha_template`;
  566. });
  567. const deployTemplate = baseApi<
  568. {
  569. template_name: string;
  570. template_version: string;
  571. image_url?: string;
  572. values?: any;
  573. name: string;
  574. git_action_config?: FullActionConfigType;
  575. build_config?: any;
  576. synced_env_groups?: string[];
  577. },
  578. {
  579. id: number;
  580. cluster_id: number;
  581. namespace: string;
  582. repo_url?: string;
  583. }
  584. >("POST", (pathParams) => {
  585. let { cluster_id, id, namespace, repo_url } = pathParams;
  586. if (repo_url) {
  587. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases?repo_url=${repo_url}`;
  588. }
  589. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases`;
  590. });
  591. const deployAddon = baseApi<
  592. {
  593. template_name: string;
  594. template_version: string;
  595. values?: any;
  596. name: string;
  597. },
  598. {
  599. id: number;
  600. cluster_id: number;
  601. namespace: string;
  602. repo_url?: string;
  603. }
  604. >("POST", (pathParams) => {
  605. let { cluster_id, id, namespace, repo_url } = pathParams;
  606. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/addons?repo_url=${repo_url}`;
  607. });
  608. const detectBuildpack = baseApi<
  609. {},
  610. {
  611. project_id: number;
  612. git_repo_id: number;
  613. kind: string;
  614. owner: string;
  615. name: string;
  616. branch: string;
  617. }
  618. >("GET", (pathParams) => {
  619. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
  620. }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
  621. }/${encodeURIComponent(pathParams.branch)}/buildpack/detect`;
  622. });
  623. const detectGitlabBuildpack = baseApi<
  624. { dir: string },
  625. {
  626. project_id: number;
  627. integration_id: number;
  628. repo_owner: string;
  629. repo_name: string;
  630. branch: string;
  631. }
  632. >(
  633. "GET",
  634. ({ project_id, integration_id, repo_name, repo_owner, branch }) =>
  635. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/${branch}/buildpack/detect`
  636. );
  637. const getBranchContents = baseApi<
  638. {
  639. dir: string;
  640. },
  641. {
  642. project_id: number;
  643. git_repo_id: number;
  644. kind: string;
  645. owner: string;
  646. name: string;
  647. branch: string;
  648. }
  649. >("GET", (pathParams) => {
  650. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
  651. }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
  652. }/${encodeURIComponent(pathParams.branch)}/contents`;
  653. });
  654. const getProcfileContents = baseApi<
  655. {
  656. path: string;
  657. },
  658. {
  659. project_id: number;
  660. git_repo_id: number;
  661. kind: string;
  662. owner: string;
  663. name: string;
  664. branch: string;
  665. }
  666. >("GET", (pathParams) => {
  667. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
  668. }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
  669. }/${encodeURIComponent(pathParams.branch)}/procfile`;
  670. });
  671. const getPorterYamlContents = baseApi<
  672. {
  673. path: string;
  674. },
  675. {
  676. project_id: number;
  677. git_repo_id: number;
  678. kind: string;
  679. owner: string;
  680. name: string;
  681. branch: string;
  682. }
  683. >("GET", (pathParams) => {
  684. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id
  685. }/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name
  686. }/${encodeURIComponent(pathParams.branch)}/porteryaml`;
  687. });
  688. const getGitlabProcfileContents = baseApi<
  689. {
  690. path: string;
  691. },
  692. {
  693. project_id: number;
  694. integration_id: number;
  695. owner: string;
  696. name: string;
  697. branch: string;
  698. }
  699. >(
  700. "GET",
  701. ({ project_id, integration_id, owner, name, branch }) =>
  702. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${owner}/${name}/${encodeURIComponent(
  703. branch
  704. )}/procfile`
  705. );
  706. const getBranches = baseApi<
  707. {},
  708. {
  709. project_id: number;
  710. git_repo_id: number;
  711. kind: string;
  712. owner: string;
  713. name: string;
  714. }
  715. >("GET", (pathParams) => {
  716. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name}/branches`;
  717. });
  718. const getChart = baseApi<
  719. {},
  720. {
  721. id: number;
  722. cluster_id: number;
  723. namespace: string;
  724. name: string;
  725. revision: number;
  726. }
  727. >("GET", (pathParams) => {
  728. let { id, cluster_id, namespace, name, revision } = pathParams;
  729. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}`;
  730. });
  731. const getCharts = baseApi<
  732. {
  733. limit: number;
  734. skip: number;
  735. byDate: boolean;
  736. statusFilter: string[];
  737. },
  738. {
  739. id: number;
  740. cluster_id: number;
  741. namespace: string;
  742. }
  743. >("GET", (pathParams) => {
  744. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/releases`;
  745. });
  746. const getChartComponents = baseApi<
  747. {},
  748. {
  749. id: number;
  750. cluster_id: number;
  751. namespace: string;
  752. name: string;
  753. revision: number;
  754. }
  755. >("GET", (pathParams) => {
  756. let { id, cluster_id, namespace, name, revision } = pathParams;
  757. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}/components`;
  758. });
  759. const getChartControllers = baseApi<
  760. {},
  761. {
  762. id: number;
  763. cluster_id: number;
  764. namespace: string;
  765. name: string;
  766. revision: number;
  767. }
  768. >("GET", (pathParams) => {
  769. let { id, cluster_id, namespace, name, revision } = pathParams;
  770. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}/controllers`;
  771. });
  772. const getClusterIntegrations = baseApi("GET", "/api/integrations/cluster");
  773. const getClusters = baseApi<{}, { id: number }>("GET", (pathParams) => {
  774. return `/api/projects/${pathParams.id}/clusters`;
  775. });
  776. const getCluster = baseApi<
  777. {},
  778. {
  779. project_id: number;
  780. cluster_id: number;
  781. }
  782. >("GET", (pathParams) => {
  783. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}`;
  784. });
  785. const getClusterStatus = baseApi<
  786. {},
  787. {
  788. project_id: number;
  789. cluster_id: number;
  790. }
  791. >("GET", (pathParams) => {
  792. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/status`;
  793. });
  794. const getClusterNodes = baseApi<
  795. {},
  796. {
  797. project_id: number;
  798. cluster_id: number;
  799. }
  800. >("GET", (pathParams) => {
  801. return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/nodes`;
  802. });
  803. const getClusterNode = baseApi<
  804. {},
  805. {
  806. project_id: number;
  807. cluster_id: number;
  808. nodeName: string;
  809. }
  810. >(
  811. "GET",
  812. (pathParams) =>
  813. `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/nodes/${pathParams.nodeName}`
  814. );
  815. const getGitRepoList = baseApi<
  816. {},
  817. {
  818. project_id: number;
  819. git_repo_id: number;
  820. }
  821. >("GET", (pathParams) => {
  822. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/repos`;
  823. });
  824. const getGitRepoPermission = baseApi<
  825. {},
  826. {
  827. project_id: number;
  828. git_repo_id: number;
  829. }
  830. >("GET", (pathParams) => {
  831. return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/permissions`;
  832. });
  833. const getGitRepos = baseApi<
  834. {},
  835. {
  836. project_id: number;
  837. }
  838. >("GET", (pathParams) => {
  839. return `/api/projects/${pathParams.project_id}/gitrepos`;
  840. });
  841. const getImageRepos = baseApi<
  842. {},
  843. {
  844. project_id: number;
  845. registry_id: number;
  846. }
  847. >("GET", (pathParams) => {
  848. return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}/repositories`;
  849. });
  850. const getImageTags = baseApi<
  851. {},
  852. {
  853. project_id: number;
  854. registry_id: number;
  855. repo_name: string;
  856. }
  857. >("GET", (pathParams) => {
  858. return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}/repositories/${pathParams.repo_name}`;
  859. });
  860. const getInfra = baseApi<
  861. {
  862. version?: string;
  863. },
  864. {
  865. project_id: number;
  866. }
  867. >("GET", (pathParams) => {
  868. return `/api/projects/${pathParams.project_id}/infra`;
  869. });
  870. const listInfraTemplates = baseApi<
  871. {},
  872. {
  873. project_id: number;
  874. }
  875. >("GET", (pathParams) => {
  876. return `/api/projects/${pathParams.project_id}/infras/templates`;
  877. });
  878. const getInfraTemplate = baseApi<
  879. {},
  880. {
  881. project_id: number;
  882. name: string;
  883. version: string;
  884. }
  885. >("GET", (pathParams) => {
  886. let { project_id, name, version } = pathParams;
  887. return `/api/projects/${project_id}/infras/templates/${name}/${version}`;
  888. });
  889. const provisionCluster = baseApi<
  890. {
  891. project_id: number;
  892. cluster_id?: number;
  893. cloud_provider: string;
  894. cloud_provider_credentials_id: string;
  895. cluster_settings: {
  896. cluster_name: string;
  897. cluster_version: string;
  898. cidr_range: string;
  899. region: string;
  900. node_groups: [
  901. {
  902. instance_type: string;
  903. min_instances: number;
  904. max_instances: number;
  905. node_group_type: number;
  906. },
  907. {
  908. instance_type: string;
  909. min_instances: number;
  910. max_instances: number;
  911. node_group_type: number;
  912. }
  913. ];
  914. };
  915. },
  916. {
  917. project_id: number;
  918. }
  919. >("POST", ({ project_id }) => {
  920. return `/api/projects/${project_id}/provision/cluster`;
  921. });
  922. const createContract = baseApi<Contract, { project_id: number }>(
  923. "POST",
  924. ({ project_id }) => {
  925. return `/api/projects/${project_id}/contract`;
  926. }
  927. );
  928. const getContracts = baseApi<{ cluster_id?: number }, { project_id: number }>(
  929. "GET",
  930. ({ project_id }) => {
  931. return `/api/projects/${project_id}/contracts`;
  932. }
  933. );
  934. const deleteContract = baseApi<{}, { project_id: number; revision_id: string }>(
  935. "DELETE",
  936. ({ project_id, revision_id }) => {
  937. return `/api/projects/${project_id}/contracts/${revision_id}`;
  938. }
  939. );
  940. const getClusterState = baseApi<{}, { project_id: number; cluster_id: number }>(
  941. "GET",
  942. ({ project_id, cluster_id }) => {
  943. return `/api/projects/${project_id}/clusters/${cluster_id}/state`;
  944. }
  945. );
  946. const provisionInfra = baseApi<
  947. {
  948. kind: string;
  949. values: any;
  950. aws_integration_id?: number;
  951. gcp_integration_id?: number;
  952. do_integration_id?: number;
  953. azure_integration_id?: number;
  954. cluster_id?: number;
  955. },
  956. {
  957. project_id: number;
  958. }
  959. >("POST", ({ project_id }) => {
  960. return `/api/projects/${project_id}/infras`;
  961. });
  962. const updateInfra = baseApi<
  963. { values?: any },
  964. {
  965. project_id: number;
  966. infra_id: number;
  967. }
  968. >("POST", (pathParams) => {
  969. let { project_id, infra_id } = pathParams;
  970. return `/api/projects/${project_id}/infras/${infra_id}/update`;
  971. });
  972. const retryCreateInfra = baseApi<
  973. {
  974. aws_integration_id?: number;
  975. gcp_integration_id?: number;
  976. do_integration_id?: number;
  977. values?: any;
  978. },
  979. {
  980. project_id: number;
  981. infra_id: number;
  982. }
  983. >("POST", (pathParams) => {
  984. let { project_id, infra_id } = pathParams;
  985. return `/api/projects/${project_id}/infras/${infra_id}/retry_create`;
  986. });
  987. const retryDeleteInfra = baseApi<
  988. { values?: any },
  989. {
  990. project_id: number;
  991. infra_id: number;
  992. }
  993. >("POST", (pathParams) => {
  994. let { project_id, infra_id } = pathParams;
  995. return `/api/projects/${project_id}/infras/${infra_id}/retry_delete`;
  996. });
  997. const deleteInfra = baseApi<
  998. {},
  999. {
  1000. project_id: number;
  1001. infra_id: number;
  1002. }
  1003. >("DELETE", (pathParams) => {
  1004. let { project_id, infra_id } = pathParams;
  1005. return `/api/projects/${project_id}/infras/${infra_id}`;
  1006. });
  1007. const listOperations = baseApi<
  1008. {},
  1009. {
  1010. project_id: number;
  1011. infra_id: number;
  1012. }
  1013. >("GET", (pathParams) => {
  1014. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/operations`;
  1015. });
  1016. const getOperation = baseApi<
  1017. {},
  1018. {
  1019. project_id: number;
  1020. infra_id: number;
  1021. operation_id: string;
  1022. }
  1023. >("GET", (pathParams) => {
  1024. let { project_id, infra_id, operation_id } = pathParams;
  1025. return `/api/projects/${project_id}/infras/${infra_id}/operations/${operation_id}`;
  1026. });
  1027. const getOperationLogs = baseApi<
  1028. {},
  1029. {
  1030. project_id: number;
  1031. infra_id: number;
  1032. operation_id: string;
  1033. }
  1034. >("GET", (pathParams) => {
  1035. let { project_id, infra_id, operation_id } = pathParams;
  1036. return `/api/projects/${project_id}/infras/${infra_id}/operations/${operation_id}/logs`;
  1037. });
  1038. const getInfraState = baseApi<
  1039. {},
  1040. {
  1041. project_id: number;
  1042. infra_id: number;
  1043. }
  1044. >("GET", (pathParams) => {
  1045. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/state`;
  1046. });
  1047. const getInfraRawState = baseApi<
  1048. {},
  1049. {
  1050. project_id: number;
  1051. infra_id: number;
  1052. }
  1053. >("GET", (pathParams) => {
  1054. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/raw_state`;
  1055. });
  1056. const getInfraByID = baseApi<
  1057. {},
  1058. {
  1059. project_id: number;
  1060. infra_id: number;
  1061. }
  1062. >("GET", (pathParams) => {
  1063. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}`;
  1064. });
  1065. const getInfraDesired = baseApi<
  1066. {},
  1067. {
  1068. project_id: number;
  1069. infra_id: number;
  1070. }
  1071. >("GET", (pathParams) => {
  1072. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/desired`;
  1073. });
  1074. const getInfraCurrent = baseApi<
  1075. {},
  1076. {
  1077. project_id: number;
  1078. infra_id: number;
  1079. }
  1080. >("GET", (pathParams) => {
  1081. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/current`;
  1082. });
  1083. const getIngress = baseApi<
  1084. {},
  1085. { namespace: string; cluster_id: number; name: string; id: number }
  1086. >("GET", (pathParams) => {
  1087. let { id, name, cluster_id, namespace } = pathParams;
  1088. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/ingresses/${name}`;
  1089. });
  1090. const getInvites = baseApi<{}, { id: number }>("GET", (pathParams) => {
  1091. return `/api/projects/${pathParams.id}/invites`;
  1092. });
  1093. const getJobs = baseApi<
  1094. {},
  1095. { namespace: string; cluster_id: number; release_name: string; id: number }
  1096. >("GET", (pathParams) => {
  1097. let { id, release_name, cluster_id, namespace } = pathParams;
  1098. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/jobs`;
  1099. });
  1100. const getJobStatus = baseApi<
  1101. {},
  1102. { namespace: string; cluster_id: number; release_name: string; id: number }
  1103. >("GET", (pathParams) => {
  1104. let { id, release_name, cluster_id, namespace } = pathParams;
  1105. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/jobs/status`;
  1106. });
  1107. const getJobPods = baseApi<
  1108. {},
  1109. { name: string; namespace: string; id: number; cluster_id: number }
  1110. >("GET", (pathParams) => {
  1111. let { id, name, cluster_id, namespace } = pathParams;
  1112. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}/pods`;
  1113. });
  1114. const getPodByName = baseApi<
  1115. {},
  1116. {
  1117. project_id: number;
  1118. cluster_id: number;
  1119. namespace: string;
  1120. name: string;
  1121. }
  1122. >(
  1123. "GET",
  1124. ({ project_id, cluster_id, namespace, name }) =>
  1125. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}`
  1126. );
  1127. const getMatchingPods = baseApi<
  1128. {
  1129. namespace: string;
  1130. selectors: string[];
  1131. },
  1132. { id: number; cluster_id: number }
  1133. >("GET", (pathParams) => {
  1134. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/pods`;
  1135. });
  1136. const getAllReleasePods = baseApi<
  1137. {},
  1138. {
  1139. id: number;
  1140. name: string;
  1141. namespace: string;
  1142. cluster_id: number;
  1143. }
  1144. >("GET", (pathParams) => {
  1145. const { id, name, cluster_id, namespace } = pathParams;
  1146. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/pods/all`;
  1147. });
  1148. const getMetrics = baseApi<
  1149. {
  1150. metric: string;
  1151. shouldsum: boolean;
  1152. pods?: string[];
  1153. kind?: string; // the controller kind
  1154. name?: string;
  1155. percentile?: number;
  1156. namespace: string;
  1157. startrange: number;
  1158. endrange: number;
  1159. resolution: string;
  1160. },
  1161. {
  1162. id: number;
  1163. cluster_id: number;
  1164. }
  1165. >("GET", (pathParams) => {
  1166. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/metrics`;
  1167. });
  1168. const getNamespaces = baseApi<
  1169. {},
  1170. {
  1171. id: number;
  1172. cluster_id: number;
  1173. }
  1174. >("GET", (pathParams) => {
  1175. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces`;
  1176. });
  1177. const getNGINXIngresses = baseApi<
  1178. {},
  1179. {
  1180. id: number;
  1181. cluster_id: number;
  1182. }
  1183. >("GET", (pathParams) => {
  1184. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/prometheus/ingresses`;
  1185. });
  1186. const getOAuthIds = baseApi<
  1187. {},
  1188. {
  1189. project_id: number;
  1190. }
  1191. >("GET", (pathParams) => {
  1192. return `/api/projects/${pathParams.project_id}/integrations/oauth`;
  1193. });
  1194. const getProjectClusters = baseApi<{}, { id: number }>("GET", (pathParams) => {
  1195. return `/api/projects/${pathParams.id}/clusters`;
  1196. });
  1197. const getProjectRegistries = baseApi<{}, { id: number }>(
  1198. "GET",
  1199. (pathParams) => {
  1200. return `/api/projects/${pathParams.id}/registries`;
  1201. }
  1202. );
  1203. const getProjectRepos = baseApi<{}, { id: number }>("GET", (pathParams) => {
  1204. return `/api/projects/${pathParams.id}/repos`;
  1205. });
  1206. const getProjects = baseApi("GET", "/api/projects");
  1207. const getPrometheusIsInstalled = baseApi<
  1208. {},
  1209. {
  1210. id: number;
  1211. cluster_id: number;
  1212. }
  1213. >("GET", (pathParams) => {
  1214. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/prometheus/detect`;
  1215. });
  1216. const getRegistryIntegrations = baseApi("GET", "/api/integrations/registry");
  1217. const getReleaseToken = baseApi<
  1218. {},
  1219. { name: string; id: number; namespace: string; cluster_id: number }
  1220. >("GET", (pathParams) => {
  1221. let { id, cluster_id, namespace, name } = pathParams;
  1222. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/webhook`;
  1223. });
  1224. const getReleaseSteps = baseApi<
  1225. {},
  1226. { name: string; id: number; namespace: string; cluster_id: number }
  1227. >("GET", (pathParams) => {
  1228. let { id, cluster_id, namespace, name } = pathParams;
  1229. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/steps`;
  1230. });
  1231. const destroyInfra = baseApi<
  1232. {},
  1233. {
  1234. project_id: number;
  1235. infra_id: number;
  1236. }
  1237. >("DELETE", (pathParams) => {
  1238. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}`;
  1239. });
  1240. const updateDatabaseStatus = baseApi<
  1241. {
  1242. status: string;
  1243. },
  1244. {
  1245. project_id: number;
  1246. infra_id: number;
  1247. }
  1248. >("POST", (pathParams) => {
  1249. return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/database`;
  1250. });
  1251. const getRepoIntegrations = baseApi("GET", "/api/integrations/repo");
  1252. const getRepos = baseApi<{}, { id: number }>("GET", (pathParams) => {
  1253. return `/api/projects/${pathParams.id}/repos`;
  1254. });
  1255. const getSlackIntegrations = baseApi<{}, { id: number }>(
  1256. "GET",
  1257. (pathParams) => {
  1258. return `/api/projects/${pathParams.id}/slack_integrations`;
  1259. }
  1260. );
  1261. const getRevisions = baseApi<
  1262. {},
  1263. { id: number; cluster_id: number; namespace: string; name: string }
  1264. >("GET", (pathParams) => {
  1265. let { id, cluster_id, namespace, name } = pathParams;
  1266. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/history`;
  1267. });
  1268. const getTemplateInfo = baseApi<
  1269. {
  1270. repo_url?: string;
  1271. },
  1272. { project_id: number; name: string; version: string }
  1273. >("GET", (pathParams) => {
  1274. return `/api/v1/projects/${pathParams.project_id}/templates/${pathParams.name}/versions/${pathParams.version}`;
  1275. });
  1276. const getTemplateUpgradeNotes = baseApi<
  1277. {
  1278. repo_url?: string;
  1279. prev_version: string;
  1280. },
  1281. { project_id: number; name: string; version: string }
  1282. >("GET", (pathParams) => {
  1283. return `/api/v1/projects/${pathParams.project_id}/templates/${pathParams.name}/versions/${pathParams.version}/upgrade_notes`;
  1284. });
  1285. const getTemplates = baseApi<
  1286. {
  1287. repo_url?: string;
  1288. },
  1289. {
  1290. project_id: number;
  1291. }
  1292. >("GET", (pathParams) => {
  1293. return `/api/v1/projects/${pathParams.project_id}/templates`;
  1294. });
  1295. const getHelmRepos = baseApi<
  1296. {},
  1297. {
  1298. project_id: number;
  1299. }
  1300. >("GET", (pathParams) => {
  1301. return `/api/projects/${pathParams.project_id}/helmrepos`;
  1302. });
  1303. const getChartsFromHelmRepo = baseApi<
  1304. {},
  1305. {
  1306. project_id: number;
  1307. helm_repo_id: number;
  1308. }
  1309. >("GET", (pathParams) => {
  1310. return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts`;
  1311. });
  1312. const getChartInfoFromHelmRepo = baseApi<
  1313. {},
  1314. { project_id: number; helm_repo_id: number; name: string; version: string }
  1315. >("GET", (pathParams) => {
  1316. return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts/${pathParams.name}/${pathParams.version}`;
  1317. });
  1318. const getMetadata = baseApi<{}, {}>("GET", () => {
  1319. return `/api/metadata`;
  1320. });
  1321. const postWelcome = baseApi<{
  1322. email: string;
  1323. isCompany: boolean;
  1324. name: string;
  1325. company: string;
  1326. role: string;
  1327. }>("POST", () => {
  1328. return `/api/welcome`;
  1329. });
  1330. const linkGithubProject = baseApi<
  1331. {},
  1332. {
  1333. project_id: number;
  1334. }
  1335. >("GET", (pathParams) => {
  1336. return `/api/oauth/projects/${pathParams.project_id}/github`;
  1337. });
  1338. const getGithubAccounts = baseApi<{}, {}>("GET", () => {
  1339. return `/api/integrations/github-app/accounts`;
  1340. });
  1341. const logInUser = baseApi<{
  1342. email: string;
  1343. password: string;
  1344. }>("POST", "/api/login");
  1345. const logOutUser = baseApi("POST", "/api/logout");
  1346. const registerUser = baseApi<{
  1347. email: string;
  1348. password: string;
  1349. first_name: string;
  1350. last_name: string;
  1351. company_name: string;
  1352. }>("POST", "/api/users");
  1353. const rollbackChart = baseApi<
  1354. {
  1355. revision: number;
  1356. },
  1357. {
  1358. id: number;
  1359. name: string;
  1360. namespace: string;
  1361. cluster_id: number;
  1362. }
  1363. >("POST", (pathParams) => {
  1364. let { id, name, cluster_id, namespace } = pathParams;
  1365. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/rollback`;
  1366. });
  1367. const uninstallTemplate = baseApi<
  1368. {},
  1369. {
  1370. id: number;
  1371. name: string;
  1372. cluster_id: number;
  1373. namespace: string;
  1374. }
  1375. >("DELETE", (pathParams) => {
  1376. let { id, name, cluster_id, namespace } = pathParams;
  1377. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0`;
  1378. });
  1379. const updateUserInfo = baseApi<
  1380. {
  1381. first_name: string;
  1382. last_name: string;
  1383. company_name: string;
  1384. },
  1385. {}
  1386. >("POST", (pathParams) => {
  1387. return `/api/users/update/info`;
  1388. });
  1389. const updateUser = baseApi<
  1390. {
  1391. rawKubeConfig?: string;
  1392. allowedContexts?: string[];
  1393. },
  1394. { id: number }
  1395. >("PUT", (pathParams) => {
  1396. return `/api/users/${pathParams.id}`;
  1397. });
  1398. const upgradeChartValues = baseApi<
  1399. {
  1400. values: string;
  1401. version?: string;
  1402. latest_revision?: number;
  1403. },
  1404. {
  1405. id: number;
  1406. name: string;
  1407. namespace: string;
  1408. cluster_id: number;
  1409. }
  1410. >("POST", (pathParams) => {
  1411. let { id, name, cluster_id, namespace } = pathParams;
  1412. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/upgrade`;
  1413. });
  1414. const listEnvGroups = baseApi<
  1415. {},
  1416. {
  1417. id: number;
  1418. namespace: string;
  1419. cluster_id: number;
  1420. }
  1421. >("GET", (pathParams) => {
  1422. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/list`;
  1423. });
  1424. const listConfigMaps = baseApi<
  1425. {},
  1426. {
  1427. id: number;
  1428. namespace: string;
  1429. cluster_id: number;
  1430. }
  1431. >("GET", (pathParams) => {
  1432. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/list`;
  1433. });
  1434. const getEnvGroup = baseApi<
  1435. {},
  1436. {
  1437. id: number;
  1438. namespace: string;
  1439. cluster_id: number;
  1440. name: string;
  1441. version?: number;
  1442. }
  1443. >("GET", (pathParams) => {
  1444. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id
  1445. }/namespaces/${pathParams.namespace}/envgroup?name=${pathParams.name}${pathParams.version ? "&version=" + pathParams.version : ""
  1446. }`;
  1447. });
  1448. const getConfigMap = baseApi<
  1449. {
  1450. name: string;
  1451. },
  1452. {
  1453. id: number;
  1454. namespace: string;
  1455. cluster_id: number;
  1456. }
  1457. >("GET", (pathParams) => {
  1458. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap`;
  1459. });
  1460. const createEnvGroup = baseApi<
  1461. {
  1462. name: string;
  1463. variables: Record<string, string>;
  1464. secret_variables?: Record<string, string>;
  1465. },
  1466. {
  1467. id: number;
  1468. cluster_id: number;
  1469. namespace: string;
  1470. }
  1471. >("POST", (pathParams) => {
  1472. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/create`;
  1473. });
  1474. const cloneEnvGroup = baseApi<
  1475. {
  1476. name: string;
  1477. namespace: string;
  1478. clone_name: string;
  1479. version: number;
  1480. },
  1481. {
  1482. id: number;
  1483. namespace: string;
  1484. cluster_id: number;
  1485. }
  1486. >("POST", (pathParams) => {
  1487. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/clone`;
  1488. });
  1489. const updateEnvGroup = baseApi<
  1490. {
  1491. name: string;
  1492. variables: { [key: string]: string };
  1493. secret_variables?: { [key: string]: string };
  1494. },
  1495. {
  1496. project_id: number;
  1497. cluster_id: number;
  1498. namespace: string;
  1499. }
  1500. >(
  1501. "POST",
  1502. ({ cluster_id, project_id, namespace }) =>
  1503. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/create`
  1504. );
  1505. const createConfigMap = baseApi<
  1506. {
  1507. name: string;
  1508. variables: Record<string, string>;
  1509. secret_variables?: Record<string, string>;
  1510. },
  1511. {
  1512. id: number;
  1513. cluster_id: number;
  1514. namespace: string;
  1515. }
  1516. >("POST", (pathParams) => {
  1517. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/create`;
  1518. });
  1519. const updateConfigMap = baseApi<
  1520. {
  1521. name: string;
  1522. variables: Record<string, string>;
  1523. secret_variables?: Record<string, string>;
  1524. },
  1525. {
  1526. id: number;
  1527. cluster_id: number;
  1528. namespace: string;
  1529. }
  1530. >("POST", (pathParams) => {
  1531. let { id, cluster_id } = pathParams;
  1532. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/update`;
  1533. });
  1534. const renameConfigMap = baseApi<
  1535. {
  1536. name: string;
  1537. new_name: string;
  1538. },
  1539. {
  1540. id: number;
  1541. cluster_id: number;
  1542. namespace: string;
  1543. }
  1544. >("POST", (pathParams) => {
  1545. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/rename`;
  1546. });
  1547. const deleteEnvGroup = baseApi<
  1548. {
  1549. name: string;
  1550. },
  1551. {
  1552. id: number;
  1553. namespace: string;
  1554. cluster_id: number;
  1555. }
  1556. >("DELETE", (pathParams) => {
  1557. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup`;
  1558. });
  1559. const deleteConfigMap = baseApi<
  1560. {
  1561. name: string;
  1562. },
  1563. {
  1564. id: number;
  1565. namespace: string;
  1566. cluster_id: number;
  1567. }
  1568. >("DELETE", (pathParams) => {
  1569. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/delete`;
  1570. });
  1571. const createNamespace = baseApi<
  1572. {
  1573. name: string;
  1574. },
  1575. { id: number; cluster_id: number }
  1576. >("POST", (pathParams) => {
  1577. let { id, cluster_id } = pathParams;
  1578. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/create`;
  1579. });
  1580. const deleteNamespace = baseApi<
  1581. {},
  1582. {
  1583. id: number;
  1584. cluster_id: number;
  1585. namespace: string;
  1586. }
  1587. >("DELETE", (pathParams) => {
  1588. let { id, cluster_id, namespace } = pathParams;
  1589. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}`;
  1590. });
  1591. const deleteJob = baseApi<
  1592. {},
  1593. { name: string; namespace: string; id: number; cluster_id: number }
  1594. >("DELETE", (pathParams) => {
  1595. let { id, name, cluster_id, namespace } = pathParams;
  1596. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}`;
  1597. });
  1598. const stopJob = baseApi<
  1599. {},
  1600. { name: string; namespace: string; id: number; cluster_id: number }
  1601. >("POST", (pathParams) => {
  1602. let { id, name, namespace, cluster_id } = pathParams;
  1603. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}/stop`;
  1604. });
  1605. const listAPITokens = baseApi<{}, { project_id: number }>(
  1606. "GET",
  1607. ({ project_id }) => `/api/projects/${project_id}/api_token`
  1608. );
  1609. const getAPIToken = baseApi<{}, { project_id: number; token: string }>(
  1610. "GET",
  1611. ({ project_id, token }) => `/api/projects/${project_id}/api_token/${token}`
  1612. );
  1613. const revokeAPIToken = baseApi<{}, { project_id: number; token: string }>(
  1614. "POST",
  1615. ({ project_id, token }) =>
  1616. `/api/projects/${project_id}/api_token/${token}/revoke`
  1617. );
  1618. const createAPIToken = baseApi<
  1619. {
  1620. name: string;
  1621. policy_uid: string;
  1622. expires_at?: string;
  1623. },
  1624. { project_id: number }
  1625. >("POST", ({ project_id }) => `/api/projects/${project_id}/api_token`);
  1626. const createPolicy = baseApi<
  1627. {
  1628. name: string;
  1629. policy: PolicyDocType[];
  1630. },
  1631. { project_id: number }
  1632. >("POST", ({ project_id }) => `/api/projects/${project_id}/policy`);
  1633. const getAvailableRoles = baseApi<{}, { project_id: number }>(
  1634. "GET",
  1635. ({ project_id }) => `/api/projects/${project_id}/roles`
  1636. );
  1637. const updateInvite = baseApi<
  1638. { kind: string },
  1639. { project_id: number; invite_id: number }
  1640. >(
  1641. "POST",
  1642. ({ project_id, invite_id }) =>
  1643. `/api/projects/${project_id}/invites/${invite_id}`
  1644. );
  1645. const getCollaborators = baseApi<{}, { project_id: number }>(
  1646. "GET",
  1647. ({ project_id }) => `/api/projects/${project_id}/collaborators`
  1648. );
  1649. const updateCollaborator = baseApi<
  1650. {
  1651. kind: string;
  1652. user_id: number;
  1653. },
  1654. { project_id: number }
  1655. >("POST", ({ project_id }) => `/api/projects/${project_id}/roles`);
  1656. const removeCollaborator = baseApi<{ user_id: number }, { project_id: number }>(
  1657. "DELETE",
  1658. ({ project_id }) => `/api/projects/${project_id}/roles`
  1659. );
  1660. const getPolicyDocument = baseApi<{}, { project_id: number }>(
  1661. "GET",
  1662. ({ project_id }) => `/api/projects/${project_id}/policy`
  1663. );
  1664. const createWebhookToken = baseApi<
  1665. {},
  1666. {
  1667. project_id: number;
  1668. chart_name: string;
  1669. namespace: string;
  1670. cluster_id: number;
  1671. }
  1672. >(
  1673. "POST",
  1674. ({ project_id, chart_name, namespace, cluster_id }) =>
  1675. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${chart_name}/0/webhook`
  1676. );
  1677. const getUsage = baseApi<{}, { project_id: number }>(
  1678. "GET",
  1679. ({ project_id }) => `/api/projects/${project_id}/usage`
  1680. );
  1681. // Used for billing purposes
  1682. const getCustomerToken = baseApi<{}, { project_id: number }>(
  1683. "GET",
  1684. ({ project_id }) => `/api/projects/${project_id}/billing/token`
  1685. );
  1686. const getHasBilling = baseApi<{}, { project_id: number }>(
  1687. "GET",
  1688. ({ project_id }) => `/api/projects/${project_id}/billing`
  1689. );
  1690. const getOnboardingState = baseApi<{}, { project_id: number }>(
  1691. "GET",
  1692. ({ project_id }) => `/api/projects/${project_id}/onboarding`
  1693. );
  1694. const saveOnboardingState = baseApi<{}, { project_id: number }>(
  1695. "POST",
  1696. ({ project_id }) => `/api/projects/${project_id}/onboarding`
  1697. );
  1698. const getOnboardingInfra = baseApi<
  1699. {},
  1700. { project_id: number; registry_infra_id: number }
  1701. >(
  1702. "GET",
  1703. ({ project_id, registry_infra_id }) =>
  1704. `/api/projects/${project_id}/infras/${registry_infra_id}`
  1705. );
  1706. const getOnboardingRegistry = baseApi<
  1707. {},
  1708. { project_id: number; registry_connection_id: number }
  1709. >(
  1710. "GET",
  1711. ({ project_id, registry_connection_id }) =>
  1712. `/api/projects/${project_id}/registries/${registry_connection_id}`
  1713. );
  1714. const detectPorterAgent = baseApi<
  1715. {},
  1716. { project_id: number; cluster_id: number }
  1717. >(
  1718. "GET",
  1719. ({ project_id, cluster_id }) =>
  1720. `/api/projects/${project_id}/clusters/${cluster_id}/agent/detect`
  1721. );
  1722. const installPorterAgent = baseApi<
  1723. {},
  1724. { project_id: number; cluster_id: number }
  1725. >(
  1726. "POST",
  1727. ({ cluster_id, project_id }) =>
  1728. `/api/projects/${project_id}/clusters/${cluster_id}/agent/install`
  1729. );
  1730. const getKubeEvents = baseApi<
  1731. {
  1732. skip: number;
  1733. resource_type: string;
  1734. owner_type?: string;
  1735. owner_name?: string;
  1736. namespace?: string;
  1737. },
  1738. { project_id: number; cluster_id: number }
  1739. >("GET", ({ project_id, cluster_id }) => {
  1740. return `/api/projects/${project_id}/clusters/${cluster_id}/kube_events`;
  1741. });
  1742. const getKubeEvent = baseApi<
  1743. {},
  1744. { project_id: number; cluster_id: number; kube_event_id: number }
  1745. >(
  1746. "GET",
  1747. ({ project_id, cluster_id, kube_event_id }) =>
  1748. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}`
  1749. );
  1750. const getLogBuckets = baseApi<
  1751. {},
  1752. { project_id: number; cluster_id: number; kube_event_id: number }
  1753. >(
  1754. "GET",
  1755. ({ project_id, cluster_id, kube_event_id }) =>
  1756. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/log_buckets`
  1757. );
  1758. const getLogBucketLogs = baseApi<
  1759. { timestamp: number },
  1760. { project_id: number; cluster_id: number; kube_event_id: number }
  1761. >(
  1762. "GET",
  1763. ({ project_id, cluster_id, kube_event_id }) =>
  1764. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/logs`
  1765. );
  1766. const getCanCreateProject = baseApi<{}, {}>(
  1767. "GET",
  1768. () => "/api/can_create_project"
  1769. );
  1770. const addApplicationToEnvGroup = baseApi<
  1771. {
  1772. name: string; // Env Group name
  1773. app_name: string;
  1774. },
  1775. { project_id: number; cluster_id: number; namespace: string }
  1776. >(
  1777. "POST",
  1778. ({ cluster_id, namespace, project_id }) =>
  1779. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/add_application`
  1780. );
  1781. const removeApplicationFromEnvGroup = baseApi<
  1782. {
  1783. name: string; // Env Group name
  1784. app_name: string;
  1785. },
  1786. { project_id: number; cluster_id: number; namespace: string }
  1787. >(
  1788. "POST",
  1789. ({ cluster_id, namespace, project_id }) =>
  1790. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/remove_application`
  1791. );
  1792. const provisionDatabase = baseApi<
  1793. {
  1794. username: string;
  1795. password: string;
  1796. machine_type: string;
  1797. db_storage_encrypted: boolean;
  1798. db_name: string;
  1799. db_max_allocated_storage: string;
  1800. db_family: string;
  1801. db_engine_version: string;
  1802. db_allocated_storage: string;
  1803. },
  1804. { project_id: number; cluster_id: number; namespace: string }
  1805. >(
  1806. "POST",
  1807. ({ project_id, cluster_id, namespace }) =>
  1808. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/provision/rds`
  1809. );
  1810. const getDatabases = baseApi<
  1811. {},
  1812. {
  1813. project_id: number;
  1814. cluster_id: number;
  1815. }
  1816. >(
  1817. "GET",
  1818. ({ project_id, cluster_id }) =>
  1819. `/api/projects/${project_id}/clusters/${cluster_id}/databases`
  1820. );
  1821. const getPreviousLogsForContainer = baseApi<
  1822. {
  1823. container_name: string;
  1824. },
  1825. {
  1826. project_id: number;
  1827. cluster_id: number;
  1828. namespace: string;
  1829. pod_name: string;
  1830. }
  1831. >(
  1832. "GET",
  1833. ({ cluster_id, namespace, pod_name: name, project_id }) =>
  1834. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/pod/${name}/previous_logs`
  1835. );
  1836. const upgradePorterAgent = baseApi<
  1837. {},
  1838. { project_id: number; cluster_id: number }
  1839. >(
  1840. "POST",
  1841. ({ project_id, cluster_id }) =>
  1842. `/api/projects/${project_id}/clusters/${cluster_id}/agent/upgrade`
  1843. );
  1844. const updateBuildConfig = baseApi<
  1845. BuildConfig,
  1846. {
  1847. project_id: number;
  1848. cluster_id: number;
  1849. namespace: string;
  1850. release_name: string;
  1851. }
  1852. >(
  1853. "POST",
  1854. ({ project_id, cluster_id, namespace, release_name }) =>
  1855. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/buildconfig`
  1856. );
  1857. const updateGitActionConfig = baseApi<
  1858. {
  1859. git_action_config: {
  1860. git_branch: string;
  1861. };
  1862. },
  1863. {
  1864. project_id: number;
  1865. cluster_id: number;
  1866. namespace: string;
  1867. release_name: string;
  1868. revision?: 0; // Always update latest
  1869. }
  1870. >(
  1871. "PATCH",
  1872. ({ project_id, cluster_id, namespace, release_name, revision = 0 }) =>
  1873. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/${revision}/git_action_config`
  1874. );
  1875. const reRunGHWorkflow = baseApi<
  1876. {},
  1877. {
  1878. project_id: number;
  1879. cluster_id: number;
  1880. git_installation_id: number;
  1881. owner: string;
  1882. name: string;
  1883. branch?: string;
  1884. filename?: string;
  1885. release_name?: string;
  1886. }
  1887. >(
  1888. "POST",
  1889. ({
  1890. project_id,
  1891. git_installation_id,
  1892. owner,
  1893. name,
  1894. cluster_id,
  1895. filename,
  1896. release_name,
  1897. branch,
  1898. }) => {
  1899. const queryParams = new URLSearchParams();
  1900. if (branch) {
  1901. queryParams.set("branch", branch);
  1902. }
  1903. if (release_name) {
  1904. queryParams.set("release_name", release_name);
  1905. }
  1906. if (filename) {
  1907. queryParams.set("filename", filename);
  1908. }
  1909. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/rerun_workflow?${queryParams.toString()}`;
  1910. }
  1911. );
  1912. const getGHWorkflowLogs = baseApi<
  1913. {},
  1914. {
  1915. project_id: number;
  1916. cluster_id: number;
  1917. git_installation_id: number;
  1918. owner: string;
  1919. name: string;
  1920. filename?: string;
  1921. release_name?: string;
  1922. }
  1923. >(
  1924. "GET",
  1925. ({
  1926. project_id,
  1927. git_installation_id,
  1928. owner,
  1929. name,
  1930. cluster_id,
  1931. filename,
  1932. release_name,
  1933. }) => {
  1934. const queryParams = new URLSearchParams();
  1935. if (release_name) {
  1936. queryParams.set("release_name", release_name);
  1937. }
  1938. if (filename) {
  1939. queryParams.set("filename", filename);
  1940. }
  1941. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/get_logs_workflow?${queryParams.toString()}`;
  1942. }
  1943. );
  1944. const getGHWorkflowLogById = baseApi<
  1945. {},
  1946. {
  1947. project_id: number;
  1948. cluster_id: number;
  1949. git_installation_id: number;
  1950. owner: string;
  1951. name: string;
  1952. filename?: string;
  1953. run_id: string;
  1954. release_name?: string;
  1955. }
  1956. >(
  1957. "GET",
  1958. ({
  1959. project_id,
  1960. git_installation_id,
  1961. owner,
  1962. name,
  1963. cluster_id,
  1964. filename,
  1965. run_id,
  1966. release_name,
  1967. }) => {
  1968. const queryParams = new URLSearchParams();
  1969. if (release_name) {
  1970. queryParams.set("release_name", release_name);
  1971. }
  1972. if (filename) {
  1973. queryParams.set("filename", filename);
  1974. }
  1975. if (run_id) {
  1976. queryParams.set("run_id", run_id);
  1977. }
  1978. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/workflow_run_id?${queryParams.toString()}`;
  1979. }
  1980. );
  1981. const triggerPreviewEnvWorkflow = baseApi<
  1982. {},
  1983. { project_id: number; cluster_id: number; deployment_id: number }
  1984. >(
  1985. "POST",
  1986. ({ project_id, cluster_id, deployment_id }) =>
  1987. `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}/trigger_workflow`
  1988. );
  1989. const getTagsByProjectId = baseApi<{}, { project_id: number }>(
  1990. "GET",
  1991. ({ project_id }) => `/api/projects/${project_id}/tags`
  1992. );
  1993. const createTag = baseApi<
  1994. { name: string; color: string },
  1995. { project_id: number }
  1996. >("POST", ({ project_id }) => `/api/projects/${project_id}/tags`);
  1997. const updateReleaseTags = baseApi<
  1998. {
  1999. tags: string[];
  2000. },
  2001. {
  2002. project_id: number;
  2003. cluster_id: number;
  2004. namespace: string;
  2005. release_name: string;
  2006. }
  2007. >(
  2008. "PATCH",
  2009. ({ project_id, cluster_id, namespace, release_name }) =>
  2010. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/update_tags`
  2011. );
  2012. const updateCanonicalName = baseApi<
  2013. {
  2014. canonical_name: string;
  2015. },
  2016. {
  2017. project_id: number;
  2018. cluster_id: number;
  2019. namespace: string;
  2020. release_name: string;
  2021. }
  2022. >(
  2023. "PATCH",
  2024. ({ project_id, cluster_id, namespace, release_name }) =>
  2025. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/update_canonical_name`
  2026. );
  2027. const getGitProviders = baseApi<{}, { project_id: number }>(
  2028. "GET",
  2029. ({ project_id }) => `/api/projects/${project_id}/integrations/git`
  2030. );
  2031. const getGitlabRepos = baseApi<
  2032. {},
  2033. { project_id: number; integration_id: number }
  2034. >(
  2035. "GET",
  2036. ({ project_id, integration_id }) =>
  2037. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos`
  2038. );
  2039. const getGitlabBranches = baseApi<
  2040. {},
  2041. {
  2042. project_id: number;
  2043. integration_id: number;
  2044. repo_owner: string;
  2045. repo_name: string;
  2046. }
  2047. >(
  2048. "GET",
  2049. ({ project_id, integration_id, repo_owner, repo_name }) =>
  2050. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/branches`
  2051. );
  2052. const getGitlabFolderContent = baseApi<
  2053. {
  2054. dir: string;
  2055. },
  2056. {
  2057. project_id: number;
  2058. integration_id: number;
  2059. repo_owner: string;
  2060. repo_name: string;
  2061. branch: string;
  2062. }
  2063. >(
  2064. "GET",
  2065. ({ project_id, integration_id, repo_owner, repo_name, branch }) =>
  2066. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/${branch}/contents`
  2067. );
  2068. const getLogPodValues = baseApi<
  2069. {
  2070. namespace?: string;
  2071. revision?: string;
  2072. match_prefix?: string;
  2073. start_range?: string;
  2074. end_range?: string;
  2075. },
  2076. {
  2077. project_id: number;
  2078. cluster_id: number;
  2079. }
  2080. >(
  2081. "GET",
  2082. ({ project_id, cluster_id }) =>
  2083. `/api/projects/${project_id}/clusters/${cluster_id}/logs/pod_values`
  2084. );
  2085. const getLogs = baseApi<
  2086. {
  2087. limit?: number;
  2088. start_range?: string;
  2089. end_range?: string;
  2090. revision?: string;
  2091. pod_selector: string;
  2092. namespace?: string;
  2093. search_param?: string;
  2094. direction?: string;
  2095. },
  2096. {
  2097. project_id: number;
  2098. cluster_id: number;
  2099. }
  2100. >(
  2101. "GET",
  2102. ({ project_id, cluster_id }) =>
  2103. `/api/projects/${project_id}/clusters/${cluster_id}/logs`
  2104. );
  2105. const listPorterEvents = baseApi<
  2106. {
  2107. release_name?: number;
  2108. release_namespace?: string;
  2109. type?: string;
  2110. },
  2111. {
  2112. project_id: number;
  2113. cluster_id: number;
  2114. }
  2115. >(
  2116. "GET",
  2117. ({ project_id, cluster_id }) =>
  2118. `/api/projects/${project_id}/clusters/${cluster_id}/events`
  2119. );
  2120. const listPorterJobEvents = baseApi<
  2121. {
  2122. release_name?: number;
  2123. release_namespace?: string;
  2124. type?: string;
  2125. job_name: string;
  2126. },
  2127. {
  2128. project_id: number;
  2129. cluster_id: number;
  2130. }
  2131. >(
  2132. "GET",
  2133. ({ project_id, cluster_id }) =>
  2134. `/api/projects/${project_id}/clusters/${cluster_id}/events/job`
  2135. );
  2136. const listIncidents = baseApi<
  2137. {
  2138. release_name?: number;
  2139. release_namespace?: string;
  2140. status?: string;
  2141. },
  2142. {
  2143. project_id: number;
  2144. cluster_id: number;
  2145. }
  2146. >(
  2147. "GET",
  2148. ({ project_id, cluster_id }) =>
  2149. `/api/projects/${project_id}/clusters/${cluster_id}/incidents`
  2150. );
  2151. const getIncident = baseApi<
  2152. {},
  2153. {
  2154. project_id: number;
  2155. cluster_id: number;
  2156. incident_id: string;
  2157. }
  2158. >(
  2159. "GET",
  2160. ({ project_id, cluster_id, incident_id }) =>
  2161. `/api/projects/${project_id}/clusters/${cluster_id}/incidents/${incident_id}`
  2162. );
  2163. const getIncidentEvents = baseApi<
  2164. {
  2165. incident_id?: string;
  2166. pod_prefix?: string;
  2167. },
  2168. {
  2169. project_id: number;
  2170. cluster_id: number;
  2171. }
  2172. >(
  2173. "GET",
  2174. ({ project_id, cluster_id }) =>
  2175. `/api/projects/${project_id}/clusters/${cluster_id}/incidents/events`
  2176. );
  2177. // TRACKING
  2178. const updateOnboardingStep = baseApi<
  2179. {
  2180. step: string;
  2181. },
  2182. {}
  2183. >("POST", (pathParams) => {
  2184. return `/api/onboarding_step`;
  2185. });
  2186. const updateStackStep = baseApi<
  2187. {
  2188. step: string;
  2189. stack_name?: string;
  2190. },
  2191. {
  2192. project_id: number;
  2193. cluster_id: number;
  2194. }
  2195. >("POST", (pathParams) => {
  2196. let { project_id, cluster_id } = pathParams;
  2197. return `/api/projects/${project_id}/clusters/${cluster_id}/stacks/analytics`;
  2198. });
  2199. // STACKS
  2200. const createStack = baseApi<
  2201. CreateStackBody,
  2202. {
  2203. project_id: number;
  2204. cluster_id: number;
  2205. namespace: string;
  2206. }
  2207. >(
  2208. "POST",
  2209. ({ project_id, cluster_id, namespace }) =>
  2210. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks`
  2211. );
  2212. const updateStack = baseApi<
  2213. {
  2214. name: string;
  2215. },
  2216. {
  2217. project_id: number;
  2218. cluster_id: number;
  2219. namespace: string;
  2220. stack_id: string;
  2221. }
  2222. >(
  2223. "PATCH",
  2224. ({ project_id, cluster_id, namespace, stack_id }) =>
  2225. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  2226. );
  2227. const listStacks = baseApi<
  2228. {},
  2229. { project_id: number; cluster_id: number; namespace: string }
  2230. >(
  2231. "GET",
  2232. ({ project_id, cluster_id, namespace }) =>
  2233. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks`
  2234. );
  2235. const getStack = baseApi<
  2236. {},
  2237. {
  2238. project_id: number;
  2239. cluster_id: number;
  2240. namespace: string;
  2241. stack_id: string;
  2242. }
  2243. >(
  2244. "GET",
  2245. ({ project_id, cluster_id, namespace, stack_id }) =>
  2246. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  2247. );
  2248. const getStackRevision = baseApi<
  2249. {},
  2250. {
  2251. project_id: number;
  2252. cluster_id: number;
  2253. namespace: string;
  2254. stack_id: string;
  2255. revision_id: number;
  2256. }
  2257. >(
  2258. "GET",
  2259. ({ project_id, cluster_id, namespace, stack_id, revision_id }) =>
  2260. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/${revision_id}`
  2261. );
  2262. const rollbackStack = baseApi<
  2263. {
  2264. target_revision: number;
  2265. },
  2266. {
  2267. project_id: number;
  2268. cluster_id: number;
  2269. namespace: string;
  2270. stack_id: string;
  2271. }
  2272. >(
  2273. "POST",
  2274. ({ project_id, cluster_id, namespace, stack_id }) =>
  2275. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/rollback`
  2276. );
  2277. const deleteStack = baseApi<
  2278. {},
  2279. {
  2280. project_id: number;
  2281. cluster_id: number;
  2282. namespace: string;
  2283. stack_id: string;
  2284. }
  2285. >(
  2286. "DELETE",
  2287. ({ project_id, cluster_id, namespace, stack_id }) =>
  2288. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  2289. );
  2290. const updateStackSourceConfig = baseApi<
  2291. {
  2292. source_configs: SourceConfig[];
  2293. },
  2294. {
  2295. project_id: number;
  2296. cluster_id: number;
  2297. namespace: string;
  2298. stack_id: string;
  2299. }
  2300. >(
  2301. "PUT",
  2302. ({ project_id, cluster_id, namespace, stack_id }) =>
  2303. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/source`
  2304. );
  2305. const addStackAppResource = baseApi<
  2306. CreateStackBody["app_resources"][0],
  2307. {
  2308. project_id: number;
  2309. cluster_id: number;
  2310. namespace: string;
  2311. stack_id: string;
  2312. }
  2313. >(
  2314. "PATCH",
  2315. ({ project_id, cluster_id, namespace, stack_id }) =>
  2316. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/add_application`
  2317. );
  2318. const removeStackAppResource = baseApi<
  2319. {},
  2320. {
  2321. project_id: number;
  2322. cluster_id: number;
  2323. namespace: string;
  2324. stack_id: string;
  2325. app_resource_name: string;
  2326. }
  2327. >(
  2328. "DELETE",
  2329. ({ project_id, cluster_id, namespace, stack_id, app_resource_name }) =>
  2330. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/remove_application/${app_resource_name}`
  2331. );
  2332. const addStackEnvGroup = baseApi<
  2333. CreateStackBody["env_groups"][0],
  2334. {
  2335. project_id: number;
  2336. cluster_id: number;
  2337. namespace: string;
  2338. stack_id: string;
  2339. }
  2340. >(
  2341. "PATCH",
  2342. ({ project_id, cluster_id, namespace, stack_id }) =>
  2343. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/add_env_group`
  2344. );
  2345. const removeStackEnvGroup = baseApi<
  2346. {},
  2347. {
  2348. project_id: number;
  2349. cluster_id: number;
  2350. namespace: string;
  2351. stack_id: string;
  2352. env_group_name: string;
  2353. }
  2354. >(
  2355. "DELETE",
  2356. ({ project_id, cluster_id, namespace, stack_id, env_group_name }) =>
  2357. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/remove_env_group/${env_group_name}`
  2358. );
  2359. const getGithubStatus = baseApi<{}, {}>("GET", ({ }) => `/api/status/github`);
  2360. const createSecretAndOpenGitHubPullRequest = baseApi<
  2361. {
  2362. github_app_installation_id: number;
  2363. github_repo_owner: string;
  2364. github_repo_name: string;
  2365. open_pr: boolean;
  2366. branch: string;
  2367. porter_yaml_path: string;
  2368. },
  2369. {
  2370. project_id: number;
  2371. cluster_id: number;
  2372. stack_name: string;
  2373. }
  2374. >(
  2375. "POST",
  2376. ({ project_id, cluster_id, stack_name }) =>
  2377. `/api/projects/${project_id}/clusters/${cluster_id}/stacks/${stack_name}/pr`
  2378. );
  2379. // Bundle export to allow default api import (api.<method> is more readable)
  2380. export default {
  2381. checkAuth,
  2382. connectECRRegistry,
  2383. connectGCRRegistry,
  2384. connectDORegistry,
  2385. getAWSIntegration,
  2386. getGCPIntegration,
  2387. getAzureIntegration,
  2388. getGitlabIntegration,
  2389. createAWSIntegration,
  2390. overwriteAWSIntegration,
  2391. updateCluster,
  2392. renameCluster,
  2393. createAzureIntegration,
  2394. createGitlabIntegration,
  2395. createEmailVerification,
  2396. createEnvironment,
  2397. updateEnvironment,
  2398. deleteEnvironment,
  2399. createPreviewEnvironmentDeployment,
  2400. reenablePreviewEnvironmentDeployment,
  2401. listEnvironments,
  2402. getEnvironment,
  2403. toggleNewCommentForEnvironment,
  2404. validatePorterYAML,
  2405. createGCPIntegration,
  2406. createInvite,
  2407. createNamespace,
  2408. createPasswordReset,
  2409. createPasswordResetVerify,
  2410. createPasswordResetFinalize,
  2411. createProject,
  2412. // PORTER APP
  2413. getPorterApps,
  2414. getPorterApp,
  2415. createPorterApp,
  2416. deletePorterApp,
  2417. rollbackPorterApp,
  2418. getLogsWithinTimeRange,
  2419. createConfigMap,
  2420. deleteCluster,
  2421. deleteConfigMap,
  2422. deleteInvite,
  2423. deleteNamespace,
  2424. deletePod,
  2425. deleteProject,
  2426. deleteRegistryIntegration,
  2427. deleteSlackIntegration,
  2428. updateNotificationConfig,
  2429. getNotificationConfig,
  2430. createSubdomain,
  2431. deployTemplate,
  2432. deployAddon,
  2433. destroyInfra,
  2434. updateDatabaseStatus,
  2435. detectBuildpack,
  2436. detectGitlabBuildpack,
  2437. getBranchContents,
  2438. getBranches,
  2439. getMetadata,
  2440. postWelcome,
  2441. getChart,
  2442. getCharts,
  2443. getChartComponents,
  2444. getChartControllers,
  2445. getClusterIntegrations,
  2446. getClusters,
  2447. getCluster,
  2448. getClusterNodes,
  2449. getClusterNode,
  2450. getClusterStatus,
  2451. getConfigMap,
  2452. getPRDeploymentList,
  2453. getPRDeploymentByID,
  2454. getGHAWorkflowTemplate,
  2455. getGitRepoList,
  2456. getGitRepoPermission,
  2457. getGitRepos,
  2458. getImageRepos,
  2459. getImageTags,
  2460. listInfraTemplates,
  2461. getInfraTemplate,
  2462. getInfra,
  2463. provisionCluster,
  2464. provisionInfra,
  2465. deleteInfra,
  2466. updateInfra,
  2467. listOperations,
  2468. getOperation,
  2469. getOperationLogs,
  2470. retryCreateInfra,
  2471. retryDeleteInfra,
  2472. getInfraState,
  2473. getInfraRawState,
  2474. getInfraByID,
  2475. getInfraDesired,
  2476. getInfraCurrent,
  2477. getIngress,
  2478. getInvites,
  2479. getJobs,
  2480. getJobStatus,
  2481. getJobPods,
  2482. getPodByName,
  2483. getMatchingPods,
  2484. getAllReleasePods,
  2485. getClusterState,
  2486. getMetrics,
  2487. getNamespaces,
  2488. getNGINXIngresses,
  2489. getOAuthIds,
  2490. getPodEvents,
  2491. getProcfileContents,
  2492. getPorterYamlContents,
  2493. getGitlabProcfileContents,
  2494. getProjectClusters,
  2495. getProjectRegistries,
  2496. getProjectRepos,
  2497. getProjects,
  2498. getPrometheusIsInstalled,
  2499. getRegistryIntegrations,
  2500. getReleaseToken,
  2501. getReleaseSteps,
  2502. getRepoIntegrations,
  2503. getSlackIntegrations,
  2504. getRepos,
  2505. getRevisions,
  2506. getTemplateInfo,
  2507. getTemplateUpgradeNotes,
  2508. getTemplates,
  2509. getHelmRepos,
  2510. getChartsFromHelmRepo,
  2511. getChartInfoFromHelmRepo,
  2512. linkGithubProject,
  2513. inviteAdmin,
  2514. getGithubAccounts,
  2515. listConfigMaps,
  2516. logInUser,
  2517. logOutUser,
  2518. registerUser,
  2519. rollbackChart,
  2520. uninstallTemplate,
  2521. updateUserInfo,
  2522. updateUser,
  2523. renameConfigMap,
  2524. updateConfigMap,
  2525. upgradeChartValues,
  2526. deleteJob,
  2527. stopJob,
  2528. updateInvite,
  2529. listAPITokens,
  2530. getAPIToken,
  2531. revokeAPIToken,
  2532. createAPIToken,
  2533. createPolicy,
  2534. getAvailableRoles,
  2535. getCollaborators,
  2536. updateCollaborator,
  2537. removeCollaborator,
  2538. getPolicyDocument,
  2539. createWebhookToken,
  2540. getUsage,
  2541. getCustomerToken,
  2542. getHasBilling,
  2543. getOnboardingState,
  2544. saveOnboardingState,
  2545. getOnboardingInfra,
  2546. getOnboardingRegistry,
  2547. detectPorterAgent,
  2548. installPorterAgent,
  2549. getKubeEvents,
  2550. getKubeEvent,
  2551. getLogBuckets,
  2552. getLogBucketLogs,
  2553. getCanCreateProject,
  2554. createEnvGroup,
  2555. cloneEnvGroup,
  2556. updateEnvGroup,
  2557. listEnvGroups,
  2558. getEnvGroup,
  2559. deleteEnvGroup,
  2560. addApplicationToEnvGroup,
  2561. removeApplicationFromEnvGroup,
  2562. provisionDatabase,
  2563. preflightCheckAWSUsage,
  2564. getDatabases,
  2565. getPreviousLogsForContainer,
  2566. upgradePorterAgent,
  2567. deletePRDeployment,
  2568. updateBuildConfig,
  2569. updateGitActionConfig,
  2570. reRunGHWorkflow,
  2571. getGHWorkflowLogs,
  2572. getGHWorkflowLogById,
  2573. triggerPreviewEnvWorkflow,
  2574. getTagsByProjectId,
  2575. createTag,
  2576. updateReleaseTags,
  2577. updateCanonicalName,
  2578. getGitProviders,
  2579. getGitlabRepos,
  2580. getGitlabBranches,
  2581. getGitlabFolderContent,
  2582. getLogPodValues,
  2583. getLogs,
  2584. listPorterEvents,
  2585. listPorterJobEvents,
  2586. listIncidents,
  2587. getIncident,
  2588. getIncidentEvents,
  2589. createContract,
  2590. getContracts,
  2591. deleteContract,
  2592. createSecretAndOpenGitHubPullRequest,
  2593. // TRACKING
  2594. updateOnboardingStep,
  2595. updateStackStep,
  2596. // STACKS
  2597. listStacks,
  2598. getStack,
  2599. getStackRevision,
  2600. createStack,
  2601. updateStack,
  2602. rollbackStack,
  2603. deleteStack,
  2604. updateStackSourceConfig,
  2605. addStackAppResource,
  2606. removeStackAppResource,
  2607. addStackEnvGroup,
  2608. removeStackEnvGroup,
  2609. getFeedEvents,
  2610. // STATUS
  2611. getGithubStatus,
  2612. };