Skip to content

Commit 4ffa5a5

Browse files
authored
[8.18] [Detection Engine][Docs] Updating examples to meet old ascii docs (#207558) (#209942)
# Backport This will backport the following commits from `main` to `8.18`: - [[Detection Engine][Docs] Updating examples to meet old ascii docs (#207558)](#207558) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Yara Tercero","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-05T07:02:48Z","message":"[Detection Engine][Docs] Updating examples to meet old ascii docs (#207558)\n\n# Summary\r\n\r\nAs part of the effort to add missing content for Security APIs, this PR\r\nintroduces a few missing request, response, and parameter examples for\r\nDetection Engine Alert and migration APIs.","sha":"d4199dcac1f0bff5f3511e79a860c77534b35c74","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Detection Engine","v8.16.0","backport:version","v8.17.0","v8.18.0","v9.1.0"],"title":"[Detection Engine][Docs] Updating examples to meet old ascii docs","number":207558,"url":"https://github.com/elastic/kibana/pull/207558","mergeCommit":{"message":"[Detection Engine][Docs] Updating examples to meet old ascii docs (#207558)\n\n# Summary\r\n\r\nAs part of the effort to add missing content for Security APIs, this PR\r\nintroduces a few missing request, response, and parameter examples for\r\nDetection Engine Alert and migration APIs.","sha":"d4199dcac1f0bff5f3511e79a860c77534b35c74"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.16","8.17","8.18"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207558","number":207558,"mergeCommit":{"message":"[Detection Engine][Docs] Updating examples to meet old ascii docs (#207558)\n\n# Summary\r\n\r\nAs part of the effort to add missing content for Security APIs, this PR\r\nintroduces a few missing request, response, and parameter examples for\r\nDetection Engine Alert and migration APIs.","sha":"d4199dcac1f0bff5f3511e79a860c77534b35c74"}}]}] BACKPORT-->
1 parent 5f58a5b commit 4ffa5a5

26 files changed

+1609
-113
lines changed

oas_docs/output/kibana.serverless.yaml

Lines changed: 269 additions & 24 deletions
Large diffs are not rendered by default.

oas_docs/output/kibana.yaml

Lines changed: 340 additions & 18 deletions
Large diffs are not rendered by default.

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/alert_assignees/set_alert_assignees_route.gen.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,14 @@
1515
*/
1616

1717
import { z } from '@kbn/zod';
18+
import { isNonEmptyString } from '@kbn/zod-helpers';
1819

1920
import { AlertIds } from '../../model/alert.gen';
20-
import { NonEmptyString } from '../../model/primitives.gen';
2121

2222
export type AlertAssignees = z.infer<typeof AlertAssignees>;
2323
export const AlertAssignees = z.object({
24-
/**
25-
* A list of users ids to assign.
26-
*/
27-
add: z.array(NonEmptyString),
28-
/**
29-
* A list of users ids to unassign.
30-
*/
31-
remove: z.array(NonEmptyString),
24+
add: z.array(z.string().min(1).superRefine(isNonEmptyString)),
25+
remove: z.array(z.string().min(1).superRefine(isNonEmptyString)),
3226
});
3327

3428
export type SetAlertAssigneesRequestBody = z.infer<typeof SetAlertAssigneesRequestBody>;
@@ -37,9 +31,6 @@ export const SetAlertAssigneesRequestBody = z.object({
3731
* Details about the assignees to assign and unassign.
3832
*/
3933
assignees: AlertAssignees,
40-
/**
41-
* List of alerts ids to assign and unassign passed assignees.
42-
*/
4334
ids: AlertIds,
4435
});
4536
export type SetAlertAssigneesRequestBodyInput = z.input<typeof SetAlertAssigneesRequestBody>;

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/alert_assignees/set_alert_assignees_route.schema.yaml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,42 @@ paths:
2828
description: Details about the assignees to assign and unassign.
2929
ids:
3030
$ref: '../../model/alert.schema.yaml#/components/schemas/AlertIds'
31-
description: List of alerts ids to assign and unassign passed assignees.
31+
examples:
32+
add:
33+
value:
34+
assignees:
35+
add: ['u_MxY0jbrft7EcfC6iNZSUGeI_n6iYrSwZj5mWF5EqmSU_0']
36+
remove: []
37+
ids: ['681c2a707335aa7df5f349b70013d87254746191712ecf0ced9b3e2d538503a6']
38+
remove:
39+
value:
40+
assignees:
41+
add: []
42+
remove: ['u_MxY0jbrft7EcfC6iNZSUGeI_n6iYrSwZj5mWF5EqmSU_0']
43+
ids: ['681c2a707335aa7df5f349b70013d87254746191712ecf0ced9b3e2d538503a6']
3244
responses:
3345
200:
3446
description: Indicates a successful call.
47+
content:
48+
application/ndjson:
49+
examples:
50+
add:
51+
value:
52+
took: 76,
53+
timed_out: false,
54+
total: 1,
55+
updated: 1,
56+
deleted: 0,
57+
batches: 1,
58+
version_conflicts: 0,
59+
noops: 0,
60+
retries:
61+
- bulk: 0,
62+
- search: 0
63+
throttled_millis: 0,
64+
requests_per_second: -1,
65+
throttled_until_millis: 0,
66+
failures: []
3567
400:
3668
description: Invalid request.
3769

@@ -46,10 +78,14 @@ components:
4678
add:
4779
type: array
4880
items:
49-
$ref: '../../model/primitives.schema.yaml#/components/schemas/NonEmptyString'
50-
description: A list of users ids to assign.
81+
type: string
82+
format: nonempty
83+
minLength: 1
84+
description: A list of users ids to assign.
5185
remove:
5286
type: array
5387
items:
54-
$ref: '../../model/primitives.schema.yaml#/components/schemas/NonEmptyString'
55-
description: A list of users ids to unassign.
88+
type: string
89+
format: nonempty
90+
minLength: 1
91+
description: A list of users ids to unassign.

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/alert_tags/set_alert_tags/set_alert_tags.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import { z } from '@kbn/zod';
1818

1919
import { AlertIds, AlertTags } from '../../../model/alert.gen';
2020

21+
/**
22+
* Object with list of tags to add and remove.
23+
*/
2124
export type SetAlertTags = z.infer<typeof SetAlertTags>;
2225
export const SetAlertTags = z.object({
2326
tags_to_add: AlertTags,

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/alert_tags/set_alert_tags/set_alert_tags.schema.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ paths:
3030
required:
3131
- ids
3232
- tags
33+
examples:
34+
add:
35+
value:
36+
tags:
37+
tags_to_add: ['Duplicate']
38+
tags_to_remove: []
39+
ids: ['549c7129c76cbd554aba1bd638f8a49dde95088f5832e50218358e7eca1cf16e']
40+
remove:
41+
value:
42+
tags:
43+
tags_to_add: []
44+
tags_to_remove: ['Duplicate']
45+
ids: ['549c7129c76cbd554aba1bd638f8a49dde95088f5832e50218358e7eca1cf16e']
3346
responses:
3447
200:
3548
description: Successful response
@@ -39,6 +52,24 @@ paths:
3952
type: object
4053
additionalProperties: true
4154
description: Elasticsearch update by query response
55+
examples:
56+
success:
57+
value:
58+
took: 68,
59+
timed_out: false,
60+
total: 1,
61+
updated: 1,
62+
deleted: 0,
63+
batches: 1,
64+
version_conflicts: 0,
65+
noops: 0,
66+
retries:
67+
bulk: 0,
68+
search: 0
69+
throttled_millis: 0,
70+
requests_per_second: -1,
71+
throttled_until_millis: 0,
72+
failures: []
4273
400:
4374
description: Invalid input data response
4475
content:
@@ -63,6 +94,7 @@ paths:
6394
components:
6495
schemas:
6596
SetAlertTags:
97+
description: Object with list of tags to add and remove.
6698
type: object
6799
properties:
68100
tags_to_add:

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/index_management/read_index/read_index.schema.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ paths:
2525
type: boolean
2626
nullable: true
2727
required: [name, index_mapping_outdated]
28+
examples:
29+
success:
30+
value:
31+
index_mapping_outdated: false
32+
name: '.alerts-security.alerts-default'
2833
401:
2934
description: Unsuccessful authentication response
3035
content:

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/index_management/read_privileges/read_privileges.schema.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ paths:
2929
has_encryption_key:
3030
type: boolean
3131
required: [is_authenticated, has_encryption_key]
32+
examples:
33+
success:
34+
value:
35+
username: elastic
36+
has_all_requested: true
37+
cluster:
38+
all: true
39+
monitor_ml: true
40+
manage_transform: true
41+
manage_index_templates: true
42+
monitor_transform: true
43+
manage_ml: true
44+
monitor: true
45+
manage_pipeline: true
46+
manage_api_key: true
47+
manage_security: true
48+
manage_own_api_key: true
49+
manage: true
50+
index:
51+
.alerts-security.alerts-default:
52+
all: true
53+
create: true
54+
create_doc: true
55+
create_index: true
56+
delete: true
57+
delete_index: true
58+
index: true
59+
maintenance: true
60+
manage: true
61+
monitor: true
62+
read: true
63+
view_index_metadata: true
64+
write: true
65+
application: {}
66+
is_authenticated: true
67+
has_encryption_key: true
3268
401:
3369
description: Unsuccessful authentication response
3470
content:

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/signals/query_signals/query_signals_route.schema.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,35 @@ paths:
4848
sort:
4949
$ref: '#/components/schemas/AlertsSort'
5050
description: Elasticsearch query and aggregation request
51+
examples:
52+
query:
53+
value:
54+
size: 0
55+
query:
56+
bool:
57+
filter:
58+
- bool:
59+
must: []
60+
filter:
61+
- match_phrase:
62+
kibana.alert.workflow_status: open
63+
should: []
64+
must_not:
65+
- exists:
66+
field: kibana.alert.building_block_type
67+
- range:
68+
'@timestamp':
69+
gte: 2025-01-17T08:00:00.000Z
70+
lte: 2025-01-18T07:59:59.999Z
71+
aggs:
72+
alertsByGrouping:
73+
terms:
74+
field: host.name
75+
size: 10
76+
missingFields:
77+
missing:
78+
field: host.name
79+
runtime_mappings: {}
5180
responses:
5281
200:
5382
description: Successful response
@@ -57,6 +86,31 @@ paths:
5786
type: object
5887
additionalProperties: true
5988
description: Elasticsearch search response
89+
examples:
90+
success:
91+
value:
92+
took: 0
93+
timed_out: false
94+
_shards:
95+
total: 1
96+
successful: 1
97+
skipped: 0
98+
failed: 0
99+
hits:
100+
total:
101+
value: 5
102+
relation: eq
103+
max_score: null
104+
hits: []
105+
aggregations:
106+
alertsByGrouping:
107+
doc_count_error_upper_bound: 0
108+
sum_other_doc_count: 0
109+
buckets:
110+
- key: Host-f43kkddfyc
111+
doc_count: 5
112+
missingFields:
113+
doc_count: 0
60114
400:
61115
description: Invalid input data response
62116
content:

x-pack/solutions/security/plugins/security_solution/common/api/detection_engine/signals/set_signal_status/set_signals_status_route.gen.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
*/
1616

1717
import { z } from '@kbn/zod';
18+
import { isNonEmptyString } from '@kbn/zod-helpers';
1819

19-
import { NonEmptyString } from '../../../model/primitives.gen';
2020
import { AlertStatus } from '../../../model/alert.gen';
2121

2222
export type SetAlertsStatusByIds = z.infer<typeof SetAlertsStatusByIds>;
2323
export const SetAlertsStatusByIds = z.object({
24-
signal_ids: z.array(NonEmptyString).min(1),
24+
/**
25+
* List of alert `id`s.
26+
*/
27+
signal_ids: z.array(z.string().min(1).superRefine(isNonEmptyString)).min(1),
2528
status: AlertStatus,
2629
});
2730

0 commit comments

Comments
 (0)