diff --git a/src/plugins/data_source/README.md b/src/plugins/data_source/README.md new file mode 100755 index 000000000000..7ccdeb62b7c4 --- /dev/null +++ b/src/plugins/data_source/README.md @@ -0,0 +1,13 @@ +# data_source + +A OpenSearch Dashboards plugin + +This plugin introduce OpenSearch data source into OpenSearch Dashboards, and provides related functions to connect to OpenSearch data sources. + +--- + +## Development + +See the [OpenSearch Dashboards contributing +guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/CONTRIBUTING.md) for instructions +setting up your development environment. diff --git a/src/plugins/data_source/common/index.ts b/src/plugins/data_source/common/index.ts new file mode 100644 index 000000000000..10fde727a706 --- /dev/null +++ b/src/plugins/data_source/common/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export const PLUGIN_ID = 'dataSource'; +export const PLUGIN_NAME = 'data_source'; diff --git a/src/plugins/data_source/opensearch_dashboards.json b/src/plugins/data_source/opensearch_dashboards.json new file mode 100644 index 000000000000..e6556eca7988 --- /dev/null +++ b/src/plugins/data_source/opensearch_dashboards.json @@ -0,0 +1,9 @@ +{ + "id": "dataSource", + "version": "opensearchDashboards", + "opensearchDashboardsVersion": "opensearchDashboards", + "server": true, + "ui": false, + "requiredPlugins": [], + "optionalPlugins": [] +} diff --git a/src/plugins/data_source/server/index.ts b/src/plugins/data_source/server/index.ts new file mode 100644 index 000000000000..41df94090986 --- /dev/null +++ b/src/plugins/data_source/server/index.ts @@ -0,0 +1,24 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { schema, TypeOf } from '@osd/config-schema'; +import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server'; +import { DataSourcePlugin } from './plugin'; + +export const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: false }), +}); + +export type DataSourcePluginConfigType = TypeOf; + +export const config: PluginConfigDescriptor = { + schema: configSchema, +}; + +export function plugin(initializerContext: PluginInitializerContext) { + return new DataSourcePlugin(initializerContext); +} + +export { DataSourcePluginSetup, DataSourcePluginStart } from './types'; diff --git a/src/plugins/data_source/server/plugin.ts b/src/plugins/data_source/server/plugin.ts new file mode 100644 index 000000000000..dc5c53b9cfb2 --- /dev/null +++ b/src/plugins/data_source/server/plugin.ts @@ -0,0 +1,29 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from 'src/core/server'; + +import { DataSourcePluginSetup, DataSourcePluginStart } from './types'; + +export class DataSourcePlugin implements Plugin { + private readonly logger: Logger; + + constructor(initializerContext: PluginInitializerContext) { + this.logger = initializerContext.logger.get(); + } + + public setup(core: CoreSetup) { + this.logger.debug('data_source: Setup'); + + return {}; + } + + public start(core: CoreStart) { + this.logger.debug('data_source: Started'); + return {}; + } + + public stop() {} +} diff --git a/src/plugins/data_source/server/types.ts b/src/plugins/data_source/server/types.ts new file mode 100644 index 000000000000..a70c8c1bf199 --- /dev/null +++ b/src/plugins/data_source/server/types.ts @@ -0,0 +1,9 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface DataSourcePluginSetup {} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface DataSourcePluginStart {}