api.tsx 86 KB

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