[Security Solution] update es connection error code placeholder (#143712)

This commit is contained in:
Joey F. Poon 2022-10-20 10:30:59 -05:00 committed by GitHub
parent d108b48d6f
commit e01b6bd5b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -79,3 +79,7 @@ export const failedFleetActionErrorCode = '424';
export const ENDPOINT_DEFAULT_PAGE = 0;
export const ENDPOINT_DEFAULT_PAGE_SIZE = 10;
export const ENDPOINT_ERROR_CODES: Record<string, number> = {
ES_CONNECTION_ERROR: -272,
};

View file

@ -17,6 +17,7 @@ import type {
import { FleetServerAgentComponentStatuses, AGENTS_INDEX } from '@kbn/fleet-plugin/common';
import moment from 'moment';
import { BaseDataGenerator } from './base_data_generator';
import { ENDPOINT_ERROR_CODES } from '../constants';
// List of computed (as in, done in code is kibana via
// https://github.com/elastic/kibana/blob/main/x-pack/plugins/fleet/common/services/agent_status.ts#L13-L44
@ -91,7 +92,7 @@ export class FleetAgentGenerator extends BaseDataGenerator<Agent> {
componentStatus === 'failed'
? {
error: {
code: 123,
code: ENDPOINT_ERROR_CODES.ES_CONNECTION_ERROR,
message: 'Unable to connect to Elasticsearch',
},
}

View file

@ -8,6 +8,8 @@
import { i18n } from '@kbn/i18n';
import type { DocLinks } from '@kbn/doc-links';
import { ENDPOINT_ERROR_CODES } from '../../../../common/endpoint/constants';
type PackageActions = 'es_connection' | 'policy_failure';
export const titles = Object.freeze(
@ -93,7 +95,7 @@ export class PackageActionFormatter {
}
private getKeyFromErrorCode(code: number): PackageActions {
if (code === 123) {
if (code === ENDPOINT_ERROR_CODES.ES_CONNECTION_ERROR) {
return 'es_connection';
} else if (code === 124) {
return 'policy_failure';