Skip to content

Commit 34960cc

Browse files
stephmilovicakowalska622
authored andcommitted
[Security Assistant] Added examples for necessary AI Assistant OpenAPI docs (elastic#219883)
1 parent 3afe22c commit 34960cc

File tree

123 files changed

+5943
-1116
lines changed

Some content is hidden

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

123 files changed

+5943
-1116
lines changed

oas_docs/output/kibana.serverless.yaml

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

oas_docs/output/kibana.yaml

Lines changed: 973 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: 1066 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: 1066 additions & 135 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const ExecuteConnectorRequestBody = z.object({
5454
langSmithApiKey: z.string().optional(),
5555
screenContext: ScreenContext.optional(),
5656
/**
57-
* optional system prompt, will be appended to default system prompt. Different from conversation system prompt, which is retrieved on the server
57+
* System prompt, will be appended to default system prompt. Different from conversation system prompt, which is retrieved on the server
5858
*/
5959
promptIds: PromptIds.optional(),
6060
});

x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/actions_connector/post_actions_connector_execute_route.schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ paths:
7373
$ref: '../common_attributes.schema.yaml#/components/schemas/ScreenContext'
7474
promptIds:
7575
$ref: '../common_attributes.schema.yaml#/components/schemas/PromptIds'
76-
description: optional system prompt, will be appended to default system prompt. Different from conversation system prompt, which is retrieved on the server
76+
description: System prompt, will be appended to default system prompt. Different from conversation system prompt, which is retrieved on the server
7777
responses:
7878
'200':
7979
description: Successful static response

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

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616

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

19-
import { NonEmptyString, User } from '../common_attributes.gen';
19+
import {
20+
BulkActionBase,
21+
NonEmptyString,
22+
NonEmptyTimestamp,
23+
User,
24+
BulkCrudActionSummary,
25+
} from '../common_attributes.gen';
2026
import { Replacements } from '../conversations/common_attributes.gen';
2127

2228
export type AlertSummaryBulkActionSkipReason = z.infer<typeof AlertSummaryBulkActionSkipReason>;
@@ -47,7 +53,7 @@ export type AlertSummaryResponse = z.infer<typeof AlertSummaryResponse>;
4753
export const AlertSummaryResponse = z.object({
4854
id: NonEmptyString,
4955
alertId: NonEmptyString,
50-
timestamp: NonEmptyString.optional(),
56+
timestamp: NonEmptyTimestamp.optional(),
5157
summary: z.string(),
5258
recommendedActions: z.string().optional(),
5359
replacements: Replacements,
@@ -70,14 +76,6 @@ export const AlertSummaryBulkCrudActionResults = z.object({
7076
skipped: z.array(AlertSummaryBulkActionSkipResult),
7177
});
7278

73-
export type BulkCrudActionSummary = z.infer<typeof BulkCrudActionSummary>;
74-
export const BulkCrudActionSummary = z.object({
75-
failed: z.number().int(),
76-
skipped: z.number().int(),
77-
succeeded: z.number().int(),
78-
total: z.number().int(),
79-
});
80-
8179
export type AlertSummaryBulkCrudActionResponse = z.infer<typeof AlertSummaryBulkCrudActionResponse>;
8280
export const AlertSummaryBulkCrudActionResponse = z.object({
8381
success: z.boolean().optional(),
@@ -91,18 +89,6 @@ export const AlertSummaryBulkCrudActionResponse = z.object({
9189
}),
9290
});
9391

94-
export type BulkActionBase = z.infer<typeof BulkActionBase>;
95-
export const BulkActionBase = z.object({
96-
/**
97-
* Query to filter alert summaries
98-
*/
99-
query: z.string().optional(),
100-
/**
101-
* Array of alert summary IDs
102-
*/
103-
ids: z.array(z.string()).min(1).optional(),
104-
});
105-
10692
export type AlertSummaryCreateProps = z.infer<typeof AlertSummaryCreateProps>;
10793
export const AlertSummaryCreateProps = z.object({
10894
alertId: z.string(),

x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/alert_summary/bulk_crud_alert_summary_route.schema.yaml

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ paths:
1919
type: object
2020
properties:
2121
delete:
22-
$ref: '#/components/schemas/BulkActionBase'
22+
$ref: '../common_attributes.schema.yaml#/components/schemas/BulkActionBase'
2323
create:
2424
type: array
2525
items:
@@ -110,7 +110,7 @@ components:
110110
alertId:
111111
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
112112
'timestamp':
113-
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
113+
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyTimestamp'
114114
summary:
115115
type: string
116116
recommendedActions:
@@ -158,24 +158,6 @@ components:
158158
- deleted
159159
- skipped
160160

161-
162-
BulkCrudActionSummary:
163-
type: object
164-
properties:
165-
failed:
166-
type: integer
167-
skipped:
168-
type: integer
169-
succeeded:
170-
type: integer
171-
total:
172-
type: integer
173-
required:
174-
- failed
175-
- skipped
176-
- succeeded
177-
- total
178-
179161
AlertSummaryBulkCrudActionResponse:
180162
type: object
181163
properties:
@@ -193,7 +175,7 @@ components:
193175
results:
194176
$ref: '#/components/schemas/AlertSummaryBulkCrudActionResults'
195177
summary:
196-
$ref: '#/components/schemas/BulkCrudActionSummary'
178+
$ref: '../common_attributes.schema.yaml#/components/schemas/BulkCrudActionSummary'
197179
errors:
198180
type: array
199181
items:
@@ -204,20 +186,6 @@ components:
204186
required:
205187
- attributes
206188

207-
BulkActionBase:
208-
x-inline: true
209-
type: object
210-
properties:
211-
query:
212-
type: string
213-
description: Query to filter alert summaries
214-
ids:
215-
type: array
216-
description: Array of alert summary IDs
217-
minItems: 1
218-
items:
219-
type: string
220-
221189
AlertSummaryCreateProps:
222190
type: object
223191
required:

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)