From f33baa36cd4cff9be2b9fb50151be655910b4433 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Tue, 5 Nov 2024 09:23:00 +0000 Subject: [PATCH] [ML] Removing validate detector endpoint (#198667) The ML UI makes no use of the validate detector endpoint in es, therefore we do not need the kibana endpoint. This can be replaced if we ever do need it, but for now it's better to not have unused internal endpoints exposed in kibana with no api tests. --- .../services/ml_api_service/index.ts | 10 ------ .../plugins/ml/server/lib/ml_client/types.ts | 3 +- .../ml/server/routes/anomaly_detectors.ts | 31 ------------------- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts index f21e67fe450f4..3552b8f006091 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts @@ -27,7 +27,6 @@ import type { JobStats, Datafeed, CombinedJob, - Detector, AnalysisConfig, ModelSnapshot, IndicesOptions, @@ -350,15 +349,6 @@ export function mlApiProvider(httpService: HttpService) { }); }, - validateDetector({ detector }: { detector: Detector }) { - const body = JSON.stringify(detector); - return httpService.http({ - path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/_validate/detector`, - method: 'POST', - body, - }); - }, - forecast({ jobId, duration, diff --git a/x-pack/plugins/ml/server/lib/ml_client/types.ts b/x-pack/plugins/ml/server/lib/ml_client/types.ts index 93977257cdc22..ca7b36df8f208 100644 --- a/x-pack/plugins/ml/server/lib/ml_client/types.ts +++ b/x-pack/plugins/ml/server/lib/ml_client/types.ts @@ -121,8 +121,7 @@ export type MlClientParams = | Parameters | Parameters | Parameters - | Parameters - | Parameters; + | Parameters; export type MlGetADParams = Parameters | Parameters; diff --git a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts index 8cd9f45a4217e..4c75b7a85556a 100644 --- a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts +++ b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts @@ -349,37 +349,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - router.versioned - .post({ - path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/_validate/detector`, - access: 'internal', - options: { - tags: ['access:ml:canCreateJob'], - }, - summary: 'Validates detector', - description: 'Validates specified detector.', - }) - .addVersion( - { - version: '1', - validate: { - request: { - body: schema.any(), - }, - }, - }, - routeGuard.fullLicenseAPIGuard(async ({ mlClient, request, response }) => { - try { - const body = await mlClient.validateDetector({ body: request.body }); - return response.ok({ - body, - }); - } catch (e) { - return response.customError(wrapError(e)); - } - }) - ); - router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_forecast/{forecastId}`,