From d720be12509fa90661671eca944f71520424b299 Mon Sep 17 00:00:00 2001 From: Senthamil Sindhu Date: Tue, 26 Mar 2024 09:30:33 -0700 Subject: [PATCH] Activate CassandraProxy in MPAC --- src/ConfigContext.ts | 21 +++++++++++---------- src/Explorer/Tables/TableDataClient.ts | 9 ++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ConfigContext.ts b/src/ConfigContext.ts index e3350c7f6..c2e018002 100644 --- a/src/ConfigContext.ts +++ b/src/ConfigContext.ts @@ -102,20 +102,20 @@ let configContext: Readonly = { NEW_BACKEND_APIS: [BackendApi.GenerateToken], MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod, NEW_MONGO_APIS: [ - // "resourcelist", - // "createDocument", - // "readDocument", - // "updateDocument", - // "deleteDocument", - // "createCollectionWithProxy", + "resourcelist", + "createDocument", + "readDocument", + "updateDocument", + "deleteDocument", + "createCollectionWithProxy", ], MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false, CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod, NEW_CASSANDRA_APIS: [ - // "postQuery", - // "createOrDelete", - // "getKeys", - // "getSchema", + "postQuery", + "createOrDelete", + "getKeys", + "getSchema", ], CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: false, isTerminalEnabled: false, @@ -248,3 +248,4 @@ export async function initializeConfiguration(): Promise { } export { configContext }; + diff --git a/src/Explorer/Tables/TableDataClient.ts b/src/Explorer/Tables/TableDataClient.ts index 3d5f05c72..097ade395 100644 --- a/src/Explorer/Tables/TableDataClient.ts +++ b/src/Explorer/Tables/TableDataClient.ts @@ -19,7 +19,7 @@ import Explorer from "../Explorer"; import * as TableConstants from "./Constants"; import * as Entities from "./Entities"; import * as TableEntityProcessor from "./TableEntityProcessor"; -import { CassandraProxyAPIs } from "../../Common/Constants"; +import { CassandraProxyAPIs, CassandraProxyEndpoints } from "../../Common/Constants"; export interface CassandraTableKeys { partitionKeys: CassandraTableKey[]; @@ -458,7 +458,7 @@ export class CassandraAPIDataClient extends TableDataClient { } public getTableKeys(collection: ViewModels.Collection): Q.Promise { - if (!this.useCassandraProxyEndpoint("getTableKeys")) { + if (!this.useCassandraProxyEndpoint("getKeys")) { return this.getTableKeys_ToBeDeprecated(collection); } @@ -732,6 +732,7 @@ export class CassandraAPIDataClient extends TableDataClient { } private useCassandraProxyEndpoint(api: string): boolean { + const activeCassandraProxyEndpoints: string[] = [CassandraProxyEndpoints.Development, CassandraProxyEndpoints.Mpac]; let canAccessCassandraProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled"; if (userContext.databaseAccount.properties.ipRules?.length > 0) { canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED; @@ -740,9 +741,7 @@ export class CassandraAPIDataClient extends TableDataClient { return ( canAccessCassandraProxy && configContext.NEW_CASSANDRA_APIS?.includes(api) && - [Constants.CassandraProxyEndpoints.Development, Constants.CassandraProxyEndpoints.Mpac].includes( - configContext.CASSANDRA_PROXY_ENDPOINT, - ) + activeCassandraProxyEndpoints.includes(configContext.CASSANDRA_PROXY_ENDPOINT) ); } }