Skip to content

Commit

Permalink
Start tracking stats for _bulk_delete
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaindik committed Jan 20, 2025
1 parent a7d2e3c commit 55399e8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const registerRuleManagementRoutes = (
bulkCreateRulesRoute(router, logger, docLinks);
bulkUpdateRulesRoute(router, logger, docLinks);
bulkPatchRulesRoute(router, logger, docLinks);
bulkDeleteRulesRoute(router, logger);
bulkDeleteRulesRoute(router, logger, docLinks);
// ALONG WITH THEIR IMPORTS

// Rules bulk actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
*/

import type { VersionedRouteConfig } from '@kbn/core-http-server';
import type { IKibanaResponse, Logger, RequestHandler } from '@kbn/core/server';
import type {
DocLinksServiceSetup,
IKibanaResponse,
Logger,
RequestHandler,
} from '@kbn/core/server';
import { transformError } from '@kbn/securitysolution-es-utils';
import { buildRouteValidationWithZod } from '@kbn/zod-helpers';
import type {
Expand All @@ -19,7 +24,10 @@ import {
BulkDeleteRulesRequestBody,
validateQueryRuleByIds,
} from '../../../../../../../common/api/detection_engine/rule_management';
import { DETECTION_ENGINE_RULES_BULK_DELETE } from '../../../../../../../common/constants';
import {
DETECTION_ENGINE_RULES_BULK_ACTION,
DETECTION_ENGINE_RULES_BULK_DELETE,
} from '../../../../../../../common/constants';
import type {
SecuritySolutionPluginRouter,
SecuritySolutionRequestHandlerContext,
Expand Down Expand Up @@ -48,7 +56,11 @@ type Handler = RequestHandler<
*
* TODO: https://github.com/elastic/kibana/issues/193184 Delete this route and clean up the code
*/
export const bulkDeleteRulesRoute = (router: SecuritySolutionPluginRouter, logger: Logger) => {
export const bulkDeleteRulesRoute = (
router: SecuritySolutionPluginRouter,
logger: Logger,
docLinks: DocLinksServiceSetup
) => {
const handler: Handler = async (
context,
request,
Expand Down Expand Up @@ -126,6 +138,17 @@ export const bulkDeleteRulesRoute = (router: SecuritySolutionPluginRouter, logge
body: buildRouteValidationWithZod(BulkDeleteRulesRequestBody),
},
},
options: {
deprecated: {
documentationUrl: docLinks.links.securitySolution.legacyBulkApiDeprecations,
severity: 'warning',
reason: {
type: 'migrate',
newApiMethod: 'POST',
newApiPath: DETECTION_ENGINE_RULES_BULK_ACTION,
},
},
},
},
handler
);
Expand All @@ -137,6 +160,17 @@ export const bulkDeleteRulesRoute = (router: SecuritySolutionPluginRouter, logge
body: buildRouteValidationWithZod(BulkDeleteRulesPostRequestBody),
},
},
options: {
deprecated: {
documentationUrl: docLinks.links.securitySolution.legacyBulkApiDeprecations,
severity: 'warning',
reason: {
type: 'migrate',
newApiMethod: 'POST',
newApiPath: DETECTION_ENGINE_RULES_BULK_ACTION,
},
},
},
},
handler
);
Expand Down

0 comments on commit 55399e8

Please sign in to comment.