[Entity Analytics] Tidy Asset Criticality API docs (#190037)

**Addresses:** https://github.com/elastic/kibana/issues/190038

## Summary

Tidy the asset criticality API docs after reviewing the doc previews for
[Serverless](https://bump.sh/per-solution-example/doc/security-solution-api-playground)
and
[ESS](https://bump.sh/per-solution-example/doc/security-solution-api-playground-ess)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Mark Hopkin 2024-08-13 15:30:46 +01:00 committed by GitHub
parent bd5927fab4
commit 919844da4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 64 additions and 23 deletions

View file

@ -1,3 +1,4 @@
# ⚠️ Updating this file? Also update the public API docs at https://github.com/elastic/security-docs/tree/main/docs/advanced-entity-analytics/api
openapi: 3.0.0 openapi: 3.0.0
info: info:
version: '2023-10-31' version: '2023-10-31'
@ -8,7 +9,8 @@ paths:
x-labels: [ess, serverless] x-labels: [ess, serverless]
x-codegen-enabled: true x-codegen-enabled: true
operationId: BulkUpsertAssetCriticalityRecords operationId: BulkUpsertAssetCriticalityRecords
summary: Bulk upsert asset criticality data, creating or updating records as needed summary: Bulk Upsert Asset Criticality Records
description: Bulk upsert up to 1000 asset criticality records, creating or updating them as needed.
requestBody: requestBody:
content: content:
application/json: application/json:

View file

@ -1,3 +1,4 @@
# ⚠️ Updating this file? Also update the public API docs at https://github.com/elastic/security-docs/tree/main/docs/advanced-entity-analytics/api
openapi: 3.0.0 openapi: 3.0.0
info: info:
version: '2023-10-31' version: '2023-10-31'
@ -8,7 +9,8 @@ paths:
x-labels: [ess, serverless] x-labels: [ess, serverless]
x-codegen-enabled: true x-codegen-enabled: true
operationId: CreateAssetCriticalityRecord operationId: CreateAssetCriticalityRecord
summary: Create Criticality Record summary: Upsert Criticality Record
description: Create or update a criticality record for a specific asset.
requestBody: requestBody:
required: true required: true
content: content:

View file

@ -44,8 +44,11 @@ export type DeleteAssetCriticalityRecordResponse = z.infer<
>; >;
export const DeleteAssetCriticalityRecordResponse = z.object({ export const DeleteAssetCriticalityRecordResponse = z.object({
/** /**
* If the record was deleted. If false the record did not exist. * True if the record was deleted or false if the record did not exist.
*/ */
deleted: z.boolean(), deleted: z.boolean(),
/**
* The deleted record if it existed.
*/
record: AssetCriticalityRecord.optional(), record: AssetCriticalityRecord.optional(),
}); });

View file

@ -1,3 +1,4 @@
# ⚠️ Updating this file? Also update the public API docs at https://github.com/elastic/security-docs/tree/main/docs/advanced-entity-analytics/api
openapi: 3.0.0 openapi: 3.0.0
info: info:
version: '2023-10-31' version: '2023-10-31'
@ -9,6 +10,7 @@ paths:
x-codegen-enabled: true x-codegen-enabled: true
operationId: DeleteAssetCriticalityRecord operationId: DeleteAssetCriticalityRecord
summary: Delete Criticality Record summary: Delete Criticality Record
description: Delete the asset criticality record for a specific asset if it exists.
parameters: parameters:
- name: id_value - name: id_value
in: query in: query
@ -40,8 +42,9 @@ paths:
properties: properties:
deleted: deleted:
type: boolean type: boolean
description: If the record was deleted. If false the record did not exist. description: True if the record was deleted or false if the record did not exist.
record: record:
description: The deleted record if it existed.
$ref: './common.schema.yaml#/components/schemas/AssetCriticalityRecord' $ref: './common.schema.yaml#/components/schemas/AssetCriticalityRecord'
required: required:
- deleted - deleted

View file

@ -1,3 +1,4 @@
# ⚠️ Updating this file? Also update the public API docs at https://github.com/elastic/security-docs/tree/main/docs/advanced-entity-analytics/api
openapi: 3.0.0 openapi: 3.0.0
info: info:
version: '2023-10-31' version: '2023-10-31'
@ -9,6 +10,7 @@ paths:
x-codegen-enabled: true x-codegen-enabled: true
operationId: GetAssetCriticalityRecord operationId: GetAssetCriticalityRecord
summary: Get Criticality Record summary: Get Criticality Record
description: Get the criticality record for a specific asset.
parameters: parameters:
- name: id_value - name: id_value
in: query in: query

View file

@ -1,14 +1,16 @@
# ⚠️ Updating this file? Also update the public API docs at https://github.com/elastic/security-docs/tree/main/docs/advanced-entity-analytics/api
openapi: 3.0.0 openapi: 3.0.0
info: info:
version: '2023-10-31' version: '2023-10-31'
title: Asset Criticality List Schema title: Asset Criticality List Schema
paths: paths:
/api/asset_criticality/list: /api/asset_criticality/list:
post: get:
x-labels: [ess, serverless] x-labels: [ess, serverless]
x-codegen-enabled: true x-codegen-enabled: true
operationId: FindAssetCriticalityRecords operationId: FindAssetCriticalityRecords
summary: List asset criticality data, filtering and sorting as needed summary: List Asset Criticality Records
description: List asset criticality records, paging, sorting and filtering as needed.
parameters: parameters:
- name: sort_field - name: sort_field
in: query in: query

View file

@ -13,6 +13,7 @@ servers:
paths: paths:
/api/asset_criticality: /api/asset_criticality:
delete: delete:
description: Delete the asset criticality record for a specific asset if it exists.
operationId: DeleteAssetCriticalityRecord operationId: DeleteAssetCriticalityRecord
parameters: parameters:
- description: The ID value of the asset. - description: The ID value of the asset.
@ -45,11 +46,12 @@ paths:
properties: properties:
deleted: deleted:
description: >- description: >-
If the record was deleted. If false the record did not True if the record was deleted or false if the record did
exist. not exist.
type: boolean type: boolean
record: record:
$ref: '#/components/schemas/AssetCriticalityRecord' $ref: '#/components/schemas/AssetCriticalityRecord'
description: The deleted record if it existed.
required: required:
- deleted - deleted
description: Successful response description: Successful response
@ -59,6 +61,7 @@ paths:
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
get: get:
description: Get the criticality record for a specific asset.
operationId: GetAssetCriticalityRecord operationId: GetAssetCriticalityRecord
parameters: parameters:
- description: The ID value of the asset. - description: The ID value of the asset.
@ -89,6 +92,7 @@ paths:
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
post: post:
description: Create or update a criticality record for a specific asset.
operationId: CreateAssetCriticalityRecord operationId: CreateAssetCriticalityRecord
requestBody: requestBody:
content: content:
@ -115,11 +119,14 @@ paths:
description: Successful response description: Successful response
'400': '400':
description: Invalid request description: Invalid request
summary: Create Criticality Record summary: Upsert Criticality Record
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
/api/asset_criticality/bulk: /api/asset_criticality/bulk:
post: post:
description: >-
Bulk upsert up to 1000 asset criticality records, creating or updating
them as needed.
operationId: BulkUpsertAssetCriticalityRecords operationId: BulkUpsertAssetCriticalityRecords
requestBody: requestBody:
content: content:
@ -170,13 +177,12 @@ paths:
description: Bulk upload successful description: Bulk upload successful
'413': '413':
description: File too large description: File too large
summary: >- summary: Bulk Upsert Asset Criticality Records
Bulk upsert asset criticality data, creating or updating records as
needed
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
/api/asset_criticality/list: /api/asset_criticality/list:
post: get:
description: 'List asset criticality records, paging, sorting and filtering as needed.'
operationId: FindAssetCriticalityRecords operationId: FindAssetCriticalityRecords
parameters: parameters:
- description: The field to sort by. - description: The field to sort by.
@ -247,7 +253,7 @@ paths:
- per_page - per_page
- total - total
description: Bulk upload successful description: Bulk upload successful
summary: 'List asset criticality data, filtering and sorting as needed' summary: List Asset Criticality Records
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
components: components:

View file

@ -13,6 +13,7 @@ servers:
paths: paths:
/api/asset_criticality: /api/asset_criticality:
delete: delete:
description: Delete the asset criticality record for a specific asset if it exists.
operationId: DeleteAssetCriticalityRecord operationId: DeleteAssetCriticalityRecord
parameters: parameters:
- description: The ID value of the asset. - description: The ID value of the asset.
@ -45,11 +46,12 @@ paths:
properties: properties:
deleted: deleted:
description: >- description: >-
If the record was deleted. If false the record did not True if the record was deleted or false if the record did
exist. not exist.
type: boolean type: boolean
record: record:
$ref: '#/components/schemas/AssetCriticalityRecord' $ref: '#/components/schemas/AssetCriticalityRecord'
description: The deleted record if it existed.
required: required:
- deleted - deleted
description: Successful response description: Successful response
@ -59,6 +61,7 @@ paths:
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
get: get:
description: Get the criticality record for a specific asset.
operationId: GetAssetCriticalityRecord operationId: GetAssetCriticalityRecord
parameters: parameters:
- description: The ID value of the asset. - description: The ID value of the asset.
@ -89,6 +92,7 @@ paths:
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
post: post:
description: Create or update a criticality record for a specific asset.
operationId: CreateAssetCriticalityRecord operationId: CreateAssetCriticalityRecord
requestBody: requestBody:
content: content:
@ -115,11 +119,14 @@ paths:
description: Successful response description: Successful response
'400': '400':
description: Invalid request description: Invalid request
summary: Create Criticality Record summary: Upsert Criticality Record
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
/api/asset_criticality/bulk: /api/asset_criticality/bulk:
post: post:
description: >-
Bulk upsert up to 1000 asset criticality records, creating or updating
them as needed.
operationId: BulkUpsertAssetCriticalityRecords operationId: BulkUpsertAssetCriticalityRecords
requestBody: requestBody:
content: content:
@ -170,13 +177,12 @@ paths:
description: Bulk upload successful description: Bulk upload successful
'413': '413':
description: File too large description: File too large
summary: >- summary: Bulk Upsert Asset Criticality Records
Bulk upsert asset criticality data, creating or updating records as
needed
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
/api/asset_criticality/list: /api/asset_criticality/list:
post: get:
description: 'List asset criticality records, paging, sorting and filtering as needed.'
operationId: FindAssetCriticalityRecords operationId: FindAssetCriticalityRecords
parameters: parameters:
- description: The field to sort by. - description: The field to sort by.
@ -247,7 +253,7 @@ paths:
- per_page - per_page
- total - total
description: Bulk upload successful description: Bulk upload successful
summary: 'List asset criticality data, filtering and sorting as needed' summary: List Asset Criticality Records
tags: tags:
- Security Solution Entity Analytics API - Security Solution Entity Analytics API
components: components:

View file

@ -212,6 +212,9 @@ after 30 days. It also deletes other artifacts specific to the migration impleme
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object); .send(props.body as object);
}, },
/**
* Bulk upsert up to 1000 asset criticality records, creating or updating them as needed.
*/
bulkUpsertAssetCriticalityRecords(props: BulkUpsertAssetCriticalityRecordsProps) { bulkUpsertAssetCriticalityRecords(props: BulkUpsertAssetCriticalityRecordsProps) {
return supertest return supertest
.post('/api/asset_criticality/bulk') .post('/api/asset_criticality/bulk')
@ -252,6 +255,9 @@ Migrations are initiated per index. While the process is neither destructive nor
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object); .send(props.body as object);
}, },
/**
* Create or update a criticality record for a specific asset.
*/
createAssetCriticalityRecord(props: CreateAssetCriticalityRecordProps) { createAssetCriticalityRecord(props: CreateAssetCriticalityRecordProps) {
return supertest return supertest
.post('/api/asset_criticality') .post('/api/asset_criticality')
@ -296,6 +302,9 @@ Migrations are initiated per index. While the process is neither destructive nor
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
}, },
/**
* Delete the asset criticality record for a specific asset if it exists.
*/
deleteAssetCriticalityRecord(props: DeleteAssetCriticalityRecordProps) { deleteAssetCriticalityRecord(props: DeleteAssetCriticalityRecordProps) {
return supertest return supertest
.delete('/api/asset_criticality') .delete('/api/asset_criticality')
@ -575,9 +584,12 @@ finalize it.
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object); .send(props.body as object);
}, },
/**
* List asset criticality records, paging, sorting and filtering as needed.
*/
findAssetCriticalityRecords(props: FindAssetCriticalityRecordsProps) { findAssetCriticalityRecords(props: FindAssetCriticalityRecordsProps) {
return supertest return supertest
.post('/api/asset_criticality/list') .get('/api/asset_criticality/list')
.set('kbn-xsrf', 'true') .set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
@ -602,6 +614,9 @@ finalize it.
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query); .query(props.query);
}, },
/**
* Get the criticality record for a specific asset.
*/
getAssetCriticalityRecord(props: GetAssetCriticalityRecordProps) { getAssetCriticalityRecord(props: GetAssetCriticalityRecordProps) {
return supertest return supertest
.get('/api/asset_criticality') .get('/api/asset_criticality')