From 48674c83344cb4e339a4fb72a93fe029e13c4996 Mon Sep 17 00:00:00 2001 From: dfulgham Date: Mon, 8 Jul 2024 05:33:36 -0700 Subject: [PATCH 1/2] fix(admin): fix members endpoint - fixes #207 removed 'clusters' from prefixUrl and updated clusters endpoint urls to include 'clusters/...' --- src/admin/lib/AdminApiClient.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/admin/lib/AdminApiClient.ts b/src/admin/lib/AdminApiClient.ts index b262c105..f3304eee 100644 --- a/src/admin/lib/AdminApiClient.ts +++ b/src/admin/lib/AdminApiClient.ts @@ -36,7 +36,7 @@ export class AdminApiClient { const config = CamundaEnvironmentConfigurator.mergeConfigWithEnvironment( options?.config ?? {} ) - const baseUrl = RequireConfiguration( + const prefixUrl = RequireConfiguration( config.CAMUNDA_CONSOLE_BASE_URL, 'CAMUNDA_CONSOLE_BASE_URL' ) @@ -45,7 +45,6 @@ export class AdminApiClient { options?.oAuthProvider ?? constructOAuthProvider(config) this.userAgentString = createUserAgentString(config) - const prefixUrl = `${baseUrl}/clusters` this.rest = GetCustomCertificateBuffer(config).then( (certificateAuthority) => got.extend({ @@ -65,7 +64,7 @@ export class AdminApiClient { }, }) ) - debug('prefixUrl', `${baseUrl}/clusters`) + debug('prefixUrl', `${baseUrl}`) } private async getHeaders() { @@ -89,7 +88,7 @@ export class AdminApiClient { async getClients(clusterUuid: string): Promise { const headers = await this.getHeaders() const rest = await this.rest - return rest(`${clusterUuid}/clients`, { + return rest(`clusters/${clusterUuid}/clients`, { headers, }).json() } @@ -106,7 +105,7 @@ export class AdminApiClient { const headers = await this.getHeaders() const rest = await this.rest return rest - .post(`${req.clusterUuid}/clients`, { + .post(`clusters/${req.clusterUuid}/clients`, { body: JSON.stringify({ clientName: req.clientName, permissions: req.permissions, @@ -129,7 +128,7 @@ export class AdminApiClient { ): Promise { const headers = await this.getHeaders() const rest = await this.rest - return rest(`${clusterUuid}/clients/${clientId}`, { + return rest(`clusters/${clusterUuid}/clients/${clientId}`, { headers, }).json() } @@ -144,7 +143,7 @@ export class AdminApiClient { const headers = await this.getHeaders() const rest = await this.rest return rest - .delete(`${clusterUuid}/clients/${clientId}`, { + .delete(`clusters/${clusterUuid}/clients/${clientId}`, { headers, }) .json() @@ -158,7 +157,7 @@ export class AdminApiClient { async getClusters(): Promise { const headers = await this.getHeaders() const rest = await this.rest - return rest('', { + return rest('clusters', { headers, }).json() } @@ -177,7 +176,7 @@ export class AdminApiClient { headers, } const rest = await this.rest - return rest.post('', req).json() + return rest.post('clusters', req).json() } /** @@ -189,7 +188,7 @@ export class AdminApiClient { async getCluster(clusterUuid: string): Promise { const headers = await this.getHeaders() const rest = await this.rest - return rest(`${clusterUuid}`, { + return rest(`clusters/${clusterUuid}`, { headers, }).json() } @@ -204,7 +203,7 @@ export class AdminApiClient { const headers = await this.getHeaders() const rest = await this.rest return rest - .delete(`${clusterUuid}`, { + .delete(`clusters/${clusterUuid}`, { headers, }) .json() @@ -218,7 +217,7 @@ export class AdminApiClient { async getParameters(): Promise { const headers = await this.getHeaders() const rest = await this.rest - return rest('parameters', { + return rest('clusters/parameters', { headers, }).json() } @@ -231,7 +230,7 @@ export class AdminApiClient { async getSecrets(clusterUuid: string): Promise<{ [key: string]: string }> { const headers = await this.getHeaders() const rest = await this.rest - return rest(`${clusterUuid}/secrets`, { + return rest(`clusters/${clusterUuid}/secrets`, { headers, }).json() } @@ -256,7 +255,7 @@ export class AdminApiClient { headers, } const rest = await this.rest - return rest.post(`${clusterUuid}/secrets`, req).json() + return rest.post(`clusters/${clusterUuid}/secrets`, req).json() } /** @@ -268,7 +267,7 @@ export class AdminApiClient { const headers = await this.getHeaders() const rest = await this.rest return rest - .delete(`${clusterUuid}/secrets/${secretName}`, { + .delete(`clusters/${clusterUuid}/secrets/${secretName}`, { headers, }) .json() @@ -293,7 +292,7 @@ export class AdminApiClient { const headers = await this.getHeaders() const rest = await this.rest return rest - .put(`${clusterUuid}/ipwhitelist`, { + .put(`clusters/${clusterUuid}/ipwhitelist`, { body: JSON.stringify({ ipwhitelist, }), From 0f71f05e1f147af58f32298b81988bd9dbb23b88 Mon Sep 17 00:00:00 2001 From: dfulgham Date: Mon, 8 Jul 2024 05:45:43 -0700 Subject: [PATCH 2/2] fix(admin): fix members endpoint - fixes #207 fixed debug output for prefixUrl --- src/admin/lib/AdminApiClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/admin/lib/AdminApiClient.ts b/src/admin/lib/AdminApiClient.ts index f3304eee..0dd70fba 100644 --- a/src/admin/lib/AdminApiClient.ts +++ b/src/admin/lib/AdminApiClient.ts @@ -64,7 +64,7 @@ export class AdminApiClient { }, }) ) - debug('prefixUrl', `${baseUrl}`) + debug('prefixUrl', `${prefixUrl}`) } private async getHeaders() {