mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[Security Solution] Auto-bundle Exceptions API OpenAPI specs (#188408)
**Addresses**: https://github.com/elastic/kibana/issues/184428 ## Summary This PR adds scripts for automatic bundling of Exceptions API OpenAPI specs as a part of PR pipeline. Corresponding resulting bundles are automatically committed in the Lists common package `kbn-securitysolution-exceptions-common` in the `docs/openapi/ess/` and `docs/openapi/serverless` folders (similar to https://github.com/elastic/kibana/pull/186384).
This commit is contained in:
parent
edad80ce5f
commit
179b78b499
11 changed files with 3769 additions and 5 deletions
|
@ -10,4 +10,7 @@ echo --- Security Solution OpenAPI Bundling
|
|||
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
|
||||
|
||||
(cd packages/kbn-securitysolution-exceptions-common && yarn openapi:bundle)
|
||||
check_for_changed_files "yarn openapi:bundle" true
|
|
@ -5,6 +5,7 @@ info:
|
|||
paths:
|
||||
/api/exception_lists/_duplicate:
|
||||
post:
|
||||
x-labels: [serverless, ess]
|
||||
operationId: DuplicateExceptionList
|
||||
x-codegen-enabled: true
|
||||
summary: Duplicates an exception list
|
||||
|
|
|
@ -5,6 +5,7 @@ info:
|
|||
paths:
|
||||
/api/exception_lists/_export:
|
||||
post:
|
||||
x-labels: [serverless, ess]
|
||||
operationId: ExportExceptionList
|
||||
x-codegen-enabled: true
|
||||
summary: Exports an exception list
|
||||
|
|
|
@ -3,7 +3,7 @@ info:
|
|||
title: Find exception lists API endpoint
|
||||
version: '2023-10-31'
|
||||
paths:
|
||||
/api/exception_lists/items/_find:
|
||||
/api/exception_lists/_find:
|
||||
get:
|
||||
x-labels: [serverless, ess]
|
||||
operationId: FindExceptionLists
|
||||
|
|
|
@ -5,6 +5,7 @@ info:
|
|||
paths:
|
||||
/api/exception_lists/_import:
|
||||
post:
|
||||
x-labels: [serverless, ess]
|
||||
operationId: ImportExceptionList
|
||||
x-codegen-enabled: true
|
||||
summary: Imports an exception list
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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_exceptions_api_{version}.bundled.schema.yaml'
|
||||
),
|
||||
options: {
|
||||
includeLabels: ['serverless'],
|
||||
specInfo: {
|
||||
title: 'Security Solution Exceptions API (Elastic Cloud Serverless)',
|
||||
description:
|
||||
"Exceptions API allows you to manage detection rule exceptions to prevent a rule from generating an alert from incoming events even when the rule's other criteria are met.",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await bundle({
|
||||
sourceGlob: join(ROOT, 'api/**/*.schema.yaml'),
|
||||
outputFilePath: join(
|
||||
ROOT,
|
||||
'docs/openapi/ess/security_solution_exceptions_api_{version}.bundled.schema.yaml'
|
||||
),
|
||||
options: {
|
||||
includeLabels: ['ess'],
|
||||
specInfo: {
|
||||
title: 'Security Solution Exceptions API (Elastic Cloud and self-hosted)',
|
||||
description:
|
||||
"Exceptions API allows you to manage detection rule exceptions to prevent a rule from generating an alert from incoming events even when the rule's other criteria are met.",
|
||||
},
|
||||
},
|
||||
});
|
||||
})();
|
|
@ -17,14 +17,14 @@ const ROOT = resolve(__dirname, '..');
|
|||
await generate({
|
||||
title: 'OpenAPI Exceptions API Schemas',
|
||||
rootDir: ROOT,
|
||||
sourceGlob: './**/*.schema.yaml',
|
||||
sourceGlob: './api/**/*.schema.yaml',
|
||||
templateName: 'zod_operation_schema',
|
||||
});
|
||||
|
||||
await generate({
|
||||
title: 'Exceptions API client for tests',
|
||||
rootDir: ROOT,
|
||||
sourceGlob: './**/*.schema.yaml',
|
||||
sourceGlob: './api/**/*.schema.yaml',
|
||||
templateName: 'api_client_supertest',
|
||||
skipLinting: true,
|
||||
bundle: {
|
||||
|
|
|
@ -122,7 +122,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
},
|
||||
findExceptionLists(props: FindExceptionListsProps) {
|
||||
return supertest
|
||||
.get('/api/exception_lists/items/_find')
|
||||
.get('/api/exception_lists/_find')
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue