Skip to content

Commit e105a19

Browse files
[8.18] [Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (#219883) (#220712)
# Backport This will backport the following commits from `main` to `8.18`: - [[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (#219883)](#219883) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-05-09T14:47:44Z","message":"[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (#219883)","sha":"214c5f099e61a9e0c5e893e0c417d12636e3e000","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","Team:Security Generative AI","backport:version","v9.1.0","v8.19.0","v9.0.1","v8.18.2"],"title":"[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs","number":219883,"url":"https://github.com/elastic/kibana/pull/219883","mergeCommit":{"message":"[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (#219883)","sha":"214c5f099e61a9e0c5e893e0c417d12636e3e000"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219883","number":219883,"mergeCommit":{"message":"[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (#219883)","sha":"214c5f099e61a9e0c5e893e0c417d12636e3e000"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
1 parent 27f63c0 commit e105a19

File tree

90 files changed

+4946
-873
lines changed

Some content is hidden

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

90 files changed

+4946
-873
lines changed

oas_docs/output/kibana.yaml

Lines changed: 972 additions & 135 deletions
Large diffs are not rendered by default.

x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml

Lines changed: 1065 additions & 135 deletions
Large diffs are not rendered by default.

x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml

Lines changed: 1065 additions & 135 deletions
Large diffs are not rendered by default.

x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen.ts

Lines changed: 116 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@
1616

1717
import { z } from '@kbn/zod';
1818

19-
import { NonEmptyString } from '../common_attributes.gen';
20-
19+
import {
20+
BulkActionBase,
21+
NonEmptyString,
22+
NonEmptyTimestamp,
23+
BulkCrudActionSummary,
24+
} from '../common_attributes.gen';
25+
26+
/**
27+
* Reason why the anonymization field was not modified.
28+
*/
2129
export type AnonymizationFieldsBulkActionSkipReason = z.infer<
2230
typeof AnonymizationFieldsBulkActionSkipReason
2331
>;
@@ -29,38 +37,92 @@ export type AnonymizationFieldsBulkActionSkipResult = z.infer<
2937
typeof AnonymizationFieldsBulkActionSkipResult
3038
>;
3139
export const AnonymizationFieldsBulkActionSkipResult = z.object({
40+
/**
41+
* The ID of the anonymization field that was not modified.
42+
*/
3243
id: z.string(),
44+
/**
45+
* Name of the anonymization field that was not modified.
46+
*/
3347
name: z.string().optional(),
48+
/**
49+
* Reason why the anonymization field was not modified.
50+
*/
3451
skip_reason: AnonymizationFieldsBulkActionSkipReason,
3552
});
3653

3754
export type AnonymizationFieldDetailsInError = z.infer<typeof AnonymizationFieldDetailsInError>;
3855
export const AnonymizationFieldDetailsInError = z.object({
56+
/**
57+
* The ID of the anonymization field.
58+
*/
3959
id: z.string(),
60+
/**
61+
* Name of the anonymization field.
62+
*/
4063
name: z.string().optional(),
4164
});
4265

4366
export type NormalizedAnonymizationFieldError = z.infer<typeof NormalizedAnonymizationFieldError>;
4467
export const NormalizedAnonymizationFieldError = z.object({
68+
/**
69+
* Error message.
70+
*/
4571
message: z.string(),
72+
/**
73+
* Status code of the response.
74+
*/
4675
status_code: z.number().int(),
76+
/**
77+
* Error code indicating the type of failure.
78+
*/
4779
err_code: z.string().optional(),
80+
/**
81+
* Array of anonymization fields that caused the error.
82+
*/
4883
anonymization_fields: z.array(AnonymizationFieldDetailsInError),
4984
});
5085

5186
export type AnonymizationFieldResponse = z.infer<typeof AnonymizationFieldResponse>;
5287
export const AnonymizationFieldResponse = z.object({
88+
/**
89+
* The ID of the anonymization field.
90+
*/
5391
id: NonEmptyString,
54-
timestamp: NonEmptyString.optional(),
92+
/**
93+
* Timestamp when the anonymization field was initially created.
94+
*/
95+
timestamp: NonEmptyTimestamp.optional(),
96+
/**
97+
* Name of the anonymization field.
98+
*/
5599
field: z.string(),
100+
/**
101+
* Whether this field is allowed to be sent to the model.
102+
*/
56103
allowed: z.boolean().optional(),
104+
/**
105+
* Whether this field should be anonymized.
106+
*/
57107
anonymized: z.boolean().optional(),
108+
/**
109+
* Timestamp of the last update.
110+
*/
58111
updatedAt: z.string().optional(),
112+
/**
113+
* Username of the person who last updated the field.
114+
*/
59115
updatedBy: z.string().optional(),
116+
/**
117+
* Timestamp of when the anonymization field was created.
118+
*/
60119
createdAt: z.string().optional(),
120+
/**
121+
* Username of the person who created the anonymization field.
122+
*/
61123
createdBy: z.string().optional(),
62124
/**
63-
* Kibana space
125+
* Kibana space in which this anonymization field exists.
64126
*/
65127
namespace: z.string().optional(),
66128
});
@@ -69,67 +131,98 @@ export type AnonymizationFieldsBulkCrudActionResults = z.infer<
69131
typeof AnonymizationFieldsBulkCrudActionResults
70132
>;
71133
export const AnonymizationFieldsBulkCrudActionResults = z.object({
134+
/**
135+
* List of anonymization fields successfully updated.
136+
*/
72137
updated: z.array(AnonymizationFieldResponse),
138+
/**
139+
* List of anonymization fields successfully created.
140+
*/
73141
created: z.array(AnonymizationFieldResponse),
74142
deleted: z.array(z.string()),
143+
/**
144+
* List of anonymization fields that were skipped during the operation.
145+
*/
75146
skipped: z.array(AnonymizationFieldsBulkActionSkipResult),
76147
});
77148

78-
export type BulkCrudActionSummary = z.infer<typeof BulkCrudActionSummary>;
79-
export const BulkCrudActionSummary = z.object({
80-
failed: z.number().int(),
81-
skipped: z.number().int(),
82-
succeeded: z.number().int(),
83-
total: z.number().int(),
84-
});
85-
86149
export type AnonymizationFieldsBulkCrudActionResponse = z.infer<
87150
typeof AnonymizationFieldsBulkCrudActionResponse
88151
>;
89152
export const AnonymizationFieldsBulkCrudActionResponse = z.object({
153+
/**
154+
* Indicates if the bulk action was successful.
155+
*/
90156
success: z.boolean().optional(),
157+
/**
158+
* HTTP status code returned.
159+
*/
91160
status_code: z.number().int().optional(),
161+
/**
162+
* Message providing information about the bulk action result.
163+
*/
92164
message: z.string().optional(),
165+
/**
166+
* Total number of anonymization fields processed.
167+
*/
93168
anonymization_fields_count: z.number().int().optional(),
94169
attributes: z.object({
95170
results: AnonymizationFieldsBulkCrudActionResults,
96171
summary: BulkCrudActionSummary,
172+
/**
173+
* List of errors that occurred during the bulk operation.
174+
*/
97175
errors: z.array(NormalizedAnonymizationFieldError).optional(),
98176
}),
99177
});
100178

101-
export type BulkActionBase = z.infer<typeof BulkActionBase>;
102-
export const BulkActionBase = z.object({
179+
export type AnonymizationFieldCreateProps = z.infer<typeof AnonymizationFieldCreateProps>;
180+
export const AnonymizationFieldCreateProps = z.object({
103181
/**
104-
* Query to filter anonymization fields
182+
* Name of the anonymization field to create.
105183
*/
106-
query: z.string().optional(),
184+
field: z.string(),
107185
/**
108-
* Array of anonymization fields IDs
186+
* Whether this field is allowed to be sent to the model.
109187
*/
110-
ids: z.array(z.string()).min(1).optional(),
111-
});
112-
113-
export type AnonymizationFieldCreateProps = z.infer<typeof AnonymizationFieldCreateProps>;
114-
export const AnonymizationFieldCreateProps = z.object({
115-
field: z.string(),
116188
allowed: z.boolean().optional(),
189+
/**
190+
* Whether this field should be anonymized.
191+
*/
117192
anonymized: z.boolean().optional(),
118193
});
119194

120195
export type AnonymizationFieldUpdateProps = z.infer<typeof AnonymizationFieldUpdateProps>;
121196
export const AnonymizationFieldUpdateProps = z.object({
197+
/**
198+
* The ID of the anonymization field to update.
199+
*/
122200
id: z.string(),
201+
/**
202+
* Whether this field is allowed to be sent to the model.
203+
*/
123204
allowed: z.boolean().optional(),
205+
/**
206+
* Whether this field should be anonymized.
207+
*/
124208
anonymized: z.boolean().optional(),
125209
});
126210

127211
export type PerformAnonymizationFieldsBulkActionRequestBody = z.infer<
128212
typeof PerformAnonymizationFieldsBulkActionRequestBody
129213
>;
130214
export const PerformAnonymizationFieldsBulkActionRequestBody = z.object({
215+
/**
216+
* Object containing the query to filter anonymization fields and/or an array of anonymization field IDs to delete.
217+
*/
131218
delete: BulkActionBase.optional(),
219+
/**
220+
* Array of anonymization fields to create.
221+
*/
132222
create: z.array(AnonymizationFieldCreateProps).optional(),
223+
/**
224+
* Array of anonymization fields to update.
225+
*/
133226
update: z.array(AnonymizationFieldUpdateProps).optional(),
134227
});
135228
export type PerformAnonymizationFieldsBulkActionRequestBodyInput = z.input<

0 commit comments

Comments
 (0)