Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Entity Analytics] Tidy Asset Criticality API docs #190037

Merged
merged 12 commits into from
Aug 13, 2024
Merged
Original file line number Diff line number Diff line change
@@ -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
hop-dev marked this conversation as resolved.
Show resolved Hide resolved
openapi: 3.0.0
info:
version: '2023-10-31'
Expand All @@ -8,7 +9,8 @@ paths:
x-labels: [ess, serverless]
x-codegen-enabled: true
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:
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
info:
version: '2023-10-31'
Expand All @@ -8,7 +9,8 @@ paths:
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: CreateAssetCriticalityRecord
summary: Create Criticality Record
summary: Upsert Criticality Record
description: Create or update a criticality record for a specific asset.
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ export type DeleteAssetCriticalityRecordResponse = z.infer<
>;
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(),
/**
* The deleted record if it existed.
*/
record: AssetCriticalityRecord.optional(),
});
Original file line number Diff line number Diff line change
@@ -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
info:
version: '2023-10-31'
Expand All @@ -9,6 +10,7 @@ paths:
x-codegen-enabled: true
operationId: DeleteAssetCriticalityRecord
summary: Delete Criticality Record
description: Delete the asset criticality record for a specific asset if it exists.
parameters:
- name: id_value
in: query
Expand Down Expand Up @@ -40,8 +42,9 @@ paths:
properties:
deleted:
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:
description: The deleted record if it existed.
$ref: './common.schema.yaml#/components/schemas/AssetCriticalityRecord'
required:
- deleted
Expand Down
Original file line number Diff line number Diff line change
@@ -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
info:
version: '2023-10-31'
Expand All @@ -9,6 +10,7 @@ paths:
x-codegen-enabled: true
operationId: GetAssetCriticalityRecord
summary: Get Criticality Record
description: Get the criticality record for a specific asset.
parameters:
- name: id_value
in: query
Expand Down
Original file line number Diff line number Diff line change
@@ -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
info:
version: '2023-10-31'
title: Asset Criticality List Schema
paths:
/api/asset_criticality/list:
post:
get:
x-labels: [ess, serverless]
x-codegen-enabled: true
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:
- name: sort_field
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ servers:
paths:
/api/asset_criticality:
delete:
description: Delete the asset criticality record for a specific asset if it exists.
operationId: DeleteAssetCriticalityRecord
parameters:
- description: The ID value of the asset.
Expand Down Expand Up @@ -45,11 +46,12 @@ paths:
properties:
deleted:
description: >-
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.
type: boolean
record:
$ref: '#/components/schemas/AssetCriticalityRecord'
description: The deleted record if it existed.
required:
- deleted
description: Successful response
Expand All @@ -59,6 +61,7 @@ paths:
tags:
- Security Solution Entity Analytics API
get:
description: Get the criticality record for a specific asset.
operationId: GetAssetCriticalityRecord
parameters:
- description: The ID value of the asset.
Expand Down Expand Up @@ -89,6 +92,7 @@ paths:
tags:
- Security Solution Entity Analytics API
post:
description: Create or update a criticality record for a specific asset.
operationId: CreateAssetCriticalityRecord
requestBody:
content:
Expand All @@ -115,11 +119,14 @@ paths:
description: Successful response
'400':
description: Invalid request
summary: Create Criticality Record
summary: Upsert Criticality Record
tags:
- Security Solution Entity Analytics API
/api/asset_criticality/bulk:
post:
description: >-
Bulk upsert up to 1000 asset criticality records, creating or updating
them as needed.
operationId: BulkUpsertAssetCriticalityRecords
requestBody:
content:
Expand Down Expand Up @@ -170,13 +177,12 @@ paths:
description: Bulk upload successful
'413':
description: File too large
summary: >-
Bulk upsert asset criticality data, creating or updating records as
needed
summary: Bulk Upsert Asset Criticality Records
tags:
- Security Solution Entity Analytics API
/api/asset_criticality/list:
post:
get:
description: 'List asset criticality records, paging, sorting and filtering as needed.'
operationId: FindAssetCriticalityRecords
parameters:
- description: The field to sort by.
Expand Down Expand Up @@ -247,7 +253,7 @@ paths:
- per_page
- total
description: Bulk upload successful
summary: 'List asset criticality data, filtering and sorting as needed'
summary: List Asset Criticality Records
tags:
- Security Solution Entity Analytics API
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ servers:
paths:
/api/asset_criticality:
delete:
description: Delete the asset criticality record for a specific asset if it exists.
operationId: DeleteAssetCriticalityRecord
parameters:
- description: The ID value of the asset.
Expand Down Expand Up @@ -45,11 +46,12 @@ paths:
properties:
deleted:
description: >-
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.
type: boolean
record:
$ref: '#/components/schemas/AssetCriticalityRecord'
description: The deleted record if it existed.
required:
- deleted
description: Successful response
Expand All @@ -59,6 +61,7 @@ paths:
tags:
- Security Solution Entity Analytics API
get:
description: Get the criticality record for a specific asset.
operationId: GetAssetCriticalityRecord
parameters:
- description: The ID value of the asset.
Expand Down Expand Up @@ -89,6 +92,7 @@ paths:
tags:
- Security Solution Entity Analytics API
post:
description: Create or update a criticality record for a specific asset.
operationId: CreateAssetCriticalityRecord
requestBody:
content:
Expand All @@ -115,11 +119,14 @@ paths:
description: Successful response
'400':
description: Invalid request
summary: Create Criticality Record
summary: Upsert Criticality Record
tags:
- Security Solution Entity Analytics API
/api/asset_criticality/bulk:
post:
description: >-
Bulk upsert up to 1000 asset criticality records, creating or updating
them as needed.
operationId: BulkUpsertAssetCriticalityRecords
requestBody:
content:
Expand Down Expand Up @@ -170,13 +177,12 @@ paths:
description: Bulk upload successful
'413':
description: File too large
summary: >-
Bulk upsert asset criticality data, creating or updating records as
needed
summary: Bulk Upsert Asset Criticality Records
tags:
- Security Solution Entity Analytics API
/api/asset_criticality/list:
post:
get:
description: 'List asset criticality records, paging, sorting and filtering as needed.'
operationId: FindAssetCriticalityRecords
parameters:
- description: The field to sort by.
Expand Down Expand Up @@ -247,7 +253,7 @@ paths:
- per_page
- total
description: Bulk upload successful
summary: 'List asset criticality data, filtering and sorting as needed'
summary: List Asset Criticality Records
tags:
- Security Solution Entity Analytics API
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ after 30 days. It also deletes other artifacts specific to the migration impleme
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
/**
* Bulk upsert up to 1000 asset criticality records, creating or updating them as needed.
*/
bulkUpsertAssetCriticalityRecords(props: BulkUpsertAssetCriticalityRecordsProps) {
return supertest
.post('/api/asset_criticality/bulk')
Expand Down Expand Up @@ -252,6 +255,9 @@ Migrations are initiated per index. While the process is neither destructive nor
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
/**
* Create or update a criticality record for a specific asset.
*/
createAssetCriticalityRecord(props: CreateAssetCriticalityRecordProps) {
return supertest
.post('/api/asset_criticality')
Expand Down Expand Up @@ -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(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
/**
* Delete the asset criticality record for a specific asset if it exists.
*/
deleteAssetCriticalityRecord(props: DeleteAssetCriticalityRecordProps) {
return supertest
.delete('/api/asset_criticality')
Expand Down Expand Up @@ -575,9 +584,12 @@ finalize it.
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
/**
* List asset criticality records, paging, sorting and filtering as needed.
*/
findAssetCriticalityRecords(props: FindAssetCriticalityRecordsProps) {
return supertest
.post('/api/asset_criticality/list')
.get('/api/asset_criticality/list')
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -602,6 +614,9 @@ finalize it.
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query);
},
/**
* Get the criticality record for a specific asset.
*/
getAssetCriticalityRecord(props: GetAssetCriticalityRecordProps) {
return supertest
.get('/api/asset_criticality')
Expand Down