[8.x] [Entity Analytics] New API endpoint to cleanup the risk engine installation and data (#191843)#193989
Merged
abhishekbhatia1710 merged 9 commits intoelastic:8.xfrom Sep 26, 2024
Conversation
…lation and data (elastic#191843) ## Summary 1. Create a new public API endpoint : `DELETE /api/risk_score/engine/dangerously_delete_data` ## Test cases Result ``` PASS x-pack/plugins/security_solution/server/lib/entity_analytics/risk_engine/routes/delete.test.ts (7.017 s) risk engine cleanup route invokes the risk engine cleanup route ✓ should call the router with the correct route and handler (71 ms) ✓ returns a 200 when cleanup is successful (64 ms) ✓ returns a 500 when cleanup is unsuccessful (57 ms) ✓ returns a 500 when cleanup is unsuccessful with multiple errors (53 ms) when task manager is unavailable ✓ returns a 400 when task manager is unavailable (55 ms) when user does not have the required privileges ✓ returns a 403 when user does not have the required privileges (88 ms) ``` ### API Responses ## When multiple errors encountered ``` { "risk_engine_cleanup": false, "errors": [ { "seq": 1, "error": "resource_not_found_exception\n\tRoot causes:\n\t\tresource_not_found_exception: Transform with id [risk_score_latest_transform_default] could not be found" }, { "seq": 2, "error": "index_not_found_exception\n\tRoot causes:\n\t\tindex_not_found_exception: no such index [risk-score.risk-score-default]" }, { "seq": 3, "error": "index_template_missing_exception\n\tRoot causes:\n\t\tindex_template_missing_exception: index_template [.risk-score.risk-score-default-index-template] missing" }, { "seq": 4, "error": "resource_not_found_exception\n\tRoot causes:\n\t\tresource_not_found_exception: .risk-score-mappings" } ], "status_code": 500 } ``` ## Success ``` { "risk_engine_cleanup": true } ``` ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### OpenAPI spec  ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit 22f451b) # Conflicts: # oas_docs/output/kibana.serverless.staging.yaml # oas_docs/output/kibana.staging.yaml
4 tasks
tiansivive
approved these changes
Sep 26, 2024
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.x:Questions ?
Please refer to the Backport tool documentation