diff --git a/x-pack/test/api_integration/services/security_solution_endpoint_exceptions_api.gen.ts b/x-pack/test/api_integration/services/security_solution_endpoint_exceptions_api.gen.ts index 505faf82fd681..d8c06801ab5b9 100644 --- a/x-pack/test/api_integration/services/security_solution_endpoint_exceptions_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_endpoint_exceptions_api.gen.ts @@ -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') diff --git a/x-pack/test/api_integration/services/security_solution_exceptions_api.gen.ts b/x-pack/test/api_integration/services/security_solution_exceptions_api.gen.ts index 726f877898918..e9c26ad55ebf3 100644 --- a/x-pack/test/api_integration/services/security_solution_exceptions_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_exceptions_api.gen.ts @@ -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') diff --git a/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts b/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts index 6ae8c4d1d4903..703dbebcf28ec 100644 --- a/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_lists_api.gen.ts @@ -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')