Skip to content

Commit

Permalink
fix(admin): fix members endpoint - fixes #206 (#208)
Browse files Browse the repository at this point in the history
* fix(admin): fix members endpoint - fixes #207

removed 'clusters' from prefixUrl and updated clusters endpoint urls to include 'clusters/...'
fixed debug output for prefixUrl
  • Loading branch information
dfulgham authored Jul 9, 2024
1 parent 5c72d0d commit 19c4c5c
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/admin/lib/AdminApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand All @@ -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({
Expand All @@ -65,7 +64,7 @@ export class AdminApiClient {
},
})
)
debug('prefixUrl', `${baseUrl}/clusters`)
debug('prefixUrl', `${prefixUrl}`)
}

private async getHeaders() {
Expand All @@ -89,7 +88,7 @@ export class AdminApiClient {
async getClients(clusterUuid: string): Promise<Dto.ClusterClient[]> {
const headers = await this.getHeaders()
const rest = await this.rest
return rest(`${clusterUuid}/clients`, {
return rest(`clusters/${clusterUuid}/clients`, {
headers,
}).json()
}
Expand All @@ -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,
Expand All @@ -129,7 +128,7 @@ export class AdminApiClient {
): Promise<Dto.ClusterClientConnectionDetails> {
const headers = await this.getHeaders()
const rest = await this.rest
return rest(`${clusterUuid}/clients/${clientId}`, {
return rest(`clusters/${clusterUuid}/clients/${clientId}`, {
headers,
}).json()
}
Expand All @@ -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()
Expand All @@ -158,7 +157,7 @@ export class AdminApiClient {
async getClusters(): Promise<Dto.Cluster[]> {
const headers = await this.getHeaders()
const rest = await this.rest
return rest('', {
return rest('clusters', {
headers,
}).json()
}
Expand All @@ -177,7 +176,7 @@ export class AdminApiClient {
headers,
}
const rest = await this.rest
return rest.post('', req).json()
return rest.post('clusters', req).json()
}

/**
Expand All @@ -189,7 +188,7 @@ export class AdminApiClient {
async getCluster(clusterUuid: string): Promise<Dto.Cluster> {
const headers = await this.getHeaders()
const rest = await this.rest
return rest(`${clusterUuid}`, {
return rest(`clusters/${clusterUuid}`, {
headers,
}).json()
}
Expand All @@ -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()
Expand All @@ -218,7 +217,7 @@ export class AdminApiClient {
async getParameters(): Promise<Dto.Parameters> {
const headers = await this.getHeaders()
const rest = await this.rest
return rest('parameters', {
return rest('clusters/parameters', {
headers,
}).json()
}
Expand All @@ -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()
}
Expand All @@ -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()
}

/**
Expand All @@ -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()
Expand All @@ -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,
}),
Expand Down

0 comments on commit 19c4c5c

Please sign in to comment.