Skip to content

Commit 08d0717

Browse files
adcoelhokibanamachinelcawl
authored
[ResponseOps][MaintenanceWindow] Public maintenance window API (#216756)
Closes #198685 ## Summary This PR creates a public Maintenance Window API. The work was done on a feature branch over multiple separate PRs. Here we will merge the feature branch into `main`. - #209734 - #213694 - #214747 - #213771 The [documentation PR](#212377) still needs to be merged. ## Release Notes Publish new public APIs for the Maintenance Window. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: lcawl <[email protected]>
1 parent 334ca2a commit 08d0717

File tree

187 files changed

+3739
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+3739
-395
lines changed

.buildkite/scripts/steps/checks/capture_oas_snapshot.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ cmd="node scripts/capture_oas_snapshot \
1919
--include-path /api/fleet \
2020
--include-path /api/dashboards \
2121
--include-path /api/saved_objects/_import \
22-
--include-path /api/saved_objects/_export"
22+
--include-path /api/saved_objects/_export \
23+
--include-path /api/alerting/maintenance_window"
2324
if is_pr && ! is_auto_commit_disabled; then
2425
cmd="$cmd --update"
2526
fi

oas_docs/overlays/kibana.overlays.shared.yaml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ info:
44
title: Overlays that are applicable to both serverless and non-serverless documentas
55
version: 0.0.1
66
actions:
7-
# Add some tag descriptions and displayNames
7+
# Add some tag descriptions and displayNames
8+
- target: '$.tags[?(@.name=="maintenance-window")]'
9+
description: Change tag description and displayName
10+
update:
11+
description: >
12+
You can schedule single or recurring maintenance windows to temporarily reduce rule notifications.
13+
For example, a maintenance window prevents false alarms during planned outages.
14+
externalDocs:
15+
description: Maintenance window documentation
16+
url: https://www.elastic.co/docs/explore-analyze/alerts-cases/alerts/maintenance-windows
17+
x-displayName: 'Maintenance windows'
818
- target: '$.tags[?(@.name=="alerting")]'
919
description: Change tag description and displayName
1020
update:
@@ -15,7 +25,7 @@ actions:
1525
externalDocs:
1626
description: Alerting documentation
1727
url: https://www.elastic.co/docs/explore-analyze/alerts-cases/alerts
18-
x-displayName: "Alerting"
28+
x-displayName: 'Alerting'
1929
- target: '$.tags[?(@.name=="cases")]'
2030
description: Change tag description and displayName
2131
update:
@@ -26,7 +36,7 @@ actions:
2636
externalDocs:
2737
description: Cases documentation
2838
url: https://www.elastic.co/docs/explore-analyze/alerts-cases/cases
29-
x-displayName: "Cases"
39+
x-displayName: 'Cases'
3040
- target: '$.tags[?(@.name=="connectors")]'
3141
description: Change tag description and displayName
3242
update:
@@ -36,45 +46,45 @@ actions:
3646
externalDocs:
3747
description: Connector documentation
3848
url: https://www.elastic.co/docs/reference/kibana/connectors-kibana
39-
x-displayName: "Connectors"
40-
# Add some spaces API examples
49+
x-displayName: 'Connectors'
50+
# Add some spaces API examples
4151
- target: "$.paths['/api/spaces/space']['post']"
42-
description: "Add example to create space API"
52+
description: 'Add example to create space API'
4353
update:
4454
requestBody:
4555
content:
4656
application/json:
4757
examples:
4858
createSpaceRequest:
49-
$ref: "../examples/create_space_request.yaml"
59+
$ref: '../examples/create_space_request.yaml'
5060
- target: "$.paths['/api/spaces/space/{id}']['put']"
51-
description: "Add example to update space API"
61+
description: 'Add example to update space API'
5262
update:
5363
requestBody:
5464
content:
5565
application/json:
5666
examples:
5767
updateSpaceRequest:
58-
$ref: "../examples/update_space_request.yaml"
68+
$ref: '../examples/update_space_request.yaml'
5969
- target: "$.paths['/api/spaces/space/{id}']['get']"
60-
description: "Add example to get space API"
70+
description: 'Add example to get space API'
6171
update:
6272
responses:
6373
200:
6474
content:
6575
application/json:
6676
examples:
6777
getSpaceResponseExample:
68-
$ref: "../examples/get_space_response.yaml"
78+
$ref: '../examples/get_space_response.yaml'
6979
- target: "$.paths['/api/spaces/space']['get']"
70-
description: "Add example to get all spaces API"
80+
description: 'Add example to get all spaces API'
7181
update:
7282
responses:
7383
200:
7484
content:
7585
application/json:
7686
examples:
7787
getSpacesResponseExample1:
78-
$ref: "../examples/get_spaces_response1.yaml"
88+
$ref: '../examples/get_spaces_response1.yaml'
7989
getSpacesResponseExample2:
80-
$ref: "../examples/get_spaces_response2.yaml"
90+
$ref: '../examples/get_spaces_response2.yaml'

x-pack/platform/plugins/shared/alerting/common/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ export {
209209

210210
export const LEGACY_BASE_ALERT_API_PATH = '/api/alerts';
211211
export const BASE_ALERTING_API_PATH = '/api/alerting';
212+
export const BASE_MAINTENANCE_WINDOW_API_PATH = '/api/maintenance_window';
213+
214+
// Internal
212215
export const INTERNAL_BASE_ALERTING_API_PATH = '/internal/alerting' as const;
213216
export const INTERNAL_ALERTING_SNOOZE_RULE =
214217
`${INTERNAL_BASE_ALERTING_API_PATH}/rule/{id}/_snooze` as const;
@@ -242,6 +245,14 @@ export const INTERNAL_ALERTING_GAPS_GET_SUMMARY_BY_RULE_IDS_API_PATH =
242245
export const INTERNAL_ALERTING_GAPS_FILL_BY_ID_API_PATH =
243246
`${INTERNAL_ALERTING_GAPS_API_PATH}/_fill_by_id` as const;
244247

248+
// External
249+
export const ARCHIVE_MAINTENANCE_WINDOW_API_PATH = `${BASE_MAINTENANCE_WINDOW_API_PATH}/{id}/_archive`;
250+
export const UNARCHIVE_MAINTENANCE_WINDOW_API_PATH = `${BASE_MAINTENANCE_WINDOW_API_PATH}/{id}/_unarchive`;
251+
export const CREATE_MAINTENANCE_WINDOW_API_PATH = BASE_MAINTENANCE_WINDOW_API_PATH;
252+
export const GET_MAINTENANCE_WINDOW_API_PATH = `${BASE_MAINTENANCE_WINDOW_API_PATH}/{id}`;
253+
export const UPDATE_MAINTENANCE_WINDOW_API_PATH = `${BASE_MAINTENANCE_WINDOW_API_PATH}/{id}`;
254+
export const DELETE_MAINTENANCE_WINDOW_API_PATH = `${BASE_MAINTENANCE_WINDOW_API_PATH}/{id}`;
255+
245256
export const ALERTING_FEATURE_ID = 'alerts';
246257
export const MONITORING_HISTORY_LIMIT = 200;
247258
export const ENABLE_MAINTENANCE_WINDOWS = true;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export { archiveMaintenanceWindowRequestParamsSchema } from './schemas/latest';
9+
export type {
10+
ArchiveMaintenanceWindowRequestParams,
11+
ArchiveMaintenanceWindowResponse,
12+
} from './types/latest';
13+
14+
export { archiveMaintenanceWindowRequestParamsSchema as archiveMaintenanceWindowRequestParamsSchemaV1 } from './schemas/v1';
15+
16+
export type {
17+
ArchiveMaintenanceWindowRequestParams as ArchiveMaintenanceWindowRequestParamsV1,
18+
ArchiveMaintenanceWindowResponse as ArchiveMaintenanceWindowResponseV1,
19+
} from './types/latest';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export { archiveMaintenanceWindowRequestParamsSchema } from './v1';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { schema } from '@kbn/config-schema';
9+
10+
export const archiveMaintenanceWindowRequestParamsSchema = schema.object({
11+
id: schema.string({
12+
meta: {
13+
description: 'The identifier for the maintenance window to be archived.',
14+
},
15+
}),
16+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export type { ArchiveMaintenanceWindowRequestParams, ArchiveMaintenanceWindowResponse } from './v1';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import type { TypeOf } from '@kbn/config-schema';
9+
import type { MaintenanceWindowResponseV1 } from '../../../response';
10+
import type { archiveMaintenanceWindowRequestParamsSchemaV1 } from '..';
11+
12+
export type ArchiveMaintenanceWindowRequestParams = TypeOf<
13+
typeof archiveMaintenanceWindowRequestParamsSchemaV1
14+
>;
15+
16+
export interface ArchiveMaintenanceWindowResponse {
17+
body: MaintenanceWindowResponseV1;
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export { createMaintenanceWindowRequestBodySchema } from './schemas/latest';
9+
export type {
10+
CreateMaintenanceWindowRequestBody,
11+
CreateMaintenanceWindowResponse,
12+
} from './types/latest';
13+
14+
export { createMaintenanceWindowRequestBodySchema as createMaintenanceWindowRequestBodySchemaV1 } from './schemas/v1';
15+
export type {
16+
CreateMaintenanceWindowRequestBody as CreateMaintenanceWindowRequestBodyV1,
17+
CreateMaintenanceWindowResponse as CreateMaintenanceWindowResponseV1,
18+
} from './types/v1';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export { createMaintenanceWindowRequestBodySchema } from './v1';

0 commit comments

Comments
 (0)