-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…6878) # Backport This will backport the following commits from `main` to `8.x`: - [[Response Ops][Alerting] HTTP Version health API (#196690)](#196690) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julian Gernun","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-18T13:19:40Z","message":"[Response Ops][Alerting] HTTP Version health API (#196690)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/195181\r\nCloses https://github.com/elastic/kibana/issues/195182\r\n\r\nOAS descriptions and HTTP version for `GET /api/alerting/_health`","sha":"c1ac7228503de1ed4ddac4373f9a0bbf79c595c5","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor"],"title":"[Response Ops][Alerting] HTTP Version health API","number":196690,"url":"https://github.com/elastic/kibana/pull/196690","mergeCommit":{"message":"[Response Ops][Alerting] HTTP Version health API (#196690)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/195181\r\nCloses https://github.com/elastic/kibana/issues/195182\r\n\r\nOAS descriptions and HTTP version for `GET /api/alerting/_health`","sha":"c1ac7228503de1ed4ddac4373f9a0bbf79c595c5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196690","number":196690,"mergeCommit":{"message":"[Response Ops][Alerting] HTTP Version health API (#196690)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/195181\r\nCloses https://github.com/elastic/kibana/issues/195182\r\n\r\nOAS descriptions and HTTP version for `GET /api/alerting/_health`","sha":"c1ac7228503de1ed4ddac4373f9a0bbf79c595c5"}}]}] BACKPORT--> Co-authored-by: Julian Gernun <[email protected]>
- Loading branch information
1 parent
3ceb6b9
commit 44d7264
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