api.tsx 66 KB

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