api.tsx 87 KB

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