From 107d02c0e2979860f0da86a4ebacd49fd10390e8 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 23 Apr 2021 14:11:03 +0100 Subject: [PATCH] [ML] removing unused notification settings endpoint (#98109) * [ML] removing unused notification settings endpoint * removing route init function * test commit * removing test comment --- .../services/ml_api_service/index.ts | 7 --- x-pack/plugins/ml/server/plugin.ts | 2 - x-pack/plugins/ml/server/routes/apidoc.json | 3 -- .../ml/server/routes/notification_settings.ts | 45 ------------------- 4 files changed, 57 deletions(-) delete mode 100644 x-pack/plugins/ml/server/routes/notification_settings.ts 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 3b6b948132c43..bf6b752faa8da 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 @@ -361,13 +361,6 @@ export function mlApiServicesProvider(httpService: HttpService) { }); }, - getNotificationSettings() { - return httpService.http({ - path: `${basePath()}/notification_settings`, - method: 'GET', - }); - }, - checkIndexExists({ index }: { index: string }) { const body = JSON.stringify({ index }); diff --git a/x-pack/plugins/ml/server/plugin.ts b/x-pack/plugins/ml/server/plugin.ts index 746d290950704..213be9421c41d 100644 --- a/x-pack/plugins/ml/server/plugin.ts +++ b/x-pack/plugins/ml/server/plugin.ts @@ -42,7 +42,6 @@ import { jobRoutes } from './routes/anomaly_detectors'; import { jobServiceRoutes } from './routes/job_service'; import { savedObjectsRoutes } from './routes/saved_objects'; import { jobValidationRoutes } from './routes/job_validation'; -import { notificationRoutes } from './routes/notification_settings'; import { resultsServiceRoutes } from './routes/results_service'; import { systemRoutes } from './routes/system'; import { MlLicense } from '../common/license'; @@ -181,7 +180,6 @@ export class MlServerPlugin jobAuditMessagesRoutes(routeInit); jobRoutes(routeInit); jobServiceRoutes(routeInit); - notificationRoutes(routeInit); resultsServiceRoutes(routeInit); jobValidationRoutes(routeInit); savedObjectsRoutes(routeInit, { diff --git a/x-pack/plugins/ml/server/routes/apidoc.json b/x-pack/plugins/ml/server/routes/apidoc.json index 55f66b354df27..7b54e48099d60 100644 --- a/x-pack/plugins/ml/server/routes/apidoc.json +++ b/x-pack/plugins/ml/server/routes/apidoc.json @@ -127,9 +127,6 @@ "ValidateCardinality", "ValidateJob", - "NotificationSettings", - "GetNotificationSettings", - "DatafeedService", "CreateDatafeed", "PreviewDatafeed", diff --git a/x-pack/plugins/ml/server/routes/notification_settings.ts b/x-pack/plugins/ml/server/routes/notification_settings.ts deleted file mode 100644 index 3e0a74a32ec8e..0000000000000 --- a/x-pack/plugins/ml/server/routes/notification_settings.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { wrapError } from '../client/error_wrapper'; -import { RouteInitialization } from '../types'; - -/** - * Routes for notification settings - */ -export function notificationRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup NotificationSettings - * - * @api {get} /api/ml/notification_settings Get notification settings - * @apiName GetNotificationSettings - * @apiDescription Returns cluster notification settings - */ - router.get( - { - path: '/api/ml/notification_settings', - validate: false, - options: { - tags: ['access:ml:canAccessML'], - }, - }, - routeGuard.fullLicenseAPIGuard(async ({ client, response }) => { - try { - const { body } = await client.asCurrentUser.cluster.getSettings({ - include_defaults: true, - filter_path: '**.xpack.notification', - }); - - return response.ok({ - body, - }); - } catch (e) { - return response.customError(wrapError(e)); - } - }) - ); -}