diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index b83907699ec76..d9dbce0c460ec 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -11087,6 +11087,7 @@ paths: - Security Detections API /api/detection_engine/signals/finalize_migration: post: + deprecated: true description: | Finalize successful migrations of detection alerts. This replaces the original index's alias with the successfully migrated index's alias. The endpoint is idempotent; therefore, it can safely be used to poll a given migration and, upon completion, @@ -11141,6 +11142,7 @@ paths: - Security Detections API /api/detection_engine/signals/migration: delete: + deprecated: true description: | Migrations favor data integrity over shard size. Consequently, unused or orphaned indices are artifacts of the migration process. A successful migration will result in both the old and new indices being present. @@ -11198,6 +11200,7 @@ paths: tags: - Security Detections API post: + deprecated: true description: | Initiate a migration of detection alerts. Migrations are initiated per index. While the process is neither destructive nor interferes with existing data, it may be resource-intensive. As such, it is recommended that you plan your migrations accordingly. @@ -11261,6 +11264,7 @@ paths: - Security Detections API /api/detection_engine/signals/migration_status: post: + deprecated: true description: Retrieve indices that contain detection alerts of a particular age, along with migration information for each of those indices. operationId: ReadAlertsMigrationStatus parameters: diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index 271d34d800471..b79fab50089f4 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -504,6 +504,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D }, detectionEngineOverview: `${SECURITY_SOLUTION_DOCS}detection-engine-overview.html`, aiAssistant: `${SECURITY_SOLUTION_DOCS}security-assistant.html`, + signalsMigrationApi: `${SECURITY_SOLUTION_DOCS}signals-migration-api.html`, }, query: { eql: `${ELASTICSEARCH_DOCS}eql.html`, diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 749e7a40708ca..fd1c2cf8fe3ca 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -372,6 +372,7 @@ export interface DocLinks { readonly assetCriticality: string; }; readonly detectionEngineOverview: string; + readonly signalsMigrationApi: string; }; readonly query: { readonly eql: string; diff --git a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/create_signals_migration/create_signals_migration.schema.yaml b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/create_signals_migration/create_signals_migration.schema.yaml index 52178537d6363..d77bb820ec59e 100644 --- a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/create_signals_migration/create_signals_migration.schema.yaml +++ b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/create_signals_migration/create_signals_migration.schema.yaml @@ -9,6 +9,7 @@ paths: operationId: CreateAlertsMigration x-codegen-enabled: true summary: Initiate a detection alert migration + deprecated: true description: | Initiate a migration of detection alerts. Migrations are initiated per index. While the process is neither destructive nor interferes with existing data, it may be resource-intensive. As such, it is recommended that you plan your migrations accordingly. diff --git a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/delete_signals_migration/delete_signals_migration.schema.yaml b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/delete_signals_migration/delete_signals_migration.schema.yaml index 8aa36d8496d09..a03d7c476d65f 100644 --- a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/delete_signals_migration/delete_signals_migration.schema.yaml +++ b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/delete_signals_migration/delete_signals_migration.schema.yaml @@ -9,6 +9,7 @@ paths: operationId: AlertsMigrationCleanup x-codegen-enabled: true summary: Clean up detection alert migrations + deprecated: true description: | Migrations favor data integrity over shard size. Consequently, unused or orphaned indices are artifacts of the migration process. A successful migration will result in both the old and new indices being present. diff --git a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/finalize_signals_migration/finalize_signals_migration.schema.yaml b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/finalize_signals_migration/finalize_signals_migration.schema.yaml index d36df73832530..1160467494090 100644 --- a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/finalize_signals_migration/finalize_signals_migration.schema.yaml +++ b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/finalize_signals_migration/finalize_signals_migration.schema.yaml @@ -9,6 +9,7 @@ paths: operationId: FinalizeAlertsMigration x-codegen-enabled: true summary: Finalize detection alert migrations + deprecated: true description: | Finalize successful migrations of detection alerts. This replaces the original index's alias with the successfully migrated index's alias. The endpoint is idempotent; therefore, it can safely be used to poll a given migration and, upon completion, diff --git a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/read_signals_migration_status/read_signals_migration_status.schema.yaml b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/read_signals_migration_status/read_signals_migration_status.schema.yaml index 6cf11191f5d70..0baa8e2281506 100644 --- a/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/read_signals_migration_status/read_signals_migration_status.schema.yaml +++ b/x-pack/plugins/security_solution/common/api/detection_engine/signals_migration/read_signals_migration_status/read_signals_migration_status.schema.yaml @@ -9,6 +9,7 @@ paths: operationId: ReadAlertsMigrationStatus x-codegen-enabled: true summary: Retrieve the status of detection alert migrations + deprecated: true description: Retrieve indices that contain detection alerts of a particular age, along with migration information for each of those indices. tags: - Alerts migration API diff --git a/x-pack/plugins/security_solution/docs/openapi/ess/security_solution_detections_api_2023_10_31.bundled.schema.yaml b/x-pack/plugins/security_solution/docs/openapi/ess/security_solution_detections_api_2023_10_31.bundled.schema.yaml index 7e8d7a61bff2c..55514516f43da 100644 --- a/x-pack/plugins/security_solution/docs/openapi/ess/security_solution_detections_api_2023_10_31.bundled.schema.yaml +++ b/x-pack/plugins/security_solution/docs/openapi/ess/security_solution_detections_api_2023_10_31.bundled.schema.yaml @@ -1010,6 +1010,7 @@ paths: - Security Detections API /api/detection_engine/signals/finalize_migration: post: + deprecated: true description: > Finalize successful migrations of detection alerts. This replaces the original index's alias with the successfully migrated index's alias. @@ -1069,6 +1070,7 @@ paths: - Alerts migration API /api/detection_engine/signals/migration: delete: + deprecated: true description: > Migrations favor data integrity over shard size. Consequently, unused or orphaned indices are artifacts of @@ -1136,6 +1138,7 @@ paths: - Security Detections API - Alerts migration API post: + deprecated: true description: > Initiate a migration of detection alerts. @@ -1204,6 +1207,7 @@ paths: - Alerts migration API /api/detection_engine/signals/migration_status: post: + deprecated: true description: >- Retrieve indices that contain detection alerts of a particular age, along with migration information for each of those indices. diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts index 094f3e560ec3e..8f5498b88362b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.test.ts @@ -16,6 +16,7 @@ import { getTemplateVersion } from '../index/check_template_version'; import { createSignalsMigrationRoute } from './create_signals_migration_route'; import { SIGNALS_TEMPLATE_VERSION } from '../index/get_signals_template'; import type { AlertsReindexOptions } from '../../../../../common/api/detection_engine/signals_migration'; +import { docLinksServiceMock } from '@kbn/core/server/mocks'; jest.mock('../index/check_template_version'); jest.mock('@kbn/securitysolution-es-utils', () => { @@ -31,6 +32,7 @@ jest.mock('../../migrations/get_signal_versions_by_index'); describe('creating signals migrations route', () => { let server: ReturnType; + const docLinks = docLinksServiceMock.createSetupContract(); beforeEach(() => { server = serverMock.create(); @@ -42,7 +44,7 @@ describe('creating signals migrations route', () => { (getIndexVersionsByIndex as jest.Mock).mockResolvedValue({ 'my-signals-index': -1 }); (getSignalVersionsByIndex as jest.Mock).mockResolvedValue({ 'my-signals-index': [] }); - createSignalsMigrationRoute(server.router); + createSignalsMigrationRoute(server.router, docLinks); }); it('passes options to the createMigration', async () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts index b4947b939b336..56be3f32fe808 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { DocLinksServiceSetup } from '@kbn/core/server'; import { transformError, BadRequestError, getIndexAliases } from '@kbn/securitysolution-es-utils'; import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; import { CreateAlertsMigrationRequestBody } from '../../../../../common/api/detection_engine/signals_migration'; @@ -19,7 +20,10 @@ import { isOutdated, signalsAreOutdated } from '../../migrations/helpers'; import { getIndexVersionsByIndex } from '../../migrations/get_index_versions_by_index'; import { getSignalVersionsByIndex } from '../../migrations/get_signal_versions_by_index'; -export const createSignalsMigrationRoute = (router: SecuritySolutionPluginRouter) => { +export const createSignalsMigrationRoute = ( + router: SecuritySolutionPluginRouter, + docLinks: DocLinksServiceSetup +) => { router.versioned .post({ path: DETECTION_ENGINE_SIGNALS_MIGRATION_URL, @@ -36,6 +40,13 @@ export const createSignalsMigrationRoute = (router: SecuritySolutionPluginRouter validate: { request: { body: buildRouteValidationWithZod(CreateAlertsMigrationRequestBody) }, }, + options: { + deprecated: { + documentationUrl: docLinks.links.securitySolution.signalsMigrationApi, + severity: 'warning', + reason: { type: 'remove' }, + }, + }, }, async (context, request, response) => { const siemResponse = buildSiemResponse(response); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts index 14a490d34d4fc..8d03bc75e9fc9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { DocLinksServiceSetup } from '@kbn/core/server'; import { transformError } from '@kbn/securitysolution-es-utils'; import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; import { AlertsMigrationCleanupRequestBody } from '../../../../../common/api/detection_engine/signals_migration'; @@ -15,7 +16,10 @@ import { buildSiemResponse } from '../utils'; import { signalsMigrationService } from '../../migrations/migration_service'; import { getMigrationSavedObjectsById } from '../../migrations/get_migration_saved_objects_by_id'; -export const deleteSignalsMigrationRoute = (router: SecuritySolutionPluginRouter) => { +export const deleteSignalsMigrationRoute = ( + router: SecuritySolutionPluginRouter, + docLinks: DocLinksServiceSetup +) => { router.versioned .delete({ path: DETECTION_ENGINE_SIGNALS_MIGRATION_URL, @@ -32,6 +36,13 @@ export const deleteSignalsMigrationRoute = (router: SecuritySolutionPluginRouter validate: { request: { body: buildRouteValidationWithZod(AlertsMigrationCleanupRequestBody) }, }, + options: { + deprecated: { + documentationUrl: docLinks.links.securitySolution.signalsMigrationApi, + severity: 'warning', + reason: { type: 'remove' }, + }, + }, }, async (context, request, response) => { const siemResponse = buildSiemResponse(response); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts index 8183c0bbac7bd..8c892279acc62 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.test.ts @@ -12,18 +12,20 @@ import { getSignalsMigrationSavedObjectMock } from '../../migrations/saved_objec import { finalizeSignalsMigrationRoute } from './finalize_signals_migration_route'; import type { RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; import { ruleDataServiceMock } from '@kbn/rule-registry-plugin/server/rule_data_plugin_service/rule_data_plugin_service.mock'; +import { docLinksServiceMock } from '@kbn/core/server/mocks'; jest.mock('../../migrations/get_migration_saved_objects_by_id'); describe('finalizing signals migrations', () => { let server: ReturnType; + const docLinks = docLinksServiceMock.createSetupContract(); beforeEach(() => { server = serverMock.create(); const ruleDataPluginServiceMock = ruleDataServiceMock.create() as unknown as RuleDataPluginService; - finalizeSignalsMigrationRoute(server.router, ruleDataPluginServiceMock); + finalizeSignalsMigrationRoute(server.router, ruleDataPluginServiceMock, docLinks); }); it('returns an empty array error if no migrations exists', async () => { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts index 6ea0584c0b0c4..0ff0220056e73 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { DocLinksServiceSetup } from '@kbn/core/server'; import { transformError, BadRequestError } from '@kbn/securitysolution-es-utils'; import type { RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; @@ -19,7 +20,8 @@ import { getMigrationSavedObjectsById } from '../../migrations/get_migration_sav export const finalizeSignalsMigrationRoute = ( router: SecuritySolutionPluginRouter, - ruleDataService: RuleDataPluginService + ruleDataService: RuleDataPluginService, + docLinks: DocLinksServiceSetup ) => { router.versioned .post({ @@ -37,6 +39,13 @@ export const finalizeSignalsMigrationRoute = ( validate: { request: { body: buildRouteValidationWithZod(FinalizeAlertsMigrationRequestBody) }, }, + options: { + deprecated: { + documentationUrl: docLinks.links.securitySolution.signalsMigrationApi, + severity: 'warning', + reason: { type: 'remove' }, + }, + }, }, async (context, request, response) => { const siemResponse = buildSiemResponse(response); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.test.ts index 598e6bfa3e154..9586bc6daebdd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.test.ts @@ -12,6 +12,7 @@ import { getMigrationSavedObjectsByIndex } from '../../migrations/get_migration_ import { getSignalVersionsByIndex } from '../../migrations/get_signal_versions_by_index'; import { getSignalsMigrationStatusRoute } from './get_signals_migration_status_route'; import { getSignalsIndicesInRange } from '../../migrations/get_signals_indices_in_range'; +import { docLinksServiceMock } from '@kbn/core/server/mocks'; jest.mock('../../migrations/get_signals_indices_in_range'); jest.mock('../../migrations/get_signal_versions_by_index'); @@ -19,10 +20,11 @@ jest.mock('../../migrations/get_migration_saved_objects_by_index'); describe('get signals migration status', () => { let server: ReturnType; + const docLinks = docLinksServiceMock.createSetupContract(); beforeEach(() => { server = serverMock.create(); - getSignalsMigrationStatusRoute(server.router); + getSignalsMigrationStatusRoute(server.router, docLinks); (getSignalsIndicesInRange as jest.Mock).mockResolvedValueOnce(['my-signals-index']); (getSignalVersionsByIndex as jest.Mock).mockResolvedValueOnce({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.ts index fc7cfe6fc2eae..15f64c7f96c41 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/get_signals_migration_status_route.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { DocLinksServiceSetup } from '@kbn/core/server'; import { transformError, getIndexAliases } from '@kbn/securitysolution-es-utils'; import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; import { ReadAlertsMigrationStatusRequestQuery } from '../../../../../common/api/detection_engine/signals_migration'; @@ -18,7 +19,10 @@ import { isOutdated, signalsAreOutdated } from '../../migrations/helpers'; import { getTemplateVersion } from '../index/check_template_version'; import { buildSiemResponse } from '../utils'; -export const getSignalsMigrationStatusRoute = (router: SecuritySolutionPluginRouter) => { +export const getSignalsMigrationStatusRoute = ( + router: SecuritySolutionPluginRouter, + docLinks: DocLinksServiceSetup +) => { router.versioned .get({ path: DETECTION_ENGINE_SIGNALS_MIGRATION_STATUS_URL, @@ -35,6 +39,13 @@ export const getSignalsMigrationStatusRoute = (router: SecuritySolutionPluginRou validate: { request: { query: buildRouteValidationWithZod(ReadAlertsMigrationStatusRequestQuery) }, }, + options: { + deprecated: { + documentationUrl: docLinks.links.securitySolution.signalsMigrationApi, + severity: 'warning', + reason: { type: 'remove' }, + }, + }, }, async (context, request, response) => { const siemResponse = buildSiemResponse(response); diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index e371e0fc3b7b5..28666df8c42bf 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -397,6 +397,7 @@ export class Plugin implements ISecuritySolutionPlugin { previewRuleDataClient, this.telemetryReceiver, this.pluginContext.env.packageInfo.buildFlavor === 'serverless', + core.docLinks, this.endpointContext ); diff --git a/x-pack/plugins/security_solution/server/routes/index.ts b/x-pack/plugins/security_solution/server/routes/index.ts index 140ef1c670f61..ca1cbb493311f 100644 --- a/x-pack/plugins/security_solution/server/routes/index.ts +++ b/x-pack/plugins/security_solution/server/routes/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { StartServicesAccessor, Logger } from '@kbn/core/server'; +import type { StartServicesAccessor, Logger, DocLinksServiceSetup } from '@kbn/core/server'; import type { IRuleDataClient, RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; import type { EndpointAppContext } from '../endpoint/types'; @@ -81,6 +81,7 @@ export const initRoutes = ( previewRuleDataClient: IRuleDataClient, previewTelemetryReceiver: ITelemetryReceiver, isServerless: boolean, + docLinks: DocLinksServiceSetup, endpointContext: EndpointAppContext ) => { registerFleetIntegrationsRoutes(router); @@ -114,10 +115,10 @@ export const initRoutes = ( setAlertTagsRoute(router); setAlertAssigneesRoute(router); querySignalsRoute(router, ruleDataClient); - getSignalsMigrationStatusRoute(router); - createSignalsMigrationRoute(router); - finalizeSignalsMigrationRoute(router, ruleDataService); - deleteSignalsMigrationRoute(router); + getSignalsMigrationStatusRoute(router, docLinks); + createSignalsMigrationRoute(router, docLinks); + finalizeSignalsMigrationRoute(router, ruleDataService, docLinks); + deleteSignalsMigrationRoute(router, docLinks); suggestUserProfilesRoute(router, getStartServices); // Detection Engine index routes that have the REST endpoints of /api/detection_engine/index