Skip to content

Commit

Permalink
[Security Solution] Auto-bundle Detections API OpenAPI specs (elastic…
Browse files Browse the repository at this point in the history
…#186384)

**Addresses:** elastic#184428

## Summary

This PR adds scripts for automatic bundling Detections API OpenAPI spec as a part of PR pipeline. Corresponding resulting bundles are automatically committed to `x-pack/plugins/security_solution/docs/openapi/ess/` and `x-pack/plugins/security_solution/docs/openapi/serverless` folders.
  • Loading branch information
maximpn authored Jun 18, 2024
1 parent 7a0065d commit 858ef15
Show file tree
Hide file tree
Showing 25 changed files with 11,237 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euo pipefail

source .buildkite/scripts/common/util.sh

echo --- Security Solution OpenAPI Bundling

(cd x-pack/plugins/security_solution && yarn openapi:bundle)
check_for_changed_files "yarn openapi:bundle" true
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ paths:
/api/detection_engine/signals/assignees:
summary: Assigns users to alerts
post:
operationId: SetAlertAssignees
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: SetAlertAssignees
description: Assigns users to alerts.
requestBody:
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/prepackaged/_status:
get:
operationId: GetPrebuiltRulesAndTimelinesStatus
x-labels: [ess]
x-codegen-enabled: true
operationId: GetPrebuiltRulesAndTimelinesStatus
summary: Get the status of Elastic prebuilt rules
tags:
- Prebuilt Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/prepackaged:
put:
operationId: InstallPrebuiltRulesAndTimelines
x-labels: [ess]
x-codegen-enabled: true
operationId: InstallPrebuiltRulesAndTimelines
summary: Installs all Elastic prebuilt rules and timelines
tags:
- Prebuilt Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/_bulk_action:
post:
operationId: PerformBulkAction
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: PerformBulkAction
summary: Applies a bulk action to multiple rules
description: The bulk action is applied to all rules that match the filter or to the list of rules by their IDs.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ paths:
/api/detection_engine/rules/_bulk_create:
post:
x-labels: [ess]
operationId: BulkCreateRules
x-codegen-enabled: true
operationId: BulkCreateRules
deprecated: true
description: Creates new detection rules in bulk.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/_bulk_delete:
delete:
operationId: BulkDeleteRules
x-labels: [ess]
x-codegen-enabled: true
operationId: BulkDeleteRules
deprecated: true
description: Deletes multiple rules.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/_bulk_update:
patch:
operationId: BulkPatchRules
x-labels: [ess]
x-codegen-enabled: true
operationId: BulkPatchRules
deprecated: true
description: Updates multiple rules using the `PATCH` method.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/_bulk_update:
put:
operationId: BulkUpdateRules
x-labels: [ess]
x-codegen-enabled: true
operationId: BulkUpdateRules
deprecated: true
description: Updates multiple rules using the `PUT` method.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ paths:
/api/detection_engine/rules:
post:
x-labels: [ess, serverless]
operationId: CreateRule
x-codegen-enabled: true
operationId: CreateRule
description: Create a single detection rule
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules:
delete:
operationId: DeleteRule
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: DeleteRule
description: Deletes a single rule using the `rule_id` or `id` field.
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules:
patch:
operationId: PatchRule
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: PatchRule
description: Patch a single rule
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules:
get:
operationId: ReadRule
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: ReadRule
description: Read a single rule
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules:
put:
operationId: UpdateRule
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: UpdateRule
description: Update a single rule
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ paths:
/api/detection_engine/rules/_export:
summary: Exports rules to an `.ndjson` file
post:
operationId: ExportRules
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: ExportRules
summary: Export rules
description: Exports rules to an `.ndjson` file. The following configuration items are also included in the `.ndjson` file - Actions, Exception lists. Prebuilt rules cannot be exported.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ info:
paths:
/api/detection_engine/rules/_find:
get:
operationId: FindRules
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: FindRules
description: Finds rules that match the given query.
tags:
- Rules API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ paths:
/api/detection_engine/rules/_import:
summary: Imports rules from an `.ndjson` file
post:
operationId: ImportRules
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: ImportRules
summary: Import rules
description: Imports rules from an `.ndjson` file, including actions and exception lists.
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ paths:
/api/detection_engine/tags:
summary: Aggregates and returns rule tags
get:
operationId: ReadTags
x-labels: [ess, serverless]
x-codegen-enabled: true
operationId: ReadTags
summary: Aggregates and returns all unique tags from all rules
tags:
- Tags API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ info:
paths:
/internal/detection_engine/rules/{ruleId}/execution/events:
put:
operationId: GetRuleExecutionEvents
x-labels: [ess, serverless]
x-internal: true
x-codegen-enabled: true
operationId: GetRuleExecutionEvents
summary: Returns execution events of a given rule (aggregated by execution UUID) from Event Log.
tags:
- Rule Execution Log API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ info:
paths:
/internal/detection_engine/rules/{ruleId}/execution/results:
put:
operationId: GetRuleExecutionResults
x-labels: [ess, serverless]
x-internal: true
x-codegen-enabled: true
operationId: GetRuleExecutionResults
summary: Returns execution results of a given rule (aggregated by execution UUID) from Event Log.
tags:
- Rule Execution Log API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ paths:
/internal/detection_engine/users/_find:
summary: Suggests user profiles based on provided search term
post:
operationId: SuggestUserProfiles
x-labels: [ess, serverless]
x-internal: true
x-codegen-enabled: true
operationId: SuggestUserProfiles
description: Suggests user profiles.
parameters:
- name: searchTerm
Expand Down
Loading

0 comments on commit 858ef15

Please sign in to comment.