From 3b060933eb718763c4e1dab427f3354790bb4a2e Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:00:50 -0700 Subject: [PATCH] Add Data connection saved-object type for external connections (#7925) (#8001) * Add Data connection saved-object type for external connections * Changeset file for PR #7925 created/updated --------- (cherry picked from commit 3caaa9d38b61b583d30d520511529d1c07f20b50) Signed-off-by: Megha Goyal Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] 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> --- changelogs/fragments/7925.yml | 2 ++ ...data_connection_saved_object_attributes.ts | 28 ++++++++++++++++ .../common/data_connections/index.ts | 6 ++++ src/plugins/data_source/server/plugin.ts | 3 +- .../server/saved_objects/data_connection.ts | 32 +++++++++++++++++++ .../data_source/server/saved_objects/index.ts | 2 ++ 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7925.yml create mode 100644 src/plugins/data_source/common/data_connections/data_connection_saved_object_attributes.ts create mode 100644 src/plugins/data_source/common/data_connections/index.ts create mode 100644 src/plugins/data_source/server/saved_objects/data_connection.ts diff --git a/changelogs/fragments/7925.yml b/changelogs/fragments/7925.yml new file mode 100644 index 000000000000..124d909f60e5 --- /dev/null +++ b/changelogs/fragments/7925.yml @@ -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)) \ No newline at end of file diff --git a/src/plugins/data_source/common/data_connections/data_connection_saved_object_attributes.ts b/src/plugins/data_source/common/data_connections/data_connection_saved_object_attributes.ts new file mode 100644 index 000000000000..f685780e28d0 --- /dev/null +++ b/src/plugins/data_source/common/data_connections/data_connection_saved_object_attributes.ts @@ -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; diff --git a/src/plugins/data_source/common/data_connections/index.ts b/src/plugins/data_source/common/data_connections/index.ts new file mode 100644 index 000000000000..9d1259d8692d --- /dev/null +++ b/src/plugins/data_source/common/data_connections/index.ts @@ -0,0 +1,6 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './data_connection_saved_object_attributes'; diff --git a/src/plugins/data_source/server/plugin.ts b/src/plugins/data_source/server/plugin.ts index bbf5a89d1b53..a2e2f51d6323 100644 --- a/src/plugins/data_source/server/plugin.ts +++ b/src/plugins/data_source/server/plugin.ts @@ -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'; @@ -55,6 +55,7 @@ export class DataSourcePlugin implements Plugin