forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Shenoy Pratik <sgguruda@amazon.com> Signed-off-by: Ryan Liang <jiallian@amazon.com>
- Loading branch information
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PluginInitializerContext } from 'opensearch-dashboards/server'; | ||
import { DataSourceManagementPlugin } from './plugin'; | ||
|
||
// This exports static code and TypeScript types, | ||
// as well as, OpenSearch Dashboards Platform `plugin()` initializer. | ||
|
||
export function plugin(initializerContext: PluginInitializerContext) { | ||
return new DataSourceManagementPlugin(initializerContext); | ||
} | ||
|
||
export { DataSourceManagementPluginSetup, DataSourceManagementPluginStart } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
CoreSetup, | ||
CoreStart, | ||
Logger, | ||
Plugin, | ||
PluginInitializerContext, | ||
} from 'opensearch-dashboards/server'; | ||
|
||
import { defineRoutes } from './routes'; | ||
import { DataSourceManagementPluginSetup, DataSourceManagementPluginStart } from './types'; | ||
|
||
export class DataSourceManagementPlugin | ||
implements Plugin<DataSourceManagementPluginSetup, DataSourceManagementPluginStart> { | ||
private readonly logger: Logger; | ||
|
||
constructor(initializerContext: PluginInitializerContext) { | ||
this.logger = initializerContext.logger.get(); | ||
} | ||
|
||
public setup(core: CoreSetup) { | ||
this.logger.debug('dataSourceManagement: Setup'); | ||
const router = core.http.createRouter(); | ||
|
||
// Register server side APIs | ||
defineRoutes(router); | ||
|
||
return {}; | ||
} | ||
|
||
public start(core: CoreStart) { | ||
this.logger.debug('dataSourceManagement: Started'); | ||
return {}; | ||
} | ||
|
||
public stop() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { IRouter } from 'opensearch-dashboards/server'; | ||
|
||
export function defineRoutes(router: IRouter) { | ||
router.get( | ||
{ | ||
path: '/api/data_source_management/example', | ||
validate: false, | ||
}, | ||
async (context, request, response) => { | ||
return response.ok({ | ||
body: { | ||
time: new Date().toISOString(), | ||
}, | ||
}); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface DataSourceManagementPluginSetup {} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface DataSourceManagementPluginStart {} |