From 4fea956835e2ba10c4cc00607a5ec924a2d3fc12 Mon Sep 17 00:00:00 2001 From: Ashokaditya <1849116+ashokaditya@users.noreply.github.com> Date: Mon, 18 Oct 2021 16:43:51 +0200 Subject: [PATCH] rename review changes --- .../security_solution/common/endpoint/constants.ts | 9 +-------- .../server/endpoint/routes/actions/isolation.ts | 4 ++-- .../server/endpoint/utils/audit_log_helpers.ts | 4 ++-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/security_solution/common/endpoint/constants.ts b/x-pack/plugins/security_solution/common/endpoint/constants.ts index 749193f89f1a1..178a2b68a4aab 100644 --- a/x-pack/plugins/security_solution/common/endpoint/constants.ts +++ b/x-pack/plugins/security_solution/common/endpoint/constants.ts @@ -61,11 +61,4 @@ export const UNISOLATE_HOST_ROUTE = `${BASE_ENDPOINT_ROUTE}/unisolate`; export const ENDPOINT_ACTION_LOG_ROUTE = `/api/endpoint/action_log/{agent_id}`; export const ACTION_STATUS_ROUTE = `/api/endpoint/action_status`; -// From https://github.com/for-GET/know-your-http-well/blob/master/json/status-codes.json -// similar to x-pack/plugins/apm/public/components/shared/Summary/HttpStatusBadge/statusCodes.ts -export const statusCodes: { [key: string]: { code: string; meaning: string } } = { - '424': { - code: '424', - meaning: 'Failed Dependency', - }, -}; +export const failedFleetActionErrorCode = '424'; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts index 324e9ed4aeb29..ca47a1d4550f6 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.ts @@ -17,7 +17,7 @@ import { ENDPOINT_ACTION_RESPONSES_DS, ISOLATE_HOST_ROUTE, UNISOLATE_HOST_ROUTE, - statusCodes, + failedFleetActionErrorCode, } from '../../../../common/endpoint/constants'; import { AGENT_ACTIONS_INDEX } from '../../../../../fleet/common'; import { @@ -80,7 +80,7 @@ const createFailedActionResponseEntry = async ({ body: { ...doc, error: { - code: statusCodes['424'].code, + failedFleetActionErrorCode, message: 'Failed to deliver action request to fleet', }, }, diff --git a/x-pack/plugins/security_solution/server/endpoint/utils/audit_log_helpers.ts b/x-pack/plugins/security_solution/server/endpoint/utils/audit_log_helpers.ts index 17fecdb203eeb..f75b265bf24d7 100644 --- a/x-pack/plugins/security_solution/server/endpoint/utils/audit_log_helpers.ts +++ b/x-pack/plugins/security_solution/server/endpoint/utils/audit_log_helpers.ts @@ -13,7 +13,7 @@ import { AGENT_ACTIONS_INDEX, AGENT_ACTIONS_RESULTS_INDEX } from '../../../../fl import { ENDPOINT_ACTIONS_INDEX, ENDPOINT_ACTION_RESPONSES_INDEX, - statusCodes, + failedFleetActionErrorCode, } from '../../../common/endpoint/constants'; import { SecuritySolutionRequestHandlerContext } from '../../types'; import { @@ -57,7 +57,7 @@ export const getUniqueLogData = (activityLogEntries: ActivityLogEntry[]): Activi .filter( (e) => e.type === ActivityLogItemTypes.RESPONSE && - e.item.data.error?.code === statusCodes['424'].code + e.item.data.error?.code === failedFleetActionErrorCode ) .map( (e: ActivityLogEntry) => (e.item.data as LogsEndpointActionResponse).EndpointActions.action_id