Skip to content

Commit

Permalink
[Entity Analytics] [Entity Store] Add basic e2e tests and + tidy API …
Browse files Browse the repository at this point in the history
…route names (#193161)

## Summary

Adds basic end to end tests for the engine CRUD routes.

I also noticed there was some inconsistency in the naming of the API
routes which I have fixed.

---------

Co-authored-by: machadoum <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Tiago Vila Verde <[email protected]>
  • Loading branch information
4 people authored Sep 24, 2024
1 parent b78b633 commit 0b4f877
Show file tree
Hide file tree
Showing 33 changed files with 562 additions and 290 deletions.
40 changes: 20 additions & 20 deletions oas_docs/output/kibana.serverless.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8169,7 +8169,7 @@ paths:
- Security Solution Endpoint Management API
/api/entity_store/engines:
get:
operationId: ListEntityStoreEngines
operationId: ListEntityEngines
responses:
'200':
content:
Expand All @@ -8185,14 +8185,14 @@ paths:
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
type: array
description: Successful response
summary: List the Entity Store engines
summary: List the Entity Engines
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}:
delete:
operationId: DeleteEntityStore
operationId: DeleteEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -8215,13 +8215,13 @@ paths:
deleted:
type: boolean
description: Successful response
summary: Delete the Entity Store engine
summary: Delete the Entity Engine
tags:
- Security Solution Entity Analytics API
get:
operationId: GetEntityStoreEngine
operationId: GetEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -8236,14 +8236,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
description: Successful response
summary: Get the Entity Store engine
summary: Get an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/init:
post:
operationId: InitEntityStore
operationId: InitEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand Down Expand Up @@ -8271,14 +8271,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
description: Successful response
summary: Initialize the Entity Store
summary: Initialize an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/start:
post:
operationId: StartEntityStore
operationId: StartEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -8295,14 +8295,14 @@ paths:
started:
type: boolean
description: Successful response
summary: Start the Entity Store engine
summary: Start an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/stats:
post:
operationId: GetEntityStoreStats
operationId: GetEntityEngineStats
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand Down Expand Up @@ -8334,14 +8334,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EntityType
description: Successful response
summary: Get the Entity Store engine stats
summary: Get Entity Engine stats
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/stop:
post:
operationId: StopEntityStore
operationId: StopEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -8358,7 +8358,7 @@ paths:
stopped:
type: boolean
description: Successful response
summary: Stop the Entity Store engine
summary: Stop an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/entities/list:
Expand Down
40 changes: 20 additions & 20 deletions oas_docs/output/kibana.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11616,7 +11616,7 @@ paths:
- Security Solution Endpoint Management API
/api/entity_store/engines:
get:
operationId: ListEntityStoreEngines
operationId: ListEntityEngines
responses:
'200':
content:
Expand All @@ -11632,14 +11632,14 @@ paths:
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
type: array
description: Successful response
summary: List the Entity Store engines
summary: List the Entity Engines
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}:
delete:
operationId: DeleteEntityStore
operationId: DeleteEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -11662,13 +11662,13 @@ paths:
deleted:
type: boolean
description: Successful response
summary: Delete the Entity Store engine
summary: Delete the Entity Engine
tags:
- Security Solution Entity Analytics API
get:
operationId: GetEntityStoreEngine
operationId: GetEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -11683,14 +11683,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
description: Successful response
summary: Get the Entity Store engine
summary: Get an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/init:
post:
operationId: InitEntityStore
operationId: InitEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand Down Expand Up @@ -11718,14 +11718,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EngineDescriptor
description: Successful response
summary: Initialize the Entity Store
summary: Initialize an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/start:
post:
operationId: StartEntityStore
operationId: StartEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -11742,14 +11742,14 @@ paths:
started:
type: boolean
description: Successful response
summary: Start the Entity Store engine
summary: Start an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/stats:
post:
operationId: GetEntityStoreStats
operationId: GetEntityEngineStats
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand Down Expand Up @@ -11781,14 +11781,14 @@ paths:
$ref: >-
#/components/schemas/Security_Solution_Entity_Analytics_API_EntityType
description: Successful response
summary: Get the Entity Store engine stats
summary: Get Entity Engine stats
tags:
- Security Solution Entity Analytics API
/api/entity_store/engines/{entityType}/stop:
post:
operationId: StopEntityStore
operationId: StopEntityEngine
parameters:
- description: The entity type of the store (either 'user' or 'host').
- description: The entity type of the engine (either 'user' or 'host').
in: path
name: entityType
required: true
Expand All @@ -11805,7 +11805,7 @@ paths:
stopped:
type: boolean
description: Successful response
summary: Stop the Entity Store engine
summary: Stop an Entity Engine
tags:
- Security Solution Entity Analytics API
/api/entity_store/entities/list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Delete the entity store engine
* title: Delete an Entity Engine
* version: 2023-10-31
*/

Expand All @@ -19,25 +19,25 @@ import { BooleanFromString } from '@kbn/zod-helpers';

import { EntityType } from '../common.gen';

export type DeleteEntityStoreRequestQuery = z.infer<typeof DeleteEntityStoreRequestQuery>;
export const DeleteEntityStoreRequestQuery = z.object({
export type DeleteEntityEngineRequestQuery = z.infer<typeof DeleteEntityEngineRequestQuery>;
export const DeleteEntityEngineRequestQuery = z.object({
/**
* Control flag to also delete the entity data.
*/
data: BooleanFromString.optional(),
});
export type DeleteEntityStoreRequestQueryInput = z.input<typeof DeleteEntityStoreRequestQuery>;
export type DeleteEntityEngineRequestQueryInput = z.input<typeof DeleteEntityEngineRequestQuery>;

export type DeleteEntityStoreRequestParams = z.infer<typeof DeleteEntityStoreRequestParams>;
export const DeleteEntityStoreRequestParams = z.object({
export type DeleteEntityEngineRequestParams = z.infer<typeof DeleteEntityEngineRequestParams>;
export const DeleteEntityEngineRequestParams = z.object({
/**
* The entity type of the store (either 'user' or 'host').
* The entity type of the engine (either 'user' or 'host').
*/
entityType: EntityType,
});
export type DeleteEntityStoreRequestParamsInput = z.input<typeof DeleteEntityStoreRequestParams>;
export type DeleteEntityEngineRequestParamsInput = z.input<typeof DeleteEntityEngineRequestParams>;

export type DeleteEntityStoreResponse = z.infer<typeof DeleteEntityStoreResponse>;
export const DeleteEntityStoreResponse = z.object({
export type DeleteEntityEngineResponse = z.infer<typeof DeleteEntityEngineResponse>;
export const DeleteEntityEngineResponse = z.object({
deleted: z.boolean().optional(),
});
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
openapi: 3.0.0

info:
title: Delete the entity store engine
title: Delete an Entity Engine
version: '2023-10-31'
paths:
/api/entity_store/engines/{entityType}:
delete:
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: DeleteEntityStore
summary: Delete the Entity Store engine
operationId: DeleteEntityEngine
summary: Delete the Entity Engine
parameters:
- name: entityType
in: path
required: true
schema:
$ref: '../common.schema.yaml#/components/schemas/EntityType'
description: The entity type of the store (either 'user' or 'host').
description: The entity type of the engine (either 'user' or 'host').

- name: data
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,22 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get Entity Store engine
* title: Get Entity Engine
* version: 2023-10-31
*/

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

import { EntityType, EngineDescriptor } from '../common.gen';

export type GetEntityStoreEngineRequestParams = z.infer<typeof GetEntityStoreEngineRequestParams>;
export const GetEntityStoreEngineRequestParams = z.object({
export type GetEntityEngineRequestParams = z.infer<typeof GetEntityEngineRequestParams>;
export const GetEntityEngineRequestParams = z.object({
/**
* The entity type of the store (either 'user' or 'host').
* The entity type of the engine (either 'user' or 'host').
*/
entityType: EntityType,
});
export type GetEntityStoreEngineRequestParamsInput = z.input<
typeof GetEntityStoreEngineRequestParams
>;
export type GetEntityEngineRequestParamsInput = z.input<typeof GetEntityEngineRequestParams>;

export type GetEntityStoreEngineResponse = z.infer<typeof GetEntityStoreEngineResponse>;
export const GetEntityStoreEngineResponse = EngineDescriptor;
export type GetEntityEngineResponse = z.infer<typeof GetEntityEngineResponse>;
export const GetEntityEngineResponse = EngineDescriptor;
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
openapi: 3.0.0
info:
title: Get Entity Store engine
title: Get Entity Engine
version: '2023-10-31'
paths:
/api/entity_store/engines/{entityType}:
get:
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: GetEntityStoreEngine
summary: Get the Entity Store engine
operationId: GetEntityEngine
summary: Get an Entity Engine
parameters:
- name: entityType
in: path
required: true
schema:
$ref: '../common.schema.yaml#/components/schemas/EntityType'
description: The entity type of the store (either 'user' or 'host').
description: The entity type of the engine (either 'user' or 'host').
responses:
'200':
description: Successful response
Expand Down
Loading

0 comments on commit 0b4f877

Please sign in to comment.