forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Add missing Endpoint Exceptions API OpenAPI speci…
…fications (elastic#186082) **Resolves:** elastic#183839 ## Summary This PR adds missing OpenAPI specifications for Endpoint exceptions API which are the following - `POST /api/endpoint_list` - `POST /api/endpoint_list/items` - `GET /api/endpoint_list/items` - `PUT /api/endpoint_list/items` - `DELETE /api/endpoint_list/items` - `GET /api/endpoint_list/items/_find`
- Loading branch information
Showing
42 changed files
with
1,052 additions
and
209 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/kbn-securitysolution-endpoint-exceptions-common/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Security Solution Endpoint Exceptions | ||
|
||
The package contains common files for the Endpoint Exceptions feature. | ||
|
||
`common` in the name highlights that this package is intended to combine any common entities related to Endpoint Exceptions. E.g. the other `kbn-securitysolution-endpoint-exception-list-*` packages | ||
content should be moved here while `kbn-securitysolution-io-ts-list-types` package should be | ||
gone eventually. | ||
|
||
## API folder | ||
|
||
`api` folder contains OpenAPI schemas for Security Solution Endpoint Exceptions feature. There are automatically generated Zod schemas and TS types for each schemas located in corresponding | ||
`*.gen.ts` files. | ||
|
||
**Please add any Endpoint Exceptions feature related schemas to this package.** | ||
|
||
TS types and/or Zod schemas can be imported in a plugin or another package like | ||
|
||
```ts | ||
import { CreateEndpointExceptionRequestBody } from '@kbn/securitysolution-endpoint-exceptions-common/api'; | ||
``` |
23 changes: 23 additions & 0 deletions
23
...ysolution-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Create endpoint list API endpoint | ||
* version: 2023-10-31 | ||
*/ | ||
|
||
import { z } from 'zod'; | ||
|
||
import { EndpointList } from '../model/endpoint_list_common.gen'; | ||
|
||
export type CreateEndpointListResponse = z.infer<typeof CreateEndpointListResponse>; | ||
export const CreateEndpointListResponse = EndpointList; |
47 changes: 47 additions & 0 deletions
47
...tion-endpoint-exceptions-common/api/create_endpoint_list/create_endpoint_list.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Create endpoint list API endpoint | ||
version: '2023-10-31' | ||
paths: | ||
/api/endpoint_list: | ||
post: | ||
x-labels: [serverless, ess] | ||
x-codegen-enabled: true | ||
operationId: CreateEndpointList | ||
summary: Creates an endpoint list | ||
description: Creates an endpoint list or does nothing if the list already exists | ||
tags: | ||
- Endpoint exceptions API | ||
responses: | ||
200: | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointList' | ||
400: | ||
description: Invalid input data | ||
content: | ||
application/json: | ||
schema: | ||
oneOf: | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' | ||
401: | ||
description: Unsuccessful authentication | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
403: | ||
description: Insufficient privileges | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
500: | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' |
50 changes: 50 additions & 0 deletions
50
...endpoint-exceptions-common/api/create_endpoint_list_item/create_endpoint_list_item.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Create endpoint list item API endpoint | ||
* version: 2023-10-31 | ||
*/ | ||
|
||
import { z } from 'zod'; | ||
|
||
import { | ||
ExceptionListItemHumanId, | ||
ExceptionListItemType, | ||
ExceptionListItemName, | ||
ExceptionListItemDescription, | ||
ExceptionListItemOsTypeArray, | ||
ExceptionListItemTags, | ||
ExceptionListItemMeta, | ||
ExceptionListItemCommentArray, | ||
} from '@kbn/securitysolution-exceptions-common/api/model/exception_list_common.gen'; | ||
import { ExceptionListItemEntryArray } from '@kbn/securitysolution-exceptions-common/api/model/exception_list_item_entry.gen'; | ||
import { EndpointListItem } from '../model/endpoint_list_common.gen'; | ||
|
||
export type CreateEndpointListItemRequestBody = z.infer<typeof CreateEndpointListItemRequestBody>; | ||
export const CreateEndpointListItemRequestBody = z.object({ | ||
item_id: ExceptionListItemHumanId.optional(), | ||
type: ExceptionListItemType, | ||
name: ExceptionListItemName, | ||
description: ExceptionListItemDescription, | ||
entries: ExceptionListItemEntryArray, | ||
os_types: ExceptionListItemOsTypeArray.optional().default([]), | ||
tags: ExceptionListItemTags.optional().default([]), | ||
meta: ExceptionListItemMeta.optional(), | ||
comments: ExceptionListItemCommentArray.optional().default([]), | ||
}); | ||
export type CreateEndpointListItemRequestBodyInput = z.input< | ||
typeof CreateEndpointListItemRequestBody | ||
>; | ||
|
||
export type CreateEndpointListItemResponse = z.infer<typeof CreateEndpointListItemResponse>; | ||
export const CreateEndpointListItemResponse = EndpointListItem; |
86 changes: 86 additions & 0 deletions
86
...int-exceptions-common/api/create_endpoint_list_item/create_endpoint_list_item.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Create endpoint list item API endpoint | ||
version: '2023-10-31' | ||
paths: | ||
/api/endpoint_list/items: | ||
post: | ||
x-labels: [serverless, ess] | ||
x-codegen-enabled: true | ||
operationId: CreateEndpointListItem | ||
summary: Creates an endpoint list item | ||
tags: | ||
- Endpoint exceptions API | ||
requestBody: | ||
description: Exception list item's properties | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
item_id: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId' | ||
type: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemType' | ||
name: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemName' | ||
description: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemDescription' | ||
entries: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_item_entry.schema.yaml#/components/schemas/ExceptionListItemEntryArray' | ||
os_types: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemOsTypeArray' | ||
default: [] | ||
tags: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemTags' | ||
default: [] | ||
meta: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemMeta' | ||
comments: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemCommentArray' | ||
default: [] | ||
required: | ||
- type | ||
- name | ||
- description | ||
- entries | ||
responses: | ||
200: | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointListItem' | ||
400: | ||
description: Invalid input data | ||
content: | ||
application/json: | ||
schema: | ||
oneOf: | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' | ||
401: | ||
description: Unsuccessful authentication | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
403: | ||
description: Insufficient privileges | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
409: | ||
description: Endpoint list item already exists | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' | ||
500: | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' |
42 changes: 42 additions & 0 deletions
42
...endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Delete endpoint list item API endpoint | ||
* version: 2023-10-31 | ||
*/ | ||
|
||
import { z } from 'zod'; | ||
|
||
import { | ||
ExceptionListItemId, | ||
ExceptionListItemHumanId, | ||
} from '@kbn/securitysolution-exceptions-common/api/model/exception_list_common.gen'; | ||
import { EndpointListItem } from '../model/endpoint_list_common.gen'; | ||
|
||
export type DeleteEndpointListItemRequestQuery = z.infer<typeof DeleteEndpointListItemRequestQuery>; | ||
export const DeleteEndpointListItemRequestQuery = z.object({ | ||
/** | ||
* Either `id` or `item_id` must be specified | ||
*/ | ||
id: ExceptionListItemId.optional(), | ||
/** | ||
* Either `id` or `item_id` must be specified | ||
*/ | ||
item_id: ExceptionListItemHumanId.optional(), | ||
}); | ||
export type DeleteEndpointListItemRequestQueryInput = z.input< | ||
typeof DeleteEndpointListItemRequestQuery | ||
>; | ||
|
||
export type DeleteEndpointListItemResponse = z.infer<typeof DeleteEndpointListItemResponse>; | ||
export const DeleteEndpointListItemResponse = EndpointListItem; |
65 changes: 65 additions & 0 deletions
65
...int-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Delete endpoint list item API endpoint | ||
version: '2023-10-31' | ||
paths: | ||
/api/endpoint_list/items: | ||
delete: | ||
x-labels: [serverless, ess] | ||
x-codegen-enabled: true | ||
operationId: DeleteEndpointListItem | ||
summary: Deletes an endpoint list item | ||
tags: | ||
- Endpoint exceptions API | ||
parameters: | ||
- name: id | ||
in: query | ||
required: false | ||
description: Either `id` or `item_id` must be specified | ||
schema: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemId' | ||
- name: item_id | ||
in: query | ||
required: false | ||
description: Either `id` or `item_id` must be specified | ||
schema: | ||
$ref: '../../../kbn-securitysolution-exceptions-common/api/model/exception_list_common.schema.yaml#/components/schemas/ExceptionListItemHumanId' | ||
responses: | ||
200: | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../model/endpoint_list_common.schema.yaml#/components/schemas/EndpointListItem' | ||
400: | ||
description: Invalid input data | ||
content: | ||
application/json: | ||
schema: | ||
oneOf: | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
- $ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' | ||
401: | ||
description: Unsuccessful authentication | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
403: | ||
description: Insufficient privileges | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/PlatformErrorResponse' | ||
404: | ||
description: Endpoint list item not found | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' | ||
500: | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../../../kbn-openapi-common/schemas/error_responses.schema.yaml#/components/schemas/SiemErrorResponse' |
Oops, something went wrong.