Skip to content

Commit

Permalink
[MDS] Mute the non-mds endpoints for direct query data connections (o…
Browse files Browse the repository at this point in the history
…pensearch-project#8537)

* Mute the non-mds  endpoints for direct query data connections when MDS enabled

Signed-off-by: Ryan Liang <[email protected]>

* Handle the case for local cluster too

Signed-off-by: Ryan Liang <[email protected]>

* Handle the case for local cluster 2

Signed-off-by: Ryan Liang <[email protected]>

* Changeset file for PR opensearch-project#8537 created/updated

---------

Signed-off-by: Ryan Liang <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
RyanL1997 and opensearch-changeset-bot[bot] authored Oct 15, 2024
1 parent 64ed61b commit 47ae28b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8537.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [MDS] Mute the non-mds endpoints for direct query data connections ([#8537](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8537))
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const getDirectQueryConnections = async (dataSourceId: string, http: Http
};

export const getLocalClusterConnections = async (http: HttpSetup) => {
const res = await http.get(`${DATACONNECTIONS_BASE}`);
const res = await http.get(`${DATACONNECTIONS_BASE}/dataSourceMDSId=`);
const localClusterConnections: DataSourceTableItem[] = res.map(
(dataConnection: DirectQueryDatasourceDetails) => ({
id: `${dataConnection.name}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
EDIT,
} from '../../framework/utils/shared';

export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled: boolean) {
export function registerNonMdsDataConnectionsRoute(router: IRouter) {
router.get(
{
path: `${DATACONNECTIONS_BASE}/{name}`,
Expand Down Expand Up @@ -204,7 +204,9 @@ export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled:
}
}
);
}

export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled: boolean) {
router.get(
{
path: `${DATACONNECTIONS_BASE}/dataSourceMDSId={dataSourceMDSId?}`,
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/data_source_management/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

import { IRouter, ILegacyClusterClient } from '../../../../core/server';
import { registerDslRoute } from './dsl';
import { registerDataConnectionsRoute } from './data_connections_router';
import {
registerDataConnectionsRoute,
registerNonMdsDataConnectionsRoute,
} from './data_connections_router';
import { registerDatasourcesRoute } from './datasources_router';
import { registerPplRoute } from './ppl';
import { DSLFacet } from '../services/facets/dsl_facet';
Expand Down Expand Up @@ -43,6 +46,9 @@ export function setupRoutes({
// const queryService = new QueryService(client);
// registerSqlRoute(router, queryService);

if (!dataSourceEnabled) {
registerNonMdsDataConnectionsRoute(router);
}
registerDataConnectionsRoute(router, dataSourceEnabled);
registerDatasourcesRoute(router, dataSourceEnabled);
}

0 comments on commit 47ae28b

Please sign in to comment.