api.tsx 71 KB

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