| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112 |
- import { PolicyDocType } from "./auth/types";
- import { PullRequest } from "main/home/cluster-dashboard/preview-environments/types";
- import { release } from "process";
- import { baseApi } from "./baseApi";
- import { BuildConfig, FullActionConfigType, StorageType } from "./types";
- /**
- * Generic api call format
- * @param {string} token - Bearer token.
- * @param {Object} params - Body params.
- * @param {Object} pathParams - Path params.
- * @param {(err: Object, res: Object) => void} callback - Callback function.
- */
- const checkAuth = baseApi("GET", "/api/users/current");
- const connectECRRegistry = baseApi<
- {
- name: string;
- aws_integration_id: string;
- },
- { id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/registries`;
- });
- const connectGCRRegistry = baseApi<
- {
- name: string;
- gcp_integration_id: string;
- url: string;
- },
- { id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/registries`;
- });
- const connectDORegistry = baseApi<
- {
- name: string;
- do_integration_id: string;
- url: string;
- },
- { project_id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/registries`;
- });
- const getAWSIntegration = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/integrations/aws`
- );
- const getGCPIntegration = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/integrations/gcp`
- );
- const getAzureIntegration = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/integrations/azure`
- );
- const getGitlabIntegration = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/integrations/gitlab`
- );
- const createAWSIntegration = baseApi<
- {
- aws_region: string;
- aws_cluster_id?: string;
- aws_access_key_id: string;
- aws_secret_access_key: string;
- },
- { id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/integrations/aws`;
- });
- const overwriteAWSIntegration = baseApi<
- {
- aws_integration_id: number;
- aws_access_key_id: string;
- aws_secret_access_key: string;
- cluster_id: number;
- },
- {
- project_id: number;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/integrations/aws/overwrite`;
- });
- const createAzureIntegration = baseApi<
- {
- azure_client_id: string;
- azure_subscription_id: string;
- azure_tenant_id: string;
- service_principal_key: string;
- },
- { id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/integrations/azure`;
- });
- const createGitlabIntegration = baseApi<
- {
- instance_url: string;
- client_id: string;
- client_secret: string;
- },
- { id: number }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/integrations/gitlab`;
- });
- const createEmailVerification = baseApi<{}, {}>("POST", (pathParams) => {
- return `/api/email/verify/initiate`;
- });
- const createEnvironment = baseApi<
- {
- name: string;
- mode: "auto" | "manual";
- },
- {
- project_id: number;
- cluster_id: number;
- git_installation_id: number;
- git_repo_owner: string;
- git_repo_name: string;
- }
- >("POST", (pathParams) => {
- let {
- project_id,
- cluster_id,
- git_installation_id,
- git_repo_owner,
- git_repo_name,
- } = pathParams;
- return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${git_repo_owner}/${git_repo_name}/clusters/${cluster_id}/environment`;
- });
- const deleteEnvironment = baseApi<
- {
- name: string;
- },
- {
- project_id: number;
- cluster_id: number;
- git_installation_id: number;
- git_repo_owner: string;
- git_repo_name: string;
- }
- >("DELETE", (pathParams) => {
- let {
- project_id,
- cluster_id,
- git_installation_id,
- git_repo_owner,
- git_repo_name,
- } = pathParams;
- return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${git_repo_owner}/${git_repo_name}/clusters/${cluster_id}/environment`;
- });
- const createPreviewEnvironmentDeployment = baseApi<
- PullRequest,
- { project_id: number; cluster_id: number }
- >(
- "POST",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/deployments/pull_request`
- );
- const reenablePreviewEnvironmentDeployment = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- deployment_id: number;
- }
- >(
- "PATCH",
- ({ project_id, cluster_id, deployment_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}/reenable`
- );
- const listEnvironments = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- let { project_id, cluster_id } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/environments`;
- });
- const createGCPIntegration = baseApi<
- {
- gcp_key_data: string;
- gcp_project_id: string;
- },
- {
- project_id: number;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/integrations/gcp`;
- });
- const createInvite = baseApi<
- {
- email: string;
- kind: string;
- },
- {
- id: number;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/invites`;
- });
- const createPasswordReset = baseApi<
- {
- email: string;
- },
- {}
- >("POST", (pathParams) => {
- return `/api/password/reset/initiate`;
- });
- const createPasswordResetVerify = baseApi<
- {
- email: string;
- token: string;
- token_id: number;
- },
- {}
- >("POST", (pathParams) => {
- return `/api/password/reset/verify`;
- });
- const createPasswordResetFinalize = baseApi<
- {
- email: string;
- token: string;
- token_id: number;
- new_password: string;
- },
- {}
- >("POST", (pathParams) => {
- return `/api/password/reset/finalize`;
- });
- const createProject = baseApi<{ name: string }, {}>("POST", (pathParams) => {
- return `/api/projects`;
- });
- const createSubdomain = baseApi<
- {},
- {
- id: number;
- release_name: string;
- namespace: string;
- cluster_id: number;
- }
- >("POST", (pathParams) => {
- let { cluster_id, id, namespace, release_name } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/subdomain`;
- });
- const deleteCluster = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}`;
- });
- const deleteInvite = baseApi<{}, { id: number; invId: number }>(
- "DELETE",
- (pathParams) => {
- return `/api/projects/${pathParams.id}/invites/${pathParams.invId}`;
- }
- );
- const deletePod = baseApi<
- {},
- { name: string; namespace: string; id: number; cluster_id: number }
- >("DELETE", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}`;
- });
- const getPodEvents = baseApi<
- {},
- { name: string; namespace: string; id: number; cluster_id: number }
- >("GET", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}/events`;
- });
- const deleteProject = baseApi<{}, { id: number }>("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.id}`;
- });
- const deleteRegistryIntegration = baseApi<
- {},
- {
- project_id: number;
- registry_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}`;
- });
- const deleteSlackIntegration = baseApi<
- {},
- {
- project_id: number;
- slack_integration_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/slack_integrations/${pathParams.slack_integration_id}`;
- });
- const updateNotificationConfig = baseApi<
- {
- payload: any;
- },
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- }
- >("POST", (pathParams) => {
- let { project_id, cluster_id, namespace, name } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/notifications`;
- });
- const getPRDeploymentList = baseApi<
- {
- environment_id?: number;
- },
- {
- cluster_id: number;
- project_id: number;
- }
- >("GET", (pathParams) => {
- const { cluster_id, project_id } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/deployments`;
- });
- const getPRDeploymentByCluster = baseApi<
- {
- namespace: string;
- },
- {
- cluster_id: number;
- project_id: number;
- environment_id: number;
- }
- >("GET", (pathParams) => {
- const { cluster_id, project_id, environment_id } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/${environment_id}/deployment`;
- });
- const getPRDeployment = baseApi<
- {
- namespace: string;
- },
- {
- cluster_id: number;
- project_id: number;
- git_installation_id: number;
- git_repo_owner: string;
- git_repo_name: string;
- }
- >("GET", (pathParams) => {
- const {
- cluster_id,
- project_id,
- git_installation_id,
- git_repo_owner,
- git_repo_name,
- } = pathParams;
- return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${git_repo_owner}/${git_repo_name}/clusters/${cluster_id}/deployment`;
- });
- const deletePRDeployment = baseApi<
- {},
- {
- cluster_id: number;
- project_id: number;
- deployment_id: number;
- }
- >("DELETE", (pathParams) => {
- const { cluster_id, project_id, deployment_id } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}`;
- });
- const getNotificationConfig = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- }
- >("GET", (pathParams) => {
- let { project_id, cluster_id, namespace, name } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/notifications`;
- });
- const getGHAWorkflowTemplate = baseApi<
- {
- release_name: string;
- github_action_config: FullActionConfigType;
- },
- {
- cluster_id: number;
- project_id: number;
- namespace: string;
- }
- >("POST", (pathParams) => {
- const { cluster_id, project_id, namespace } = pathParams;
- return `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/gha_template`;
- });
- const deployTemplate = baseApi<
- {
- template_name: string;
- template_version: string;
- image_url?: string;
- values?: any;
- name: string;
- git_action_config?: FullActionConfigType;
- build_config?: any;
- synced_env_groups?: string[];
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- repo_url?: string;
- }
- >("POST", (pathParams) => {
- let { cluster_id, id, namespace, repo_url } = pathParams;
- if (repo_url) {
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases?repo_url=${repo_url}`;
- }
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases`;
- });
- const deployAddon = baseApi<
- {
- template_name: string;
- template_version: string;
- values?: any;
- name: string;
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- repo_url?: string;
- }
- >("POST", (pathParams) => {
- let { cluster_id, id, namespace, repo_url } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/addons?repo_url=${repo_url}`;
- });
- const detectBuildpack = baseApi<
- {},
- {
- project_id: number;
- git_repo_id: number;
- kind: string;
- owner: string;
- name: string;
- branch: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${
- pathParams.git_repo_id
- }/repos/${pathParams.kind}/${pathParams.owner}/${
- pathParams.name
- }/${encodeURIComponent(pathParams.branch)}/buildpack/detect`;
- });
- const detectGitlabBuildpack = baseApi<
- { dir: string },
- {
- project_id: number;
- integration_id: number;
- repo_owner: string;
- repo_name: string;
- branch: string;
- }
- >(
- "GET",
- ({ project_id, integration_id, repo_name, repo_owner, branch }) =>
- `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/${branch}/buildpack/detect`
- );
- const getBranchContents = baseApi<
- {
- dir: string;
- },
- {
- project_id: number;
- git_repo_id: number;
- kind: string;
- owner: string;
- name: string;
- branch: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${
- pathParams.git_repo_id
- }/repos/${pathParams.kind}/${pathParams.owner}/${
- pathParams.name
- }/${encodeURIComponent(pathParams.branch)}/contents`;
- });
- const getProcfileContents = baseApi<
- {
- path: string;
- },
- {
- project_id: number;
- git_repo_id: number;
- kind: string;
- owner: string;
- name: string;
- branch: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${
- pathParams.git_repo_id
- }/repos/${pathParams.kind}/${pathParams.owner}/${
- pathParams.name
- }/${encodeURIComponent(pathParams.branch)}/procfile`;
- });
- const getGitlabProcfileContents = baseApi<
- {
- path: string;
- },
- {
- project_id: number;
- integration_id: number;
- owner: string;
- name: string;
- branch: string;
- }
- >(
- "GET",
- ({ project_id, integration_id, owner, name, branch }) =>
- `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${owner}/${name}/${encodeURIComponent(
- branch
- )}/procfile`
- );
- const getBranches = baseApi<
- {},
- {
- project_id: number;
- git_repo_id: number;
- kind: string;
- owner: string;
- name: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/repos/${pathParams.kind}/${pathParams.owner}/${pathParams.name}/branches`;
- });
- const getChart = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- revision: number;
- }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name, revision } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}`;
- });
- const getCharts = baseApi<
- {
- limit: number;
- skip: number;
- byDate: boolean;
- statusFilter: string[];
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/releases`;
- });
- const getChartComponents = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- revision: number;
- }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name, revision } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}/components`;
- });
- const getChartControllers = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- revision: number;
- }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name, revision } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/${revision}/controllers`;
- });
- const getClusterIntegrations = baseApi("GET", "/api/integrations/cluster");
- const getClusters = baseApi<{}, { id: number }>("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters`;
- });
- const getCluster = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}`;
- });
- const getClusterNodes = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/nodes`;
- });
- const getClusterNode = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- nodeName: string;
- }
- >(
- "GET",
- (pathParams) =>
- `/api/projects/${pathParams.project_id}/clusters/${pathParams.cluster_id}/nodes/${pathParams.nodeName}`
- );
- const getGitRepoList = baseApi<
- {},
- {
- project_id: number;
- git_repo_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/repos`;
- });
- const getGitRepoPermission = baseApi<
- {},
- {
- project_id: number;
- git_repo_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos/${pathParams.git_repo_id}/permissions`;
- });
- const getGitRepos = baseApi<
- {},
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/gitrepos`;
- });
- const getImageRepos = baseApi<
- {},
- {
- project_id: number;
- registry_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}/repositories`;
- });
- const getImageTags = baseApi<
- {},
- {
- project_id: number;
- registry_id: number;
- repo_name: string;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/registries/${pathParams.registry_id}/repositories/${pathParams.repo_name}`;
- });
- const getInfra = baseApi<
- {
- version?: string;
- },
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infra`;
- });
- const listInfraTemplates = baseApi<
- {},
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/templates`;
- });
- const getInfraTemplate = baseApi<
- {},
- {
- project_id: number;
- name: string;
- version: string;
- }
- >("GET", (pathParams) => {
- let { project_id, name, version } = pathParams;
- return `/api/projects/${project_id}/infras/templates/${name}/${version}`;
- });
- const provisionInfra = baseApi<
- {
- kind: string;
- values: any;
- aws_integration_id?: number;
- gcp_integration_id?: number;
- do_integration_id?: number;
- azure_integration_id?: number;
- cluster_id?: number;
- },
- {
- project_id: number;
- }
- >("POST", ({ project_id }) => {
- return `/api/projects/${project_id}/infras`;
- });
- const updateInfra = baseApi<
- {
- values?: any;
- },
- {
- project_id: number;
- infra_id: number;
- }
- >("POST", (pathParams) => {
- let { project_id, infra_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}/update`;
- });
- const retryCreateInfra = baseApi<
- {
- aws_integration_id?: number;
- gcp_integration_id?: number;
- do_integration_id?: number;
- values?: any;
- },
- {
- project_id: number;
- infra_id: number;
- }
- >("POST", (pathParams) => {
- let { project_id, infra_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}/retry_create`;
- });
- const retryDeleteInfra = baseApi<
- {
- values?: any;
- },
- {
- project_id: number;
- infra_id: number;
- }
- >("POST", (pathParams) => {
- let { project_id, infra_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}/retry_delete`;
- });
- const deleteInfra = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("DELETE", (pathParams) => {
- let { project_id, infra_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}`;
- });
- const listOperations = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/operations`;
- });
- const getOperation = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- operation_id: string;
- }
- >("GET", (pathParams) => {
- let { project_id, infra_id, operation_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}/operations/${operation_id}`;
- });
- const getOperationLogs = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- operation_id: string;
- }
- >("GET", (pathParams) => {
- let { project_id, infra_id, operation_id } = pathParams;
- return `/api/projects/${project_id}/infras/${infra_id}/operations/${operation_id}/logs`;
- });
- const getInfraState = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/state`;
- });
- const getInfraRawState = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/raw_state`;
- });
- const getInfraByID = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}`;
- });
- const getInfraDesired = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/desired`;
- });
- const getInfraCurrent = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/current`;
- });
- const getIngress = baseApi<
- {},
- { namespace: string; cluster_id: number; name: string; id: number }
- >("GET", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/ingresses/${name}`;
- });
- const getInvites = baseApi<{}, { id: number }>("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/invites`;
- });
- const getJobs = baseApi<
- {},
- { namespace: string; cluster_id: number; release_name: string; id: number }
- >("GET", (pathParams) => {
- let { id, release_name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/jobs`;
- });
- const getJobStatus = baseApi<
- {},
- { namespace: string; cluster_id: number; release_name: string; id: number }
- >("GET", (pathParams) => {
- let { id, release_name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/jobs/status`;
- });
- const getJobPods = baseApi<
- {},
- { name: string; namespace: string; id: number; cluster_id: number }
- >("GET", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}/pods`;
- });
- const getPodByName = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- name: string;
- }
- >(
- "GET",
- ({ project_id, cluster_id, namespace, name }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/pods/${name}`
- );
- const getMatchingPods = baseApi<
- {
- namespace: string;
- selectors: string[];
- },
- { id: number; cluster_id: number }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/pods`;
- });
- const getMetrics = baseApi<
- {
- metric: string;
- shouldsum: boolean;
- pods?: string[];
- kind?: string; // the controller kind
- name?: string;
- percentile?: number;
- namespace: string;
- startrange: number;
- endrange: number;
- resolution: string;
- },
- {
- id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/metrics`;
- });
- const getNamespaces = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces`;
- });
- const getNGINXIngresses = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/prometheus/ingresses`;
- });
- const getOAuthIds = baseApi<
- {},
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/integrations/oauth`;
- });
- const getProjectClusters = baseApi<{}, { id: number }>("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters`;
- });
- const getProjectRegistries = baseApi<{}, { id: number }>(
- "GET",
- (pathParams) => {
- return `/api/projects/${pathParams.id}/registries`;
- }
- );
- const getProjectRepos = baseApi<{}, { id: number }>("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/repos`;
- });
- const getProjects = baseApi("GET", "/api/projects");
- const getPrometheusIsInstalled = baseApi<
- {},
- {
- id: number;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/prometheus/detect`;
- });
- const getRegistryIntegrations = baseApi("GET", "/api/integrations/registry");
- const getReleaseToken = baseApi<
- {},
- { name: string; id: number; namespace: string; cluster_id: number }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/webhook`;
- });
- const getReleaseSteps = baseApi<
- {},
- { name: string; id: number; namespace: string; cluster_id: number }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/steps`;
- });
- const destroyInfra = baseApi<
- {},
- {
- project_id: number;
- infra_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}`;
- });
- const updateDatabaseStatus = baseApi<
- {
- status: string;
- },
- {
- project_id: number;
- infra_id: number;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/infras/${pathParams.infra_id}/database`;
- });
- const getRepoIntegrations = baseApi("GET", "/api/integrations/repo");
- const getRepos = baseApi<{}, { id: number }>("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/repos`;
- });
- const getSlackIntegrations = baseApi<{}, { id: number }>(
- "GET",
- (pathParams) => {
- return `/api/projects/${pathParams.id}/slack_integrations`;
- }
- );
- const getRevisions = baseApi<
- {},
- { id: number; cluster_id: number; namespace: string; name: string }
- >("GET", (pathParams) => {
- let { id, cluster_id, namespace, name } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/history`;
- });
- const getTemplateInfo = baseApi<
- {
- repo_url?: string;
- },
- { name: string; version: string }
- >("GET", (pathParams) => {
- return `/api/templates/${pathParams.name}/${pathParams.version}`;
- });
- const getTemplateUpgradeNotes = baseApi<
- {
- repo_url?: string;
- prev_version: string;
- },
- { name: string; version: string }
- >("GET", (pathParams) => {
- return `/api/templates/${pathParams.name}/${pathParams.version}/upgrade_notes`;
- });
- const getTemplates = baseApi<
- {
- repo_url?: string;
- },
- {}
- >("GET", "/api/templates");
- const getHelmRepos = baseApi<
- {},
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/helmrepos`;
- });
- const getChartsFromHelmRepo = baseApi<
- {},
- {
- project_id: number;
- helm_repo_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts`;
- });
- const getChartInfoFromHelmRepo = baseApi<
- {},
- { project_id: number; helm_repo_id: number; name: string; version: string }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.project_id}/helmrepos/${pathParams.helm_repo_id}/charts/${pathParams.name}/${pathParams.version}`;
- });
- const getMetadata = baseApi<{}, {}>("GET", () => {
- return `/api/metadata`;
- });
- const postWelcome = baseApi<{
- email: string;
- isCompany: boolean;
- company: string;
- role: string;
- }>("POST", () => {
- return `/api/welcome`;
- });
- const linkGithubProject = baseApi<
- {},
- {
- project_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/oauth/projects/${pathParams.project_id}/github`;
- });
- const getGithubAccounts = baseApi<{}, {}>("GET", () => {
- return `/api/integrations/github-app/accounts`;
- });
- const logInUser = baseApi<{
- email: string;
- password: string;
- }>("POST", "/api/login");
- const logOutUser = baseApi("POST", "/api/logout");
- const registerUser = baseApi<{
- email: string;
- password: string;
- }>("POST", "/api/users");
- const rollbackChart = baseApi<
- {
- revision: number;
- },
- {
- id: number;
- name: string;
- namespace: string;
- cluster_id: number;
- }
- >("POST", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/rollback`;
- });
- const uninstallTemplate = baseApi<
- {},
- {
- id: number;
- name: string;
- cluster_id: number;
- namespace: string;
- }
- >("DELETE", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0`;
- });
- const updateUser = baseApi<
- {
- rawKubeConfig?: string;
- allowedContexts?: string[];
- },
- { id: number }
- >("PUT", (pathParams) => {
- return `/api/users/${pathParams.id}`;
- });
- const upgradeChartValues = baseApi<
- {
- values: string;
- version?: string;
- },
- {
- id: number;
- name: string;
- namespace: string;
- cluster_id: number;
- }
- >("POST", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${name}/0/upgrade`;
- });
- const listEnvGroups = baseApi<
- {},
- {
- id: number;
- namespace: string;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/list`;
- });
- const listConfigMaps = baseApi<
- {},
- {
- id: number;
- namespace: string;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/list`;
- });
- const getEnvGroup = baseApi<
- {},
- {
- id: number;
- namespace: string;
- cluster_id: number;
- name: string;
- version?: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${
- pathParams.cluster_id
- }/namespaces/${pathParams.namespace}/envgroup?name=${pathParams.name}${
- pathParams.version ? "&version=" + pathParams.version : ""
- }`;
- });
- const getConfigMap = baseApi<
- {
- name: string;
- },
- {
- id: number;
- namespace: string;
- cluster_id: number;
- }
- >("GET", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap`;
- });
- const createEnvGroup = baseApi<
- {
- name: string;
- variables: Record<string, string>;
- secret_variables?: Record<string, string>;
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup/create`;
- });
- const updateEnvGroup = baseApi<
- {
- name: string;
- variables: { [key: string]: string };
- secret_variables?: { [key: string]: string };
- },
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- }
- >(
- "POST",
- ({ cluster_id, project_id, namespace }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/create`
- );
- const createConfigMap = baseApi<
- {
- name: string;
- variables: Record<string, string>;
- secret_variables?: Record<string, string>;
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/create`;
- });
- const updateConfigMap = baseApi<
- {
- name: string;
- variables: Record<string, string>;
- secret_variables?: Record<string, string>;
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- }
- >("POST", (pathParams) => {
- let { id, cluster_id } = pathParams;
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/update`;
- });
- const renameConfigMap = baseApi<
- {
- name: string;
- new_name: string;
- },
- {
- id: number;
- cluster_id: number;
- namespace: string;
- }
- >("POST", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/rename`;
- });
- const deleteEnvGroup = baseApi<
- {
- name: string;
- },
- {
- id: number;
- namespace: string;
- cluster_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/envgroup`;
- });
- const deleteConfigMap = baseApi<
- {
- name: string;
- },
- {
- id: number;
- namespace: string;
- cluster_id: number;
- }
- >("DELETE", (pathParams) => {
- return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/configmap/delete`;
- });
- const createNamespace = baseApi<
- {
- name: string;
- },
- { id: number; cluster_id: number }
- >("POST", (pathParams) => {
- let { id, cluster_id } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/create`;
- });
- const deleteNamespace = baseApi<
- {
- name: string;
- },
- {
- id: number;
- cluster_id: number;
- }
- >("DELETE", (pathParams) => {
- let { id, cluster_id } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/delete`;
- });
- const deleteJob = baseApi<
- {},
- { name: string; namespace: string; id: number; cluster_id: number }
- >("DELETE", (pathParams) => {
- let { id, name, cluster_id, namespace } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}`;
- });
- const stopJob = baseApi<
- {},
- { name: string; namespace: string; id: number; cluster_id: number }
- >("POST", (pathParams) => {
- let { id, name, namespace, cluster_id } = pathParams;
- return `/api/projects/${id}/clusters/${cluster_id}/namespaces/${namespace}/jobs/${name}/stop`;
- });
- const listAPITokens = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/api_token`
- );
- const getAPIToken = baseApi<{}, { project_id: number; token: string }>(
- "GET",
- ({ project_id, token }) => `/api/projects/${project_id}/api_token/${token}`
- );
- const revokeAPIToken = baseApi<{}, { project_id: number; token: string }>(
- "POST",
- ({ project_id, token }) =>
- `/api/projects/${project_id}/api_token/${token}/revoke`
- );
- const createAPIToken = baseApi<
- {
- name: string;
- policy_uid: string;
- expires_at?: string;
- },
- { project_id: number }
- >("POST", ({ project_id }) => `/api/projects/${project_id}/api_token`);
- const createPolicy = baseApi<
- {
- name: string;
- policy: PolicyDocType[];
- },
- { project_id: number }
- >("POST", ({ project_id }) => `/api/projects/${project_id}/policy`);
- const getAvailableRoles = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/roles`
- );
- const updateInvite = baseApi<
- { kind: string },
- { project_id: number; invite_id: number }
- >(
- "POST",
- ({ project_id, invite_id }) =>
- `/api/projects/${project_id}/invites/${invite_id}`
- );
- const getCollaborators = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/collaborators`
- );
- const updateCollaborator = baseApi<
- {
- kind: string;
- user_id: number;
- },
- { project_id: number }
- >("POST", ({ project_id }) => `/api/projects/${project_id}/roles`);
- const removeCollaborator = baseApi<{ user_id: number }, { project_id: number }>(
- "DELETE",
- ({ project_id }) => `/api/projects/${project_id}/roles`
- );
- const getPolicyDocument = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/policy`
- );
- const createWebhookToken = baseApi<
- {},
- {
- project_id: number;
- chart_name: string;
- namespace: string;
- cluster_id: number;
- }
- >(
- "POST",
- ({ project_id, chart_name, namespace, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${chart_name}/0/webhook`
- );
- const getUsage = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/usage`
- );
- // Used for billing purposes
- const getCustomerToken = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/billing/token`
- );
- const getHasBilling = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/billing`
- );
- const getOnboardingState = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/onboarding`
- );
- const saveOnboardingState = baseApi<{}, { project_id: number }>(
- "POST",
- ({ project_id }) => `/api/projects/${project_id}/onboarding`
- );
- const getOnboardingInfra = baseApi<
- {},
- { project_id: number; registry_infra_id: number }
- >(
- "GET",
- ({ project_id, registry_infra_id }) =>
- `/api/projects/${project_id}/infras/${registry_infra_id}`
- );
- const getOnboardingRegistry = baseApi<
- {},
- { project_id: number; registry_connection_id: number }
- >(
- "GET",
- ({ project_id, registry_connection_id }) =>
- `/api/projects/${project_id}/registries/${registry_connection_id}`
- );
- const detectPorterAgent = baseApi<
- {},
- { project_id: number; cluster_id: number }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/agent/detect`
- );
- const installPorterAgent = baseApi<
- {},
- { project_id: number; cluster_id: number }
- >(
- "POST",
- ({ cluster_id, project_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/agent/install`
- );
- const getKubeEvents = baseApi<
- {
- skip: number;
- resource_type: string;
- owner_type?: string;
- owner_name?: string;
- namespace?: string;
- },
- { project_id: number; cluster_id: number }
- >("GET", ({ project_id, cluster_id }) => {
- return `/api/projects/${project_id}/clusters/${cluster_id}/kube_events`;
- });
- const getKubeEvent = baseApi<
- {},
- { project_id: number; cluster_id: number; kube_event_id: number }
- >(
- "GET",
- ({ project_id, cluster_id, kube_event_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}`
- );
- const getLogBuckets = baseApi<
- {},
- { project_id: number; cluster_id: number; kube_event_id: number }
- >(
- "GET",
- ({ project_id, cluster_id, kube_event_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/log_buckets`
- );
- const getLogBucketLogs = baseApi<
- { timestamp: number },
- { project_id: number; cluster_id: number; kube_event_id: number }
- >(
- "GET",
- ({ project_id, cluster_id, kube_event_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/kube_events/${kube_event_id}/logs`
- );
- const getCanCreateProject = baseApi<{}, {}>(
- "GET",
- () => "/api/can_create_project"
- );
- const addApplicationToEnvGroup = baseApi<
- {
- name: string; // Env Group name
- app_name: string;
- },
- { project_id: number; cluster_id: number; namespace: string }
- >(
- "POST",
- ({ cluster_id, namespace, project_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/add_application`
- );
- const removeApplicationFromEnvGroup = baseApi<
- {
- name: string; // Env Group name
- app_name: string;
- },
- { project_id: number; cluster_id: number; namespace: string }
- >(
- "POST",
- ({ cluster_id, namespace, project_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/envgroup/remove_application`
- );
- const provisionDatabase = baseApi<
- {
- username: string;
- password: string;
- machine_type: string;
- db_storage_encrypted: boolean;
- db_name: string;
- db_max_allocated_storage: string;
- db_family: string;
- db_engine_version: string;
- db_allocated_storage: string;
- },
- { project_id: number; cluster_id: number; namespace: string }
- >(
- "POST",
- ({ project_id, cluster_id, namespace }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/provision/rds`
- );
- const getDatabases = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/databases`
- );
- const getPreviousLogsForContainer = baseApi<
- {
- container_name: string;
- },
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- pod_name: string;
- }
- >(
- "GET",
- ({ cluster_id, namespace, pod_name: name, project_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/pod/${name}/previous_logs`
- );
- const getIncidents = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/incidents`
- );
- const getIncidentsByReleaseName = baseApi<
- {
- namespace: string;
- release_name: string;
- },
- {
- project_id: number;
- cluster_id: number;
- }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/incidents`
- );
- const getIncidentById = baseApi<
- {
- incident_id: string;
- },
- {
- project_id: number;
- cluster_id: number;
- }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/incidents`
- );
- const getIncidentLogsByLogId = baseApi<
- {
- log_id: string;
- },
- {
- project_id: number;
- cluster_id: number;
- }
- >(
- "GET",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/incidents/logs`
- );
- const upgradePorterAgent = baseApi<
- {},
- { project_id: number; cluster_id: number }
- >(
- "POST",
- ({ project_id, cluster_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/agent/upgrade`
- );
- const updateBuildConfig = baseApi<
- BuildConfig,
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- release_name: string;
- }
- >(
- "POST",
- ({ project_id, cluster_id, namespace, release_name }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/buildconfig`
- );
- const reRunGHWorkflow = baseApi<
- {},
- {
- project_id: number;
- cluster_id: number;
- git_installation_id: number;
- owner: string;
- name: string;
- branch?: string;
- filename?: string;
- release_name?: string;
- }
- >(
- "POST",
- ({
- project_id,
- git_installation_id,
- owner,
- name,
- cluster_id,
- filename,
- release_name,
- branch,
- }) => {
- const queryParams = new URLSearchParams();
- if (branch) {
- queryParams.set("branch", branch);
- }
- if (release_name) {
- queryParams.set("release_name", release_name);
- }
- if (filename) {
- queryParams.set("filename", filename);
- }
- return `/api/projects/${project_id}/gitrepos/${git_installation_id}/${owner}/${name}/clusters/${cluster_id}/rerun_workflow?${queryParams.toString()}`;
- }
- );
- const triggerPreviewEnvWorkflow = baseApi<
- {},
- { project_id: number; cluster_id: number; deployment_id: number }
- >(
- "POST",
- ({ project_id, cluster_id, deployment_id }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/deployments/${deployment_id}/trigger_workflow`
- );
- const getTagsByProjectId = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/tags`
- );
- const createTag = baseApi<
- { name: string; color: string },
- { project_id: number }
- >("POST", ({ project_id }) => `/api/projects/${project_id}/tags`);
- const updateReleaseTags = baseApi<
- {
- tags: string[];
- },
- {
- project_id: number;
- cluster_id: number;
- namespace: string;
- release_name: string;
- }
- >(
- "PATCH",
- ({ project_id, cluster_id, namespace, release_name }) =>
- `/api/projects/${project_id}/clusters/${cluster_id}/namespaces/${namespace}/releases/${release_name}/0/update_tags`
- );
- const getGitProviders = baseApi<{}, { project_id: number }>(
- "GET",
- ({ project_id }) => `/api/projects/${project_id}/integrations/git`
- );
- const getGitlabRepos = baseApi<
- {},
- { project_id: number; integration_id: number }
- >(
- "GET",
- ({ project_id, integration_id }) =>
- `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos`
- );
- const getGitlabBranches = baseApi<
- {},
- {
- project_id: number;
- integration_id: number;
- repo_owner: string;
- repo_name: string;
- }
- >(
- "GET",
- ({ project_id, integration_id, repo_owner, repo_name }) =>
- `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/branches`
- );
- const getGitlabFolderContent = baseApi<
- {
- dir: string;
- },
- {
- project_id: number;
- integration_id: number;
- repo_owner: string;
- repo_name: string;
- branch: string;
- }
- >(
- "GET",
- ({ project_id, integration_id, repo_owner, repo_name, branch }) =>
- `/api/projects/${project_id}/integrations/gitlab/${integration_id}/repos/${repo_owner}/${repo_name}/${branch}/contents`
- );
- // Bundle export to allow default api import (api.<method> is more readable)
- export default {
- checkAuth,
- connectECRRegistry,
- connectGCRRegistry,
- connectDORegistry,
- getAWSIntegration,
- getGCPIntegration,
- getAzureIntegration,
- getGitlabIntegration,
- createAWSIntegration,
- overwriteAWSIntegration,
- createAzureIntegration,
- createGitlabIntegration,
- createEmailVerification,
- createEnvironment,
- deleteEnvironment,
- createPreviewEnvironmentDeployment,
- reenablePreviewEnvironmentDeployment,
- listEnvironments,
- createGCPIntegration,
- createInvite,
- createNamespace,
- createPasswordReset,
- createPasswordResetVerify,
- createPasswordResetFinalize,
- createProject,
- createConfigMap,
- deleteCluster,
- deleteConfigMap,
- deleteInvite,
- deleteNamespace,
- deletePod,
- deleteProject,
- deleteRegistryIntegration,
- deleteSlackIntegration,
- updateNotificationConfig,
- getNotificationConfig,
- createSubdomain,
- deployTemplate,
- deployAddon,
- destroyInfra,
- updateDatabaseStatus,
- detectBuildpack,
- detectGitlabBuildpack,
- getBranchContents,
- getBranches,
- getMetadata,
- postWelcome,
- getChart,
- getCharts,
- getChartComponents,
- getChartControllers,
- getClusterIntegrations,
- getClusters,
- getCluster,
- getClusterNodes,
- getClusterNode,
- getConfigMap,
- getPRDeploymentList,
- getPRDeploymentByCluster,
- getPRDeployment,
- getGHAWorkflowTemplate,
- getGitRepoList,
- getGitRepoPermission,
- getGitRepos,
- getImageRepos,
- getImageTags,
- listInfraTemplates,
- getInfraTemplate,
- getInfra,
- provisionInfra,
- deleteInfra,
- updateInfra,
- listOperations,
- getOperation,
- getOperationLogs,
- retryCreateInfra,
- retryDeleteInfra,
- getInfraState,
- getInfraRawState,
- getInfraByID,
- getInfraDesired,
- getInfraCurrent,
- getIngress,
- getInvites,
- getJobs,
- getJobStatus,
- getJobPods,
- getPodByName,
- getMatchingPods,
- getMetrics,
- getNamespaces,
- getNGINXIngresses,
- getOAuthIds,
- getPodEvents,
- getProcfileContents,
- getGitlabProcfileContents,
- getProjectClusters,
- getProjectRegistries,
- getProjectRepos,
- getProjects,
- getPrometheusIsInstalled,
- getRegistryIntegrations,
- getReleaseToken,
- getReleaseSteps,
- getRepoIntegrations,
- getSlackIntegrations,
- getRepos,
- getRevisions,
- getTemplateInfo,
- getTemplateUpgradeNotes,
- getTemplates,
- getHelmRepos,
- getChartsFromHelmRepo,
- getChartInfoFromHelmRepo,
- linkGithubProject,
- getGithubAccounts,
- listConfigMaps,
- logInUser,
- logOutUser,
- registerUser,
- rollbackChart,
- uninstallTemplate,
- updateUser,
- renameConfigMap,
- updateConfigMap,
- upgradeChartValues,
- deleteJob,
- stopJob,
- updateInvite,
- listAPITokens,
- getAPIToken,
- revokeAPIToken,
- createAPIToken,
- createPolicy,
- getAvailableRoles,
- getCollaborators,
- updateCollaborator,
- removeCollaborator,
- getPolicyDocument,
- createWebhookToken,
- getUsage,
- getCustomerToken,
- getHasBilling,
- getOnboardingState,
- saveOnboardingState,
- getOnboardingInfra,
- getOnboardingRegistry,
- detectPorterAgent,
- installPorterAgent,
- getKubeEvents,
- getKubeEvent,
- getLogBuckets,
- getLogBucketLogs,
- getCanCreateProject,
- createEnvGroup,
- updateEnvGroup,
- listEnvGroups,
- getEnvGroup,
- deleteEnvGroup,
- addApplicationToEnvGroup,
- removeApplicationFromEnvGroup,
- provisionDatabase,
- getDatabases,
- getPreviousLogsForContainer,
- getIncidents,
- getIncidentsByReleaseName,
- getIncidentById,
- getIncidentLogsByLogId,
- upgradePorterAgent,
- deletePRDeployment,
- updateBuildConfig,
- reRunGHWorkflow,
- triggerPreviewEnvWorkflow,
- getTagsByProjectId,
- createTag,
- updateReleaseTags,
- getGitProviders,
- getGitlabRepos,
- getGitlabBranches,
- getGitlabFolderContent,
- };
|