diff --git a/workbench/backend/src/app/plugin/ai-data-api.dao.ts b/workbench/backend/src/app/plugin/ai-data-api.dao.ts index 500b1df..77682ba 100644 --- a/workbench/backend/src/app/plugin/ai-data-api.dao.ts +++ b/workbench/backend/src/app/plugin/ai-data-api.dao.ts @@ -3,7 +3,7 @@ import { Context } from '../../ctx.decorator'; import { AxiosRequestConfig, AxiosError } from 'axios'; import { tap, catchError } from 'rxjs/operators'; import { throwError } from 'rxjs'; -import { FSM_HOSTS_CORESUITE_TO_COREINFRA } from 'src/common/constants'; +import { FSM_HOSTS_CORESUITE_TO_COREINFRA, FSM_HOSTS_CORESUITE_TO_SAPCLOUD } from 'src/common/constants'; export type PluginDto = { id: string, @@ -28,6 +28,10 @@ export class AiDataAPIDAO { return `https://${FSM_HOSTS_CORESUITE_TO_COREINFRA.get(host.toLowerCase()) || ''}`; } + private resolveSAPCloudHost(host: string) { + return `https://${FSM_HOSTS_CORESUITE_TO_SAPCLOUD.get(host.toLowerCase()) || ''}`; + } + private getParams(ctx: Context) { return { companyId: ctx.companyId, @@ -76,10 +80,9 @@ export class AiDataAPIDAO { } getAll(ctx: Context) { - const cloudHost = ctx.cloudHost.replace("dev.coresuite.com", "fsm-dev.cloud.sap") return this.request({ method: 'GET', - url: `https://${cloudHost}/optimization/api/v1/plugins`, + url: `${this.resolveSAPCloudHost(ctx.cloudHost)}/optimization/api/v1/plugins`, headers: this.getHeaders(ctx), params: this.getParams(ctx), responseType: 'json', diff --git a/workbench/backend/src/common/constants.ts b/workbench/backend/src/common/constants.ts index b9d33cd..271688f 100644 --- a/workbench/backend/src/common/constants.ts +++ b/workbench/backend/src/common/constants.ts @@ -26,4 +26,14 @@ export const FSM_HOSTS_CORESUITE_TO_COREINFRA = new Map() .set('de.coresuite.com', 'ingress.de-1.coreinfra.io') .set('us.coresuite.com', 'ingress.us-1.coreinfra.io') .set('au.coresuite.com', 'ingress.au-1.coreinfra.io') - .set('cn.coresuite.com', 'ingress.cn-1.coreinfra.io'); \ No newline at end of file + .set('cn.coresuite.com', 'ingress.cn-1.coreinfra.io'); + +export const FSM_HOSTS_CORESUITE_TO_SAPCLOUD = new Map() + .set('et.dev.coresuite.com', 'et.fsm-dev.cloud.sap') + .set('qt.dev.coresuite.com', 'qt.fsm-dev.cloud.sap') + .set('dt.dev.coresuite.com', 'dt.fsm-dev.cloud.sap') + .set('us.coresuite.com', 'us.fsm-dev.cloud.sap') + .set('au.coresuite.com', 'au.fsm-dev.cloud.sap') + .set('de.coresuite.com', 'de.fsm-dev.cloud.sap') + .set('eu.coresuite.com', 'eu.fsm-dev.cloud.sap') + .set('cn.coresuite.com', 'cn.fsm-dev.cloud.sap');