mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Security Solution] Support for kibana spaces in openapi generated securitySolutionApi service for integration tests (#194029)
### Summary This PR adds support for Kibana Spaces in the generated `securitySolutionApi` service for integration tests. Users can now pass an extra parameter `kibanaSpace` when calling a route from the service. The provided space will be prefixed to the API's path. If no argument is provided, it is default'ed to `'default'` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
de8c5999e8
commit
2f45c90d2f
6 changed files with 526 additions and 330 deletions
|
@ -11,6 +11,8 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '
|
|||
import { replaceParams } from '@kbn/openapi-common/shared';
|
||||
import { FtrProviderContext } from 'x-pack/test/api_integration/ftr_provider_context';
|
||||
|
||||
import { routeWithNamespace } from 'x-pack/test/common/utils/security_solution';
|
||||
|
||||
{{#each operations}}
|
||||
import {
|
||||
{{operationId}}RequestQueryInput,
|
||||
|
@ -29,9 +31,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
* {{{description}}}
|
||||
*/
|
||||
{{/if}}
|
||||
{{camelCase operationId}}({{#if (or requestQuery requestParams requestBody)}}props: {{operationId}}Props{{/if}}) {
|
||||
{{camelCase operationId}}({{#if (or requestQuery requestParams requestBody)}}props: {{operationId}}Props, {{/if}}kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.{{method}}({{#if requestParams}}replaceParams('{{path}}', props.params){{else}}'{{path}}'{{/if}})
|
||||
.{{method}}(routeWithNamespace({{#if requestParams}}replaceParams('{{path}}', props.params){{else}}'{{path}}'{{/if}}, kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '{{version}}')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,7 @@ import { DeleteEndpointListItemRequestQueryInput } from '@kbn/securitysolution-e
|
|||
import { FindEndpointListItemsRequestQueryInput } from '@kbn/securitysolution-endpoint-exceptions-common/api/find_endpoint_list_item/find_endpoint_list_item.gen';
|
||||
import { ReadEndpointListItemRequestQueryInput } from '@kbn/securitysolution-endpoint-exceptions-common/api/read_endpoint_list_item/read_endpoint_list_item.gen';
|
||||
import { UpdateEndpointListItemRequestBodyInput } from '@kbn/securitysolution-endpoint-exceptions-common/api/update_endpoint_list_item/update_endpoint_list_item.gen';
|
||||
import { routeWithNamespace } from '../../common/utils/security_solution';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {
|
||||
|
@ -33,9 +34,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create an endpoint exception list, which groups endpoint exception list items. If an endpoint exception list already exists, an empty response is returned.
|
||||
*/
|
||||
createEndpointList() {
|
||||
createEndpointList(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/endpoint_list')
|
||||
.post(routeWithNamespace('/api/endpoint_list', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -43,9 +44,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create an endpoint exception list item, and associate it with the endpoint exception list.
|
||||
*/
|
||||
createEndpointListItem(props: CreateEndpointListItemProps) {
|
||||
createEndpointListItem(props: CreateEndpointListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/endpoint_list/items')
|
||||
.post(routeWithNamespace('/api/endpoint_list/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -54,9 +55,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Delete an endpoint exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
deleteEndpointListItem(props: DeleteEndpointListItemProps) {
|
||||
deleteEndpointListItem(props: DeleteEndpointListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/endpoint_list/items')
|
||||
.delete(routeWithNamespace('/api/endpoint_list/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -65,9 +66,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all endpoint exception list items.
|
||||
*/
|
||||
findEndpointListItems(props: FindEndpointListItemsProps) {
|
||||
findEndpointListItems(props: FindEndpointListItemsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/endpoint_list/items/_find')
|
||||
.get(routeWithNamespace('/api/endpoint_list/items/_find', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -76,9 +77,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of an endpoint exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
readEndpointListItem(props: ReadEndpointListItemProps) {
|
||||
readEndpointListItem(props: ReadEndpointListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/endpoint_list/items')
|
||||
.get(routeWithNamespace('/api/endpoint_list/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -87,9 +88,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Update an endpoint exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
updateEndpointListItem(props: UpdateEndpointListItemProps) {
|
||||
updateEndpointListItem(props: UpdateEndpointListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put('/api/endpoint_list/items')
|
||||
.put(routeWithNamespace('/api/endpoint_list/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
|
@ -39,6 +39,7 @@ import { ReadExceptionListItemRequestQueryInput } from '@kbn/securitysolution-ex
|
|||
import { ReadExceptionListSummaryRequestQueryInput } from '@kbn/securitysolution-exceptions-common/api/read_exception_list_summary/read_exception_list_summary.gen';
|
||||
import { UpdateExceptionListRequestBodyInput } from '@kbn/securitysolution-exceptions-common/api/update_exception_list/update_exception_list.gen';
|
||||
import { UpdateExceptionListItemRequestBodyInput } from '@kbn/securitysolution-exceptions-common/api/update_exception_list_item/update_exception_list_item.gen';
|
||||
import { routeWithNamespace } from '../../common/utils/security_solution';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {
|
||||
|
@ -51,9 +52,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
> All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.
|
||||
|
||||
*/
|
||||
createExceptionList(props: CreateExceptionListProps) {
|
||||
createExceptionList(props: CreateExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/exception_lists')
|
||||
.post(routeWithNamespace('/api/exception_lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -65,9 +66,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
> Before creating exception items, you must create an exception list.
|
||||
|
||||
*/
|
||||
createExceptionListItem(props: CreateExceptionListItemProps) {
|
||||
createExceptionListItem(props: CreateExceptionListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/exception_lists/items')
|
||||
.post(routeWithNamespace('/api/exception_lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -76,9 +77,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create exception items that apply to a single detection rule.
|
||||
*/
|
||||
createRuleExceptionListItems(props: CreateRuleExceptionListItemsProps) {
|
||||
createRuleExceptionListItems(
|
||||
props: CreateRuleExceptionListItemsProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.post(replaceParams('/api/detection_engine/rules/{id}/exceptions', props.params))
|
||||
.post(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/detection_engine/rules/{id}/exceptions', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -90,9 +99,12 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
> All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.
|
||||
|
||||
*/
|
||||
createSharedExceptionList(props: CreateSharedExceptionListProps) {
|
||||
createSharedExceptionList(
|
||||
props: CreateSharedExceptionListProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.post('/api/exceptions/shared')
|
||||
.post(routeWithNamespace('/api/exceptions/shared', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -101,9 +113,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Delete an exception list using the `id` or `list_id` field.
|
||||
*/
|
||||
deleteExceptionList(props: DeleteExceptionListProps) {
|
||||
deleteExceptionList(props: DeleteExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/exception_lists')
|
||||
.delete(routeWithNamespace('/api/exception_lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -112,9 +124,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Delete an exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
deleteExceptionListItem(props: DeleteExceptionListItemProps) {
|
||||
deleteExceptionListItem(props: DeleteExceptionListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/exception_lists/items')
|
||||
.delete(routeWithNamespace('/api/exception_lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -123,9 +135,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Duplicate an existing exception list.
|
||||
*/
|
||||
duplicateExceptionList(props: DuplicateExceptionListProps) {
|
||||
duplicateExceptionList(props: DuplicateExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/exception_lists/_duplicate')
|
||||
.post(routeWithNamespace('/api/exception_lists/_duplicate', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -134,9 +146,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Export an exception list and its associated items to an NDJSON file.
|
||||
*/
|
||||
exportExceptionList(props: ExportExceptionListProps) {
|
||||
exportExceptionList(props: ExportExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/exception_lists/_export')
|
||||
.post(routeWithNamespace('/api/exception_lists/_export', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -145,9 +157,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all exception list items in the specified list.
|
||||
*/
|
||||
findExceptionListItems(props: FindExceptionListItemsProps) {
|
||||
findExceptionListItems(props: FindExceptionListItemsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/exception_lists/items/_find')
|
||||
.get(routeWithNamespace('/api/exception_lists/items/_find', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -156,9 +168,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all exception lists.
|
||||
*/
|
||||
findExceptionLists(props: FindExceptionListsProps) {
|
||||
findExceptionLists(props: FindExceptionListsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/exception_lists/_find')
|
||||
.get(routeWithNamespace('/api/exception_lists/_find', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -167,9 +179,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Import an exception list and its associated items from an NDJSON file.
|
||||
*/
|
||||
importExceptionList(props: ImportExceptionListProps) {
|
||||
importExceptionList(props: ImportExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/exception_lists/_import')
|
||||
.post(routeWithNamespace('/api/exception_lists/_import', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -178,9 +190,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of an exception list using the `id` or `list_id` field.
|
||||
*/
|
||||
readExceptionList(props: ReadExceptionListProps) {
|
||||
readExceptionList(props: ReadExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/exception_lists')
|
||||
.get(routeWithNamespace('/api/exception_lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -189,9 +201,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of an exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
readExceptionListItem(props: ReadExceptionListItemProps) {
|
||||
readExceptionListItem(props: ReadExceptionListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/exception_lists/items')
|
||||
.get(routeWithNamespace('/api/exception_lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -200,9 +212,12 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a summary of the specified exception list.
|
||||
*/
|
||||
readExceptionListSummary(props: ReadExceptionListSummaryProps) {
|
||||
readExceptionListSummary(
|
||||
props: ReadExceptionListSummaryProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.get('/api/exception_lists/summary')
|
||||
.get(routeWithNamespace('/api/exception_lists/summary', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -211,9 +226,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Update an exception list using the `id` or `list_id` field.
|
||||
*/
|
||||
updateExceptionList(props: UpdateExceptionListProps) {
|
||||
updateExceptionList(props: UpdateExceptionListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put('/api/exception_lists')
|
||||
.put(routeWithNamespace('/api/exception_lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -222,9 +237,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Update an exception list item using the `id` or `item_id` field.
|
||||
*/
|
||||
updateExceptionListItem(props: UpdateExceptionListItemProps) {
|
||||
updateExceptionListItem(props: UpdateExceptionListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put('/api/exception_lists/items')
|
||||
.put(routeWithNamespace('/api/exception_lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
|
@ -33,6 +33,7 @@ import { ReadListRequestQueryInput } from '@kbn/securitysolution-lists-common/ap
|
|||
import { ReadListItemRequestQueryInput } from '@kbn/securitysolution-lists-common/api/read_list_item/read_list_item.gen';
|
||||
import { UpdateListRequestBodyInput } from '@kbn/securitysolution-lists-common/api/update_list/update_list.gen';
|
||||
import { UpdateListItemRequestBodyInput } from '@kbn/securitysolution-lists-common/api/update_list_item/update_list_item.gen';
|
||||
import { routeWithNamespace } from '../../common/utils/security_solution';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {
|
||||
|
@ -42,9 +43,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create a new list.
|
||||
*/
|
||||
createList(props: CreateListProps) {
|
||||
createList(props: CreateListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/lists')
|
||||
.post(routeWithNamespace('/api/lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -53,9 +54,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create `.lists` and `.items` data streams in the relevant space.
|
||||
*/
|
||||
createListIndex() {
|
||||
createListIndex(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/lists/index')
|
||||
.post(routeWithNamespace('/api/lists/index', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -68,9 +69,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
> Before creating a list item, you must create a list.
|
||||
|
||||
*/
|
||||
createListItem(props: CreateListItemProps) {
|
||||
createListItem(props: CreateListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/lists/items')
|
||||
.post(routeWithNamespace('/api/lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -82,9 +83,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
> When you delete a list, all of its list items are also deleted.
|
||||
|
||||
*/
|
||||
deleteList(props: DeleteListProps) {
|
||||
deleteList(props: DeleteListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/lists')
|
||||
.delete(routeWithNamespace('/api/lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -93,9 +94,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
/**
|
||||
* Delete the `.lists` and `.items` data streams.
|
||||
*/
|
||||
deleteListIndex() {
|
||||
deleteListIndex(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/lists/index')
|
||||
.delete(routeWithNamespace('/api/lists/index', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -103,9 +104,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
/**
|
||||
* Delete a list item using its `id`, or its `list_id` and `value` fields.
|
||||
*/
|
||||
deleteListItem(props: DeleteListItemProps) {
|
||||
deleteListItem(props: DeleteListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete('/api/lists/items')
|
||||
.delete(routeWithNamespace('/api/lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -114,9 +115,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
/**
|
||||
* Export list item values from the specified list.
|
||||
*/
|
||||
exportListItems(props: ExportListItemsProps) {
|
||||
exportListItems(props: ExportListItemsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/lists/items/_export')
|
||||
.post(routeWithNamespace('/api/lists/items/_export', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -125,9 +126,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
/**
|
||||
* Get all list items in the specified list.
|
||||
*/
|
||||
findListItems(props: FindListItemsProps) {
|
||||
findListItems(props: FindListItemsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists/items/_find')
|
||||
.get(routeWithNamespace('/api/lists/items/_find', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -136,9 +137,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
/**
|
||||
* Get a paginated subset of lists. By default, the first page is returned, with 20 results per page.
|
||||
*/
|
||||
findLists(props: FindListsProps) {
|
||||
findLists(props: FindListsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists/_find')
|
||||
.get(routeWithNamespace('/api/lists/_find', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -150,9 +151,9 @@ All list items in the same list must be the same type. For example, each list it
|
|||
You can import items to a new or existing list.
|
||||
|
||||
*/
|
||||
importListItems(props: ImportListItemsProps) {
|
||||
importListItems(props: ImportListItemsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/lists/items/_import')
|
||||
.post(routeWithNamespace('/api/lists/items/_import', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -161,9 +162,9 @@ You can import items to a new or existing list.
|
|||
/**
|
||||
* Update specific fields of an existing list using the list ID.
|
||||
*/
|
||||
patchList(props: PatchListProps) {
|
||||
patchList(props: PatchListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.patch('/api/lists')
|
||||
.patch(routeWithNamespace('/api/lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -172,9 +173,9 @@ You can import items to a new or existing list.
|
|||
/**
|
||||
* Update specific fields of an existing list item using the list item ID.
|
||||
*/
|
||||
patchListItem(props: PatchListItemProps) {
|
||||
patchListItem(props: PatchListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.patch('/api/lists/items')
|
||||
.patch(routeWithNamespace('/api/lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -183,9 +184,9 @@ You can import items to a new or existing list.
|
|||
/**
|
||||
* Get the details of a list using the list ID.
|
||||
*/
|
||||
readList(props: ReadListProps) {
|
||||
readList(props: ReadListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists')
|
||||
.get(routeWithNamespace('/api/lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -194,9 +195,9 @@ You can import items to a new or existing list.
|
|||
/**
|
||||
* Verify that `.lists` and `.items` data streams exist.
|
||||
*/
|
||||
readListIndex() {
|
||||
readListIndex(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists/index')
|
||||
.get(routeWithNamespace('/api/lists/index', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -204,17 +205,17 @@ You can import items to a new or existing list.
|
|||
/**
|
||||
* Get the details of a list item.
|
||||
*/
|
||||
readListItem(props: ReadListItemProps) {
|
||||
readListItem(props: ReadListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists/items')
|
||||
.get(routeWithNamespace('/api/lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
.query(props.query);
|
||||
},
|
||||
readListPrivileges() {
|
||||
readListPrivileges(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/lists/privileges')
|
||||
.get(routeWithNamespace('/api/lists/privileges', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -225,9 +226,9 @@ You can import items to a new or existing list.
|
|||
> You cannot modify the `id` value.
|
||||
|
||||
*/
|
||||
updateList(props: UpdateListProps) {
|
||||
updateList(props: UpdateListProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put('/api/lists')
|
||||
.put(routeWithNamespace('/api/lists', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -239,9 +240,9 @@ You can import items to a new or existing list.
|
|||
> You cannot modify the `id` value.
|
||||
|
||||
*/
|
||||
updateListItem(props: UpdateListItemProps) {
|
||||
updateListItem(props: UpdateListItemProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put('/api/lists/items')
|
||||
.put(routeWithNamespace('/api/lists/items', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
|
@ -51,43 +51,54 @@ import {
|
|||
} from '@kbn/osquery-plugin/common/api/saved_query/saved_query.gen';
|
||||
import { ReadAssetsStatusRequestQueryInput } from '@kbn/osquery-plugin/common/api/asset/assets.gen';
|
||||
import { UpdateAssetsStatusRequestQueryInput } from '@kbn/osquery-plugin/common/api/asset/assets.gen';
|
||||
import { routeWithNamespace } from '../../common/utils/security_solution';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
|
||||
return {
|
||||
getAgentDetails(props: GetAgentDetailsProps) {
|
||||
getAgentDetails(props: GetAgentDetailsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get(replaceParams('/internal/osquery/fleet_wrapper/agents/{id}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(
|
||||
replaceParams('/internal/osquery/fleet_wrapper/agents/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
getAgentPackagePolicies() {
|
||||
getAgentPackagePolicies(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/fleet_wrapper/package_policies')
|
||||
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/package_policies', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
getAgentPolicies() {
|
||||
getAgentPolicies(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/fleet_wrapper/agent_policies')
|
||||
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/agent_policies', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
getAgentPolicy(props: GetAgentPolicyProps) {
|
||||
getAgentPolicy(props: GetAgentPolicyProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get(replaceParams('/internal/osquery/fleet_wrapper/agent_policies/{id}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(
|
||||
replaceParams('/internal/osquery/fleet_wrapper/agent_policies/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
getAgents(props: GetAgentsProps) {
|
||||
getAgents(props: GetAgentsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/fleet_wrapper/agents')
|
||||
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/agents', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -96,9 +107,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create and run a live query.
|
||||
*/
|
||||
osqueryCreateLiveQuery(props: OsqueryCreateLiveQueryProps) {
|
||||
osqueryCreateLiveQuery(props: OsqueryCreateLiveQueryProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/osquery/live_queries')
|
||||
.post(routeWithNamespace('/api/osquery/live_queries', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -107,9 +118,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create a query pack.
|
||||
*/
|
||||
osqueryCreatePacks(props: OsqueryCreatePacksProps) {
|
||||
osqueryCreatePacks(props: OsqueryCreatePacksProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/osquery/packs')
|
||||
.post(routeWithNamespace('/api/osquery/packs', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -118,9 +129,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Create and run a saved query.
|
||||
*/
|
||||
osqueryCreateSavedQuery(props: OsqueryCreateSavedQueryProps) {
|
||||
osqueryCreateSavedQuery(props: OsqueryCreateSavedQueryProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/api/osquery/saved_queries')
|
||||
.post(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -129,9 +140,11 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Delete a query pack using the pack ID.
|
||||
*/
|
||||
osqueryDeletePacks(props: OsqueryDeletePacksProps) {
|
||||
osqueryDeletePacks(props: OsqueryDeletePacksProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete(replaceParams('/api/osquery/packs/{id}', props.params))
|
||||
.delete(
|
||||
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -139,9 +152,14 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Delete a saved query using the query ID.
|
||||
*/
|
||||
osqueryDeleteSavedQuery(props: OsqueryDeleteSavedQueryProps) {
|
||||
osqueryDeleteSavedQuery(props: OsqueryDeleteSavedQueryProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.delete(replaceParams('/api/osquery/saved_queries/{id}', props.params))
|
||||
.delete(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/osquery/saved_queries/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -149,9 +167,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all live queries.
|
||||
*/
|
||||
osqueryFindLiveQueries(props: OsqueryFindLiveQueriesProps) {
|
||||
osqueryFindLiveQueries(props: OsqueryFindLiveQueriesProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/osquery/live_queries')
|
||||
.get(routeWithNamespace('/api/osquery/live_queries', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -160,9 +178,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all query packs.
|
||||
*/
|
||||
osqueryFindPacks(props: OsqueryFindPacksProps) {
|
||||
osqueryFindPacks(props: OsqueryFindPacksProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/osquery/packs')
|
||||
.get(routeWithNamespace('/api/osquery/packs', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -171,9 +189,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get a list of all saved queries.
|
||||
*/
|
||||
osqueryFindSavedQueries(props: OsqueryFindSavedQueriesProps) {
|
||||
osqueryFindSavedQueries(props: OsqueryFindSavedQueriesProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/api/osquery/saved_queries')
|
||||
.get(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -182,9 +200,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of a live query using the query ID.
|
||||
*/
|
||||
osqueryGetLiveQueryDetails(props: OsqueryGetLiveQueryDetailsProps) {
|
||||
osqueryGetLiveQueryDetails(
|
||||
props: OsqueryGetLiveQueryDetailsProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.get(replaceParams('/api/osquery/live_queries/{id}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/osquery/live_queries/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -193,9 +219,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the results of a live query using the query action ID.
|
||||
*/
|
||||
osqueryGetLiveQueryResults(props: OsqueryGetLiveQueryResultsProps) {
|
||||
osqueryGetLiveQueryResults(
|
||||
props: OsqueryGetLiveQueryResultsProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.get(replaceParams('/api/osquery/live_queries/{id}/results/{actionId}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/osquery/live_queries/{id}/results/{actionId}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -204,9 +238,11 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of a query pack using the pack ID.
|
||||
*/
|
||||
osqueryGetPacksDetails(props: OsqueryGetPacksDetailsProps) {
|
||||
osqueryGetPacksDetails(props: OsqueryGetPacksDetailsProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get(replaceParams('/api/osquery/packs/{id}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -214,9 +250,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
/**
|
||||
* Get the details of a saved query using the query ID.
|
||||
*/
|
||||
osqueryGetSavedQueryDetails(props: OsqueryGetSavedQueryDetailsProps) {
|
||||
osqueryGetSavedQueryDetails(
|
||||
props: OsqueryGetSavedQueryDetailsProps,
|
||||
kibanaSpace: string = 'default'
|
||||
) {
|
||||
return supertest
|
||||
.get(replaceParams('/api/osquery/saved_queries/{id}', props.params))
|
||||
.get(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/osquery/saved_queries/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
|
@ -227,9 +271,11 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
> You cannot update a prebuilt pack.
|
||||
|
||||
*/
|
||||
osqueryUpdatePacks(props: OsqueryUpdatePacksProps) {
|
||||
osqueryUpdatePacks(props: OsqueryUpdatePacksProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put(replaceParams('/api/osquery/packs/{id}', props.params))
|
||||
.put(
|
||||
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
@ -241,39 +287,44 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
|
|||
> You cannot update a prebuilt saved query.
|
||||
|
||||
*/
|
||||
osqueryUpdateSavedQuery(props: OsqueryUpdateSavedQueryProps) {
|
||||
osqueryUpdateSavedQuery(props: OsqueryUpdateSavedQueryProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.put(replaceParams('/api/osquery/saved_queries/{id}', props.params))
|
||||
.put(
|
||||
routeWithNamespace(
|
||||
replaceParams('/api/osquery/saved_queries/{id}', props.params),
|
||||
kibanaSpace
|
||||
)
|
||||
)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
.send(props.body as object);
|
||||
},
|
||||
readAssetsStatus(props: ReadAssetsStatusProps) {
|
||||
readAssetsStatus(props: ReadAssetsStatusProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/assets')
|
||||
.get(routeWithNamespace('/internal/osquery/assets', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
.query(props.query);
|
||||
},
|
||||
readInstallationStatus() {
|
||||
readInstallationStatus(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/status')
|
||||
.get(routeWithNamespace('/internal/osquery/status', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
readPrivilegesCheck() {
|
||||
readPrivilegesCheck(kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.get('/internal/osquery/privileges_check')
|
||||
.get(routeWithNamespace('/internal/osquery/privileges_check', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
|
||||
},
|
||||
updateAssetsStatus(props: UpdateAssetsStatusProps) {
|
||||
updateAssetsStatus(props: UpdateAssetsStatusProps, kibanaSpace: string = 'default') {
|
||||
return supertest
|
||||
.post('/internal/osquery/assets/update')
|
||||
.post(routeWithNamespace('/internal/osquery/assets/update', kibanaSpace))
|
||||
.set('kbn-xsrf', 'true')
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue