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.
[Entity Analytics] [Entity Store] Refactor entity store enablement (s…
…erver side) (elastic#199638) ## Summary This PR adds 2 new endpoints regarding enablement of the Entity Store: * `api/entity_store/enable`, which initializes entity engines for both `user` and `host` entities * `api/entity_store/status`, which computes a global store status based on the individual engine status In addition, running initialization of multiple engines in parallel is now allowed. ### How to test 1. Use dev tools to call `POST kbn:/api/entity_store/enable` 2. Check that two engines were created and that the status is `installing` by calling `GET kbn:/api/entity_store/status` 3. Wait a few seconds and keep calling the `status` endpoint. Once initialization finishes, the status should switch to `running` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
6e9520a
commit 3757e64
Showing
19 changed files
with
697 additions
and
7 deletions.
There are no files selected for viewing
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
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
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/enablement.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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Enable Entity Store | ||
* version: 2023-10-31 | ||
*/ | ||
|
||
import { z } from '@kbn/zod'; | ||
|
||
import { IndexPattern, EngineDescriptor, StoreStatus } from './common.gen'; | ||
|
||
export type GetEntityStoreStatusResponse = z.infer<typeof GetEntityStoreStatusResponse>; | ||
export const GetEntityStoreStatusResponse = z.object({ | ||
status: StoreStatus.optional(), | ||
engines: z.array(EngineDescriptor).optional(), | ||
}); | ||
|
||
export type InitEntityStoreRequestBody = z.infer<typeof InitEntityStoreRequestBody>; | ||
export const InitEntityStoreRequestBody = z.object({ | ||
/** | ||
* The number of historical values to keep for each field. | ||
*/ | ||
fieldHistoryLength: z.number().int().optional().default(10), | ||
indexPattern: IndexPattern.optional(), | ||
filter: z.string().optional(), | ||
}); | ||
export type InitEntityStoreRequestBodyInput = z.input<typeof InitEntityStoreRequestBody>; | ||
|
||
export type InitEntityStoreResponse = z.infer<typeof InitEntityStoreResponse>; | ||
export const InitEntityStoreResponse = z.object({ | ||
succeeded: z.boolean().optional(), | ||
engines: z.array(EngineDescriptor).optional(), | ||
}); |
64 changes: 64 additions & 0 deletions
64
...plugins/security_solution/common/api/entity_analytics/entity_store/enablement.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,64 @@ | ||
openapi: 3.0.0 | ||
|
||
info: | ||
title: Enable Entity Store | ||
version: '2023-10-31' | ||
paths: | ||
/api/entity_store/enable: | ||
post: | ||
x-labels: [ess, serverless] | ||
x-codegen-enabled: true | ||
operationId: InitEntityStore | ||
summary: Initialize the Entity Store | ||
|
||
requestBody: | ||
description: Schema for the entity store initialization | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
fieldHistoryLength: | ||
type: integer | ||
description: The number of historical values to keep for each field. | ||
default: 10 | ||
indexPattern: | ||
$ref: './common.schema.yaml#/components/schemas/IndexPattern' | ||
filter: | ||
type: string | ||
responses: | ||
'200': | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
succeeded: | ||
type: boolean | ||
engines: | ||
type: array | ||
items: | ||
$ref: './common.schema.yaml#/components/schemas/EngineDescriptor' | ||
|
||
/api/entity_store/status: | ||
get: | ||
x-labels: [ess, serverless] | ||
x-codegen-enabled: true | ||
operationId: GetEntityStoreStatus | ||
summary: Get the status of the Entity Store | ||
responses: | ||
'200': | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
status: | ||
$ref: './common.schema.yaml#/components/schemas/StoreStatus' | ||
engines: | ||
type: array | ||
items: | ||
$ref: './common.schema.yaml#/components/schemas/EngineDescriptor' |
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
Oops, something went wrong.