forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [EDR Workflows] Deprecate public endpoint/suggestions api endpo…
…int in favour of an internal one (elastic#194832) (elastic#195416) # Backport This will backport the following commits from `main` to `8.x`: - [[EDR Workflows] Deprecate public endpoint/suggestions api endpoint in favour of an internal one (elastic#194832)](elastic#194832) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Konrad Szwarc","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-08T13:34:27Z","message":"[EDR Workflows] Deprecate public endpoint/suggestions api endpoint in favour of an internal one (elastic#194832)\n\nNew internal GET `/internal/api/endpoint/suggestions/{suggestion_type}`\r\nroute.\r\n\r\nCurrent public GET `/api/endpoint/suggestions/{suggestion_type}` route\r\nis set to deprecated.\r\n\r\n\r\nUI uses now the internal GET\r\n`/internal/api/endpoint/suggestions/{suggestion_type}` api route\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ef4755a063e5e08af3ebd44c2a866ac804eabcd4","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend Workflows","v8.16.0","backport:version"],"title":"[EDR Workflows] Deprecate public endpoint/suggestions api endpoint in favour of an internal one ","number":194832,"url":"https://github.com/elastic/kibana/pull/194832","mergeCommit":{"message":"[EDR Workflows] Deprecate public endpoint/suggestions api endpoint in favour of an internal one (elastic#194832)\n\nNew internal GET `/internal/api/endpoint/suggestions/{suggestion_type}`\r\nroute.\r\n\r\nCurrent public GET `/api/endpoint/suggestions/{suggestion_type}` route\r\nis set to deprecated.\r\n\r\n\r\nUI uses now the internal GET\r\n`/internal/api/endpoint/suggestions/{suggestion_type}` api route\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ef4755a063e5e08af3ebd44c2a866ac804eabcd4"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194832","number":194832,"mergeCommit":{"message":"[EDR Workflows] Deprecate public endpoint/suggestions api endpoint in favour of an internal one (elastic#194832)\n\nNew internal GET `/internal/api/endpoint/suggestions/{suggestion_type}`\r\nroute.\r\n\r\nCurrent public GET `/api/endpoint/suggestions/{suggestion_type}` route\r\nis set to deprecated.\r\n\r\n\r\nUI uses now the internal GET\r\n`/internal/api/endpoint/suggestions/{suggestion_type}` api route\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ef4755a063e5e08af3ebd44c2a866ac804eabcd4"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Konrad Szwarc <[email protected]>
- Loading branch information
1 parent
b88ba17
commit 5de888f
Showing
13 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
44 changes: 44 additions & 0 deletions
44
...lugins/security_solution/public/management/pages/event_filters/service/api_client.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { HttpSetup } from '@kbn/core-http-browser'; | ||
import { EventFiltersApiClient } from './api_client'; | ||
import { coreMock } from '@kbn/core/public/mocks'; | ||
import { SUGGESTIONS_INTERNAL_ROUTE } from '../../../../../common/endpoint/constants'; | ||
import { resolvePathVariables } from '../../../../common/utils/resolve_path_variables'; | ||
|
||
describe('EventFiltersApiClient', () => { | ||
let fakeHttpServices: jest.Mocked<HttpSetup>; | ||
let eventFiltersApiClient: EventFiltersApiClient; | ||
|
||
beforeAll(() => { | ||
fakeHttpServices = coreMock.createStart().http as jest.Mocked<HttpSetup>; | ||
eventFiltersApiClient = new EventFiltersApiClient(fakeHttpServices); | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should call the SUGGESTIONS_INTERNAL_ROUTE with correct URL and body', async () => { | ||
await eventFiltersApiClient.getSuggestions({ | ||
field: 'host.name', | ||
query: 'test', | ||
}); | ||
|
||
expect(fakeHttpServices.post).toHaveBeenCalledWith( | ||
resolvePathVariables(SUGGESTIONS_INTERNAL_ROUTE, { suggestion_type: 'eventFilters' }), | ||
{ | ||
version: '1', | ||
body: JSON.stringify({ | ||
field: 'host.name', | ||
query: 'test', | ||
}), | ||
} | ||
); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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