api.tsx 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780
  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. const getRepoIntegrations = baseApi("GET", "/api/integrations/repo");
  1799. const getRepos = baseApi<{}, { id: number }>("GET", (pathParams) => {
  1800. return `/api/projects/${pathParams.id}/repos`;
  1801. });
  1802. const getSlackIntegrations = baseApi<{}, { id: number }>(
  1803. "GET",
  1804. (pathParams) => {
  1805. return `/api/projects/${pathParams.id}/slack_integrations`;
  1806. }
  1807. );
  1808. const getRevisions = baseApi<
  1809. {},
  1810. { id: number; cluster_id: number; namespace: string; name: string }
  1811. >("GET", (pathParams) => {
  1812. const { id, cluster_id, namespace, name } = pathParams;
  1813. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/history`;
  1814. });
  1815. const getTemplateInfo = baseApi<
  1816. {
  1817. repo_url?: string;
  1818. },
  1819. { project_id: number; name: string; version: string }
  1820. >("GET", (pathParams) => {
  1821. return `/api/v1/projects/${pathParams.project_id}/templates/${pathParams.name}/versions/${pathParams.version}`;
  1822. });
  1823. const getTemplateUpgradeNotes = baseApi<
  1824. {
  1825. repo_url?: string;
  1826. prev_version: string;
  1827. },
  1828. { project_id: number; name: string; version: string }
  1829. >("GET", (pathParams) => {
  1830. return `/api/v1/projects/${pathParams.project_id}/templates/${pathParams.name}/versions/${pathParams.version}/upgrade_notes`;
  1831. });
  1832. const getTemplates = baseApi<
  1833. {
  1834. repo_url?: string;
  1835. },
  1836. {
  1837. project_id: number;
  1838. }
  1839. >("GET", (pathParams) => {
  1840. return `/api/v1/projects/${pathParams.project_id}/templates`;
  1841. });
  1842. const getHelmRepos = baseApi<
  1843. {},
  1844. {
  1845. project_id: number;
  1846. }
  1847. >("GET", (pathParams) => {
  1848. return `/api/projects/${pathParams.project_id}/helmrepos`;
  1849. });
  1850. const getChartsFromHelmRepo = baseApi<
  1851. {},
  1852. {
  1853. project_id: number;
  1854. helm_repo_id: number;
  1855. }
  1856. >("GET", (pathParams) => {
  1857. return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts`;
  1858. });
  1859. const getChartInfoFromHelmRepo = baseApi<
  1860. {},
  1861. { project_id: number; helm_repo_id: number; name: string; version: string }
  1862. >("GET", (pathParams) => {
  1863. return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts/${pathParams.name}/${pathParams.version}`;
  1864. });
  1865. const getMetadata = baseApi<{}, {}>("GET", () => {
  1866. return `/api/metadata`;
  1867. });
  1868. const postWelcome = baseApi<{
  1869. email: string;
  1870. isCompany: boolean;
  1871. name: string;
  1872. company: string;
  1873. role: string;
  1874. }>("POST", () => {
  1875. return `/api/welcome`;
  1876. });
  1877. const linkGithubProject = baseApi<
  1878. {},
  1879. {
  1880. project_id: number;
  1881. }
  1882. >("GET", (pathParams) => {
  1883. return `/api/oauth/projects/${pathParams.project_id}/github`;
  1884. });
  1885. const getGithubAccounts = baseApi<{}, {}>("GET", () => {
  1886. return `/api/integrations/github-app/accounts`;
  1887. });
  1888. const logInUser = baseApi<{
  1889. email: string;
  1890. password: string;
  1891. }>("POST", "/api/login");
  1892. const logOutUser = baseApi("POST", "/api/logout");
  1893. const registerUser = baseApi<{
  1894. email: string;
  1895. password: string;
  1896. first_name: string;
  1897. last_name: string;
  1898. company_name: string;
  1899. referral_method?: string;
  1900. }>("POST", "/api/users");
  1901. const rollbackChart = baseApi<
  1902. {
  1903. revision: number;
  1904. },
  1905. {
  1906. id: number;
  1907. name: string;
  1908. namespace: string;
  1909. cluster_id: number;
  1910. }
  1911. >("POST", (pathParams) => {
  1912. const { id, name, cluster_id, namespace } = pathParams;
  1913. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/rollback`;
  1914. });
  1915. const uninstallTemplate = baseApi<
  1916. {},
  1917. {
  1918. id: number;
  1919. name: string;
  1920. cluster_id: number;
  1921. namespace: string;
  1922. }
  1923. >("DELETE", (pathParams) => {
  1924. const { id, name, cluster_id, namespace } = pathParams;
  1925. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0`;
  1926. });
  1927. const updateUserInfo = baseApi<
  1928. {
  1929. first_name: string;
  1930. last_name: string;
  1931. company_name: string;
  1932. },
  1933. {}
  1934. >("POST", (pathParams) => {
  1935. return `/api/users/update/info`;
  1936. });
  1937. const updateUser = baseApi<
  1938. {
  1939. rawKubeConfig?: string;
  1940. allowedContexts?: string[];
  1941. },
  1942. { id: number }
  1943. >("PUT", (pathParams) => {
  1944. return `/api/users/${pathParams.id}`;
  1945. });
  1946. const upgradeChartValues = baseApi<
  1947. {
  1948. values: string;
  1949. version?: string;
  1950. latest_revision?: number;
  1951. },
  1952. {
  1953. id: number;
  1954. name: string;
  1955. namespace: string;
  1956. cluster_id: number;
  1957. }
  1958. >("POST", (pathParams) => {
  1959. const { id, name, cluster_id, namespace } = pathParams;
  1960. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/upgrade`;
  1961. });
  1962. const getAllEnvGroups = baseApi<
  1963. {
  1964. type?: string;
  1965. },
  1966. {
  1967. id: number;
  1968. cluster_id: number;
  1969. }
  1970. >("GET", (pathParams) => {
  1971. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups`;
  1972. });
  1973. const updateAppsLinkedToEnvironmentGroup = baseApi<
  1974. {
  1975. name: string;
  1976. },
  1977. {
  1978. id: number;
  1979. cluster_id: number;
  1980. }
  1981. >("POST", (pathParams) => {
  1982. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups/update-linked-apps`;
  1983. });
  1984. const updateEnvironmentGroupV2 = baseApi<
  1985. {
  1986. deployment_target_id: string;
  1987. variables: Record<string, string>;
  1988. secrets: Record<string, string>;
  1989. b64_app_proto: string;
  1990. remove_missing?: boolean;
  1991. },
  1992. {
  1993. id: number;
  1994. cluster_id: number;
  1995. app_name: string;
  1996. }
  1997. >("POST", (pathParams) => {
  1998. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/apps/${pathParams.app_name}/update-environment `;
  1999. });
  2000. const listEnvGroups = baseApi<
  2001. {},
  2002. {
  2003. id: number;
  2004. namespace: string;
  2005. cluster_id: number;
  2006. }
  2007. >("GET", (pathParams) => {
  2008. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/list`;
  2009. });
  2010. const listConfigMaps = baseApi<
  2011. {},
  2012. {
  2013. id: number;
  2014. namespace: string;
  2015. cluster_id: number;
  2016. }
  2017. >("GET", (pathParams) => {
  2018. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/list`;
  2019. });
  2020. const getEnvGroup = baseApi<
  2021. {},
  2022. {
  2023. id: number;
  2024. namespace: string;
  2025. cluster_id: number;
  2026. name: string;
  2027. version?: number;
  2028. }
  2029. >("GET", (pathParams) => {
  2030. return `/api/projects/${pathParams.id}/clusters/${
  2031. pathParams.cluster_id
  2032. }/namespaces/${pathParams.namespace}/envgroup?name=${pathParams.name}${
  2033. pathParams.version ? "&version=" + pathParams.version : ""
  2034. }`;
  2035. });
  2036. const getConfigMap = baseApi<
  2037. {
  2038. name: string;
  2039. },
  2040. {
  2041. id: number;
  2042. namespace: string;
  2043. cluster_id: number;
  2044. }
  2045. >("GET", (pathParams) => {
  2046. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap`;
  2047. });
  2048. const createEnvGroup = baseApi<
  2049. {
  2050. name: string;
  2051. variables: Record<string, string>;
  2052. secret_variables?: Record<string, string>;
  2053. },
  2054. {
  2055. id: number;
  2056. cluster_id: number;
  2057. namespace: string;
  2058. }
  2059. >("POST", (pathParams) => {
  2060. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/create`;
  2061. });
  2062. const createEnvironmentGroups = baseApi<
  2063. {
  2064. name: string;
  2065. variables?: Record<string, string>;
  2066. secret_variables?: Record<string, string>;
  2067. type?: string;
  2068. auth_token?: string;
  2069. is_env_override?: boolean;
  2070. },
  2071. {
  2072. id: number;
  2073. cluster_id: number;
  2074. }
  2075. >("POST", (pathParams) => {
  2076. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups`;
  2077. });
  2078. const enableExternalEnvGroupProviders = baseApi<
  2079. {},
  2080. {
  2081. id: number;
  2082. cluster_id: number;
  2083. }
  2084. >("POST", (pathParams) => {
  2085. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups/enable-external-providers`;
  2086. });
  2087. const areExternalEnvGroupProvidersEnabled = baseApi<
  2088. {},
  2089. {
  2090. id: number;
  2091. cluster_id: number;
  2092. }
  2093. >("GET", (pathParams) => {
  2094. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups/are-external-providers-enabled`;
  2095. });
  2096. const cloneEnvGroup = baseApi<
  2097. {
  2098. name: string;
  2099. namespace: string;
  2100. clone_name: string;
  2101. version: number;
  2102. },
  2103. {
  2104. id: number;
  2105. namespace: string;
  2106. cluster_id: number;
  2107. }
  2108. >("POST", (pathParams) => {
  2109. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/clone`;
  2110. });
  2111. const updateEnvGroup = baseApi<
  2112. {
  2113. name: string;
  2114. variables: Record<string, string>;
  2115. secret_variables?: Record<string, string>;
  2116. },
  2117. {
  2118. project_id: number;
  2119. cluster_id: number;
  2120. namespace: string;
  2121. }
  2122. >(
  2123. "POST",
  2124. ({ cluster_id, project_id, namespace }) =>
  2125. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/create`
  2126. );
  2127. const updateStacksEnvGroup = baseApi<
  2128. {
  2129. name: string;
  2130. variables: Record<string, string>;
  2131. secret_variables?: Record<string, string>;
  2132. apps?: string[];
  2133. },
  2134. {
  2135. project_id: number;
  2136. cluster_id: number;
  2137. namespace: string;
  2138. }
  2139. >(
  2140. "POST",
  2141. ({ cluster_id, project_id, namespace }) =>
  2142. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/envgroup/create`
  2143. );
  2144. const createConfigMap = baseApi<
  2145. {
  2146. name: string;
  2147. variables: Record<string, string>;
  2148. secret_variables?: Record<string, string>;
  2149. },
  2150. {
  2151. id: number;
  2152. cluster_id: number;
  2153. namespace: string;
  2154. }
  2155. >("POST", (pathParams) => {
  2156. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/create`;
  2157. });
  2158. const updateConfigMap = baseApi<
  2159. {
  2160. name: string;
  2161. variables: Record<string, string>;
  2162. secret_variables?: Record<string, string>;
  2163. },
  2164. {
  2165. id: number;
  2166. cluster_id: number;
  2167. namespace: string;
  2168. }
  2169. >("POST", (pathParams) => {
  2170. const { id, cluster_id } = pathParams;
  2171. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/update`;
  2172. });
  2173. const renameConfigMap = baseApi<
  2174. {
  2175. name: string;
  2176. new_name: string;
  2177. },
  2178. {
  2179. id: number;
  2180. cluster_id: number;
  2181. namespace: string;
  2182. }
  2183. >("POST", (pathParams) => {
  2184. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/rename`;
  2185. });
  2186. const deleteEnvGroup = baseApi<
  2187. {
  2188. name: string;
  2189. },
  2190. {
  2191. id: number;
  2192. namespace: string;
  2193. cluster_id: number;
  2194. }
  2195. >("DELETE", (pathParams) => {
  2196. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup`;
  2197. });
  2198. const deleteNewEnvGroup = baseApi<
  2199. {
  2200. name: string;
  2201. type?: string;
  2202. },
  2203. {
  2204. id: number;
  2205. cluster_id: number;
  2206. }
  2207. >("DELETE", (pathParams) => {
  2208. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/environment-groups`;
  2209. });
  2210. const deleteConfigMap = baseApi<
  2211. {
  2212. name: string;
  2213. },
  2214. {
  2215. id: number;
  2216. namespace: string;
  2217. cluster_id: number;
  2218. }
  2219. >("DELETE", (pathParams) => {
  2220. return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/delete`;
  2221. });
  2222. const createNamespace = baseApi<
  2223. {
  2224. name: string;
  2225. },
  2226. { id: number; cluster_id: number }
  2227. >("POST", (pathParams) => {
  2228. const { id, cluster_id } = pathParams;
  2229. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/create`;
  2230. });
  2231. const deleteNamespace = baseApi<
  2232. {},
  2233. {
  2234. id: number;
  2235. cluster_id: number;
  2236. namespace: string;
  2237. }
  2238. >("DELETE", (pathParams) => {
  2239. const { id, cluster_id, namespace } = pathParams;
  2240. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}`;
  2241. });
  2242. const deleteJob = baseApi<
  2243. {},
  2244. { name: string; namespace: string; id: number; cluster_id: number }
  2245. >("DELETE", (pathParams) => {
  2246. const { id, name, cluster_id, namespace } = pathParams;
  2247. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}`;
  2248. });
  2249. const stopJob = baseApi<
  2250. {},
  2251. { name: string; namespace: string; id: number; cluster_id: number }
  2252. >("POST", (pathParams) => {
  2253. const { id, name, namespace, cluster_id } = pathParams;
  2254. return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}/stop`;
  2255. });
  2256. const listAPITokens = baseApi<{}, { project_id: number }>(
  2257. "GET",
  2258. ({ project_id }) => `/api/projects/${project_id}/api_token`
  2259. );
  2260. const getAPIToken = baseApi<{}, { project_id: number; token: string }>(
  2261. "GET",
  2262. ({ project_id, token }) => `/api/projects/${project_id}/api_token/${token}`
  2263. );
  2264. const revokeAPIToken = baseApi<{}, { project_id: number; token: string }>(
  2265. "POST",
  2266. ({ project_id, token }) =>
  2267. `/api/projects/${project_id}/api_token/${token}/revoke`
  2268. );
  2269. const createAPIToken = baseApi<
  2270. {
  2271. name: string;
  2272. policy_uid: string;
  2273. expires_at?: string;
  2274. },
  2275. { project_id: number }
  2276. >("POST", ({ project_id }) => `/api/projects/${project_id}/api_token`);
  2277. const createPolicy = baseApi<
  2278. {
  2279. name: string;
  2280. policy: PolicyDocType[];
  2281. },
  2282. { project_id: number }
  2283. >("POST", ({ project_id }) => `/api/projects/${project_id}/policy`);
  2284. const getAvailableRoles = baseApi<{}, { project_id: number }>(
  2285. "GET",
  2286. ({ project_id }) => `/api/projects/${project_id}/roles`
  2287. );
  2288. const updateInvite = baseApi<
  2289. { kind: string },
  2290. { project_id: number; invite_id: number }
  2291. >(
  2292. "POST",
  2293. ({ project_id, invite_id }) =>
  2294. `/api/projects/${project_id}/invites/${invite_id}`
  2295. );
  2296. const getCollaborators = baseApi<{}, { project_id: number }>(
  2297. "GET",
  2298. ({ project_id }) => `/api/projects/${project_id}/collaborators`
  2299. );
  2300. const updateCollaborator = baseApi<
  2301. {
  2302. kind: string;
  2303. user_id: number;
  2304. },
  2305. { project_id: number }
  2306. >("POST", ({ project_id }) => `/api/projects/${project_id}/roles`);
  2307. const removeCollaborator = baseApi<{ user_id: number }, { project_id: number }>(
  2308. "DELETE",
  2309. ({ project_id }) => `/api/projects/${project_id}/roles`
  2310. );
  2311. const getPolicyDocument = baseApi<{}, { project_id: number }>(
  2312. "GET",
  2313. ({ project_id }) => `/api/projects/${project_id}/policy`
  2314. );
  2315. const createWebhookToken = baseApi<
  2316. {},
  2317. {
  2318. project_id: number;
  2319. chart_name: string;
  2320. namespace: string;
  2321. cluster_id: number;
  2322. }
  2323. >(
  2324. "POST",
  2325. ({ project_id, chart_name, namespace, cluster_id }) =>
  2326. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${chart_name}/0/webhook`
  2327. );
  2328. const getUsage = baseApi<{}, { project_id: number }>(
  2329. "GET",
  2330. ({ project_id }) => `/api/projects/${project_id}/usage`
  2331. );
  2332. // Used for billing purposes
  2333. const getCustomerToken = baseApi<{}, { project_id: number }>(
  2334. "GET",
  2335. ({ project_id }) => `/api/projects/${project_id}/billing/token`
  2336. );
  2337. const getHasBilling = baseApi<{}, { project_id: number }>(
  2338. "GET",
  2339. ({ project_id }) => `/api/projects/${project_id}/billing`
  2340. );
  2341. const getOnboardingState = baseApi<{}, { project_id: number }>(
  2342. "GET",
  2343. ({ project_id }) => `/api/projects/${project_id}/onboarding`
  2344. );
  2345. const saveOnboardingState = baseApi<{}, { project_id: number }>(
  2346. "POST",
  2347. ({ project_id }) => `/api/projects/${project_id}/onboarding`
  2348. );
  2349. const getOnboardingInfra = baseApi<
  2350. {},
  2351. { project_id: number; registry_infra_id: number }
  2352. >(
  2353. "GET",
  2354. ({ project_id, registry_infra_id }) =>
  2355. `/api/projects/${project_id}/infras/${registry_infra_id}`
  2356. );
  2357. const getOnboardingRegistry = baseApi<
  2358. {},
  2359. { project_id: number; registry_connection_id: number }
  2360. >(
  2361. "GET",
  2362. ({ project_id, registry_connection_id }) =>
  2363. `/api/projects/${project_id}/registries/${registry_connection_id}`
  2364. );
  2365. const detectPorterAgent = baseApi<
  2366. {},
  2367. { project_id: number; cluster_id: number }
  2368. >(
  2369. "GET",
  2370. ({ project_id, cluster_id }) =>
  2371. `/api/projects/${project_id}/clusters/${cluster_id}/agent/detect`
  2372. );
  2373. const installPorterAgent = baseApi<
  2374. {},
  2375. { project_id: number; cluster_id: number }
  2376. >(
  2377. "POST",
  2378. ({ cluster_id, project_id }) =>
  2379. `/api/projects/${project_id}/clusters/${cluster_id}/agent/install`
  2380. );
  2381. const getKubeEvents = baseApi<
  2382. {
  2383. skip: number;
  2384. resource_type: string;
  2385. owner_type?: string;
  2386. owner_name?: string;
  2387. namespace?: string;
  2388. },
  2389. { project_id: number; cluster_id: number }
  2390. >("GET", ({ project_id, cluster_id }) => {
  2391. return `/api/projects/${project_id}/clusters/${cluster_id}/kube_events`;
  2392. });
  2393. const getKubeEvent = baseApi<
  2394. {},
  2395. { project_id: number; cluster_id: number; kube_event_id: number }
  2396. >(
  2397. "GET",
  2398. ({ project_id, cluster_id, kube_event_id }) =>
  2399. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}`
  2400. );
  2401. const getLogBuckets = baseApi<
  2402. {},
  2403. { project_id: number; cluster_id: number; kube_event_id: number }
  2404. >(
  2405. "GET",
  2406. ({ project_id, cluster_id, kube_event_id }) =>
  2407. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/log_buckets`
  2408. );
  2409. const getLogBucketLogs = baseApi<
  2410. { timestamp: number },
  2411. { project_id: number; cluster_id: number; kube_event_id: number }
  2412. >(
  2413. "GET",
  2414. ({ project_id, cluster_id, kube_event_id }) =>
  2415. `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/logs`
  2416. );
  2417. const getCanCreateProject = baseApi<{}, {}>(
  2418. "GET",
  2419. () => "/api/can_create_project"
  2420. );
  2421. const addApplicationToEnvGroup = baseApi<
  2422. {
  2423. name: string; // Env Group name
  2424. app_name: string;
  2425. },
  2426. { project_id: number; cluster_id: number; namespace: string }
  2427. >(
  2428. "POST",
  2429. ({ cluster_id, namespace, project_id }) =>
  2430. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/add_application`
  2431. );
  2432. const removeApplicationFromEnvGroup = baseApi<
  2433. {
  2434. name: string; // Env Group name
  2435. app_name: string;
  2436. },
  2437. { project_id: number; cluster_id: number; namespace: string }
  2438. >(
  2439. "POST",
  2440. ({ cluster_id, namespace, project_id }) =>
  2441. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/remove_application`
  2442. );
  2443. const provisionDatabase = baseApi<
  2444. {
  2445. username: string;
  2446. password: string;
  2447. machine_type: string;
  2448. db_storage_encrypted: boolean;
  2449. db_name: string;
  2450. db_max_allocated_storage: string;
  2451. db_family: string;
  2452. db_engine_version: string;
  2453. db_allocated_storage: string;
  2454. },
  2455. { project_id: number; cluster_id: number; namespace: string }
  2456. >(
  2457. "POST",
  2458. ({ project_id, cluster_id, namespace }) =>
  2459. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/provision/rds`
  2460. );
  2461. const getAwsCloudProviders = baseApi<
  2462. {},
  2463. {
  2464. project_id: number;
  2465. }
  2466. >("GET", ({ project_id }) => {
  2467. return `/api/projects/${project_id}/cloud-providers/aws`;
  2468. });
  2469. const getDatabases = baseApi<
  2470. {},
  2471. {
  2472. project_id: number;
  2473. cluster_id: number;
  2474. }
  2475. >(
  2476. "GET",
  2477. ({ project_id, cluster_id }) =>
  2478. `/api/projects/${project_id}/clusters/${cluster_id}/databases`
  2479. );
  2480. const getDatastores = baseApi<
  2481. {},
  2482. {
  2483. project_id: number;
  2484. cloud_provider_name: string;
  2485. cloud_provider_id: string;
  2486. datastore_name?: string;
  2487. datastore_type?: string;
  2488. include_env_group?: boolean;
  2489. include_metadata?: boolean;
  2490. }
  2491. >(
  2492. "GET",
  2493. ({
  2494. project_id,
  2495. cloud_provider_name,
  2496. cloud_provider_id,
  2497. datastore_name,
  2498. datastore_type,
  2499. include_env_group,
  2500. include_metadata,
  2501. }) => {
  2502. const queryParams = new URLSearchParams();
  2503. if (datastore_name) {
  2504. queryParams.set("name", datastore_name);
  2505. }
  2506. if (datastore_type) {
  2507. queryParams.set("type", datastore_type);
  2508. }
  2509. if (include_env_group) {
  2510. queryParams.set("include_env_group", "true");
  2511. }
  2512. if (include_metadata) {
  2513. queryParams.set("include_metadata", "true");
  2514. }
  2515. return `/api/projects/${project_id}/cloud-providers/${cloud_provider_name}/${cloud_provider_id}/datastores?${queryParams.toString()}`;
  2516. }
  2517. );
  2518. const listDatastores = baseApi<
  2519. {},
  2520. {
  2521. project_id: number;
  2522. }
  2523. >("GET", ({ project_id }) => {
  2524. return `/api/projects/${project_id}/datastores`;
  2525. });
  2526. const getDatastore = baseApi<
  2527. {},
  2528. {
  2529. project_id: number;
  2530. datastore_name: string;
  2531. }
  2532. >("GET", ({ project_id, datastore_name }) => {
  2533. return `/api/projects/${project_id}/datastores/${datastore_name}`;
  2534. });
  2535. const updateDatastore = baseApi<
  2536. {
  2537. name: string;
  2538. type: "RDS" | "ELASTICACHE";
  2539. engine: "POSTGRES" | "AURORA-POSTGRES" | "REDIS";
  2540. values: any;
  2541. },
  2542. { project_id: number; cluster_id: number }
  2543. >(
  2544. "POST",
  2545. ({ project_id, cluster_id }) =>
  2546. `/api/projects/${project_id}/clusters/${cluster_id}/datastores`
  2547. );
  2548. const deleteDatastore = baseApi<
  2549. {},
  2550. {
  2551. project_id: number;
  2552. datastore_name: string;
  2553. }
  2554. >(
  2555. "DELETE",
  2556. ({ project_id, datastore_name }) =>
  2557. `/api/projects/${project_id}/datastores/${datastore_name}`
  2558. );
  2559. const getPreviousLogsForContainer = baseApi<
  2560. {
  2561. container_name: string;
  2562. },
  2563. {
  2564. project_id: number;
  2565. cluster_id: number;
  2566. namespace: string;
  2567. pod_name: string;
  2568. }
  2569. >(
  2570. "GET",
  2571. ({ cluster_id, namespace, pod_name: name, project_id }) =>
  2572. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/pod/${name}/previous_logs`
  2573. );
  2574. const upgradePorterAgent = baseApi<
  2575. {},
  2576. { project_id: number; cluster_id: number }
  2577. >(
  2578. "POST",
  2579. ({ project_id, cluster_id }) =>
  2580. `/api/projects/${project_id}/clusters/${cluster_id}/agent/upgrade`
  2581. );
  2582. const updateBuildConfig = baseApi<
  2583. BuildConfig,
  2584. {
  2585. project_id: number;
  2586. cluster_id: number;
  2587. namespace: string;
  2588. release_name: string;
  2589. }
  2590. >(
  2591. "POST",
  2592. ({ project_id, cluster_id, namespace, release_name }) =>
  2593. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/buildconfig`
  2594. );
  2595. const updateGitActionConfig = baseApi<
  2596. {
  2597. git_action_config: {
  2598. git_branch: string;
  2599. };
  2600. },
  2601. {
  2602. project_id: number;
  2603. cluster_id: number;
  2604. namespace: string;
  2605. release_name: string;
  2606. revision?: 0; // Always update latest
  2607. }
  2608. >(
  2609. "PATCH",
  2610. ({ project_id, cluster_id, namespace, release_name, revision = 0 }) =>
  2611. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/${revision}/git_action_config`
  2612. );
  2613. const reRunGHWorkflow = baseApi<
  2614. {},
  2615. {
  2616. project_id: number;
  2617. cluster_id: number;
  2618. git_installation_id: number;
  2619. owner: string;
  2620. name: string;
  2621. branch?: string;
  2622. filename?: string;
  2623. release_name?: string;
  2624. }
  2625. >(
  2626. "POST",
  2627. ({
  2628. project_id,
  2629. git_installation_id,
  2630. owner,
  2631. name,
  2632. cluster_id,
  2633. filename,
  2634. release_name,
  2635. branch,
  2636. }) => {
  2637. const queryParams = new URLSearchParams();
  2638. if (branch) {
  2639. queryParams.set("branch", branch);
  2640. }
  2641. if (release_name) {
  2642. queryParams.set("release_name", release_name);
  2643. }
  2644. if (filename) {
  2645. queryParams.set("filename", filename);
  2646. }
  2647. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/rerun_workflow?${queryParams.toString()}`;
  2648. }
  2649. );
  2650. const getGHWorkflowLogs = baseApi<
  2651. {},
  2652. {
  2653. project_id: number;
  2654. cluster_id: number;
  2655. git_installation_id: number;
  2656. owner: string;
  2657. name: string;
  2658. filename?: string;
  2659. release_name?: string;
  2660. }
  2661. >(
  2662. "GET",
  2663. ({
  2664. project_id,
  2665. git_installation_id,
  2666. owner,
  2667. name,
  2668. cluster_id,
  2669. filename,
  2670. release_name,
  2671. }) => {
  2672. const queryParams = new URLSearchParams();
  2673. if (release_name) {
  2674. queryParams.set("release_name", release_name);
  2675. }
  2676. if (filename) {
  2677. queryParams.set("filename", filename);
  2678. }
  2679. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/get_logs_workflow?${queryParams.toString()}`;
  2680. }
  2681. );
  2682. const getGHWorkflowLogById = baseApi<
  2683. {},
  2684. {
  2685. project_id: number;
  2686. cluster_id: number;
  2687. git_installation_id: number;
  2688. owner: string;
  2689. name: string;
  2690. filename?: string;
  2691. run_id: string;
  2692. release_name?: string;
  2693. }
  2694. >(
  2695. "GET",
  2696. ({
  2697. project_id,
  2698. git_installation_id,
  2699. owner,
  2700. name,
  2701. cluster_id,
  2702. filename,
  2703. run_id,
  2704. release_name,
  2705. }) => {
  2706. const queryParams = new URLSearchParams();
  2707. if (release_name) {
  2708. queryParams.set("release_name", release_name);
  2709. }
  2710. if (filename) {
  2711. queryParams.set("filename", filename);
  2712. }
  2713. if (run_id) {
  2714. queryParams.set("run_id", run_id);
  2715. }
  2716. return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/workflow_run_id?${queryParams.toString()}`;
  2717. }
  2718. );
  2719. const triggerPreviewEnvWorkflow = baseApi<
  2720. {},
  2721. { project_id: number; cluster_id: number; deployment_id: number }
  2722. >(
  2723. "POST",
  2724. ({ project_id, cluster_id, deployment_id }) =>
  2725. `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}/trigger_workflow`
  2726. );
  2727. const getTagsByProjectId = baseApi<{}, { project_id: number }>(
  2728. "GET",
  2729. ({ project_id }) => `/api/projects/${project_id}/tags`
  2730. );
  2731. const createTag = baseApi<
  2732. { name: string; color: string },
  2733. { project_id: number }
  2734. >("POST", ({ project_id }) => `/api/projects/${project_id}/tags`);
  2735. const updateReleaseTags = baseApi<
  2736. {
  2737. tags: string[];
  2738. },
  2739. {
  2740. project_id: number;
  2741. cluster_id: number;
  2742. namespace: string;
  2743. release_name: string;
  2744. }
  2745. >(
  2746. "PATCH",
  2747. ({ project_id, cluster_id, namespace, release_name }) =>
  2748. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/update_tags`
  2749. );
  2750. const updateCanonicalName = baseApi<
  2751. {
  2752. canonical_name: string;
  2753. },
  2754. {
  2755. project_id: number;
  2756. cluster_id: number;
  2757. namespace: string;
  2758. release_name: string;
  2759. }
  2760. >(
  2761. "PATCH",
  2762. ({ project_id, cluster_id, namespace, release_name }) =>
  2763. `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/update_canonical_name`
  2764. );
  2765. const getGitProviders = baseApi<{}, { project_id: number }>(
  2766. "GET",
  2767. ({ project_id }) => `/api/projects/${project_id}/integrations/git`
  2768. );
  2769. const getGitlabRepos = baseApi<
  2770. {},
  2771. { project_id: number; integration_id: number }
  2772. >(
  2773. "GET",
  2774. ({ project_id, integration_id }) =>
  2775. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos`
  2776. );
  2777. const getGitlabBranches = baseApi<
  2778. {},
  2779. {
  2780. project_id: number;
  2781. integration_id: number;
  2782. repo_owner: string;
  2783. repo_name: string;
  2784. }
  2785. >(
  2786. "GET",
  2787. ({ project_id, integration_id, repo_owner, repo_name }) =>
  2788. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/branches`
  2789. );
  2790. const getGitlabFolderContent = baseApi<
  2791. {
  2792. dir: string;
  2793. },
  2794. {
  2795. project_id: number;
  2796. integration_id: number;
  2797. repo_owner: string;
  2798. repo_name: string;
  2799. branch: string;
  2800. }
  2801. >(
  2802. "GET",
  2803. ({ project_id, integration_id, repo_owner, repo_name, branch }) =>
  2804. `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/${branch}/contents`
  2805. );
  2806. const getLogPodValues = baseApi<
  2807. {
  2808. namespace?: string;
  2809. revision?: string;
  2810. match_prefix?: string;
  2811. start_range?: string;
  2812. end_range?: string;
  2813. },
  2814. {
  2815. project_id: number;
  2816. cluster_id: number;
  2817. }
  2818. >(
  2819. "GET",
  2820. ({ project_id, cluster_id }) =>
  2821. `/api/projects/${project_id}/clusters/${cluster_id}/logs/pod_values`
  2822. );
  2823. const getLogs = baseApi<
  2824. {
  2825. limit?: number;
  2826. start_range?: string;
  2827. end_range?: string;
  2828. revision?: string;
  2829. pod_selector: string;
  2830. namespace?: string;
  2831. search_param?: string;
  2832. direction?: string;
  2833. },
  2834. {
  2835. project_id: number;
  2836. cluster_id: number;
  2837. }
  2838. >(
  2839. "GET",
  2840. ({ project_id, cluster_id }) =>
  2841. `/api/projects/${project_id}/clusters/${cluster_id}/logs`
  2842. );
  2843. const listPorterEvents = baseApi<
  2844. {
  2845. release_name?: number;
  2846. release_namespace?: string;
  2847. type?: string;
  2848. },
  2849. {
  2850. project_id: number;
  2851. cluster_id: number;
  2852. }
  2853. >(
  2854. "GET",
  2855. ({ project_id, cluster_id }) =>
  2856. `/api/projects/${project_id}/clusters/${cluster_id}/events`
  2857. );
  2858. const listPorterJobEvents = baseApi<
  2859. {
  2860. release_name?: number;
  2861. release_namespace?: string;
  2862. type?: string;
  2863. job_name: string;
  2864. },
  2865. {
  2866. project_id: number;
  2867. cluster_id: number;
  2868. }
  2869. >(
  2870. "GET",
  2871. ({ project_id, cluster_id }) =>
  2872. `/api/projects/${project_id}/clusters/${cluster_id}/events/job`
  2873. );
  2874. const listIncidents = baseApi<
  2875. {
  2876. release_name?: number;
  2877. release_namespace?: string;
  2878. status?: string;
  2879. },
  2880. {
  2881. project_id: number;
  2882. cluster_id: number;
  2883. }
  2884. >(
  2885. "GET",
  2886. ({ project_id, cluster_id }) =>
  2887. `/api/projects/${project_id}/clusters/${cluster_id}/incidents`
  2888. );
  2889. const getIncident = baseApi<
  2890. {},
  2891. {
  2892. project_id: number;
  2893. cluster_id: number;
  2894. incident_id: string;
  2895. }
  2896. >(
  2897. "GET",
  2898. ({ project_id, cluster_id, incident_id }) =>
  2899. `/api/projects/${project_id}/clusters/${cluster_id}/incidents/${incident_id}`
  2900. );
  2901. const getIncidentEvents = baseApi<
  2902. {
  2903. incident_id?: string;
  2904. pod_prefix?: string;
  2905. },
  2906. {
  2907. project_id: number;
  2908. cluster_id: number;
  2909. }
  2910. >(
  2911. "GET",
  2912. ({ project_id, cluster_id }) =>
  2913. `/api/projects/${project_id}/clusters/${cluster_id}/incidents/events`
  2914. );
  2915. // TRACKING
  2916. const updateOnboardingStep = baseApi<
  2917. {
  2918. step: string;
  2919. provider?: string;
  2920. cloud_provider_credential_identifier?: string;
  2921. account_id?: string;
  2922. cloudformation_url?: string;
  2923. error_message?: string;
  2924. login_url?: string;
  2925. external_id?: string;
  2926. region?: string;
  2927. cluster_name?: string;
  2928. },
  2929. {
  2930. project_id: number;
  2931. }
  2932. >("POST", ({ project_id }) => {
  2933. return `/api/projects/${project_id}/onboarding_step`;
  2934. });
  2935. const updateStackStep = baseApi<
  2936. {
  2937. step: string;
  2938. stack_name?: string;
  2939. error_message?: string;
  2940. delete_workflow_file?: boolean;
  2941. error_stack_trace?: string;
  2942. },
  2943. {
  2944. project_id: number;
  2945. cluster_id: number;
  2946. }
  2947. >("POST", (pathParams) => {
  2948. const { project_id, cluster_id } = pathParams;
  2949. return `/api/projects/${project_id}/clusters/${cluster_id}/applications/analytics`;
  2950. });
  2951. // STACKS
  2952. const createStack = baseApi<
  2953. CreateStackBody,
  2954. {
  2955. project_id: number;
  2956. cluster_id: number;
  2957. namespace: string;
  2958. }
  2959. >(
  2960. "POST",
  2961. ({ project_id, cluster_id, namespace }) =>
  2962. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks`
  2963. );
  2964. const updateStack = baseApi<
  2965. {
  2966. name: string;
  2967. },
  2968. {
  2969. project_id: number;
  2970. cluster_id: number;
  2971. namespace: string;
  2972. stack_id: string;
  2973. }
  2974. >(
  2975. "PATCH",
  2976. ({ project_id, cluster_id, namespace, stack_id }) =>
  2977. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  2978. );
  2979. const listStacks = baseApi<
  2980. {},
  2981. { project_id: number; cluster_id: number; namespace: string }
  2982. >(
  2983. "GET",
  2984. ({ project_id, cluster_id, namespace }) =>
  2985. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks`
  2986. );
  2987. const getStack = baseApi<
  2988. {},
  2989. {
  2990. project_id: number;
  2991. cluster_id: number;
  2992. namespace: string;
  2993. stack_id: string;
  2994. }
  2995. >(
  2996. "GET",
  2997. ({ project_id, cluster_id, namespace, stack_id }) =>
  2998. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  2999. );
  3000. const getStackRevision = baseApi<
  3001. {},
  3002. {
  3003. project_id: number;
  3004. cluster_id: number;
  3005. namespace: string;
  3006. stack_id: string;
  3007. revision_id: number;
  3008. }
  3009. >(
  3010. "GET",
  3011. ({ project_id, cluster_id, namespace, stack_id, revision_id }) =>
  3012. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/${revision_id}`
  3013. );
  3014. const rollbackStack = baseApi<
  3015. {
  3016. target_revision: number;
  3017. },
  3018. {
  3019. project_id: number;
  3020. cluster_id: number;
  3021. namespace: string;
  3022. stack_id: string;
  3023. }
  3024. >(
  3025. "POST",
  3026. ({ project_id, cluster_id, namespace, stack_id }) =>
  3027. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/rollback`
  3028. );
  3029. const deleteStack = baseApi<
  3030. {},
  3031. {
  3032. project_id: number;
  3033. cluster_id: number;
  3034. namespace: string;
  3035. stack_id: string;
  3036. }
  3037. >(
  3038. "DELETE",
  3039. ({ project_id, cluster_id, namespace, stack_id }) =>
  3040. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}`
  3041. );
  3042. const updateStackSourceConfig = baseApi<
  3043. {
  3044. source_configs: SourceConfig[];
  3045. },
  3046. {
  3047. project_id: number;
  3048. cluster_id: number;
  3049. namespace: string;
  3050. stack_id: string;
  3051. }
  3052. >(
  3053. "PUT",
  3054. ({ project_id, cluster_id, namespace, stack_id }) =>
  3055. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/source`
  3056. );
  3057. const addStackAppResource = baseApi<
  3058. CreateStackBody["app_resources"][0],
  3059. {
  3060. project_id: number;
  3061. cluster_id: number;
  3062. namespace: string;
  3063. stack_id: string;
  3064. }
  3065. >(
  3066. "PATCH",
  3067. ({ project_id, cluster_id, namespace, stack_id }) =>
  3068. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/add_application`
  3069. );
  3070. const removeStackAppResource = baseApi<
  3071. {},
  3072. {
  3073. project_id: number;
  3074. cluster_id: number;
  3075. namespace: string;
  3076. stack_id: string;
  3077. app_resource_name: string;
  3078. }
  3079. >(
  3080. "DELETE",
  3081. ({ project_id, cluster_id, namespace, stack_id, app_resource_name }) =>
  3082. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/remove_application/${app_resource_name}`
  3083. );
  3084. const addStackEnvGroup = baseApi<
  3085. CreateStackBody["env_groups"][0],
  3086. {
  3087. project_id: number;
  3088. cluster_id: number;
  3089. namespace: string;
  3090. stack_id: string;
  3091. }
  3092. >(
  3093. "PATCH",
  3094. ({ project_id, cluster_id, namespace, stack_id }) =>
  3095. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/add_env_group`
  3096. );
  3097. const removeStackEnvGroup = baseApi<
  3098. {},
  3099. {
  3100. project_id: number;
  3101. cluster_id: number;
  3102. namespace: string;
  3103. stack_id: string;
  3104. env_group_name: string;
  3105. }
  3106. >(
  3107. "DELETE",
  3108. ({ project_id, cluster_id, namespace, stack_id, env_group_name }) =>
  3109. `/api/v1/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/stacks/${stack_id}/remove_env_group/${env_group_name}`
  3110. );
  3111. const getGithubStatus = baseApi<{}, {}>("GET", ({}) => `/api/status/github`);
  3112. const createSecretAndOpenGitHubPullRequest = baseApi<
  3113. {
  3114. github_app_installation_id: number;
  3115. github_repo_owner: string;
  3116. github_repo_name: string;
  3117. branch: string;
  3118. open_pr?: boolean;
  3119. porter_yaml_path?: string;
  3120. delete_workflow_filename?: string;
  3121. previews_workflow_filename?: string;
  3122. },
  3123. {
  3124. project_id: number;
  3125. cluster_id: number;
  3126. stack_name: string;
  3127. }
  3128. >(
  3129. "POST",
  3130. ({ project_id, cluster_id, stack_name }) =>
  3131. `/api/projects/${project_id}/clusters/${cluster_id}/applications/${stack_name}/pr`
  3132. );
  3133. const getCloudProviderPermissionsStatus = baseApi<
  3134. {
  3135. cloud_provider: string;
  3136. cloud_provider_credential_identifier: string;
  3137. },
  3138. { project_id: number }
  3139. >(
  3140. "GET",
  3141. ({ project_id }) =>
  3142. `/api/projects/${project_id}/integrations/cloud-permissions`
  3143. );
  3144. const getCloudSqlSecret = baseApi<
  3145. {},
  3146. { project_id: number; deployment_target_id: string; app_name: string }
  3147. >(
  3148. "GET",
  3149. ({ project_id, deployment_target_id, app_name }) =>
  3150. `/api/projects/${project_id}/targets/${deployment_target_id}/apps/${app_name}/cloudsql`
  3151. );
  3152. const createCloudSqlSecret = baseApi<
  3153. {
  3154. b64_service_account_json: string;
  3155. },
  3156. { project_id: number; deployment_target_id: string; app_name: string }
  3157. >(
  3158. "POST",
  3159. ({ project_id, deployment_target_id, app_name }) =>
  3160. `/api/projects/${project_id}/targets/${deployment_target_id}/apps/${app_name}/cloudsql`
  3161. );
  3162. // Bundle export to allow default api import (api.<method> is more readable)
  3163. export default {
  3164. checkAuth,
  3165. connectECRRegistry,
  3166. connectGCRRegistry,
  3167. connectDORegistry,
  3168. getAWSIntegration,
  3169. getGCPIntegration,
  3170. getAzureIntegration,
  3171. getGitlabIntegration,
  3172. createAWSIntegration,
  3173. overwriteAWSIntegration,
  3174. updateCluster,
  3175. renameCluster,
  3176. renameProject,
  3177. createAzureIntegration,
  3178. createGitlabIntegration,
  3179. createEmailVerification,
  3180. createEnvironment,
  3181. createEnvironmentGroups,
  3182. enableExternalEnvGroupProviders,
  3183. areExternalEnvGroupProvidersEnabled,
  3184. updateEnvironment,
  3185. deleteEnvironment,
  3186. createPreviewEnvironmentDeployment,
  3187. reenablePreviewEnvironmentDeployment,
  3188. listEnvironments,
  3189. getEnvironment,
  3190. toggleNewCommentForEnvironment,
  3191. validatePorterYAML,
  3192. createGCPIntegration,
  3193. createInvite,
  3194. createNamespace,
  3195. createPasswordReset,
  3196. createPasswordResetVerify,
  3197. createPasswordResetFinalize,
  3198. createProject,
  3199. connectProjectToCluster,
  3200. // ------------ PORTER APP -----------
  3201. getPorterApps,
  3202. getPorterApp,
  3203. getPorterAppEvent,
  3204. createPorterApp,
  3205. deletePorterApp,
  3206. rollbackPorterApp,
  3207. createSecretAndOpenGitHubPullRequest,
  3208. getLogsWithinTimeRange,
  3209. appLogs,
  3210. appJobs,
  3211. appEvents,
  3212. appServiceStatus,
  3213. getFeedEvents,
  3214. updateStackStep,
  3215. porterYamlFromRevision,
  3216. // -----------------------------------
  3217. createConfigMap,
  3218. deleteCluster,
  3219. deleteConfigMap,
  3220. deleteInvite,
  3221. deleteNamespace,
  3222. deletePod,
  3223. deleteProject,
  3224. deleteRegistryIntegration,
  3225. deleteSlackIntegration,
  3226. legacyUpdateNotificationConfig,
  3227. updateNotificationConfig,
  3228. legacyGetNotificationConfig,
  3229. getNotificationConfig,
  3230. getNotification,
  3231. createSubdomain,
  3232. deployTemplate,
  3233. deployAddon,
  3234. destroyInfra,
  3235. updateDatabaseStatus,
  3236. detectBuildpack,
  3237. detectGitlabBuildpack,
  3238. getBranchContents,
  3239. getBranches,
  3240. getMetadata,
  3241. postWelcome,
  3242. getChart,
  3243. getCharts,
  3244. getChartComponents,
  3245. getChartControllers,
  3246. getClusterIntegrations,
  3247. getClusters,
  3248. getCluster,
  3249. getClusterNodes,
  3250. getClusterNode,
  3251. getClusterStatus,
  3252. getConfigMap,
  3253. getPRDeploymentList,
  3254. getPRDeploymentByID,
  3255. getGHAWorkflowTemplate,
  3256. getGitRepoList,
  3257. getGitRepoPermission,
  3258. getGitRepos,
  3259. getImageRepos,
  3260. getImageTags,
  3261. images,
  3262. listInfraTemplates,
  3263. getInfraTemplate,
  3264. getInfra,
  3265. provisionCluster,
  3266. provisionInfra,
  3267. deleteInfra,
  3268. updateInfra,
  3269. listOperations,
  3270. getOperation,
  3271. getOperationLogs,
  3272. retryCreateInfra,
  3273. retryDeleteInfra,
  3274. getInfraState,
  3275. getInfraRawState,
  3276. getInfraByID,
  3277. getInfraDesired,
  3278. getInfraCurrent,
  3279. getIngress,
  3280. getInvites,
  3281. getJobs,
  3282. getJobStatus,
  3283. getJobPods,
  3284. getPodByName,
  3285. getMatchingPods,
  3286. getAllReleasePods,
  3287. getClusterState,
  3288. getComplianceChecks,
  3289. getMetrics,
  3290. appMetrics,
  3291. appHelmValues,
  3292. getNamespaces,
  3293. getNGINXIngresses,
  3294. getOAuthIds,
  3295. getPodEvents,
  3296. getProcfileContents,
  3297. getPorterYamlContents,
  3298. parsePorterYaml,
  3299. attachEnvGroup,
  3300. getDefaultDeploymentTarget,
  3301. deleteDeploymentTarget,
  3302. getBranchHead,
  3303. createApp,
  3304. createAppTemplate,
  3305. updateApp,
  3306. appRun,
  3307. updateBuildSettings,
  3308. revertApp,
  3309. getAttachedEnvGroups,
  3310. getLatestRevision,
  3311. appNotifications,
  3312. getRevision,
  3313. listAppRevisions,
  3314. getLatestAppRevisions,
  3315. getAppInstances,
  3316. listDeploymentTargets,
  3317. createDeploymentTarget,
  3318. getDeploymentTarget,
  3319. getAppTemplate,
  3320. listLatestAddons,
  3321. getGitlabProcfileContents,
  3322. getProjectClusters,
  3323. getProjectRegistries,
  3324. getProjectRepos,
  3325. getProjects,
  3326. getProject,
  3327. getPrometheusIsInstalled,
  3328. getRegistryIntegrations,
  3329. getReleaseToken,
  3330. getReleaseSteps,
  3331. getRepoIntegrations,
  3332. getSlackIntegrations,
  3333. getRepos,
  3334. getRevisions,
  3335. getTemplateInfo,
  3336. getTemplateUpgradeNotes,
  3337. getTemplates,
  3338. getHelmRepos,
  3339. getChartsFromHelmRepo,
  3340. getChartInfoFromHelmRepo,
  3341. linkGithubProject,
  3342. inviteAdmin,
  3343. getGithubAccounts,
  3344. listConfigMaps,
  3345. logInUser,
  3346. logOutUser,
  3347. registerUser,
  3348. rollbackChart,
  3349. uninstallTemplate,
  3350. updateUserInfo,
  3351. updateUser,
  3352. renameConfigMap,
  3353. updateConfigMap,
  3354. upgradeChartValues,
  3355. deleteJob,
  3356. stopJob,
  3357. updateInvite,
  3358. listAPITokens,
  3359. getAPIToken,
  3360. revokeAPIToken,
  3361. createAPIToken,
  3362. createPolicy,
  3363. getAvailableRoles,
  3364. getCollaborators,
  3365. updateCollaborator,
  3366. removeCollaborator,
  3367. getPolicyDocument,
  3368. createWebhookToken,
  3369. getUsage,
  3370. getCustomerToken,
  3371. getHasBilling,
  3372. getOnboardingState,
  3373. saveOnboardingState,
  3374. getOnboardingInfra,
  3375. getOnboardingRegistry,
  3376. detectPorterAgent,
  3377. installPorterAgent,
  3378. getKubeEvents,
  3379. getKubeEvent,
  3380. getLogBuckets,
  3381. getLogBucketLogs,
  3382. getCanCreateProject,
  3383. createEnvGroup,
  3384. cloneEnvGroup,
  3385. updateEnvGroup,
  3386. updateStacksEnvGroup,
  3387. listEnvGroups,
  3388. getAllEnvGroups,
  3389. updateEnvironmentGroupV2,
  3390. updateAppsLinkedToEnvironmentGroup,
  3391. getEnvGroup,
  3392. deleteEnvGroup,
  3393. deleteNewEnvGroup,
  3394. addApplicationToEnvGroup,
  3395. removeApplicationFromEnvGroup,
  3396. provisionDatabase,
  3397. legacyPreflightCheck,
  3398. requestQuotaIncrease,
  3399. getAwsCloudProviders,
  3400. getDatabases,
  3401. getDatastores,
  3402. listDatastores,
  3403. getDatastore,
  3404. updateDatastore,
  3405. deleteDatastore,
  3406. getPreviousLogsForContainer,
  3407. upgradePorterAgent,
  3408. deletePRDeployment,
  3409. updateBuildConfig,
  3410. updateGitActionConfig,
  3411. reRunGHWorkflow,
  3412. getGHWorkflowLogs,
  3413. getGHWorkflowLogById,
  3414. triggerPreviewEnvWorkflow,
  3415. getTagsByProjectId,
  3416. createTag,
  3417. updateReleaseTags,
  3418. updateCanonicalName,
  3419. getGitProviders,
  3420. getGitlabRepos,
  3421. getGitlabBranches,
  3422. getGitlabFolderContent,
  3423. getLogPodValues,
  3424. getLogs,
  3425. listPorterEvents,
  3426. listPorterJobEvents,
  3427. listIncidents,
  3428. getIncident,
  3429. getIncidentEvents,
  3430. createContract,
  3431. getContracts,
  3432. cloudContractPreflightCheck,
  3433. deleteContract,
  3434. // TRACKING
  3435. updateOnboardingStep,
  3436. // STACKS
  3437. listStacks,
  3438. getStack,
  3439. getStackRevision,
  3440. createStack,
  3441. updateStack,
  3442. rollbackStack,
  3443. deleteStack,
  3444. updateStackSourceConfig,
  3445. addStackAppResource,
  3446. removeStackAppResource,
  3447. addStackEnvGroup,
  3448. removeStackEnvGroup,
  3449. // STATUS
  3450. getGithubStatus,
  3451. getCloudProviderPermissionsStatus,
  3452. getCloudSqlSecret,
  3453. createCloudSqlSecret,
  3454. };