diff --git a/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh b/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh index be17669d980b6..616a6deea19c7 100755 --- a/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh +++ b/.buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh @@ -8,3 +8,6 @@ echo --- Security Solution OpenAPI Bundling (cd x-pack/plugins/security_solution && yarn openapi:bundle) check_for_changed_files "yarn openapi:bundle" true + +(cd packages/kbn-securitysolution-lists-common && yarn openapi:bundle) +check_for_changed_files "yarn openapi:bundle" true \ No newline at end of file diff --git a/packages/kbn-securitysolution-lists-common/api/export_list_item/export_list_item.schema.yaml b/packages/kbn-securitysolution-lists-common/api/export_list_item/export_list_item.schema.yaml index 26708a18a899a..69dd492e86638 100644 --- a/packages/kbn-securitysolution-lists-common/api/export_list_item/export_list_item.schema.yaml +++ b/packages/kbn-securitysolution-lists-common/api/export_list_item/export_list_item.schema.yaml @@ -5,6 +5,7 @@ info: paths: /api/lists/items/_export: post: + x-labels: [serverless, ess] operationId: ExportListItems x-codegen-enabled: true summary: Exports list items diff --git a/packages/kbn-securitysolution-lists-common/api/find_list_item/find_list_item.schema.yaml b/packages/kbn-securitysolution-lists-common/api/find_list_item/find_list_item.schema.yaml index f08b2d1c6c0cd..1e822d442a4e2 100644 --- a/packages/kbn-securitysolution-lists-common/api/find_list_item/find_list_item.schema.yaml +++ b/packages/kbn-securitysolution-lists-common/api/find_list_item/find_list_item.schema.yaml @@ -3,7 +3,7 @@ info: title: Find list items API endpoint version: '2023-10-31' paths: - /api/lists/_find: + /api/lists/items/_find: get: x-labels: [serverless, ess] operationId: FindListItems diff --git a/packages/kbn-securitysolution-lists-common/api/import_list_item/import_list_item.schema.yaml b/packages/kbn-securitysolution-lists-common/api/import_list_item/import_list_item.schema.yaml index 561d52587aad2..04a0e18d76782 100644 --- a/packages/kbn-securitysolution-lists-common/api/import_list_item/import_list_item.schema.yaml +++ b/packages/kbn-securitysolution-lists-common/api/import_list_item/import_list_item.schema.yaml @@ -5,6 +5,7 @@ info: paths: /api/lists/items/_import: post: + x-labels: [serverless, ess] operationId: ImportListItems x-codegen-enabled: true summary: Imports list items diff --git a/packages/kbn-securitysolution-lists-common/docs/openapi/ess/security_solution_lists_api_2023_10_31.bundled.schema.yaml b/packages/kbn-securitysolution-lists-common/docs/openapi/ess/security_solution_lists_api_2023_10_31.bundled.schema.yaml new file mode 100644 index 0000000000000..19a11b1ec58ea --- /dev/null +++ b/packages/kbn-securitysolution-lists-common/docs/openapi/ess/security_solution_lists_api_2023_10_31.bundled.schema.yaml @@ -0,0 +1,1523 @@ +openapi: 3.0.3 +info: + description: 'Lists API allows you to manage lists of keywords, IPs or IP ranges items.' + title: Security Solution Lists API (Elastic Cloud and self-hosted) + version: '2023-10-31' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/lists: + delete: + operationId: DeleteList + parameters: + - description: List's `id` value + in: query + name: id + required: true + schema: + $ref: '#/components/schemas/ListId' + - in: query + name: deleteReferences + required: false + schema: + default: false + type: boolean + - in: query + name: ignoreReferences + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes a list + tags: + - List API + get: + operationId: GetList + parameters: + - description: List's `id` value + in: query + name: id + required: true + schema: + $ref: '#/components/schemas/ListId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Retrieves a list using its id field + tags: + - List API + patch: + operationId: PatchList + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + description: + $ref: '#/components/schemas/ListDescription' + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + version: + minimum: 1 + type: integer + required: + - id + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Patches a list + tags: + - List API + post: + operationId: CreateList + requestBody: + content: + application/json: + schema: + type: object + properties: + description: + $ref: '#/components/schemas/ListDescription' + deserializer: + type: string + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + serializer: + type: string + type: + $ref: '#/components/schemas/ListType' + version: + default: 1 + minimum: 1 + type: integer + required: + - name + - description + - type + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List already exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates a list + tags: + - List API + put: + operationId: UpdateList + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + description: + $ref: '#/components/schemas/ListDescription' + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + version: + minimum: 1 + type: integer + required: + - id + - name + - description + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Updates a list + tags: + - List API + /api/lists/_find: + get: + operationId: FindLists + parameters: + - description: The page number to return + in: query + name: page + required: false + schema: + type: integer + - description: The number of lists to return per page + in: query + name: per_page + required: false + schema: + type: integer + - description: Determines which field is used to sort the results + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/NonEmptyString' + - description: 'Determines the sort order, which can be `desc` or `asc`' + in: query + name: sort_order + required: false + schema: + enum: + - desc + - asc + type: string + - description: > + Returns the list that come after the last list returned in the + previous call + + (use the cursor value returned in the previous call). This parameter + uses + + the `tie_breaker_id` field to ensure all lists are sorted and + returned correctly. + in: query + name: cursor + required: false + schema: + $ref: '#/components/schemas/FindListsCursor' + - description: > + Filters the returned results according to the value of the specified + field, + + using the : syntax. + in: query + name: filter + required: false + schema: + $ref: '#/components/schemas/FindListsFilter' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + cursor: + $ref: '#/components/schemas/FindListsCursor' + data: + items: + $ref: '#/components/schemas/List' + type: array + page: + minimum: 0 + type: integer + per_page: + minimum: 0 + type: integer + total: + minimum: 0 + type: integer + required: + - data + - page + - per_page + - total + - cursor + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Finds lists + tags: + - List API + /api/lists/index: + delete: + operationId: DeleteListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + required: + - acknowledged + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes list data streams + tags: + - List API + get: + operationId: GetListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + list_index: + type: boolean + list_item_index: + type: boolean + required: + - list_index + - list_item_index + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream(s) not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Get list data stream existence status + tags: + - List API + post: + operationId: CreateListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + required: + - acknowledged + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates necessary list data streams + tags: + - List API + /api/lists/items: + delete: + operationId: DeleteListItem + parameters: + - description: Required if `list_id` and `value` are not specified + in: query + name: id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: value + required: false + schema: + type: string + - description: >- + Determines when changes made by the request are made visible to + search + in: query + name: refresh + required: false + schema: + default: 'false' + enum: + - 'true' + - 'false' + - wait_for + type: string + responses: + '200': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ListItem' + - items: + $ref: '#/components/schemas/ListItem' + type: array + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes a list item + tags: + - List item API + get: + operationId: GetListItem + parameters: + - description: Required if `list_id` and `value` are not specified + in: query + name: id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: value + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ListItem' + - items: + $ref: '#/components/schemas/ListItem' + type: array + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Gets a list item + tags: + - List item API + patch: + operationId: PatchListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + id: + $ref: '#/components/schemas/ListItemId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + refresh: + description: >- + Determines when changes made by the request are made visible + to search + enum: + - 'true' + - 'false' + - wait_for + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Patches a list item + tags: + - List item API + post: + operationId: CreateListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + id: + $ref: '#/components/schemas/ListItemId' + list_id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + refresh: + description: >- + Determines when changes made by the request are made visible + to search + enum: + - 'true' + - 'false' + - wait_for + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - list_id + - value + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item already exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates a list item + tags: + - List item API + put: + operationId: UpdateListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + id: + $ref: '#/components/schemas/ListItemId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + - value + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Updates a list item + tags: + - List item API + /api/lists/items/_export: + post: + description: Exports list item values from the specified list + operationId: ExportListItems + parameters: + - description: List's id to export + in: query + name: list_id + required: true + schema: + $ref: '#/components/schemas/ListId' + responses: + '200': + content: + application/ndjson: + schema: + description: A `.txt` file containing list items from the specified list + format: binary + type: string + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Exports list items + tags: + - List items Import/Export API + /api/lists/items/_find: + get: + operationId: FindListItems + parameters: + - description: List's id + in: query + name: list_id + required: true + schema: + $ref: '#/components/schemas/ListId' + - description: The page number to return + in: query + name: page + required: false + schema: + type: integer + - description: The number of list items to return per page + in: query + name: per_page + required: false + schema: + type: integer + - description: Determines which field is used to sort the results + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/NonEmptyString' + - description: 'Determines the sort order, which can be `desc` or `asc`' + in: query + name: sort_order + required: false + schema: + enum: + - desc + - asc + type: string + - description: > + Returns the list that come after the last list returned in the + previous call + + (use the cursor value returned in the previous call). This parameter + uses + + the `tie_breaker_id` field to ensure all lists are sorted and + returned correctly. + in: query + name: cursor + required: false + schema: + $ref: '#/components/schemas/FindListItemsCursor' + - description: > + Filters the returned results according to the value of the specified + field, + + using the : syntax. + in: query + name: filter + required: false + schema: + $ref: '#/components/schemas/FindListItemsFilter' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + cursor: + $ref: '#/components/schemas/FindListItemsCursor' + data: + items: + $ref: '#/components/schemas/ListItem' + type: array + page: + minimum: 0 + type: integer + per_page: + minimum: 0 + type: integer + total: + minimum: 0 + type: integer + required: + - data + - page + - per_page + - total + - cursor + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Finds list items + tags: + - List API + /api/lists/items/_import: + post: + description: > + Imports a list of items from a `.txt` or `.csv` file. The maximum file + size is 9 million bytes. + + + You can import items to a new or existing list. + operationId: ImportListItems + parameters: + - description: | + List's id. + + Required when importing to an existing list. + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: > + Type of the importing list. + + + Required when importing a new list that is `list_id` is not + specified. + in: query + name: type + required: false + schema: + $ref: '#/components/schemas/ListType' + - in: query + name: serializer + required: false + schema: + type: string + - in: query + name: deserializer + required: false + schema: + type: string + - description: >- + Determines when changes made by the request are made visible to + search + in: query + name: refresh + required: false + schema: + enum: + - 'true' + - 'false' + - wait_for + type: string + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + description: >- + A `.txt` or `.csv` file containing newline separated list + items + format: binary + type: string + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List with specified list_id does not exist response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Imports list items + tags: + - List items Import/Export API + /api/lists/privileges: + get: + operationId: GetListPrivileges + responses: + '200': + content: + application/json: + schema: + type: object + properties: + is_authenticated: + type: boolean + listItems: + $ref: '#/components/schemas/ListItemPrivileges' + lists: + $ref: '#/components/schemas/ListPrivileges' + required: + - lists + - listItems + - is_authenticated + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Gets list privileges + tags: + - List API +components: + schemas: + FindListItemsCursor: + $ref: '#/components/schemas/NonEmptyString' + FindListItemsFilter: + type: string + FindListsCursor: + $ref: '#/components/schemas/NonEmptyString' + FindListsFilter: + type: string + List: + type: object + properties: + _version: + type: string + '@timestamp': + format: date-time + type: string + created_at: + format: date-time + type: string + created_by: + type: string + description: + $ref: '#/components/schemas/ListDescription' + deserializer: + type: string + id: + $ref: '#/components/schemas/ListId' + immutable: + type: boolean + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + serializer: + type: string + tie_breaker_id: + type: string + type: + $ref: '#/components/schemas/ListType' + updated_at: + format: date-time + type: string + updated_by: + type: string + version: + minimum: 1 + type: integer + required: + - id + - type + - name + - description + - immutable + - version + - tie_breaker_id + - created_at + - created_by + - updated_at + - updated_by + ListDescription: + $ref: '#/components/schemas/NonEmptyString' + ListId: + $ref: '#/components/schemas/NonEmptyString' + ListItem: + type: object + properties: + _version: + type: string + '@timestamp': + format: date-time + type: string + created_at: + format: date-time + type: string + created_by: + type: string + deserializer: + type: string + id: + $ref: '#/components/schemas/ListItemId' + list_id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + serializer: + type: string + tie_breaker_id: + type: string + type: + $ref: '#/components/schemas/ListType' + updated_at: + format: date-time + type: string + updated_by: + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + - type + - list_id + - value + - tie_breaker_id + - created_at + - created_by + - updated_at + - updated_by + ListItemId: + $ref: '#/components/schemas/NonEmptyString' + ListItemMetadata: + additionalProperties: true + type: object + ListItemPrivileges: + type: object + properties: + application: + additionalProperties: + type: boolean + type: object + cluster: + additionalProperties: + type: boolean + type: object + has_all_requested: + type: boolean + index: + additionalProperties: + additionalProperties: + type: boolean + type: object + type: object + username: + type: string + required: + - username + - has_all_requested + - cluster + - index + - application + ListItemValue: + $ref: '#/components/schemas/NonEmptyString' + ListMetadata: + additionalProperties: true + type: object + ListName: + $ref: '#/components/schemas/NonEmptyString' + ListPrivileges: + type: object + properties: + application: + additionalProperties: + type: boolean + type: object + cluster: + additionalProperties: + type: boolean + type: object + has_all_requested: + type: boolean + index: + additionalProperties: + additionalProperties: + type: boolean + type: object + type: object + username: + type: string + required: + - username + - has_all_requested + - cluster + - index + - application + ListType: + enum: + - binary + - boolean + - byte + - date + - date_nanos + - date_range + - double + - double_range + - float + - float_range + - geo_point + - geo_shape + - half_float + - integer + - integer_range + - ip + - ip_range + - keyword + - long + - long_range + - shape + - short + - text + type: string + NonEmptyString: + description: A string that is not empty and does not contain only whitespace + minLength: 1 + pattern: ^(?! *$).+$ + type: string + PlatformErrorResponse: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: integer + required: + - statusCode + - error + - message + SiemErrorResponse: + type: object + properties: + message: + type: string + status_code: + type: integer + required: + - status_code + - message + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/packages/kbn-securitysolution-lists-common/docs/openapi/serverless/security_solution_lists_api_2023_10_31.bundled.schema.yaml b/packages/kbn-securitysolution-lists-common/docs/openapi/serverless/security_solution_lists_api_2023_10_31.bundled.schema.yaml new file mode 100644 index 0000000000000..b59461fd800d9 --- /dev/null +++ b/packages/kbn-securitysolution-lists-common/docs/openapi/serverless/security_solution_lists_api_2023_10_31.bundled.schema.yaml @@ -0,0 +1,1523 @@ +openapi: 3.0.3 +info: + description: 'Lists API allows you to manage lists of keywords, IPs or IP ranges items.' + title: Security Solution Lists API (Elastic Cloud Serverless) + version: '2023-10-31' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/lists: + delete: + operationId: DeleteList + parameters: + - description: List's `id` value + in: query + name: id + required: true + schema: + $ref: '#/components/schemas/ListId' + - in: query + name: deleteReferences + required: false + schema: + default: false + type: boolean + - in: query + name: ignoreReferences + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes a list + tags: + - List API + get: + operationId: GetList + parameters: + - description: List's `id` value + in: query + name: id + required: true + schema: + $ref: '#/components/schemas/ListId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Retrieves a list using its id field + tags: + - List API + patch: + operationId: PatchList + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + description: + $ref: '#/components/schemas/ListDescription' + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + version: + minimum: 1 + type: integer + required: + - id + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Patches a list + tags: + - List API + post: + operationId: CreateList + requestBody: + content: + application/json: + schema: + type: object + properties: + description: + $ref: '#/components/schemas/ListDescription' + deserializer: + type: string + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + serializer: + type: string + type: + $ref: '#/components/schemas/ListType' + version: + default: 1 + minimum: 1 + type: integer + required: + - name + - description + - type + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List already exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates a list + tags: + - List API + put: + operationId: UpdateList + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + description: + $ref: '#/components/schemas/ListDescription' + id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + version: + minimum: 1 + type: integer + required: + - id + - name + - description + description: List's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Updates a list + tags: + - List API + /api/lists/_find: + get: + operationId: FindLists + parameters: + - description: The page number to return + in: query + name: page + required: false + schema: + type: integer + - description: The number of lists to return per page + in: query + name: per_page + required: false + schema: + type: integer + - description: Determines which field is used to sort the results + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/NonEmptyString' + - description: 'Determines the sort order, which can be `desc` or `asc`' + in: query + name: sort_order + required: false + schema: + enum: + - desc + - asc + type: string + - description: > + Returns the list that come after the last list returned in the + previous call + + (use the cursor value returned in the previous call). This parameter + uses + + the `tie_breaker_id` field to ensure all lists are sorted and + returned correctly. + in: query + name: cursor + required: false + schema: + $ref: '#/components/schemas/FindListsCursor' + - description: > + Filters the returned results according to the value of the specified + field, + + using the : syntax. + in: query + name: filter + required: false + schema: + $ref: '#/components/schemas/FindListsFilter' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + cursor: + $ref: '#/components/schemas/FindListsCursor' + data: + items: + $ref: '#/components/schemas/List' + type: array + page: + minimum: 0 + type: integer + per_page: + minimum: 0 + type: integer + total: + minimum: 0 + type: integer + required: + - data + - page + - per_page + - total + - cursor + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Finds lists + tags: + - List API + /api/lists/index: + delete: + operationId: DeleteListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + required: + - acknowledged + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes list data streams + tags: + - List API + get: + operationId: GetListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + list_index: + type: boolean + list_item_index: + type: boolean + required: + - list_index + - list_item_index + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream(s) not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Get list data stream existence status + tags: + - List API + post: + operationId: CreateListIndex + responses: + '200': + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + required: + - acknowledged + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List data stream exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates necessary list data streams + tags: + - List API + /api/lists/items: + delete: + operationId: DeleteListItem + parameters: + - description: Required if `list_id` and `value` are not specified + in: query + name: id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: value + required: false + schema: + type: string + - description: >- + Determines when changes made by the request are made visible to + search + in: query + name: refresh + required: false + schema: + default: 'false' + enum: + - 'true' + - 'false' + - wait_for + type: string + responses: + '200': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ListItem' + - items: + $ref: '#/components/schemas/ListItem' + type: array + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Deletes a list item + tags: + - List item API + get: + operationId: GetListItem + parameters: + - description: Required if `list_id` and `value` are not specified + in: query + name: id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: Required if `id` is not specified + in: query + name: value + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ListItem' + - items: + $ref: '#/components/schemas/ListItem' + type: array + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Gets a list item + tags: + - List item API + patch: + operationId: PatchListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + id: + $ref: '#/components/schemas/ListItemId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + refresh: + description: >- + Determines when changes made by the request are made visible + to search + enum: + - 'true' + - 'false' + - wait_for + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Patches a list item + tags: + - List item API + post: + operationId: CreateListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + id: + $ref: '#/components/schemas/ListItemId' + list_id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + refresh: + description: >- + Determines when changes made by the request are made visible + to search + enum: + - 'true' + - 'false' + - wait_for + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - list_id + - value + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item already exists response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Creates a list item + tags: + - List item API + put: + operationId: UpdateListItem + requestBody: + content: + application/json: + schema: + type: object + properties: + _version: + type: string + id: + $ref: '#/components/schemas/ListItemId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + - value + description: List item's properties + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListItem' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List item not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Updates a list item + tags: + - List item API + /api/lists/items/_export: + post: + description: Exports list item values from the specified list + operationId: ExportListItems + parameters: + - description: List's id to export + in: query + name: list_id + required: true + schema: + $ref: '#/components/schemas/ListId' + responses: + '200': + content: + application/ndjson: + schema: + description: A `.txt` file containing list items from the specified list + format: binary + type: string + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List not found response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Exports list items + tags: + - List items Import/Export API + /api/lists/items/_find: + get: + operationId: FindListItems + parameters: + - description: List's id + in: query + name: list_id + required: true + schema: + $ref: '#/components/schemas/ListId' + - description: The page number to return + in: query + name: page + required: false + schema: + type: integer + - description: The number of list items to return per page + in: query + name: per_page + required: false + schema: + type: integer + - description: Determines which field is used to sort the results + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/NonEmptyString' + - description: 'Determines the sort order, which can be `desc` or `asc`' + in: query + name: sort_order + required: false + schema: + enum: + - desc + - asc + type: string + - description: > + Returns the list that come after the last list returned in the + previous call + + (use the cursor value returned in the previous call). This parameter + uses + + the `tie_breaker_id` field to ensure all lists are sorted and + returned correctly. + in: query + name: cursor + required: false + schema: + $ref: '#/components/schemas/FindListItemsCursor' + - description: > + Filters the returned results according to the value of the specified + field, + + using the : syntax. + in: query + name: filter + required: false + schema: + $ref: '#/components/schemas/FindListItemsFilter' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + cursor: + $ref: '#/components/schemas/FindListItemsCursor' + data: + items: + $ref: '#/components/schemas/ListItem' + type: array + page: + minimum: 0 + type: integer + per_page: + minimum: 0 + type: integer + total: + minimum: 0 + type: integer + required: + - data + - page + - per_page + - total + - cursor + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Finds list items + tags: + - List API + /api/lists/items/_import: + post: + description: > + Imports a list of items from a `.txt` or `.csv` file. The maximum file + size is 9 million bytes. + + + You can import items to a new or existing list. + operationId: ImportListItems + parameters: + - description: | + List's id. + + Required when importing to an existing list. + in: query + name: list_id + required: false + schema: + $ref: '#/components/schemas/ListId' + - description: > + Type of the importing list. + + + Required when importing a new list that is `list_id` is not + specified. + in: query + name: type + required: false + schema: + $ref: '#/components/schemas/ListType' + - in: query + name: serializer + required: false + schema: + type: string + - in: query + name: deserializer + required: false + schema: + type: string + - description: >- + Determines when changes made by the request are made visible to + search + in: query + name: refresh + required: false + schema: + enum: + - 'true' + - 'false' + - wait_for + type: string + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + description: >- + A `.txt` or `.csv` file containing newline separated list + items + format: binary + type: string + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/List' + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: List with specified list_id does not exist response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Imports list items + tags: + - List items Import/Export API + /api/lists/privileges: + get: + operationId: GetListPrivileges + responses: + '200': + content: + application/json: + schema: + type: object + properties: + is_authenticated: + type: boolean + listItems: + $ref: '#/components/schemas/ListItemPrivileges' + lists: + $ref: '#/components/schemas/ListPrivileges' + required: + - lists + - listItems + - is_authenticated + description: Successful response + '400': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/PlatformErrorResponse' + - $ref: '#/components/schemas/SiemErrorResponse' + description: Invalid input data response + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Unsuccessful authentication response + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/PlatformErrorResponse' + description: Not enough privileges response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/SiemErrorResponse' + description: Internal server error response + summary: Gets list privileges + tags: + - List API +components: + schemas: + FindListItemsCursor: + $ref: '#/components/schemas/NonEmptyString' + FindListItemsFilter: + type: string + FindListsCursor: + $ref: '#/components/schemas/NonEmptyString' + FindListsFilter: + type: string + List: + type: object + properties: + _version: + type: string + '@timestamp': + format: date-time + type: string + created_at: + format: date-time + type: string + created_by: + type: string + description: + $ref: '#/components/schemas/ListDescription' + deserializer: + type: string + id: + $ref: '#/components/schemas/ListId' + immutable: + type: boolean + meta: + $ref: '#/components/schemas/ListMetadata' + name: + $ref: '#/components/schemas/ListName' + serializer: + type: string + tie_breaker_id: + type: string + type: + $ref: '#/components/schemas/ListType' + updated_at: + format: date-time + type: string + updated_by: + type: string + version: + minimum: 1 + type: integer + required: + - id + - type + - name + - description + - immutable + - version + - tie_breaker_id + - created_at + - created_by + - updated_at + - updated_by + ListDescription: + $ref: '#/components/schemas/NonEmptyString' + ListId: + $ref: '#/components/schemas/NonEmptyString' + ListItem: + type: object + properties: + _version: + type: string + '@timestamp': + format: date-time + type: string + created_at: + format: date-time + type: string + created_by: + type: string + deserializer: + type: string + id: + $ref: '#/components/schemas/ListItemId' + list_id: + $ref: '#/components/schemas/ListId' + meta: + $ref: '#/components/schemas/ListItemMetadata' + serializer: + type: string + tie_breaker_id: + type: string + type: + $ref: '#/components/schemas/ListType' + updated_at: + format: date-time + type: string + updated_by: + type: string + value: + $ref: '#/components/schemas/ListItemValue' + required: + - id + - type + - list_id + - value + - tie_breaker_id + - created_at + - created_by + - updated_at + - updated_by + ListItemId: + $ref: '#/components/schemas/NonEmptyString' + ListItemMetadata: + additionalProperties: true + type: object + ListItemPrivileges: + type: object + properties: + application: + additionalProperties: + type: boolean + type: object + cluster: + additionalProperties: + type: boolean + type: object + has_all_requested: + type: boolean + index: + additionalProperties: + additionalProperties: + type: boolean + type: object + type: object + username: + type: string + required: + - username + - has_all_requested + - cluster + - index + - application + ListItemValue: + $ref: '#/components/schemas/NonEmptyString' + ListMetadata: + additionalProperties: true + type: object + ListName: + $ref: '#/components/schemas/NonEmptyString' + ListPrivileges: + type: object + properties: + application: + additionalProperties: + type: boolean + type: object + cluster: + additionalProperties: + type: boolean + type: object + has_all_requested: + type: boolean + index: + additionalProperties: + additionalProperties: + type: boolean + type: object + type: object + username: + type: string + required: + - username + - has_all_requested + - cluster + - index + - application + ListType: + enum: + - binary + - boolean + - byte + - date + - date_nanos + - date_range + - double + - double_range + - float + - float_range + - geo_point + - geo_shape + - half_float + - integer + - integer_range + - ip + - ip_range + - keyword + - long + - long_range + - shape + - short + - text + type: string + NonEmptyString: + description: A string that is not empty and does not contain only whitespace + minLength: 1 + pattern: ^(?! *$).+$ + type: string + PlatformErrorResponse: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: integer + required: + - statusCode + - error + - message + SiemErrorResponse: + type: object + properties: + message: + type: string + status_code: + type: integer + required: + - status_code + - message + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/packages/kbn-securitysolution-lists-common/package.json b/packages/kbn-securitysolution-lists-common/package.json index 298f0e47bb10f..e47531892d65d 100644 --- a/packages/kbn-securitysolution-lists-common/package.json +++ b/packages/kbn-securitysolution-lists-common/package.json @@ -5,6 +5,7 @@ "private": true, "version": "1.0.0", "scripts": { - "openapi:generate": "node scripts/openapi_generate" + "openapi:generate": "node scripts/openapi_generate", + "openapi:bundle": "node scripts/openapi_bundle" } } diff --git a/packages/kbn-securitysolution-lists-common/scripts/openapi_bundle.js b/packages/kbn-securitysolution-lists-common/scripts/openapi_bundle.js new file mode 100644 index 0000000000000..9bed9a313882f --- /dev/null +++ b/packages/kbn-securitysolution-lists-common/scripts/openapi_bundle.js @@ -0,0 +1,45 @@ +/* + * 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. + */ + +require('../../../src/setup_node_env'); +const { join, resolve } = require('path'); +const { bundle } = require('@kbn/openapi-bundler'); + +const ROOT = resolve(__dirname, '..'); + +(async () => { + await bundle({ + sourceGlob: join(ROOT, 'api/**/*.schema.yaml'), + outputFilePath: join( + ROOT, + 'docs/openapi/serverless/security_solution_lists_api_{version}.bundled.schema.yaml' + ), + options: { + includeLabels: ['serverless'], + specInfo: { + title: 'Security Solution Lists API (Elastic Cloud Serverless)', + description: 'Lists API allows you to manage lists of keywords, IPs or IP ranges items.', + }, + }, + }); + + await bundle({ + sourceGlob: join(ROOT, 'api/**/*.schema.yaml'), + outputFilePath: join( + ROOT, + 'docs/openapi/ess/security_solution_lists_api_{version}.bundled.schema.yaml' + ), + options: { + includeLabels: ['ess'], + specInfo: { + title: 'Security Solution Lists API (Elastic Cloud and self-hosted)', + description: 'Lists API allows you to manage lists of keywords, IPs or IP ranges items.', + }, + }, + }); +})(); diff --git a/packages/kbn-securitysolution-lists-common/scripts/openapi_generate.js b/packages/kbn-securitysolution-lists-common/scripts/openapi_generate.js index 49bd2860befd6..aba406bb16b4b 100644 --- a/packages/kbn-securitysolution-lists-common/scripts/openapi_generate.js +++ b/packages/kbn-securitysolution-lists-common/scripts/openapi_generate.js @@ -17,14 +17,14 @@ const ROOT = resolve(__dirname, '..'); await generate({ title: 'OpenAPI Lists API Schemas', rootDir: ROOT, - sourceGlob: './**/*.schema.yaml', + sourceGlob: './api/**/*.schema.yaml', templateName: 'zod_operation_schema', }); await generate({ title: 'Lists API client for tests', rootDir: ROOT, - sourceGlob: './**/*.schema.yaml', + sourceGlob: './api/**/*.schema.yaml', templateName: 'api_client_supertest', skipLinting: true, bundle: { diff --git a/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts b/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts index 4f201d868e92c..9800f0b802873 100644 --- a/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts @@ -98,7 +98,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) }, findListItems(props: FindListItemsProps) { return supertest - .get('/api/lists/_find') + .get('/api/lists/items/_find') .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')