Skip to content

Commit

Permalink
Add Data connection saved-object type for external connections (#7925) (
Browse files Browse the repository at this point in the history
#8001)

* Add Data connection saved-object type for external connections



* Changeset file for PR #7925 created/updated

---------



(cherry picked from commit 3caaa9d)

Signed-off-by: Megha Goyal <goyamegh@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 10, 2024
1 parent a0440d3 commit 3b06093
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/7925.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Introduce a data-connection saved-object type for external data connections ([#7925](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7925))
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { SavedObjectAttributes } from 'src/core/types';

export const DATA_CONNECTION_SAVED_OBJECT_TYPE = 'data-connection';

/**
* Represents the attributes of a data connection saved object.
* @property connectionId: The name of the data connection.
* @property type: The type of the data connection based on enum DataConnectionType
* @property meta: Additional metadata associated with the data connection.
*/
export interface DataConnectionSavedObjectAttributes extends SavedObjectAttributes {
connectionId: string;
type: DataConnectionType;
meta?: string;
}

export enum DataConnectionType {
CloudWatch = 'AWS CloudWatch',
SecurityLake = 'AWS Security Lake',
NA = 'None',
}

export const DATA_CONNECTION_ID_LENGTH_LIMIT = 32;
6 changes: 6 additions & 0 deletions src/plugins/data_source/common/data_connections/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export * from './data_connection_saved_object_attributes';
3 changes: 2 additions & 1 deletion src/plugins/data_source/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DataSourcePluginConfigType } from '../config';
import { LoggingAuditor } from './audit/logging_auditor';
import { CryptographyService, CryptographyServiceSetup } from './cryptography_service';
import { DataSourceService, DataSourceServiceSetup } from './data_source_service';
import { DataSourceSavedObjectsClientWrapper, dataSource } from './saved_objects';
import { dataConnection, dataSource, DataSourceSavedObjectsClientWrapper } from './saved_objects';
import { AuthenticationMethod, DataSourcePluginSetup, DataSourcePluginStart } from './types';
import { DATA_SOURCE_SAVED_OBJECT_TYPE } from '../common';

Expand Down Expand Up @@ -55,6 +55,7 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc

// Register data source saved object type
core.savedObjects.registerType(dataSource);
core.savedObjects.registerType(dataConnection);

const config: DataSourcePluginConfigType = await this.config$.pipe(first()).toPromise();

Expand Down
32 changes: 32 additions & 0 deletions src/plugins/data_source/server/saved_objects/data_connection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { SavedObjectsType } from 'opensearch-dashboards/server';

export const dataConnection: SavedObjectsType = {
name: 'data-connection',
namespaceType: 'agnostic',
hidden: false,
management: {
icon: 'apps',
defaultSearchField: 'connectionId',
importableAndExportable: true,
},
mappings: {
dynamic: false,
properties: {
connectionId: {
type: 'text',
},
type: {
type: 'text',
},
meta: {
type: 'text',
},
},
},
migrations: {},
};
2 changes: 2 additions & 0 deletions src/plugins/data_source/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

export { dataSource } from './data_source';
export { DataSourceSavedObjectsClientWrapper } from './data_source_saved_objects_client_wrapper';

export { dataConnection } from './data_connection';

0 comments on commit 3b06093

Please sign in to comment.