forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Alerting] HTTP Version health API (elastic#196690)
## Summary Closes elastic#195181 Closes elastic#195182 OAS descriptions and HTTP version for `GET /api/alerting/_health`
- Loading branch information
Showing
12 changed files
with
167 additions
and
31 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
x-pack/plugins/alerting/common/routes/framework/apis/health/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { healthFrameworkResponseSchema } from './schemas/latest'; | ||
export type { HealthFrameworkResponse } from './types/latest'; | ||
|
||
export { | ||
healthFrameworkResponseBodySchema as healthFrameworkResponseBodySchemaV1, | ||
healthFrameworkResponseSchema as healthFrameworkResponseSchemaV1, | ||
} from './schemas/v1'; | ||
export type { HealthFrameworkResponseBody as HealthFrameworkResponseBodyV1 } from './types/v1'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/framework/apis/health/schemas/latest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './v1'; |
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/alerting/common/routes/framework/apis/health/schemas/v1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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 { schema } from '@kbn/config-schema'; | ||
|
||
const alertingFrameworkHealthSchemaObject = { | ||
status: schema.oneOf([schema.literal('ok'), schema.literal('warn'), schema.literal('error')]), | ||
timestamp: schema.string(), | ||
}; | ||
|
||
export const healthFrameworkResponseBodySchema = schema.object({ | ||
is_sufficiently_secure: schema.boolean({ | ||
meta: { | ||
description: 'If false, security is enabled but TLS is not.', | ||
}, | ||
}), | ||
has_permanent_encryption_key: schema.boolean({ | ||
meta: { | ||
description: 'If false, the encryption key is not set', | ||
}, | ||
}), | ||
alerting_framework_health: schema.object( | ||
{ | ||
decryption_health: schema.object(alertingFrameworkHealthSchemaObject, { | ||
meta: { description: 'The timestamp and status of the alert decryption.' }, | ||
}), | ||
execution_health: schema.object(alertingFrameworkHealthSchemaObject, { | ||
meta: { description: 'The timestamp and status of the alert execution.' }, | ||
}), | ||
read_health: schema.object(alertingFrameworkHealthSchemaObject, { | ||
meta: { description: 'The timestamp and status of the alert reading events.' }, | ||
}), | ||
}, | ||
{ | ||
meta: { | ||
description: | ||
'Three substates identify the health of the alerting framework: decryptionHealth, executionHealth, and readHealth.', | ||
}, | ||
} | ||
), | ||
}); | ||
|
||
export const healthFrameworkResponseSchema = schema.object({ | ||
body: healthFrameworkResponseBodySchema, | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/framework/apis/health/types/latest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './v1'; |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/common/routes/framework/apis/health/types/v1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* 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 type { TypeOf } from '@kbn/config-schema'; | ||
|
||
import { healthFrameworkResponseBodySchemaV1, healthFrameworkResponseSchemaV1 } from '..'; | ||
|
||
export type HealthFrameworkResponseBody = TypeOf<typeof healthFrameworkResponseBodySchemaV1>; | ||
export type HealthFrameworkResponse = TypeOf<typeof healthFrameworkResponseSchemaV1>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/server/routes/framework/apis/health/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { healthRoute } from './health'; |
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/alerting/server/routes/framework/apis/health/transforms/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { transformHealthBodyResponse } from './transform_health_response/latest'; | ||
export { transformHealthBodyResponse as transformHealthBodyResponseV1 } from './transform_health_response/v1'; |
8 changes: 8 additions & 0 deletions
8
...erting/server/routes/framework/apis/health/transforms/transform_health_response/latest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './v1'; |
21 changes: 21 additions & 0 deletions
21
...s/alerting/server/routes/framework/apis/health/transforms/transform_health_response/v1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* 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 { AlertingFrameworkHealth } from '../../../../../../types'; | ||
import type { HealthFrameworkResponseBodyV1 } from '../../../../../../../common/routes/framework/apis/health'; | ||
|
||
export const transformHealthBodyResponse = ( | ||
frameworkHealth: AlertingFrameworkHealth | ||
): HealthFrameworkResponseBodyV1 => ({ | ||
is_sufficiently_secure: frameworkHealth.isSufficientlySecure, | ||
has_permanent_encryption_key: frameworkHealth.hasPermanentEncryptionKey, | ||
alerting_framework_health: { | ||
decryption_health: frameworkHealth.alertingFrameworkHealth.decryptionHealth, | ||
execution_health: frameworkHealth.alertingFrameworkHealth.executionHealth, | ||
read_health: frameworkHealth.alertingFrameworkHealth.readHealth, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters