Skip to content

Commit cb6aaf3

Browse files
[8.19] feat(slo): bulk delete APIs (elastic#217405) (elastic#219308)
# Backport This will backport the following commits from `main` to `8.19`: - [feat(slo): bulk delete APIs (elastic#217405)](elastic#217405) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Kevin Delemme","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-25T00:11:26Z","message":"feat(slo): bulk delete APIs (elastic#217405)","sha":"18826975c7321cfa1a11d392d852e43e179d4f2f","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0"],"title":"feat(slo): bulk delete APIs","number":217405,"url":"https://github.com/elastic/kibana/pull/217405","mergeCommit":{"message":"feat(slo): bulk delete APIs (elastic#217405)","sha":"18826975c7321cfa1a11d392d852e43e179d4f2f"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217405","number":217405,"mergeCommit":{"message":"feat(slo): bulk delete APIs (elastic#217405)","sha":"18826975c7321cfa1a11d392d852e43e179d4f2f"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
1 parent de70cc9 commit cb6aaf3

File tree

28 files changed

+1395
-84
lines changed

28 files changed

+1395
-84
lines changed

oas_docs/output/kibana.serverless.yaml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45897,6 +45897,91 @@ paths:
4589745897
summary: Create an SLO
4589845898
tags:
4589945899
- slo
45900+
/s/{spaceId}/api/observability/slos/_bulk_delete:
45901+
post:
45902+
description: |
45903+
Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint.
45904+
operationId: bulkDeleteOp
45905+
parameters:
45906+
- $ref: '#/components/parameters/SLOs_kbn_xsrf'
45907+
- $ref: '#/components/parameters/SLOs_space_id'
45908+
requestBody:
45909+
content:
45910+
application/json:
45911+
schema:
45912+
$ref: '#/components/schemas/SLOs_bulk_delete_request'
45913+
required: true
45914+
responses:
45915+
'200':
45916+
content:
45917+
application/json:
45918+
schema:
45919+
$ref: '#/components/schemas/SLOs_bulk_delete_response'
45920+
description: Successful response
45921+
'400':
45922+
content:
45923+
application/json:
45924+
schema:
45925+
$ref: '#/components/schemas/SLOs_400_response'
45926+
description: Bad request
45927+
'401':
45928+
content:
45929+
application/json:
45930+
schema:
45931+
$ref: '#/components/schemas/SLOs_401_response'
45932+
description: Unauthorized response
45933+
'403':
45934+
content:
45935+
application/json:
45936+
schema:
45937+
$ref: '#/components/schemas/SLOs_403_response'
45938+
description: Unauthorized response
45939+
summary: Bulk delete SLO definitions and their associated summary and rollup data.
45940+
tags:
45941+
- slo
45942+
/s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}:
45943+
get:
45944+
description: |
45945+
Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation.
45946+
operationId: bulkDeleteStatusOp
45947+
parameters:
45948+
- $ref: '#/components/parameters/SLOs_kbn_xsrf'
45949+
- $ref: '#/components/parameters/SLOs_space_id'
45950+
- description: The task id of the bulk delete operation
45951+
in: path
45952+
name: taskId
45953+
required: true
45954+
schema:
45955+
example: 8853df00-ae2e-11ed-90af-09bb6422b258
45956+
type: string
45957+
responses:
45958+
'200':
45959+
content:
45960+
application/json:
45961+
schema:
45962+
$ref: '#/components/schemas/SLOs_bulk_delete_status_response'
45963+
description: Successful response
45964+
'400':
45965+
content:
45966+
application/json:
45967+
schema:
45968+
$ref: '#/components/schemas/SLOs_400_response'
45969+
description: Bad request
45970+
'401':
45971+
content:
45972+
application/json:
45973+
schema:
45974+
$ref: '#/components/schemas/SLOs_401_response'
45975+
description: Unauthorized response
45976+
'403':
45977+
content:
45978+
application/json:
45979+
schema:
45980+
$ref: '#/components/schemas/SLOs_403_response'
45981+
description: Unauthorized response
45982+
summary: Retrieve the status of the bulk deletion
45983+
tags:
45984+
- slo
4590045985
/s/{spaceId}/api/observability/slos/_bulk_purge_rollup:
4590145986
post:
4590245987
description: |
@@ -62085,6 +62170,62 @@ components:
6208562170
example: occurrences
6208662171
title: Budgeting method
6208762172
type: string
62173+
SLOs_bulk_delete_request:
62174+
description: |
62175+
The bulk delete SLO request takes a list of SLOs Definition id to delete.
62176+
properties:
62177+
list:
62178+
description: An array of SLO Definition id
62179+
items:
62180+
description: The SLO Definition id
62181+
example: 8853df00-ae2e-11ed-90af-09bb6422b258
62182+
type: string
62183+
type: array
62184+
required:
62185+
- list
62186+
title: Bulk delete SLO request
62187+
type: object
62188+
SLOs_bulk_delete_response:
62189+
description: |
62190+
The bulk delete SLO response returns a taskId that can be used to poll for its status
62191+
properties:
62192+
taskId:
62193+
description: The taskId of the bulk delete operation
62194+
example: d08506b7-f0e8-4f8b-a06a-a83940f4db91
62195+
type: string
62196+
title: Bulk delete SLO response
62197+
type: object
62198+
SLOs_bulk_delete_status_response:
62199+
description: Indicates if the bulk deletion is completed, with the detailed results of the operation.
62200+
properties:
62201+
error:
62202+
description: The error message if the bulk deletion operation failed
62203+
example: Task not found
62204+
type: string
62205+
isDone:
62206+
description: Indicates if the bulk deletion operation is completed
62207+
example: true
62208+
type: boolean
62209+
results:
62210+
description: The results of the bulk deletion operation, including the success status and any errors for each SLO
62211+
items:
62212+
type: object
62213+
properties:
62214+
error:
62215+
description: The error message if the deletion operation failed for this SLO
62216+
example: SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found
62217+
type: string
62218+
id:
62219+
description: The ID of the SLO that was deleted
62220+
example: d08506b7-f0e8-4f8b-a06a-a83940f4db91
62221+
type: string
62222+
success:
62223+
description: The result of the deletion operation for this SLO
62224+
example: true
62225+
type: boolean
62226+
type: array
62227+
title: The status of the bulk deletion
62228+
type: object
6208862229
SLOs_bulk_purge_rollup_request:
6208962230
description: |
6209062231
The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated.

oas_docs/output/kibana.yaml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24918,6 +24918,91 @@ paths:
2491824918
summary: Create an SLO
2491924919
tags:
2492024920
- slo
24921+
/s/{spaceId}/api/observability/slos/_bulk_delete:
24922+
post:
24923+
description: |
24924+
Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint.
24925+
operationId: bulkDeleteOp
24926+
parameters:
24927+
- $ref: '#/components/parameters/SLOs_kbn_xsrf'
24928+
- $ref: '#/components/parameters/SLOs_space_id'
24929+
requestBody:
24930+
content:
24931+
application/json:
24932+
schema:
24933+
$ref: '#/components/schemas/SLOs_bulk_delete_request'
24934+
required: true
24935+
responses:
24936+
'200':
24937+
content:
24938+
application/json:
24939+
schema:
24940+
$ref: '#/components/schemas/SLOs_bulk_delete_response'
24941+
description: Successful response
24942+
'400':
24943+
content:
24944+
application/json:
24945+
schema:
24946+
$ref: '#/components/schemas/SLOs_400_response'
24947+
description: Bad request
24948+
'401':
24949+
content:
24950+
application/json:
24951+
schema:
24952+
$ref: '#/components/schemas/SLOs_401_response'
24953+
description: Unauthorized response
24954+
'403':
24955+
content:
24956+
application/json:
24957+
schema:
24958+
$ref: '#/components/schemas/SLOs_403_response'
24959+
description: Unauthorized response
24960+
summary: Bulk delete SLO definitions and their associated summary and rollup data.
24961+
tags:
24962+
- slo
24963+
/s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}:
24964+
get:
24965+
description: |
24966+
Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation.
24967+
operationId: bulkDeleteStatusOp
24968+
parameters:
24969+
- $ref: '#/components/parameters/SLOs_kbn_xsrf'
24970+
- $ref: '#/components/parameters/SLOs_space_id'
24971+
- description: The task id of the bulk delete operation
24972+
in: path
24973+
name: taskId
24974+
required: true
24975+
schema:
24976+
example: 8853df00-ae2e-11ed-90af-09bb6422b258
24977+
type: string
24978+
responses:
24979+
'200':
24980+
content:
24981+
application/json:
24982+
schema:
24983+
$ref: '#/components/schemas/SLOs_bulk_delete_status_response'
24984+
description: Successful response
24985+
'400':
24986+
content:
24987+
application/json:
24988+
schema:
24989+
$ref: '#/components/schemas/SLOs_400_response'
24990+
description: Bad request
24991+
'401':
24992+
content:
24993+
application/json:
24994+
schema:
24995+
$ref: '#/components/schemas/SLOs_401_response'
24996+
description: Unauthorized response
24997+
'403':
24998+
content:
24999+
application/json:
25000+
schema:
25001+
$ref: '#/components/schemas/SLOs_403_response'
25002+
description: Unauthorized response
25003+
summary: Retrieve the status of the bulk deletion
25004+
tags:
25005+
- slo
2492125006
/s/{spaceId}/api/observability/slos/_bulk_purge_rollup:
2492225007
post:
2492325008
description: |
@@ -46127,6 +46212,62 @@ components:
4612746212
example: occurrences
4612846213
title: Budgeting method
4612946214
type: string
46215+
SLOs_bulk_delete_request:
46216+
description: |
46217+
The bulk delete SLO request takes a list of SLOs Definition id to delete.
46218+
properties:
46219+
list:
46220+
description: An array of SLO Definition id
46221+
items:
46222+
description: The SLO Definition id
46223+
example: 8853df00-ae2e-11ed-90af-09bb6422b258
46224+
type: string
46225+
type: array
46226+
required:
46227+
- list
46228+
title: Bulk delete SLO request
46229+
type: object
46230+
SLOs_bulk_delete_response:
46231+
description: |
46232+
The bulk delete SLO response returns a taskId that can be used to poll for its status
46233+
properties:
46234+
taskId:
46235+
description: The taskId of the bulk delete operation
46236+
example: d08506b7-f0e8-4f8b-a06a-a83940f4db91
46237+
type: string
46238+
title: Bulk delete SLO response
46239+
type: object
46240+
SLOs_bulk_delete_status_response:
46241+
description: Indicates if the bulk deletion is completed, with the detailed results of the operation.
46242+
properties:
46243+
error:
46244+
description: The error message if the bulk deletion operation failed
46245+
example: Task not found
46246+
type: string
46247+
isDone:
46248+
description: Indicates if the bulk deletion operation is completed
46249+
example: true
46250+
type: boolean
46251+
results:
46252+
description: The results of the bulk deletion operation, including the success status and any errors for each SLO
46253+
items:
46254+
type: object
46255+
properties:
46256+
error:
46257+
description: The error message if the deletion operation failed for this SLO
46258+
example: SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found
46259+
type: string
46260+
id:
46261+
description: The ID of the SLO that was deleted
46262+
example: d08506b7-f0e8-4f8b-a06a-a83940f4db91
46263+
type: string
46264+
success:
46265+
description: The result of the deletion operation for this SLO
46266+
example: true
46267+
type: boolean
46268+
type: array
46269+
title: The status of the bulk deletion
46270+
type: object
4613046271
SLOs_bulk_purge_rollup_request:
4613146272
description: |
4613246273
The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
import * as t from 'io-ts';
8+
import { sloIdSchema } from '../../schema/slo';
9+
10+
const bulkDeleteParamsSchema = t.type({
11+
body: t.type({
12+
list: t.array(sloIdSchema),
13+
}),
14+
});
15+
16+
const bulkDeleteStatusParamsSchema = t.type({
17+
path: t.type({
18+
taskId: t.string,
19+
}),
20+
});
21+
22+
type BulkDeleteInput = t.OutputOf<typeof bulkDeleteParamsSchema.props.body>;
23+
type BulkDeleteParams = t.TypeOf<typeof bulkDeleteParamsSchema.props.body>;
24+
25+
interface BulkDeleteResult {
26+
id: string;
27+
success: boolean;
28+
error?: string;
29+
}
30+
31+
interface BulkDeleteStatusResponse {
32+
isDone: boolean;
33+
results?: BulkDeleteResult[];
34+
error?: string;
35+
}
36+
37+
export type { BulkDeleteInput, BulkDeleteParams, BulkDeleteResult, BulkDeleteStatusResponse };
38+
export { bulkDeleteParamsSchema, bulkDeleteStatusParamsSchema };

x-pack/platform/packages/shared/kbn-slo-schema/src/rest_specs/routes/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export * from './fetch_historical_summary';
2424
export * from './put_settings';
2525
export * from './get_suggestions';
2626
export * from './get_slo_health';
27+
export * from './bulk_delete';

0 commit comments

Comments
 (0)