diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 95b13fa0832b0..fc3c9d60184be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1940,6 +1940,8 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/platform/test/serverless/functional/services/ @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/platform/test/serverless/functional/config* @elastic/appex-qa /x-pack/platform/test/serverless/functional/ftr_provider_context.d.ts @elastic/appex-qa +/x-pack/test/api_integration/services/helpers.ts @elastic/appex-qa +/x-pack/solutions/security/test/common/utils/detections_response/ @elastic/appex-qa # Core /src/platform/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json @elastic/kibana-core @elastic/kibana-data-discovery @@ -2098,7 +2100,6 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi /x-pack/platform/test/functional/page_objects/api_keys_page.ts @elastic/kibana-security /x-pack/platform/test/functional/page_objects/account_settings_page.ts @elastic/kibana-security /x-pack/platform/test/functional/apps/user_profiles @elastic/kibana-security -/x-pack/test/common/services/spaces.ts @elastic/kibana-security /x-pack/test/api_integration/config_security_*.ts @elastic/kibana-security /x-pack/platform/test/functional/apps/api_keys @elastic/kibana-security /x-pack/platform/test/ftr_apis/security_and_spaces @elastic/kibana-security @@ -2234,7 +2235,6 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi # Enterprise Search # search /x-pack/platform/test/fixtures/es_archives/data/search_sessions @elastic/search-kibana -/x-pack/test/common/services/search_secure.ts @elastic/search-kibana /src/platform/test/functional/fixtures/kbn_archiver/ccs @elastic/search-kibana /src/platform/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json @elastic/search-kibana /src/platform/test/functional/fixtures/es_archiver/search/downsampled @elastic/search-kibana @@ -2447,7 +2447,7 @@ x-pack/test/security_solution_api_integration/test_suites/detections_response/ut x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry @elastic/security-detections-response x-pack/test/security_solution_api_integration/test_suites/detections_response/user_roles @elastic/security-detections-response x-pack/test/security_solution_api_integration/test_suites/sources @elastic/security-detections-response -/x-pack/test/common/utils/security_solution/detections_response @elastic/security-detections-response +/x-pack/test/security_solution_api_integration/config/services/detections_response/ @elastic/security-detections-response /x-pack/solutions/security/test/fixtures/es_archives/signals @elastic/security-detections-response /x-pack/solutions/security/test/fixtures/es_archives/rule_keyword_family @elastic/security-detections-response diff --git a/src/platform/packages/shared/kbn-openapi-generator/src/template_service/templates/api_client_supertest.handlebars b/src/platform/packages/shared/kbn-openapi-generator/src/template_service/templates/api_client_supertest.handlebars index 330df21d191c4..ad60809a6fe50 100644 --- a/src/platform/packages/shared/kbn-openapi-generator/src/template_service/templates/api_client_supertest.handlebars +++ b/src/platform/packages/shared/kbn-openapi-generator/src/template_service/templates/api_client_supertest.handlebars @@ -9,10 +9,9 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common'; import { replaceParams } from '@kbn/openapi-common/shared'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; 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, @@ -33,7 +32,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {{/if}} {{camelCase operationId}}({{#if (or requestQuery requestParams requestBody)}}props: {{operationId}}Props, {{/if}}kibanaSpace: string = 'default') { return supertest - .{{method}}(routeWithNamespace({{#if requestParams}}replaceParams('{{path}}', props.params){{else}}'{{path}}'{{/if}}, kibanaSpace)) + .{{method}}(getRouteUrlForSpace({{#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') diff --git a/x-pack/platform/plugins/shared/spaces/common/get_spaced_route_url.ts b/x-pack/platform/plugins/shared/spaces/common/get_spaced_route_url.ts new file mode 100644 index 0000000000000..ed7751506536c --- /dev/null +++ b/x-pack/platform/plugins/shared/spaces/common/get_spaced_route_url.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ + +/** + * Wraps the provided Kibana route URL with the Kibana space ID. + * "default" space is equivalent to an empty value and doesn't lead to adding any space aware path. + * + * @param routeUrl the route url string + * @param spaceId [optional] the Kibana space to account for in the route url + * + * Examples: + * - `getRouteUrlForSpace('/api/some_endpoint')` returns `/api/some_endpoint` + * - `getRouteUrlForSpace('/api/some_endpoint', 'default')` returns `/api/some_endpoint` + * - `getRouteUrlForSpace('/api/some_endpoint', 'my_space') returns `/s/my_space/api/some_endpoint` + */ +export function getRouteUrlForSpace(routeUrl: string, spaceId?: string): string { + return spaceId ? `/s/${spaceId}${routeUrl}` : routeUrl; +} diff --git a/x-pack/platform/plugins/shared/spaces/common/index.ts b/x-pack/platform/plugins/shared/spaces/common/index.ts index 9951ccd70b297..766bcd2bee2b0 100644 --- a/x-pack/platform/plugins/shared/spaces/common/index.ts +++ b/x-pack/platform/plugins/shared/spaces/common/index.ts @@ -13,6 +13,7 @@ export { DEFAULT_SPACE_ID, API_VERSIONS, } from './constants'; +export { getRouteUrlForSpace } from './get_spaced_route_url'; export { addSpaceIdToPath, getSpaceIdFromPath } from '@kbn/spaces-utils'; export type { Space, diff --git a/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts b/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts index 8e50871f3e8a3..783e0f94389bc 100644 --- a/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts +++ b/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts @@ -18,7 +18,7 @@ import { waitForAlertsToBePresent, getAlertsByIds, getQueryAlertIds, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; +} from '../../../common/utils/detections_response'; export const createSecuritySolutionAlerts = async ( supertest: SuperTest.Agent, diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts index 577ff4216edd5..85a067d2d8e07 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts @@ -68,7 +68,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; +} from '../../../../../common/utils/detections_response'; import { createSecuritySolutionAlerts, getSecuritySolutionAlerts, diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts index 2ee578a95866f..5db4944678094 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts @@ -41,17 +41,6 @@ import { createConfiguration, getConfigurationRequest, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; -import { - createAlertsIndex, - deleteAllAlerts, - deleteAllRules, - getRuleForAlertTesting, - waitForRuleSuccess, - waitForAlertsToBePresent, - getAlertsByIds, - createRule, - getQueryAlertIds, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -62,6 +51,17 @@ import { secOnlyRead, superUser, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { + createAlertsIndex, + deleteAllAlerts, + deleteAllRules, + getRuleForAlertTesting, + waitForRuleSuccess, + waitForAlertsToBePresent, + getAlertsByIds, + createRule, + getQueryAlertIds, +} from '../../../../../common/utils/detections_response'; import { getSignalsWithES } from '../../../../common/lib/api'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts index d8db3eb9b83b5..a4fd72c05e4f0 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts @@ -11,11 +11,6 @@ import { createCaseAttachAlertAndDeleteAlert, getAlertById, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; -import { - createAlertsIndex, - deleteAllAlerts, - deleteAllRules, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { @@ -51,6 +46,11 @@ import { secSolutionOnlyReadNoIndexAlerts, superUser, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { + createAlertsIndex, + deleteAllAlerts, + deleteAllRules, +} from '../../../../../common/utils/detections_response'; import { createSecuritySolutionAlerts, getSecuritySolutionAlerts, diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts index b6a982f5dfadc..e1d6fbf4f6dc6 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts @@ -11,11 +11,6 @@ import { createCaseAttachAlertAndDeleteAlert, getAlertById, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; -import { - createAlertsIndex, - deleteAllAlerts, - deleteAllRules, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { @@ -56,6 +51,11 @@ import { secSolutionOnlyReadNoIndexAlerts, superUser, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { + createAlertsIndex, + deleteAllAlerts, + deleteAllRules, +} from '../../../../../common/utils/detections_response'; import { createSecuritySolutionAlerts, getSecuritySolutionAlerts, diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts index 80a7cba5a19b2..ee290495805b6 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts @@ -49,11 +49,6 @@ import { bulkCreateAttachments, getCaseSavedObjectsFromES, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; -import { - createAlertsIndex, - deleteAllAlerts, - deleteAllRules, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -70,6 +65,11 @@ import { } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; import { getAlertById } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; +import { + createAlertsIndex, + deleteAllAlerts, + deleteAllRules, +} from '../../../../../common/utils/detections_response'; import { getSecuritySolutionAlerts, createSecuritySolutionAlerts, diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts index fa1d9648ff8e4..1febfb0b72db1 100644 --- a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts @@ -44,11 +44,6 @@ import { createComment, getCaseSavedObjectsFromES, } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; -import { - createAlertsIndex, - deleteAllAlerts, - deleteAllRules, -} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -67,6 +62,11 @@ import { getAlertById } from '@kbn/test-suites-xpack-platform/cases_api_integrat import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { SECURITY_SOLUTION_FILE_KIND } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; import { arraysToEqual } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/validation'; +import { + createAlertsIndex, + deleteAllAlerts, + deleteAllRules, +} from '../../../../../common/utils/detections_response'; import { getSecuritySolutionAlerts, createSecuritySolutionAlerts, diff --git a/x-pack/solutions/security/test/cloud_security_posture_functional/data_views/config.ts b/x-pack/solutions/security/test/cloud_security_posture_functional/data_views/config.ts index 7a547bd85b03e..249314b2d8b36 100644 --- a/x-pack/solutions/security/test/cloud_security_posture_functional/data_views/config.ts +++ b/x-pack/solutions/security/test/cloud_security_posture_functional/data_views/config.ts @@ -8,6 +8,7 @@ import { resolve } from 'path'; import type { FtrConfigProviderContext } from '@kbn/test'; import { pageObjects } from '../page_objects'; +import { services } from '../services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const xpackFunctionalConfig = await readConfigFile( @@ -17,6 +18,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...xpackFunctionalConfig.getAll(), pageObjects, + services, testFiles: [resolve(__dirname, './data_views')], junit: { reportName: 'X-Pack Cloud Security Posture Functional Tests', diff --git a/x-pack/solutions/security/test/cloud_security_posture_functional/ftr_provider_context.d.ts b/x-pack/solutions/security/test/cloud_security_posture_functional/ftr_provider_context.d.ts index a4d84a8345a4d..6092c6668a3dc 100644 --- a/x-pack/solutions/security/test/cloud_security_posture_functional/ftr_provider_context.d.ts +++ b/x-pack/solutions/security/test/cloud_security_posture_functional/ftr_provider_context.d.ts @@ -7,7 +7,7 @@ import { GenericFtrProviderContext } from '@kbn/test'; -import { services } from '@kbn/test-suites-xpack/functional/services'; +import { services } from './services'; import { pageObjects } from './page_objects'; export type FtrProviderContext = GenericFtrProviderContext; diff --git a/x-pack/solutions/security/test/cloud_security_posture_functional/services/index.ts b/x-pack/solutions/security/test/cloud_security_posture_functional/services/index.ts index 0fd22be19b19a..d136145552f37 100644 --- a/x-pack/solutions/security/test/cloud_security_posture_functional/services/index.ts +++ b/x-pack/solutions/security/test/cloud_security_posture_functional/services/index.ts @@ -5,8 +5,10 @@ * 2.0. */ +import { services as platformServices } from '@kbn/test-suites-xpack-platform/functional/services'; import { QueryBarProvider } from './query_bar_provider'; export const services = { + ...platformServices, queryBarProvider: QueryBarProvider, }; diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/create_alerts_index.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/create_alerts_index.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/create_alerts_index.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/create_alerts_index.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/delete_all_alerts.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/delete_all_alerts.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/delete_all_alerts.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/delete_all_alerts.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/get_alerts_by_id.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/get_alerts_by_id.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/get_alerts_by_id.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/get_alerts_by_id.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/get_alerts_by_ids.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/get_alerts_by_ids.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/get_alerts_by_ids.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/get_alerts_by_ids.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/get_query_alert_ids.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/get_query_alert_ids.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/get_query_alert_ids.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/get_query_alert_ids.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/get_query_alerts_ids.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/get_query_alerts_ids.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/get_query_alerts_ids.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/get_query_alerts_ids.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/index.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/index.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/index.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/index.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/search_alerts.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/search_alerts.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/search_alerts.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/search_alerts.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/alerts/wait_for_alerts_to_be_present.ts b/x-pack/solutions/security/test/common/utils/detections_response/alerts/wait_for_alerts_to_be_present.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/alerts/wait_for_alerts_to_be_present.ts rename to x-pack/solutions/security/test/common/utils/detections_response/alerts/wait_for_alerts_to_be_present.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/count_down_test.ts b/x-pack/solutions/security/test/common/utils/detections_response/count_down_test.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/count_down_test.ts rename to x-pack/solutions/security/test/common/utils/detections_response/count_down_test.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/delete_all_anomalies.ts b/x-pack/solutions/security/test/common/utils/detections_response/delete_all_anomalies.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/delete_all_anomalies.ts rename to x-pack/solutions/security/test/common/utils/detections_response/delete_all_anomalies.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/index.ts b/x-pack/solutions/security/test/common/utils/detections_response/index.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/index.ts rename to x-pack/solutions/security/test/common/utils/detections_response/index.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/route_with_namespace.ts b/x-pack/solutions/security/test/common/utils/detections_response/route_with_namespace.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/route_with_namespace.ts rename to x-pack/solutions/security/test/common/utils/detections_response/route_with_namespace.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/create_rule.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/create_rule.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/create_rule.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/create_rule.ts diff --git a/x-pack/solutions/security/test/common/utils/detections_response/rules/delete_all_rules.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/delete_all_rules.ts new file mode 100644 index 0000000000000..66bf65ccfbc20 --- /dev/null +++ b/x-pack/solutions/security/test/common/utils/detections_response/rules/delete_all_rules.ts @@ -0,0 +1,47 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; + +import { + DETECTION_ENGINE_RULES_BULK_ACTION, + DETECTION_ENGINE_RULES_URL, +} from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; + +/** + * Removes all rules by looping over any found and removing them from REST. + * @param supertest The supertest agent. + */ +export const deleteAllRules = async ( + supertest: SuperTest.Agent, + log: ToolingLog +): Promise => { + await countDownTest( + async () => { + await supertest + .post(DETECTION_ENGINE_RULES_BULK_ACTION) + .send({ action: 'delete', query: '' }) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31'); + + const { body: finalCheck } = await supertest + .get(`${DETECTION_ENGINE_RULES_URL}/_find`) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .send(); + return { + passed: finalCheck.data.length === 0, + }; + }, + 'deleteAllRules', + log, + 50, + 1000 + ); +}; diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/delete_rule.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/delete_rule.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/delete_rule.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/delete_rule.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/get_gaps_by_rule_id.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/get_gaps_by_rule_id.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/get_gaps_by_rule_id.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/get_gaps_by_rule_id.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/get_rule_for_alert_testing.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/get_rule_for_alert_testing.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/get_rule_for_alert_testing.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/get_rule_for_alert_testing.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/index.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/index.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/index.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/index.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/manual_run.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/manual_run.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/manual_run.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/manual_run.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/wait_for_rule_status.ts b/x-pack/solutions/security/test/common/utils/detections_response/rules/wait_for_rule_status.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/wait_for_rule_status.ts rename to x-pack/solutions/security/test/common/utils/detections_response/rules/wait_for_rule_status.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/tasks/index.ts b/x-pack/solutions/security/test/common/utils/detections_response/tasks/index.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/tasks/index.ts rename to x-pack/solutions/security/test/common/utils/detections_response/tasks/index.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/tasks/indices_metadata.ts b/x-pack/solutions/security/test/common/utils/detections_response/tasks/indices_metadata.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/tasks/indices_metadata.ts rename to x-pack/solutions/security/test/common/utils/detections_response/tasks/indices_metadata.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/tasks/task_manager.ts b/x-pack/solutions/security/test/common/utils/detections_response/tasks/task_manager.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/tasks/task_manager.ts rename to x-pack/solutions/security/test/common/utils/detections_response/tasks/task_manager.ts diff --git a/x-pack/test/common/utils/security_solution/detections_response/wait_for.ts b/x-pack/solutions/security/test/common/utils/detections_response/wait_for.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/wait_for.ts rename to x-pack/solutions/security/test/common/utils/detections_response/wait_for.ts diff --git a/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts b/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts index 67cda3ec268d6..3b3055a93ee1d 100644 --- a/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts +++ b/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts @@ -5,11 +5,11 @@ * 2.0. */ +import type { QueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { DETECTION_ENGINE_RULES_BULK_ACTION, DETECTION_ENGINE_RULES_URL, } from '@kbn/security-solution-plugin/common/constants'; -import type { QueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { APIRequestContext } from '@playwright/test'; import { getCommonHeadersWithApiVersion } from './headers'; diff --git a/x-pack/solutions/security/test/tsconfig.json b/x-pack/solutions/security/test/tsconfig.json index c13a30bf1f0df..ab1887e3fd035 100644 --- a/x-pack/solutions/security/test/tsconfig.json +++ b/x-pack/solutions/security/test/tsconfig.json @@ -9,12 +9,12 @@ "@kbn/ambient-ui-types", "@kbn/ambient-ftr-types" ], - "resolveJsonModule": true, + "resolveJsonModule": true }, "include": [ "**/*", "../../../../typings/**/*", - "../../../../src/platform/packages/shared/kbn-test/types/ftr_globals/**/*", + "../../../../src/platform/packages/shared/kbn-test/types/ftr_globals/**/*" ], "exclude": ["target/**/*", "*/plugins/**/*", "plugins/**/*"], "kbn_references": [ @@ -49,5 +49,6 @@ "@kbn/session-view-plugin", "@kbn/repo-info", "@kbn/es-archiver", + "@kbn/task-manager-plugin" ] } diff --git a/x-pack/test/api_integration/services/security_solution_api.gen.ts b/x-pack/test/api_integration/services/security_solution_api.gen.ts index da32b229c9f3e..a188bd83aeda3 100644 --- a/x-pack/test/api_integration/services/security_solution_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_api.gen.ts @@ -19,6 +19,7 @@ import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; import { replaceParams } from '@kbn/openapi-common/shared'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; import { AlertsMigrationCleanupRequestBodyInput } from '@kbn/security-solution-plugin/common/api/detection_engine/signals_migration/delete_signals_migration/delete_signals_migration.gen'; import { BulkUpsertAssetCriticalityRecordsRequestBodyInput } from '@kbn/security-solution-plugin/common/api/entity_analytics/asset_criticality/bulk_upload_asset_criticality.gen'; @@ -187,7 +188,6 @@ import { UpsertRuleMigrationResourcesRequestParamsInput, UpsertRuleMigrationResourcesRequestBodyInput, } from '@kbn/security-solution-plugin/common/siem_migrations/model/api/rules/rule_migration.gen'; -import { routeWithNamespace } from '../../common/utils/security_solution'; import { FtrProviderContext } from '../ftr_provider_context'; export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) { @@ -206,7 +206,7 @@ after 30 days. It also deletes other artifacts specific to the migration impleme */ alertsMigrationCleanup(props: AlertsMigrationCleanupProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/detection_engine/signals/migration', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/detection_engine/signals/migration', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -214,14 +214,14 @@ after 30 days. It also deletes other artifacts specific to the migration impleme }, applyEntityEngineDataviewIndices(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_store/engines/apply_dataview_indices', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_store/engines/apply_dataview_indices', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, assetCriticalityGetPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/asset_criticality/privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/asset_criticality/privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -232,7 +232,7 @@ after 30 days. It also deletes other artifacts specific to the migration impleme bootstrapPrebuiltRules(kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace('/internal/detection_engine/prebuilt_rules/_bootstrap', kibanaSpace) + getRouteUrlForSpace('/internal/detection_engine/prebuilt_rules/_bootstrap', kibanaSpace) ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') @@ -249,7 +249,7 @@ If asset criticality records already exist for the specified entities, those rec kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/asset_criticality/bulk', kibanaSpace)) + .post(getRouteUrlForSpace('/api/asset_criticality/bulk', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -263,7 +263,7 @@ If asset criticality records already exist for the specified entities, those rec */ cleanDraftTimelines(props: CleanDraftTimelinesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/timeline/_draft', kibanaSpace)) + .post(getRouteUrlForSpace('/api/timeline/_draft', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -274,7 +274,7 @@ If asset criticality records already exist for the specified entities, those rec */ cleanUpRiskEngine(kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/risk_score/engine/dangerously_delete_data', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/risk_score/engine/dangerously_delete_data', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -287,7 +287,7 @@ If asset criticality records already exist for the specified entities, those rec kibanaSpace: string = 'default' ) { return supertest - .patch(routeWithNamespace('/api/risk_score/engine/saved_object/configure', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/risk_score/engine/saved_object/configure', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -299,7 +299,7 @@ If asset criticality records already exist for the specified entities, those rec */ copyTimeline(props: CopyTimelineProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/timeline/_copy', kibanaSpace)) + .get(getRouteUrlForSpace('/api/timeline/_copy', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -307,7 +307,7 @@ If asset criticality records already exist for the specified entities, those rec }, createAlertsIndex(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/index', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -319,7 +319,7 @@ Migrations are initiated per index. While the process is neither destructive nor */ createAlertsMigration(props: CreateAlertsMigrationProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/migration', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/migration', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -336,7 +336,7 @@ If a record already exists for the specified entity, that record is overwritten kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/asset_criticality', kibanaSpace)) + .post(getRouteUrlForSpace('/api/asset_criticality', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -344,7 +344,7 @@ If a record already exists for the specified entity, that record is overwritten }, createEntitySource(props: CreateEntitySourceProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_analytics/monitoring/entity_source', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_analytics/monitoring/entity_source', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -355,7 +355,9 @@ If a record already exists for the specified entity, that record is overwritten kibanaSpace: string = 'default' ) { return supertest - .put(routeWithNamespace('/api/entity_analytics/monitoring/privileges/indices', kibanaSpace)) + .put( + getRouteUrlForSpace('/api/entity_analytics/monitoring/privileges/indices', kibanaSpace) + ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -363,7 +365,7 @@ If a record already exists for the specified entity, that record is overwritten }, createPrivMonUser(props: CreatePrivMonUserProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_analytics/monitoring/users', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_analytics/monitoring/users', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -428,7 +430,7 @@ For detailed information on Kibana actions and alerting, and additional API call */ createRule(props: CreateRuleProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/rules', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -439,7 +441,7 @@ For detailed information on Kibana actions and alerting, and additional API call */ createRuleMigration(props: CreateRuleMigrationProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/internal/siem_migrations/rules', kibanaSpace)) + .put(getRouteUrlForSpace('/internal/siem_migrations/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -454,7 +456,7 @@ For detailed information on Kibana actions and alerting, and additional API call ) { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/rules', props.params), kibanaSpace ) @@ -469,7 +471,7 @@ For detailed information on Kibana actions and alerting, and additional API call */ createTimelines(props: CreateTimelinesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/timeline', kibanaSpace)) + .post(getRouteUrlForSpace('/api/timeline', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -481,7 +483,7 @@ For detailed information on Kibana actions and alerting, and additional API call ) { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/api/endpoint/protection_updates_note/{package_policy_id}', props.params @@ -496,7 +498,7 @@ For detailed information on Kibana actions and alerting, and additional API call }, deleteAlertsIndex(kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/detection_engine/index', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/detection_engine/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -509,7 +511,7 @@ For detailed information on Kibana actions and alerting, and additional API call kibanaSpace: string = 'default' ) { return supertest - .delete(routeWithNamespace('/api/asset_criticality', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/asset_criticality', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -518,7 +520,7 @@ For detailed information on Kibana actions and alerting, and additional API call deleteEntityEngine(props: DeleteEntityEngineProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_store/engines/{entityType}', props.params), kibanaSpace ) @@ -531,7 +533,7 @@ For detailed information on Kibana actions and alerting, and additional API call deleteEntitySource(props: DeleteEntitySourceProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_analytics/monitoring/entity_source/{id}', props.params), kibanaSpace ) @@ -542,7 +544,7 @@ For detailed information on Kibana actions and alerting, and additional API call }, deleteMonitoringEngine(props: DeleteMonitoringEngineProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/entity_analytics/monitoring/engine/delete', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/entity_analytics/monitoring/engine/delete', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -553,7 +555,7 @@ For detailed information on Kibana actions and alerting, and additional API call */ deleteNote(props: DeleteNoteProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/note', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/note', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -562,7 +564,7 @@ For detailed information on Kibana actions and alerting, and additional API call deletePrivMonUser(props: DeletePrivMonUserProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_analytics/monitoring/users/{id}', props.params), kibanaSpace ) @@ -584,7 +586,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ deleteRule(props: DeleteRuleProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/detection_engine/rules', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/detection_engine/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -596,7 +598,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule deleteRuleMigration(props: DeleteRuleMigrationProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}', props.params), kibanaSpace ) @@ -610,7 +612,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ deleteTimelines(props: DeleteTimelinesProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/timeline', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/timeline', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -624,7 +626,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/risk_scores/calculation/entity', kibanaSpace)) + .post(getRouteUrlForSpace('/api/risk_scores/calculation/entity', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -632,21 +634,21 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule }, disableMonitoringEngine(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_analytics/monitoring/engine/disable', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_analytics/monitoring/engine/disable', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, disableRiskEngine(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/risk_score/engine/disable', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/risk_score/engine/disable', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, enableRiskEngine(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/risk_score/engine/enable', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/risk_score/engine/enable', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -656,7 +658,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointExecuteAction(props: EndpointExecuteActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/execute', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/execute', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -668,7 +670,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule endpointFileDownload(props: EndpointFileDownloadProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/endpoint/action/{action_id}/file/{file_id}/download', props.params), kibanaSpace ) @@ -683,7 +685,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule endpointFileInfo(props: EndpointFileInfoProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/endpoint/action/{action_id}/file/{file_id}', props.params), kibanaSpace ) @@ -701,7 +703,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/endpoint/action/{action_id}', props.params), kibanaSpace ) @@ -715,7 +717,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointGetActionsList(props: EndpointGetActionsListProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint/action', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint/action', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -726,7 +728,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointGetActionsState(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint/action/state', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint/action/state', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -739,7 +741,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .get(routeWithNamespace('/api/endpoint/action_status', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint/action_status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -750,7 +752,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointGetFileAction(props: EndpointGetFileActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/get_file', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/get_file', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -764,7 +766,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/endpoint/action/running_procs', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/running_procs', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -775,7 +777,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointIsolateAction(props: EndpointIsolateActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/isolate', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/isolate', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -789,7 +791,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/endpoint/action/kill_process', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/kill_process', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -800,7 +802,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointScanAction(props: EndpointScanActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/scan', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/scan', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -814,7 +816,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/endpoint/action/suspend_process', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/suspend_process', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -825,7 +827,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointUnisolateAction(props: EndpointUnisolateActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/unisolate', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/unisolate', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -836,14 +838,14 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ endpointUploadAction(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/upload', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/upload', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, entityStoreGetPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/entity_store/privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/entity_store/privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -862,7 +864,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ exportRules(props: ExportRulesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/rules/_export', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/rules/_export', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -874,7 +876,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ exportTimelines(props: ExportTimelinesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/timeline/_export', kibanaSpace)) + .post(getRouteUrlForSpace('/api/timeline/_export', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -889,7 +891,7 @@ finalize it. */ finalizeAlertsMigration(props: FinalizeAlertsMigrationProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/finalize_migration', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/finalize_migration', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -903,7 +905,7 @@ finalize it. kibanaSpace: string = 'default' ) { return supertest - .get(routeWithNamespace('/api/asset_criticality/list', kibanaSpace)) + .get(getRouteUrlForSpace('/api/asset_criticality/list', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -914,7 +916,7 @@ finalize it. */ findRules(props: FindRulesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/rules/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/rules/_find', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -925,7 +927,7 @@ finalize it. */ getAllStatsRuleMigration(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/siem_migrations/rules/stats', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/siem_migrations/rules/stats', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -938,7 +940,7 @@ finalize it. kibanaSpace: string = 'default' ) { return supertest - .get(routeWithNamespace('/api/asset_criticality', kibanaSpace)) + .get(getRouteUrlForSpace('/api/asset_criticality', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -946,7 +948,7 @@ finalize it. }, getAssetCriticalityStatus(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/asset_criticality/status', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/asset_criticality/status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -956,7 +958,7 @@ finalize it. */ getDraftTimelines(props: GetDraftTimelinesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/timeline/_draft', kibanaSpace)) + .get(getRouteUrlForSpace('/api/timeline/_draft', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -964,7 +966,7 @@ finalize it. }, getEndpointMetadataList(props: GetEndpointMetadataListProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint/metadata', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint/metadata', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -973,7 +975,7 @@ finalize it. getEndpointSuggestions(props: GetEndpointSuggestionsProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/api/endpoint/suggestions/{suggestion_type}', props.params), kibanaSpace ) @@ -986,7 +988,7 @@ finalize it. getEntityEngine(props: GetEntityEngineProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_store/engines/{entityType}', props.params), kibanaSpace ) @@ -998,7 +1000,7 @@ finalize it. getEntitySource(props: GetEntitySourceProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_analytics/monitoring/entity_source/{id}', props.params), kibanaSpace ) @@ -1009,7 +1011,7 @@ finalize it. }, getEntityStoreStatus(props: GetEntityStoreStatusProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_store/status', kibanaSpace)) + .get(getRouteUrlForSpace('/api/entity_store/status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1020,7 +1022,7 @@ finalize it. */ getNotes(props: GetNotesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/note', kibanaSpace)) + .get(getRouteUrlForSpace('/api/note', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1028,7 +1030,7 @@ finalize it. }, getPolicyResponse(props: GetPolicyResponseProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint/policy_response', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint/policy_response', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1037,7 +1039,7 @@ finalize it. getPrivilegedAccessDetectionPackageStatus(kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( '/api/entity_analytics/privileged_user_monitoring/pad/status', kibanaSpace ) @@ -1052,7 +1054,7 @@ finalize it. ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/api/endpoint/protection_updates_note/{package_policy_id}', props.params @@ -1069,7 +1071,7 @@ finalize it. */ getRiskEngineStatus(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/risk_score/engine/status', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/risk_score/engine/status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1077,7 +1079,7 @@ finalize it. getRuleExecutionEvents(props: GetRuleExecutionEventsProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/internal/detection_engine/rules/{ruleId}/execution/events', props.params @@ -1093,7 +1095,7 @@ finalize it. getRuleExecutionResults(props: GetRuleExecutionResultsProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/internal/detection_engine/rules/{ruleId}/execution/results', props.params @@ -1112,7 +1114,7 @@ finalize it. getRuleMigration(props: GetRuleMigrationProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}', props.params), kibanaSpace ) @@ -1126,7 +1128,7 @@ finalize it. */ getRuleMigrationIntegrations(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/siem_migrations/rules/integrations', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/siem_migrations/rules/integrations', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1136,7 +1138,7 @@ finalize it. */ getRuleMigrationIntegrationsStats(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/siem_migrations/rules/integrations/stats', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/siem_migrations/rules/integrations/stats', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1150,7 +1152,7 @@ finalize it. ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/internal/siem_migrations/rules/{migration_id}/prebuilt_rules', props.params @@ -1167,7 +1169,7 @@ finalize it. */ getRuleMigrationPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/siem_migrations/rules/missing_privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/siem_migrations/rules/missing_privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1181,7 +1183,7 @@ finalize it. ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/resources', props.params), kibanaSpace ) @@ -1200,7 +1202,7 @@ finalize it. ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/internal/siem_migrations/rules/{migration_id}/resources/missing', props.params @@ -1218,7 +1220,7 @@ finalize it. getRuleMigrationRules(props: GetRuleMigrationRulesProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/rules', props.params), kibanaSpace ) @@ -1234,7 +1236,7 @@ finalize it. getRuleMigrationStats(props: GetRuleMigrationStatsProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/stats', props.params), kibanaSpace ) @@ -1252,7 +1254,7 @@ finalize it. ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams( '/internal/siem_migrations/rules/{migration_id}/translation_stats', props.params @@ -1269,7 +1271,7 @@ finalize it. */ getTimeline(props: GetTimelineProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/timeline', kibanaSpace)) + .get(getRouteUrlForSpace('/api/timeline', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1280,7 +1282,7 @@ finalize it. */ getTimelines(props: GetTimelinesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/timelines', kibanaSpace)) + .get(getRouteUrlForSpace('/api/timelines', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1288,7 +1290,7 @@ finalize it. }, getWorkflowInsights(props: GetWorkflowInsightsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/api/endpoint/workflow_insights', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/api/endpoint/workflow_insights', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1315,7 +1317,7 @@ finalize it. */ importRules(props: ImportRulesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/rules/_import', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/rules/_import', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1326,7 +1328,7 @@ finalize it. */ importTimelines(props: ImportTimelinesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/timeline/_import', kibanaSpace)) + .post(getRouteUrlForSpace('/api/timeline/_import', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1335,7 +1337,7 @@ finalize it. initEntityEngine(props: InitEntityEngineProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_store/engines/{entityType}/init', props.params), kibanaSpace ) @@ -1347,7 +1349,7 @@ finalize it. }, initEntityStore(props: InitEntityStoreProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_store/enable', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_store/enable', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1355,7 +1357,7 @@ finalize it. }, initMonitoringEngine(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_analytics/monitoring/engine/init', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_analytics/monitoring/engine/init', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1365,7 +1367,7 @@ finalize it. */ initRiskEngine(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/risk_score/engine/init', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/risk_score/engine/init', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1376,7 +1378,7 @@ finalize it. installMigrationRules(props: InstallMigrationRulesProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/install', props.params), kibanaSpace ) @@ -1402,7 +1404,7 @@ providing you with the most current and effective threat detection capabilities. */ installPrebuiltRulesAndTimelines(kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/detection_engine/rules/prepackaged', kibanaSpace)) + .put(getRouteUrlForSpace('/api/detection_engine/rules/prepackaged', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1415,7 +1417,7 @@ providing you with the most current and effective threat detection capabilities. kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/timeline/_prepackaged', kibanaSpace)) + .post(getRouteUrlForSpace('/api/timeline/_prepackaged', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1424,7 +1426,7 @@ providing you with the most current and effective threat detection capabilities. installPrivilegedAccessDetectionPackage(kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( '/api/entity_analytics/privileged_user_monitoring/pad/install', kibanaSpace ) @@ -1435,7 +1437,7 @@ providing you with the most current and effective threat detection capabilities. }, internalUploadAssetCriticalityRecords(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/asset_criticality/upload_csv', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/asset_criticality/upload_csv', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1445,7 +1447,7 @@ providing you with the most current and effective threat detection capabilities. */ listEntities(props: ListEntitiesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_store/entities/list', kibanaSpace)) + .get(getRouteUrlForSpace('/api/entity_store/entities/list', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1453,14 +1455,16 @@ providing you with the most current and effective threat detection capabilities. }, listEntityEngines(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_store/engines', kibanaSpace)) + .get(getRouteUrlForSpace('/api/entity_store/engines', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, listEntitySources(props: ListEntitySourcesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_analytics/monitoring/entity_source/list', kibanaSpace)) + .get( + getRouteUrlForSpace('/api/entity_analytics/monitoring/entity_source/list', kibanaSpace) + ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1468,7 +1472,7 @@ providing you with the most current and effective threat detection capabilities. }, listPrivMonUsers(props: ListPrivMonUsersProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_analytics/monitoring/users/list', kibanaSpace)) + .get(getRouteUrlForSpace('/api/entity_analytics/monitoring/users/list', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1486,7 +1490,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ patchRule(props: PatchRuleProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/detection_engine/rules', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/detection_engine/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1497,7 +1501,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ patchTimeline(props: PatchTimelineProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/timeline', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/timeline', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1516,7 +1520,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre */ performRulesBulkAction(props: PerformRulesBulkActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/rules/_bulk_action', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/rules/_bulk_action', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1528,7 +1532,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre */ persistFavoriteRoute(props: PersistFavoriteRouteProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/timeline/_favorite', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/timeline/_favorite', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1539,7 +1543,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre */ persistNoteRoute(props: PersistNoteRouteProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/note', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/note', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1550,7 +1554,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre */ persistPinnedEventRoute(props: PersistPinnedEventRouteProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/pinned_event', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/pinned_event', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1561,7 +1565,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre */ previewRiskScore(props: PreviewRiskScoreProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/risk_score/preview', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/risk_score/preview', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1569,14 +1573,14 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre }, privmonBulkUploadUsersCsv(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/entity_analytics/monitoring/users/_csv', kibanaSpace)) + .post(getRouteUrlForSpace('/api/entity_analytics/monitoring/users/_csv', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, privMonHealth(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_analytics/monitoring/privileges/health', kibanaSpace)) + .get(getRouteUrlForSpace('/api/entity_analytics/monitoring/privileges/health', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1587,7 +1591,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre privMonPrivileges(kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace('/api/entity_analytics/monitoring/privileges/privileges', kibanaSpace) + getRouteUrlForSpace('/api/entity_analytics/monitoring/privileges/privileges', kibanaSpace) ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') @@ -1595,7 +1599,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre }, readAlertsIndex(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/index', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1608,7 +1612,7 @@ The edit action is idempotent, meaning that if you add a tag to a rule that alre kibanaSpace: string = 'default' ) { return supertest - .get(routeWithNamespace('/api/detection_engine/signals/migration_status', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/signals/migration_status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1622,7 +1626,7 @@ This endpoint provides detailed information about the number of custom rules, in */ readPrebuiltRulesAndTimelinesStatus(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/rules/prepackaged/_status', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/rules/prepackaged/_status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1636,14 +1640,14 @@ detection engine rules. */ readPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, readRiskEngineSettings(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/risk_score/engine/settings', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/risk_score/engine/settings', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1661,7 +1665,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ readRule(props: ReadRuleProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/rules', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1672,14 +1676,14 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ readTags(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/detection_engine/tags', kibanaSpace)) + .get(getRouteUrlForSpace('/api/detection_engine/tags', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, resolveTimeline(props: ResolveTimelineProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/timeline/resolve', kibanaSpace)) + .get(getRouteUrlForSpace('/api/timeline/resolve', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1687,14 +1691,14 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule }, riskEngineGetPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/risk_engine/privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/risk_engine/privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, rulePreview(props: RulePreviewProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/rules/preview', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/rules/preview', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1703,7 +1707,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule }, runEntityAnalyticsMigrations(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/entity_analytics/migrations/run', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/entity_analytics/migrations/run', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1713,7 +1717,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ runScriptAction(props: RunScriptActionProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint/action/runscript', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint/action/runscript', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1724,7 +1728,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ scheduleRiskEngineNow(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/risk_score/engine/schedule_now', kibanaSpace)) + .post(getRouteUrlForSpace('/api/risk_score/engine/schedule_now', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1734,7 +1738,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ searchAlerts(props: SearchAlertsProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/search', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/search', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1742,7 +1746,9 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule }, searchPrivilegesIndices(props: SearchPrivilegesIndicesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/entity_analytics/monitoring/privileges/indices', kibanaSpace)) + .get( + getRouteUrlForSpace('/api/entity_analytics/monitoring/privileges/indices', kibanaSpace) + ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1756,7 +1762,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ setAlertAssignees(props: SetAlertAssigneesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/assignees', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/assignees', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1767,7 +1773,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ setAlertsStatus(props: SetAlertsStatusProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/status', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1781,7 +1787,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ setAlertTags(props: SetAlertTagsProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/detection_engine/signals/tags', kibanaSpace)) + .post(getRouteUrlForSpace('/api/detection_engine/signals/tags', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1790,7 +1796,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule startEntityEngine(props: StartEntityEngineProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_store/engines/{entityType}/start', props.params), kibanaSpace ) @@ -1805,7 +1811,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule startRuleMigration(props: StartRuleMigrationProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/start', props.params), kibanaSpace ) @@ -1818,7 +1824,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule stopEntityEngine(props: StopEntityEngineProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_store/engines/{entityType}/stop', props.params), kibanaSpace ) @@ -1833,7 +1839,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule stopRuleMigration(props: StopRuleMigrationProps, kibanaSpace: string = 'default') { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/stop', props.params), kibanaSpace ) @@ -1847,7 +1853,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ suggestUserProfiles(props: SuggestUserProfilesProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/detection_engine/users/_find', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/detection_engine/users/_find', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1861,7 +1867,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/internal/risk_score/calculation/entity', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/risk_score/calculation/entity', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1870,7 +1876,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule updateEntitySource(props: UpdateEntitySourceProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_analytics/monitoring/entity_source/{id}', props.params), kibanaSpace ) @@ -1883,7 +1889,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule updatePrivMonUser(props: UpdatePrivMonUserProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/entity_analytics/monitoring/users/{id}', props.params), kibanaSpace ) @@ -1905,7 +1911,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule */ updateRule(props: UpdateRuleProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/detection_engine/rules', kibanaSpace)) + .put(getRouteUrlForSpace('/api/detection_engine/rules', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -1917,7 +1923,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule updateRuleMigration(props: UpdateRuleMigrationProps, kibanaSpace: string = 'default') { return supertest .patch( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}', props.params), kibanaSpace ) @@ -1936,7 +1942,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule ) { return supertest .patch( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/rules', props.params), kibanaSpace ) @@ -1949,7 +1955,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule updateWorkflowInsight(props: UpdateWorkflowInsightProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/api/endpoint/workflow_insights/{insightId}', props.params), kibanaSpace ) @@ -1961,7 +1967,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule }, uploadAssetCriticalityRecords(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/asset_criticality/upload_csv', kibanaSpace)) + .post(getRouteUrlForSpace('/api/asset_criticality/upload_csv', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -1975,7 +1981,7 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule ) { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/siem_migrations/rules/{migration_id}/resources', props.params), kibanaSpace ) 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 9827e48ad5a00..a72af9e4c0bb6 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 @@ -18,13 +18,13 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; import { CreateEndpointListItemRequestBodyInput } from '@kbn/securitysolution-endpoint-exceptions-common/api/create_endpoint_list_item/create_endpoint_list_item.gen'; import { DeleteEndpointListItemRequestQueryInput } from '@kbn/securitysolution-endpoint-exceptions-common/api/delete_endpoint_list_item/delete_endpoint_list_item.gen'; 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) { @@ -36,7 +36,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createEndpointList(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint_list', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint_list', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -46,7 +46,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createEndpointListItem(props: CreateEndpointListItemProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/endpoint_list/items', kibanaSpace)) + .post(getRouteUrlForSpace('/api/endpoint_list/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -57,7 +57,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ deleteEndpointListItem(props: DeleteEndpointListItemProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/endpoint_list/items', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/endpoint_list/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -68,7 +68,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ findEndpointListItems(props: FindEndpointListItemsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint_list/items/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/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') @@ -79,7 +79,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ readEndpointListItem(props: ReadEndpointListItemProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/endpoint_list/items', kibanaSpace)) + .get(getRouteUrlForSpace('/api/endpoint_list/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -90,7 +90,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ updateEndpointListItem(props: UpdateEndpointListItemProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/endpoint_list/items', kibanaSpace)) + .put(getRouteUrlForSpace('/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 6b0d8dad51ef2..b195f6731c643 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 @@ -19,6 +19,7 @@ import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; import { replaceParams } from '@kbn/openapi-common/shared'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; import { CreateExceptionListRequestBodyInput } from '@kbn/securitysolution-exceptions-common/api/create_exception_list/create_exception_list.gen'; import { CreateExceptionListItemRequestBodyInput } from '@kbn/securitysolution-exceptions-common/api/create_exception_list_item/create_exception_list_item.gen'; @@ -39,7 +40,6 @@ 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) { @@ -54,7 +54,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createExceptionList(props: CreateExceptionListProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/exception_lists', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exception_lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -68,7 +68,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createExceptionListItem(props: CreateExceptionListItemProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/exception_lists/items', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exception_lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -83,7 +83,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) ) { return supertest .post( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/detection_engine/rules/{id}/exceptions', props.params), kibanaSpace ) @@ -104,7 +104,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) kibanaSpace: string = 'default' ) { return supertest - .post(routeWithNamespace('/api/exceptions/shared', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exceptions/shared', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -115,7 +115,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ deleteExceptionList(props: DeleteExceptionListProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/exception_lists', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/exception_lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -126,7 +126,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ deleteExceptionListItem(props: DeleteExceptionListItemProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/exception_lists/items', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/exception_lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -137,7 +137,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ duplicateExceptionList(props: DuplicateExceptionListProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/exception_lists/_duplicate', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exception_lists/_duplicate', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -148,7 +148,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ exportExceptionList(props: ExportExceptionListProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/exception_lists/_export', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exception_lists/_export', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -159,7 +159,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ findExceptionListItems(props: FindExceptionListItemsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/exception_lists/items/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/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') @@ -170,7 +170,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ findExceptionLists(props: FindExceptionListsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/exception_lists/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/api/exception_lists/_find', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -181,7 +181,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ importExceptionList(props: ImportExceptionListProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/exception_lists/_import', kibanaSpace)) + .post(getRouteUrlForSpace('/api/exception_lists/_import', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -192,7 +192,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ readExceptionList(props: ReadExceptionListProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/exception_lists', kibanaSpace)) + .get(getRouteUrlForSpace('/api/exception_lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -203,7 +203,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ readExceptionListItem(props: ReadExceptionListItemProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/exception_lists/items', kibanaSpace)) + .get(getRouteUrlForSpace('/api/exception_lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -217,7 +217,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) kibanaSpace: string = 'default' ) { return supertest - .get(routeWithNamespace('/api/exception_lists/summary', kibanaSpace)) + .get(getRouteUrlForSpace('/api/exception_lists/summary', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -228,7 +228,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ updateExceptionList(props: UpdateExceptionListProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/exception_lists', kibanaSpace)) + .put(getRouteUrlForSpace('/api/exception_lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -239,7 +239,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ updateExceptionListItem(props: UpdateExceptionListItemProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/exception_lists/items', kibanaSpace)) + .put(getRouteUrlForSpace('/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 eb130a1d65805..64de6940d77eb 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 @@ -18,6 +18,7 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; import { CreateListRequestBodyInput } from '@kbn/securitysolution-lists-common/api/create_list/create_list.gen'; import { CreateListItemRequestBodyInput } from '@kbn/securitysolution-lists-common/api/create_list_item/create_list_item.gen'; @@ -33,7 +34,6 @@ 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) { @@ -45,7 +45,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createList(props: CreateListProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/lists', kibanaSpace)) + .post(getRouteUrlForSpace('/api/lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -56,7 +56,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ createListIndex(kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/lists/index', kibanaSpace)) + .post(getRouteUrlForSpace('/api/lists/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -71,7 +71,7 @@ All value list items in the same list must be the same type. For example, each l */ createListItem(props: CreateListItemProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/lists/items', kibanaSpace)) + .post(getRouteUrlForSpace('/api/lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -85,7 +85,7 @@ All value list items in the same list must be the same type. For example, each l */ deleteList(props: DeleteListProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/lists', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -96,7 +96,7 @@ All value list items in the same list must be the same type. For example, each l */ deleteListIndex(kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/lists/index', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/lists/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -106,7 +106,7 @@ All value list items in the same list must be the same type. For example, each l */ deleteListItem(props: DeleteListItemProps, kibanaSpace: string = 'default') { return supertest - .delete(routeWithNamespace('/api/lists/items', kibanaSpace)) + .delete(getRouteUrlForSpace('/api/lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -117,7 +117,7 @@ All value list items in the same list must be the same type. For example, each l */ exportListItems(props: ExportListItemsProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/lists/items/_export', kibanaSpace)) + .post(getRouteUrlForSpace('/api/lists/items/_export', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -128,7 +128,7 @@ All value list items in the same list must be the same type. For example, each l */ findListItems(props: FindListItemsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists/items/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists/items/_find', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -139,7 +139,7 @@ All value list items in the same list must be the same type. For example, each l */ findLists(props: FindListsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists/_find', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists/_find', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -153,7 +153,7 @@ You can import items to a new or existing list. */ importListItems(props: ImportListItemsProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/lists/items/_import', kibanaSpace)) + .post(getRouteUrlForSpace('/api/lists/items/_import', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -164,7 +164,7 @@ You can import items to a new or existing list. */ patchList(props: PatchListProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/lists', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -175,7 +175,7 @@ You can import items to a new or existing list. */ patchListItem(props: PatchListItemProps, kibanaSpace: string = 'default') { return supertest - .patch(routeWithNamespace('/api/lists/items', kibanaSpace)) + .patch(getRouteUrlForSpace('/api/lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -186,7 +186,7 @@ You can import items to a new or existing list. */ readList(props: ReadListProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -197,7 +197,7 @@ You can import items to a new or existing list. */ readListIndex(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists/index', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists/index', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -207,7 +207,7 @@ You can import items to a new or existing list. */ readListItem(props: ReadListItemProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists/items', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists/items', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -215,7 +215,7 @@ You can import items to a new or existing list. }, readListPrivileges(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/lists/privileges', kibanaSpace)) + .get(getRouteUrlForSpace('/api/lists/privileges', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -228,7 +228,7 @@ You can import items to a new or existing list. */ updateList(props: UpdateListProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/lists', kibanaSpace)) + .put(getRouteUrlForSpace('/api/lists', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -242,7 +242,7 @@ You can import items to a new or existing list. */ updateListItem(props: UpdateListItemProps, kibanaSpace: string = 'default') { return supertest - .put(routeWithNamespace('/api/lists/items', kibanaSpace)) + .put(getRouteUrlForSpace('/api/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_osquery_api.gen.ts b/x-pack/test/api_integration/services/security_solution_osquery_api.gen.ts index 384500062155e..2a71f7065b835 100644 --- a/x-pack/test/api_integration/services/security_solution_osquery_api.gen.ts +++ b/x-pack/test/api_integration/services/security_solution_osquery_api.gen.ts @@ -19,6 +19,7 @@ import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; import { replaceParams } from '@kbn/openapi-common/shared'; +import { getRouteUrlForSpace } from '@kbn/spaces-plugin/common'; import { GetAgentDetailsRequestParamsInput } from '@kbn/osquery-plugin/common/api/fleet_wrapper/fleet_wrapper.gen'; import { GetAgentPolicyRequestParamsInput } from '@kbn/osquery-plugin/common/api/fleet_wrapper/fleet_wrapper.gen'; @@ -48,7 +49,6 @@ 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) { @@ -58,7 +58,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) getAgentDetails(props: GetAgentDetailsProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/osquery/fleet_wrapper/agents/{id}', props.params), kibanaSpace ) @@ -69,14 +69,14 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) }, getAgentPackagePolicies(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/fleet_wrapper/package_policies', kibanaSpace)) + .get(getRouteUrlForSpace('/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(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/fleet_wrapper/agent_policies', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/osquery/fleet_wrapper/agent_policies', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); @@ -84,7 +84,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) getAgentPolicy(props: GetAgentPolicyProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/internal/osquery/fleet_wrapper/agent_policies/{id}', props.params), kibanaSpace ) @@ -95,7 +95,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) }, getAgents(props: GetAgentsProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/fleet_wrapper/agents', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/osquery/fleet_wrapper/agents', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -106,7 +106,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryCreateLiveQuery(props: OsqueryCreateLiveQueryProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/osquery/live_queries', kibanaSpace)) + .post(getRouteUrlForSpace('/api/osquery/live_queries', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -117,7 +117,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryCreatePacks(props: OsqueryCreatePacksProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/osquery/packs', kibanaSpace)) + .post(getRouteUrlForSpace('/api/osquery/packs', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -128,7 +128,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryCreateSavedQuery(props: OsqueryCreateSavedQueryProps, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace)) + .post(getRouteUrlForSpace('/api/osquery/saved_queries', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -140,7 +140,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) osqueryDeletePacks(props: OsqueryDeletePacksProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) + getRouteUrlForSpace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') @@ -152,7 +152,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) osqueryDeleteSavedQuery(props: OsqueryDeleteSavedQueryProps, kibanaSpace: string = 'default') { return supertest .delete( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/osquery/saved_queries/{id}', props.params), kibanaSpace ) @@ -166,7 +166,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryFindLiveQueries(props: OsqueryFindLiveQueriesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/osquery/live_queries', kibanaSpace)) + .get(getRouteUrlForSpace('/api/osquery/live_queries', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -177,7 +177,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryFindPacks(props: OsqueryFindPacksProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/osquery/packs', kibanaSpace)) + .get(getRouteUrlForSpace('/api/osquery/packs', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -188,7 +188,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) */ osqueryFindSavedQueries(props: OsqueryFindSavedQueriesProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace)) + .get(getRouteUrlForSpace('/api/osquery/saved_queries', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -203,7 +203,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/osquery/live_queries/{id}', props.params), kibanaSpace ) @@ -221,7 +221,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/osquery/live_queries/{id}/results/{actionId}', props.params), kibanaSpace ) @@ -237,7 +237,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) osqueryGetPacksDetails(props: OsqueryGetPacksDetailsProps, kibanaSpace: string = 'default') { return supertest .get( - routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) + getRouteUrlForSpace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') @@ -252,7 +252,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) ) { return supertest .get( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/osquery/saved_queries/{id}', props.params), kibanaSpace ) @@ -270,7 +270,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) osqueryUpdatePacks(props: OsqueryUpdatePacksProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) + getRouteUrlForSpace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace) ) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') @@ -286,7 +286,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) osqueryUpdateSavedQuery(props: OsqueryUpdateSavedQueryProps, kibanaSpace: string = 'default') { return supertest .put( - routeWithNamespace( + getRouteUrlForSpace( replaceParams('/api/osquery/saved_queries/{id}', props.params), kibanaSpace ) @@ -298,7 +298,7 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) }, readAssetsStatus(props: ReadAssetsStatusProps, kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/assets', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/osquery/assets', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') @@ -306,21 +306,21 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) }, readInstallationStatus(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/status', kibanaSpace)) + .get(getRouteUrlForSpace('/internal/osquery/status', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); }, readPrivilegesCheck(kibanaSpace: string = 'default') { return supertest - .get(routeWithNamespace('/internal/osquery/privileges_check', kibanaSpace)) + .get(getRouteUrlForSpace('/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, kibanaSpace: string = 'default') { return supertest - .post(routeWithNamespace('/internal/osquery/assets/update', kibanaSpace)) + .post(getRouteUrlForSpace('/internal/osquery/assets/update', kibanaSpace)) .set('kbn-xsrf', 'true') .set(ELASTIC_HTTP_VERSION_HEADER, '1') .set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana') diff --git a/x-pack/test/common/services/index.ts b/x-pack/test/common/services/index.ts index 8723d1f0bf6d9..f3ec7ac2374c9 100644 --- a/x-pack/test/common/services/index.ts +++ b/x-pack/test/common/services/index.ts @@ -7,14 +7,10 @@ import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { SpacesServiceProvider } from './spaces'; -import { SearchSecureService } from './search_secure'; import { ApmSynthtraceKibanaClientProvider } from './apm_synthtrace_kibana_client'; export const services = { ...commonFunctionalServices, supertest: kibanaApiIntegrationServices.supertest, - spaces: SpacesServiceProvider, - secureSearch: SearchSecureService, apmSynthtraceKibanaClient: ApmSynthtraceKibanaClientProvider, }; diff --git a/x-pack/test/common/services/search_secure.ts b/x-pack/test/common/services/search_secure.ts deleted file mode 100644 index 7e132f417fba0..0000000000000 --- a/x-pack/test/common/services/search_secure.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -// NOTE: This is pretty much a copy/paste from src/platform/packages/shared/kbn-ftr-common-functional-services/services/bsearch.ts -// but with the ability to provide custom auth - -import expect from '@kbn/expect'; -import type { IEsSearchResponse } from '@kbn/search-types'; -import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { SupertestWithoutAuthProviderType } from '@kbn/ftr-common-functional-services'; -import { FtrService } from '../ftr_provider_context'; - -const getSpaceUrlPrefix = (spaceId?: string): string => { - return spaceId && spaceId !== 'default' ? `/s/${spaceId}` : ``; -}; - -interface SendOptions { - supertestWithoutAuth: SupertestWithoutAuthProviderType; - auth: { username: string; password: string }; - referer?: string; - kibanaVersion?: string; - options: object; - strategy: string; - space?: string; - internalOrigin: string; -} - -export class SearchSecureService extends FtrService { - private readonly retry = this.ctx.getService('retry'); - - async send({ - supertestWithoutAuth, - auth, - referer, - kibanaVersion, - internalOrigin, - options, - strategy, - space, - }: SendOptions) { - const spaceUrl = getSpaceUrlPrefix(space); - const statusesWithoutRetry = [200, 400, 403, 500]; - - const { body } = await this.retry.try(async () => { - let result; - const url = `${spaceUrl}/internal/search/${strategy}`; - - if (referer && kibanaVersion) { - result = await supertestWithoutAuth - .post(url) - .auth(auth.username, auth.password) - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .set('referer', referer) - .set('kbn-version', kibanaVersion) - .set('kbn-xsrf', 'true') - .send(options); - } else if (referer) { - result = await supertestWithoutAuth - .post(url) - .auth(auth.username, auth.password) - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .set('referer', referer) - .set('kbn-xsrf', 'true') - .send(options); - } else if (kibanaVersion) { - result = await supertestWithoutAuth - .post(url) - .auth(auth.username, auth.password) - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .set('kbn-version', kibanaVersion) - .set('kbn-xsrf', 'true') - .send(options); - } else if (internalOrigin) { - result = await supertestWithoutAuth - .post(url) - .auth(auth.username, auth.password) - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .set('x-elastic-internal-origin', internalOrigin) - .set('kbn-xsrf', 'true') - .send(options); - } else { - result = await supertestWithoutAuth - .post(url) - .auth(auth.username, auth.password) - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .set('kbn-xsrf', 'true') - .send(options); - } - - if (statusesWithoutRetry.includes(result.status) && result.body) { - return result; - } - - throw new Error('try again'); - }); - - if (!body.isRunning) { - return body as T; - } - - const result = await this.retry.try(async () => { - const resp = await supertestWithoutAuth - .post(`${spaceUrl}/internal/search/${strategy}/${body.id}`) - .auth(auth.username, auth.password) - .set('kbn-xsrf', 'true') - .set('x-elastic-internal-origin', 'Kibana') - .set(ELASTIC_HTTP_VERSION_HEADER, '1') - .send(options) - .expect(200); - expect(resp.body.isRunning).equal(false); - return resp.body; - }); - - return result as T; - } -} diff --git a/x-pack/test/security_solution_api_integration/config/ess/config.base.edr_workflows.ts b/x-pack/test/security_solution_api_integration/config/ess/config.base.edr_workflows.ts index 5207fa6e87425..a1832351185dd 100644 --- a/x-pack/test/security_solution_api_integration/config/ess/config.base.edr_workflows.ts +++ b/x-pack/test/security_solution_api_integration/config/ess/config.base.edr_workflows.ts @@ -7,7 +7,7 @@ import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; import { Config } from '@kbn/test'; -import { SecuritySolutionEndpointRegistryHelpers } from '../../../common/services/security_solution'; +import { SecuritySolutionEndpointRegistryHelpers } from '../services/common'; import { SUITE_TAGS } from '../../../security_solution_endpoint/configs/config.base'; export const generateConfig = async ({ diff --git a/x-pack/test/security_solution_api_integration/config/ess/services.ts b/x-pack/test/security_solution_api_integration/config/ess/services.ts index 80d88350e6dd2..5cb8f6e72d05c 100644 --- a/x-pack/test/security_solution_api_integration/config/ess/services.ts +++ b/x-pack/test/security_solution_api_integration/config/ess/services.ts @@ -7,7 +7,7 @@ import { KibanaEBTServerProvider } from '@kbn/test-suites-src/analytics/services/kibana_ebt'; import { SecuritySolutionESSUtils } from '../services/security_solution_ess_utils'; -import { SpacesServiceProvider } from '../../../common/services/spaces'; +import { SpacesServiceProvider } from '../services/spaces_service'; import { services as essServices } from '../../../api_integration/services'; export const services = { diff --git a/x-pack/test/security_solution_api_integration/config/ess/services_edr_workflows.ts b/x-pack/test/security_solution_api_integration/config/ess/services_edr_workflows.ts index 6baf6c0108492..fe657da72251e 100644 --- a/x-pack/test/security_solution_api_integration/config/ess/services_edr_workflows.ts +++ b/x-pack/test/security_solution_api_integration/config/ess/services_edr_workflows.ts @@ -15,7 +15,7 @@ import { RolesUsersProvider } from '../services/security_solution_edr_workflows_ import { SecuritySolutionEndpointDataStreamHelpers, SecuritySolutionEndpointRegistryHelpers, -} from '../../../common/services/security_solution'; +} from '../services/common'; import { SecuritySolutionESSUtils } from '../services/security_solution_ess_utils'; export const services = { diff --git a/x-pack/test/security_solution_api_integration/config/serverless/services.ts b/x-pack/test/security_solution_api_integration/config/serverless/services.ts index bfef9e1d4424b..8c5e491bc8b9b 100644 --- a/x-pack/test/security_solution_api_integration/config/serverless/services.ts +++ b/x-pack/test/security_solution_api_integration/config/serverless/services.ts @@ -8,7 +8,7 @@ import { SearchSecureService } from '@kbn/test-suites-serverless/shared/services/search_secure'; import { services as serverlessServices } from '@kbn/test-suites-serverless/api_integration/services'; import { KibanaEBTServerProvider } from '@kbn/test-suites-src/analytics/services/kibana_ebt'; -import { SpacesServiceProvider } from '../../../common/services/spaces'; +import { SpacesServiceProvider } from '../services/spaces_service'; import { SecuritySolutionServerlessUtils } from '../services/security_solution_serverless_utils'; import { SecuritySolutionServerlessSuperTest } from '../services/security_solution_serverless_supertest'; diff --git a/x-pack/test/security_solution_api_integration/config/serverless/services_edr_workflows.ts b/x-pack/test/security_solution_api_integration/config/serverless/services_edr_workflows.ts index 6c50ff3500050..dc12389487d66 100644 --- a/x-pack/test/security_solution_api_integration/config/serverless/services_edr_workflows.ts +++ b/x-pack/test/security_solution_api_integration/config/serverless/services_edr_workflows.ts @@ -7,6 +7,7 @@ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { SvlCommonApiServiceProvider } from '@kbn/test-suites-serverless/shared/services/svl_common_api'; +import { SearchSecureService } from '@kbn/test-suites-serverless/shared/services/search_secure'; import { services as essServices } from '../ess/services_edr_workflows'; import { SecuritySolutionServerlessSuperTest } from '../services/security_solution_serverless_supertest'; import { SecuritySolutionServerlessUtils } from '../services/security_solution_serverless_utils'; @@ -17,4 +18,5 @@ export const svlServices = { securitySolutionUtils: SecuritySolutionServerlessUtils, svlUserManager: commonFunctionalServices.samlAuth, svlCommonApi: SvlCommonApiServiceProvider, + secureSearch: SearchSecureService, }; diff --git a/x-pack/test/common/services/security_solution/endpoint_data_stream_helpers.ts b/x-pack/test/security_solution_api_integration/config/services/common/endpoint_data_stream_helpers.ts similarity index 100% rename from x-pack/test/common/services/security_solution/endpoint_data_stream_helpers.ts rename to x-pack/test/security_solution_api_integration/config/services/common/endpoint_data_stream_helpers.ts diff --git a/x-pack/test/common/services/security_solution/endpoint_registry_helpers.ts b/x-pack/test/security_solution_api_integration/config/services/common/endpoint_registry_helpers.ts similarity index 100% rename from x-pack/test/common/services/security_solution/endpoint_registry_helpers.ts rename to x-pack/test/security_solution_api_integration/config/services/common/endpoint_registry_helpers.ts diff --git a/x-pack/test/common/services/security_solution/fixtures/package_registry_config.yml b/x-pack/test/security_solution_api_integration/config/services/common/fixtures/package_registry_config.yml similarity index 100% rename from x-pack/test/common/services/security_solution/fixtures/package_registry_config.yml rename to x-pack/test/security_solution_api_integration/config/services/common/fixtures/package_registry_config.yml diff --git a/x-pack/test/common/services/security_solution/index.ts b/x-pack/test/security_solution_api_integration/config/services/common/index.ts similarity index 100% rename from x-pack/test/common/services/security_solution/index.ts rename to x-pack/test/security_solution_api_integration/config/services/common/index.ts diff --git a/x-pack/test/common/services/security_solution/roles_users_utils.ts b/x-pack/test/security_solution_api_integration/config/services/common/roles_users_utils.ts similarity index 96% rename from x-pack/test/common/services/security_solution/roles_users_utils.ts rename to x-pack/test/security_solution_api_integration/config/services/common/roles_users_utils.ts index f88a8de03eaf0..1487bef2df6fa 100644 --- a/x-pack/test/common/services/security_solution/roles_users_utils.ts +++ b/x-pack/test/security_solution_api_integration/config/services/common/roles_users_utils.ts @@ -10,7 +10,7 @@ import { KNOWN_SERVERLESS_ROLE_DEFINITIONS, } from '@kbn/security-solution-plugin/common/test'; import type { SecurityRoleName } from '@kbn/security-solution-plugin/common/test'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; const KNOWN_ROLE_DEFINITIONS = { ...KNOWN_SERVERLESS_ROLE_DEFINITIONS, diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/create_alerts_index.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/create_alerts_index.ts new file mode 100644 index 0000000000000..da7f7b2cf36a6 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/create_alerts_index.ts @@ -0,0 +1,37 @@ +/* + * 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 SuperTest from 'supertest'; +import { ToolingLog } from '@kbn/tooling-log'; + +import { DETECTION_ENGINE_INDEX_URL } from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; + +/** + * Creates the alerts index for use inside of beforeEach blocks of tests + * This will retry 50 times before giving up and hopefully still not interfere with other tests + * @param supertest The supertest client library + */ +export const createAlertsIndex = async ( + supertest: SuperTest.Agent, + log: ToolingLog +): Promise => { + await countDownTest( + async () => { + await supertest + .post(DETECTION_ENGINE_INDEX_URL) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .send(); + return { + passed: true, + }; + }, + 'createAlertsIndex', + log + ); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/delete_all_alerts.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/delete_all_alerts.ts new file mode 100644 index 0000000000000..5c26820feda7d --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/delete_all_alerts.ts @@ -0,0 +1,47 @@ +/* + * 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 SuperTest from 'supertest'; +import type { ToolingLog } from '@kbn/tooling-log'; +import type { Client } from '@elastic/elasticsearch'; +import { DETECTION_ENGINE_INDEX_URL } from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; + +/** + * Deletes all alerts from a given index or indices, defaults to `.alerts-security.alerts-*` + * For use inside of afterEach blocks of tests + */ +export const deleteAllAlerts = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + es: Client, + index: Array<'.alerts-security.alerts-*' | '.preview.alerts-security.alerts-*'> = [ + '.alerts-security.alerts-*', + ] +): Promise => { + await countDownTest( + async () => { + await supertest + .delete(DETECTION_ENGINE_INDEX_URL) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .send(); + await es.deleteByQuery({ + index, + query: { + match_all: {}, + }, + refresh: true, + }); + return { + passed: true, + }; + }, + 'deleteAllAlerts', + log + ); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_id.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_id.ts new file mode 100644 index 0000000000000..c13759c935d4c --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_id.ts @@ -0,0 +1,53 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; +import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine'; + +import { DETECTION_ENGINE_QUERY_SIGNALS_URL as DETECTION_ENGINE_QUERY_ALERTS_URL } from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; +import { getQueryAlertsId } from './get_query_alerts_ids'; + +/** + * Given a single rule id this will return only alerts based on that rule id. + * @param supertest agent + * @param ids Rule id + */ +export const getAlertsById = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + id: string +): Promise> => { + const alertsOpen = await countDownTest>( + async () => { + const response = await supertest + .post(DETECTION_ENGINE_QUERY_ALERTS_URL) + .set('kbn-xsrf', 'true') + .send(getQueryAlertsId([id])); + if (response.status !== 200) { + return { + passed: false, + returnValue: undefined, + }; + } else { + return { + passed: true, + returnValue: response.body, + }; + } + }, + 'getAlertsById', + log + ); + if (alertsOpen == null) { + throw new Error('Alerts not defined after countdown, cannot continue'); + } else { + return alertsOpen; + } +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_ids.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_ids.ts new file mode 100644 index 0000000000000..9cee570b8e804 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_alerts_by_ids.ts @@ -0,0 +1,59 @@ +/* + * 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 { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; +import type { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine'; +import type { RiskEnrichmentFields } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/enrichments/types'; + +import { DETECTION_ENGINE_QUERY_SIGNALS_URL as DETECTION_ENGINE_QUERY_ALERTS_URL } from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; +import { getQueryAlertsId } from './get_query_alerts_ids'; +import { routeWithNamespace } from '../route_with_namespace'; + +/** + * Given an array of rule ids this will return only alerts based on that rule id both + * open and closed + * @param supertest agent + * @param ids Array of the rule ids + */ +export const getAlertsByIds = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + ids: string[], + size?: number, + namespace?: string +): Promise> => { + const alertsOpen = await countDownTest>( + async () => { + const route = routeWithNamespace(DETECTION_ENGINE_QUERY_ALERTS_URL, namespace); + const response = await supertest + .post(route) + .set('kbn-xsrf', 'true') + .send(getQueryAlertsId(ids, size)); + if (response.status !== 200) { + return { + passed: false, + errorMessage: `Status is not 200 as expected, it is: ${response.status}`, + }; + } else { + return { + passed: true, + returnValue: response.body, + }; + } + }, + 'getAlertsByIds', + log + ); + if (alertsOpen == null) { + throw new Error('Alerts not defined after countdown, cannot continue'); + } else { + return alertsOpen; + } +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alert_ids.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alert_ids.ts new file mode 100644 index 0000000000000..1e5eafa119e8e --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alert_ids.ts @@ -0,0 +1,16 @@ +/* + * 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 { SignalIds as AlertIds } from '@kbn/security-solution-plugin/common/api/detection_engine'; + +export const getQueryAlertIds = (alertIds: AlertIds) => ({ + query: { + terms: { + _id: alertIds, + }, + }, +}); diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alerts_ids.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alerts_ids.ts new file mode 100644 index 0000000000000..d40b28d74ef39 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/get_query_alerts_ids.ts @@ -0,0 +1,23 @@ +/* + * 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 { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; + +/** + * Given an array of ids for a test this will get the alerts + * created from that rule's regular id. + * @param ids The rule_id to search for alerts + */ +export const getQueryAlertsId = (ids: string[], size = 10) => ({ + size, + sort: ['@timestamp'], + query: { + terms: { + [ALERT_RULE_UUID]: ids, + }, + }, +}); diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/index.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/index.ts new file mode 100644 index 0000000000000..160f2cc322675 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/index.ts @@ -0,0 +1,14 @@ +/* + * 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. + */ + +export * from './create_alerts_index'; +export * from './delete_all_alerts'; +export * from './get_query_alert_ids'; +export * from './get_query_alerts_ids'; +export * from './get_alerts_by_ids'; +export * from './get_alerts_by_id'; +export * from './wait_for_alerts_to_be_present'; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/search_alerts.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/search_alerts.ts new file mode 100644 index 0000000000000..3a5357a0095b0 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/search_alerts.ts @@ -0,0 +1,54 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; +import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine'; + +import { DETECTION_ENGINE_QUERY_SIGNALS_URL as DETECTION_ENGINE_QUERY_ALERTS_URL } from '@kbn/security-solution-plugin/common/constants'; +import { countDownTest } from '../count_down_test'; + +/** + * This function invokes the detection engine query alerts API to search for alerts. + * It will retry until the alerts are returned or a timeout occurs. + * @param supertest agent + * @param log ToolingLog instance for logging + * @param searchBody The body of the search request, which should conform to the {@link SearchAlertsRequestBody} schema + */ +export const searchAlerts = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + searchBody: object +): Promise> => { + const alertsOpen = await countDownTest>( + async () => { + const response = await supertest + .post(DETECTION_ENGINE_QUERY_ALERTS_URL) + .set('kbn-xsrf', 'true') + .send(searchBody); + if (response.status !== 200) { + return { + passed: false, + returnValue: undefined, + }; + } else { + return { + passed: true, + returnValue: response.body, + }; + } + }, + 'searchAlerts', + log + ); + if (alertsOpen == null) { + throw new Error('Alerts were not found in alotted time'); + } else { + return alertsOpen; + } +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/wait_for_alerts_to_be_present.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/wait_for_alerts_to_be_present.ts new file mode 100644 index 0000000000000..5772861f6e636 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/alerts/wait_for_alerts_to_be_present.ts @@ -0,0 +1,35 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; + +import { getAlertsByIds } from './get_alerts_by_ids'; +import { waitFor } from '../wait_for'; + +/** + * Waits for the signal hits to be greater than the supplied number + * before continuing with a default of at least one signal + * @param supertest Deps + * @param numberOfAlerts The number of alerts to wait for, default is 1 + */ +export const waitForAlertsToBePresent = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + numberOfAlerts = 1, + alertIds: string[], + namespace?: string +): Promise => { + await waitFor( + async () => { + const alertsOpen = await getAlertsByIds(supertest, log, alertIds, numberOfAlerts, namespace); + return alertsOpen.hits.hits.length >= numberOfAlerts; + }, + 'waitForAlertsToBePresent', + log + ); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/count_down_test.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/count_down_test.ts new file mode 100644 index 0000000000000..39292a9cbbbb7 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/count_down_test.ts @@ -0,0 +1,78 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; + +/** + * Does a plain countdown and checks against a boolean to determine if to wait and try again. + * This is useful for over the wire things that can cause issues such as conflict or timeouts + * for testing resiliency. + * @param functionToTest The function to test against + * @param name The name of the function to print if we encounter errors + * @param log The tooling logger + * @param retryCount The number of times to retry before giving up (has default) + * @param timeoutWait Time to wait before trying again (has default) + */ +export const countDownTest = async ( + functionToTest: () => Promise<{ + passed: boolean; + returnValue?: T | undefined; + errorMessage?: string; + }>, + name: string, + log: ToolingLog, + retryCount: number = 50, + timeoutWait = 250, + ignoreThrow: boolean = false +): Promise => { + if (retryCount > 0) { + try { + const testReturn = await functionToTest(); + if (!testReturn.passed) { + const error = testReturn.errorMessage != null ? ` error: ${testReturn.errorMessage},` : ''; + log.error(`Failure trying to ${name},${error} retries left are: ${retryCount - 1}`); + // retry, counting down, and delay a bit before + await new Promise((resolve) => setTimeout(resolve, timeoutWait)); + const returnValue = await countDownTest( + functionToTest, + name, + log, + retryCount - 1, + timeoutWait, + ignoreThrow + ); + return returnValue; + } else { + return testReturn.returnValue; + } + } catch (err) { + if (ignoreThrow) { + throw err; + } else { + log.error( + `Failure trying to ${name}, with exception message of: ${ + err.message + }, retries left are: ${retryCount - 1}` + ); + // retry, counting down, and delay a bit before + await new Promise((resolve) => setTimeout(resolve, timeoutWait)); + const returnValue = await countDownTest( + functionToTest, + name, + log, + retryCount - 1, + timeoutWait, + ignoreThrow + ); + return returnValue; + } + } + } else { + log.error(`Could not ${name}, no retries are left`); + return undefined; + } +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/delete_all_anomalies.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/delete_all_anomalies.ts new file mode 100644 index 0000000000000..bb7a35dd2fd8c --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/delete_all_anomalies.ts @@ -0,0 +1,34 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type { Client } from '@elastic/elasticsearch'; + +import { countDownTest } from './count_down_test'; + +export const deleteAllAnomalies = async ( + log: ToolingLog, + es: Client, + index: string[] = ['.ml-anomalies-*'] +): Promise => { + await countDownTest( + async () => { + await es.deleteByQuery({ + index, + query: { + match_all: {}, + }, + refresh: true, + }); + return { + passed: true, + }; + }, + 'deleteAllAnomalies', + log + ); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/index.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/index.ts new file mode 100644 index 0000000000000..6d659921469a5 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/index.ts @@ -0,0 +1,15 @@ +/* + * 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. + */ + +export * from './alerts'; +export * from './count_down_test'; +export * from './delete_all_anomalies'; +export * from './route_with_namespace'; +export * from './rules'; +export * from './tasks'; +export * from './wait_for'; +export * from './spaces'; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/route_with_namespace.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/route_with_namespace.ts new file mode 100644 index 0000000000000..07e5c4a8049e2 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/route_with_namespace.ts @@ -0,0 +1,14 @@ +/* + * 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. + */ + +/** + * Generates a route string with an optional namespace. + * @param route the route string + * @param namespace [optional] the namespace to account for in the route + */ +export const routeWithNamespace = (route: string, namespace?: string) => + namespace ? `/s/${namespace}${route}` : route; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/create_rule.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/create_rule.ts new file mode 100644 index 0000000000000..b1fe58770abfd --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/create_rule.ts @@ -0,0 +1,75 @@ +/* + * 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 { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; +import type { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import type { + RuleCreateProps, + RuleResponse, +} from '@kbn/security-solution-plugin/common/api/detection_engine'; + +import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; +import { deleteRule } from './delete_rule'; +import { routeWithNamespace } from '../route_with_namespace'; + +/** + * Helper to cut down on the noise in some of the tests. If this detects + * a conflict it will try to manually remove the rule before re-adding the rule one time and log + * and error about the race condition. + * rule a second attempt. It only re-tries adding the rule if it encounters a conflict once. + * @param supertest The supertest deps + * @param log The tooling logger + * @param rule The rule to create + */ +export const createRule = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + rule: RuleCreateProps, + namespace?: string +): Promise => { + const route = routeWithNamespace(DETECTION_ENGINE_RULES_URL, namespace); + const response = await supertest + .post(route) + .set('kbn-xsrf', 'true') + .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') + .send(rule); + if (response.status === 409) { + if (rule.rule_id != null) { + log.debug( + `Did not get an expected 200 "ok" when creating a rule (createRule). CI issues could happen. Suspect this line if you are seeing CI issues. body: ${JSON.stringify( + response.body + )}, status: ${JSON.stringify(response.status)}` + ); + await deleteRule(supertest, rule.rule_id); + const secondResponseTry = await supertest + .post(DETECTION_ENGINE_RULES_URL) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .send(rule); + if (secondResponseTry.status !== 200) { + throw new Error( + `Unexpected non 200 ok when attempting to create a rule (second try): ${JSON.stringify( + response.body + )}` + ); + } else { + return secondResponseTry.body; + } + } else { + throw new Error('When creating a rule found an unexpected conflict (404)'); + } + } else if (response.status !== 200) { + throw new Error( + `Unexpected non 200 ok when attempting to create a rule: ${JSON.stringify( + response.status + )},${JSON.stringify(response, null, 4)}` + ); + } else { + return response.body; + } +}; diff --git a/x-pack/test/common/utils/security_solution/detections_response/rules/delete_all_rules.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/delete_all_rules.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/detections_response/rules/delete_all_rules.ts rename to x-pack/test/security_solution_api_integration/config/services/detections_response/rules/delete_all_rules.ts diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/delete_rule.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/delete_rule.ts new file mode 100644 index 0000000000000..5b3e28f05e093 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/delete_rule.ts @@ -0,0 +1,30 @@ +/* + * 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 SuperTest from 'supertest'; +import type { RuleResponse } from '@kbn/security-solution-plugin/common/api/detection_engine'; + +import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; + +/** + * Helper to cut down on the noise in some of the tests. Does a delete of a rule. + * It does not check for a 200 "ok" on this. + * @param supertest The supertest deps + * @param ruleId The rule id to delete + */ +export const deleteRule = async ( + supertest: SuperTest.Agent, + ruleId: string +): Promise => { + const response = await supertest + .delete(`${DETECTION_ENGINE_RULES_URL}?rule_id=${ruleId}`) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .expect(200); + + return response.body; +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_gaps_by_rule_id.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_gaps_by_rule_id.ts new file mode 100644 index 0000000000000..f6c818336fb8d --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_gaps_by_rule_id.ts @@ -0,0 +1,29 @@ +/* + * 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 SuperTest from 'supertest'; +import { FindGapsResponse } from '@kbn/alerting-plugin/common/routes/gaps/apis/find'; +import { routeWithNamespace } from '../route_with_namespace'; + +export const getGapsByRuleId = async ( + supertest: SuperTest.Agent, + ruleId: string, + { start, end }: { start: string; end: string }, + perPage: number, + namespace: string = 'default' +) => { + const response = (await supertest + .post(routeWithNamespace(`/internal/alerting/rules/gaps/_find`, namespace)) + .set('kbn-xsrf', 'foo') + .send({ + rule_id: ruleId, + start, + end, + per_page: perPage, + })) as FindGapsResponse; + + return response.body.data; +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_rule_for_alert_testing.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_rule_for_alert_testing.ts new file mode 100644 index 0000000000000..5c0500f89ef51 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/get_rule_for_alert_testing.ts @@ -0,0 +1,47 @@ +/* + * 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 { QueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; + +/** + * This is a typical signal testing rule that is easy for most basic testing of output of alerts. + * It starts out in an enabled true state. The 'from' is set very far back to test the basics of signal + * creation and testing by getting all the alerts at once. + * @param ruleId The optional ruleId which is rule-1 by default. + * @param enabled Enables the rule on creation or not. Defaulted to true. + */ +export const getRuleForAlertTesting = ( + index: string[], + ruleId = 'rule-1', + enabled = true +): QueryRuleCreateProps => ({ + name: 'Alert Testing Query', + description: 'Tests a simple query', + enabled, + risk_score: 1, + rule_id: ruleId, + severity: 'high', + index, + type: 'query', + query: '*:*', + from: '1900-01-01T00:00:00.000Z', +}); + +export const getLuceneRuleForTesting = (): QueryRuleCreateProps => ({ + rule_id: 'lucene-rule-1', + enabled: true, + name: 'Incident 496 test rule', + description: 'Ensures lucene rules generate alerts', + risk_score: 1, + severity: 'high', + type: 'query', + index: ['auditbeat-*'], + query: + '((event.category: (network OR network_traffic) AND type: (tls OR http)) OR event.dataset: (network_traffic.tls OR network_traffic.http)) AND destination.domain:/[a-z]{3}.stage.[0-9]{8}..*/', + language: 'lucene', + from: '1900-01-01T00:00:00.000Z', +}); diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/index.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/index.ts new file mode 100644 index 0000000000000..0f757b0a8d6a7 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export * from './create_rule'; +export * from './delete_all_rules'; +export * from './delete_rule'; +export * from './get_rule_for_alert_testing'; +export * from './wait_for_rule_status'; +export * from './manual_run'; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/manual_run.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/manual_run.ts new file mode 100644 index 0000000000000..8e1f47440009b --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/manual_run.ts @@ -0,0 +1,42 @@ +/* + * 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 SuperTest from 'supertest'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '@kbn/alerting-plugin/common'; +import { ScheduleBackfillResponse } from '@kbn/alerting-plugin/common/routes/backfill/apis/schedule'; +import { routeWithNamespace } from '../route_with_namespace'; + +const BACKFILL_RULE_URL = `${INTERNAL_BASE_ALERTING_API_PATH}/rules/backfill`; +const BACKFILL_RULE_URL_SCHEDULE = `${BACKFILL_RULE_URL}/_schedule`; + +export const manualRuleRun = async ({ + supertest, + ruleId, + start, + end, + namespace, +}: { + ruleId: string; + start: string; + end: string; + namespace?: string; + supertest: SuperTest.Agent; +}): Promise => { + const route = routeWithNamespace(BACKFILL_RULE_URL_SCHEDULE, namespace); + const response = await supertest + .post(route) + .set('kbn-xsrf', 'true') + .set('x-elastic-internal-origin', 'Kibana') + .send([ + { + rule_id: ruleId, + start, + end, + }, + ]); + + return response; +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/wait_for_rule_status.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/wait_for_rule_status.ts new file mode 100644 index 0000000000000..975b8dbef3b72 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/rules/wait_for_rule_status.ts @@ -0,0 +1,82 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; +import { + RuleExecutionStatus, + RuleExecutionStatusEnum, +} from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; +import { waitFor } from '../wait_for'; +import { routeWithNamespace } from '../route_with_namespace'; + +interface WaitForRuleStatusBaseParams { + supertest: SuperTest.Agent; + log: ToolingLog; + afterDate?: Date; + namespace?: string; +} + +interface WaitForRuleStatusWithId extends WaitForRuleStatusBaseParams { + id: string; + ruleId?: never; +} + +interface WaitForRuleStatusWithRuleId extends WaitForRuleStatusBaseParams { + ruleId: string; + id?: never; +} + +export type WaitForRuleStatusParams = WaitForRuleStatusWithId | WaitForRuleStatusWithRuleId; + +/** + * Waits for rule to settle in a provided status. + * Depending on wether `id` or `ruleId` provided it may impact the behavior. + * - `id` leads to fetching a rule via ES Get API (rulesClient.resolve -> SOClient.resolve -> ES Get API) + * - `ruleId` leads to fetching a rule via ES Search API (rulesClient.find -> SOClient.find -> ES Search API) + * ES Search API may return outdated data while ES Get API always returns fresh data + */ +export const waitForRuleStatus = async ( + expectedStatus: RuleExecutionStatus, + { supertest, log, afterDate, namespace, ...idOrRuleId }: WaitForRuleStatusParams +): Promise => { + await waitFor( + async () => { + const query = 'id' in idOrRuleId ? { id: idOrRuleId.id } : { rule_id: idOrRuleId.ruleId }; + const route = routeWithNamespace(DETECTION_ENGINE_RULES_URL, namespace); + const response = await supertest + .get(route) + .set('kbn-xsrf', 'true') + .set('elastic-api-version', '2023-10-31') + .query(query) + .expect(200); + + // TODO: https://github.com/elastic/kibana/pull/121644 clean up, make type-safe + const rule = response.body; + const ruleStatus = rule?.execution_summary?.last_execution.status; + const ruleStatusDate = rule?.execution_summary?.last_execution.date; + + return ( + rule != null && + ruleStatus === expectedStatus && + (afterDate ? new Date(ruleStatusDate) > afterDate : true) + ); + }, + 'waitForRuleStatus', + log + ); +}; + +export const waitForRuleSuccess = (params: WaitForRuleStatusParams): Promise => + waitForRuleStatus(RuleExecutionStatusEnum.succeeded, params); + +export const waitForRulePartialFailure = (params: WaitForRuleStatusParams): Promise => + waitForRuleStatus(RuleExecutionStatusEnum['partial failure'], params); + +export const waitForRuleFailure = (params: WaitForRuleStatusParams): Promise => + waitForRuleStatus(RuleExecutionStatusEnum.failed, params); diff --git a/x-pack/test/common/utils/security_solution/spaces.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/spaces.ts similarity index 100% rename from x-pack/test/common/utils/security_solution/spaces.ts rename to x-pack/test/security_solution_api_integration/config/services/detections_response/spaces.ts diff --git a/x-pack/test/common/utils/security_solution/index.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/index.ts similarity index 78% rename from x-pack/test/common/utils/security_solution/index.ts rename to x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/index.ts index c6d201710937b..128f0cfe9b93a 100644 --- a/x-pack/test/common/utils/security_solution/index.ts +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export * from './detections_response'; -export * from './spaces'; +export * from './indices_metadata'; +export * from './task_manager'; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/indices_metadata.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/indices_metadata.ts new file mode 100644 index 0000000000000..fb92272c00789 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/indices_metadata.ts @@ -0,0 +1,167 @@ +/* + * 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 { Client } from '@elastic/elasticsearch'; +import type { IndicesPutIndexTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; + +const INGEST_PIPELINE_PREFIX = 'testing-ingest-pipeline'; +const DS_PREFIX = 'testing-datastream'; +const ILM_PREFIX = 'testing-ilm'; + +export const indexRandomData = async (es: Client, dsName: string, ingestPipeline: string) => { + await es.index({ + index: dsName, + pipeline: ingestPipeline, + document: { + '@timestamp': new Date(), + key: `value-${Date.now()}`, + }, + }); +}; + +export const randomDatastream = async ( + es: Client, + opts: { policyName?: string; defaultPipeline?: string; finalPipeline?: string } = {} +): Promise => { + const name = `${DS_PREFIX}-${Date.now()}`; + + const indexTemplateBody: IndicesPutIndexTemplateRequest = { + name: DS_PREFIX, + index_patterns: [`${DS_PREFIX}-*`], + data_stream: {}, + template: { + settings: { + index: { + mode: 'standard', + mapping: { + source: { + mode: 'stored', + }, + }, + }, + }, + }, + }; + + if (opts.policyName && indexTemplateBody.template?.settings !== undefined) { + indexTemplateBody.template.settings.index = { + ...indexTemplateBody.template.settings.index, + lifecycle: { + name: opts.policyName, + }, + }; + } + + if (opts.defaultPipeline && indexTemplateBody.template?.settings !== undefined) { + indexTemplateBody.template.settings.index = { + ...indexTemplateBody.template.settings.index, + default_pipeline: opts.defaultPipeline, + }; + } + + if (opts.finalPipeline && indexTemplateBody.template?.settings !== undefined) { + indexTemplateBody.template.settings.index = { + ...indexTemplateBody.template.settings.index, + final_pipeline: opts.finalPipeline, + }; + } + + await es.indices.putIndexTemplate(indexTemplateBody); + + await es.indices.createDataStream({ name }); + + return name; +}; + +export const randomIngestPipeline = async (es: Client): Promise => { + const id = `${INGEST_PIPELINE_PREFIX}-${Date.now()}`; + + await es.ingest.putPipeline({ + id, + processors: [ + { + set: { + field: `message-${performance.now()}`, + value: `changed-${Date.now()}`, + }, + }, + ], + }); + + return id; +}; + +export const randomIlmPolicy = async (es: Client): Promise => { + const name = `${ILM_PREFIX}-${Date.now()}`; + + const policy = { + phases: { + hot: { + actions: { + rollover: { + max_size: '50gb', + max_age: '30d', + }, + }, + }, + warm: { + min_age: '30d', + actions: { + forcemerge: { + max_num_segments: 1, + }, + shrink: { + number_of_shards: 1, + }, + allocate: { + number_of_replicas: 1, + }, + }, + }, + delete: { + min_age: '90d', + actions: { + delete: {}, + }, + }, + }, + }; + + await es.ilm.putLifecycle({ name, policy }); + + return name; +}; + +export const ensureBackingIndices = async (dsName: string, count: number, es: Client) => { + const stats = await es.indices.dataStreamsStats({ name: dsName }); + if (stats.data_streams.length !== 1) { + throw new Error('Data stream not found'); + } + const current = stats.data_streams[0].backing_indices; + + if (current < count) { + for (let i = current; i < count; i++) { + await es.indices.rollover({ alias: dsName }); + } + } else if (current > count) { + throw new Error('Cannot reduce the number of backing indices'); + } +}; + +export const cleanupDatastreams = async (es: Client) => { + await es.indices.deleteDataStream({ name: `${DS_PREFIX}*` }); +}; + +export const cleanupIngestPipelines = async (es: Client) => { + es.ingest.deletePipeline({ id: `${INGEST_PIPELINE_PREFIX}*` }); +}; + +export const cleanupPolicies = async (es: Client) => { + const policies = await es.ilm.getLifecycle({ name: `${ILM_PREFIX}*` }); + + await Promise.all(Object.entries(policies).map(([name, _]) => es.ilm.deleteLifecycle({ name }))); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/task_manager.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/task_manager.ts new file mode 100644 index 0000000000000..84015fa7b0b62 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/tasks/task_manager.ts @@ -0,0 +1,52 @@ +/* + * 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 { TaskStatus } from '@kbn/task-manager-plugin/server'; +import { KbnClient } from '@kbn/test'; +import { ToolingLog } from '@kbn/tooling-log'; + +export const taskHasRun = async (taskId: string, kbn: KbnClient, after: Date): Promise => { + const task = await kbn.savedObjects.get({ + type: 'task', + id: taskId, + }); + + const runAt = new Date(task.attributes.runAt); + const status = task.attributes.status; + + return runAt > after && status === TaskStatus.Idle; +}; + +export const launchTask = async ( + taskId: string, + kbn: KbnClient, + logger: ToolingLog, + delayMillis: number = 1_000 +): Promise => { + logger.info(`Launching task ${taskId}`); + const task = await kbn.savedObjects.get({ + type: 'task', + id: taskId, + }); + + const runAt = new Date(Date.now() + delayMillis).toISOString(); + + await kbn.savedObjects.update({ + type: 'task', + id: taskId, + attributes: { + ...task.attributes, + runAt, + scheduledAt: runAt, + status: TaskStatus.Idle, + }, + }); + + logger.info(`Task ${taskId} launched`); + + return new Date(runAt); +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/detections_response/wait_for.ts b/x-pack/test/security_solution_api_integration/config/services/detections_response/wait_for.ts new file mode 100644 index 0000000000000..dfa20bd7019d8 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/detections_response/wait_for.ts @@ -0,0 +1,35 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; + +// Similar to ReactJs's waitFor from here: https://testing-library.com/docs/dom-testing-library/api-async#waitfor +export const waitFor = async ( + functionToTest: () => Promise, + functionName: string, + log: ToolingLog, + maxTimeout: number = 400000, + timeoutWait: number = 250 +): Promise => { + let found = false; + let numberOfTries = 0; + const maxTries = Math.floor(maxTimeout / timeoutWait); + while (!found && numberOfTries < maxTries) { + if (await functionToTest()) { + found = true; + } else { + log.debug(`Try number ${numberOfTries} out of ${maxTries} for function ${functionName}`); + numberOfTries++; + } + + await new Promise((resolveTimeout) => setTimeout(resolveTimeout, timeoutWait)); + } + + if (!found) { + throw new Error(`timed out waiting for function condition to be true within ${functionName}`); + } +}; diff --git a/x-pack/test/security_solution_api_integration/config/services/spaces.ts b/x-pack/test/security_solution_api_integration/config/services/spaces.ts new file mode 100644 index 0000000000000..655760d4f4c76 --- /dev/null +++ b/x-pack/test/security_solution_api_integration/config/services/spaces.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +/** + * Wraps a provided URL with the space ID if it is not the default space. + * + * Examples: + * - `withSpaceUrl('/api/some_endpoint')` returns `/api/some_endpoint` + * - `withSpaceUrl('/api/some_endpoint', 'default')` returns `/api/some_endpoint` + * - `withSpaceUrl('/api/some_endpoint', 'my_space') returns `/s/my_space/api/some_endpoint` + */ +export function withSpaceUrl(url: string, spaceId = 'default'): string { + return spaceId === 'default' ? url : `/s/${spaceId}${url}`; +} diff --git a/x-pack/test/common/services/spaces.ts b/x-pack/test/security_solution_api_integration/config/services/spaces_service.ts similarity index 98% rename from x-pack/test/common/services/spaces.ts rename to x-pack/test/security_solution_api_integration/config/services/spaces_service.ts index ba510466178d4..3c2cdfa6c476c 100644 --- a/x-pack/test/common/services/spaces.ts +++ b/x-pack/test/security_solution_api_integration/config/services/spaces_service.ts @@ -12,7 +12,7 @@ import { format as formatUrl } from 'url'; import util from 'util'; import Chance from 'chance'; import Url from 'url'; -import { FtrProviderContext } from '../ftr_provider_context'; +import type { FtrProviderContext } from '../../ftr_provider_context'; const chance = new Chance(); diff --git a/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/nlp_cleanup_task/search_ai_lake_tier/task_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/nlp_cleanup_task/search_ai_lake_tier/task_execution.ts index e88b42c405645..c3f55fcb3989a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/nlp_cleanup_task/search_ai_lake_tier/task_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/ai4dsoc/nlp_cleanup_task/search_ai_lake_tier/task_execution.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../ftr_provider_context'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext) => { const kibanaServer = getService('kibanaServer'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts index 5eba6e2790bdf..b9dbaf232cf71 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts @@ -17,7 +17,7 @@ import { deleteAllAlerts, getRuleForAlertTesting, createRule, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { createWebHookRuleAction, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/check_privileges.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/check_privileges.ts index 249f31a2feda8..dca84233a6cf9 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/check_privileges.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/check_privileges.ts @@ -17,11 +17,8 @@ import { createAlertsIndex, waitForRulePartialFailure, getRuleForAlertTesting, -} from '../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../common/services/security_solution'; +} from '../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/throttle.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/throttle.ts index 61f2423afb06e..d6f90bdd1db49 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/throttle.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/throttle.ts @@ -29,7 +29,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/update_actions.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/update_actions.ts index 93deebb4ad7d9..49aeb7af11796 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/update_actions.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/update_actions.ts @@ -24,7 +24,7 @@ import { deleteAllRules, deleteAllAlerts, waitForRuleSuccess, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status.ts index 2d5232124058d..703170c8e425e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status.ts @@ -29,7 +29,7 @@ import { getAlertsByIds, waitForRuleSuccess, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status_ess.ts index e8ec236eab5cf..008fbbb13615f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/alert_status/alert_status_ess.ts @@ -27,11 +27,8 @@ import { getAlertsByIds, waitForRuleSuccess, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../common/services/security_solution'; +} from '../../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/alerts_compatibility.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/alerts_compatibility.ts index d1ef885a4c938..ec0d81e0ab8ed 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/alerts_compatibility.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/alerts_compatibility.ts @@ -39,7 +39,7 @@ import { waitForRuleSuccess, waitForAlertsToBePresent, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/create_index.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/create_index.ts index 7166858c9bca8..b7ea1014a547b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/create_index.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/create_index.ts @@ -13,7 +13,7 @@ import { import { SIGNALS_FIELD_ALIASES_VERSION } from '@kbn/security-solution-plugin/server/lib/detection_engine/routes/index/get_signals_template'; -import { deleteAllAlerts } from '../../../../../../../common/utils/security_solution'; +import { deleteAllAlerts } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/create_alerts_migrations.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/create_alerts_migrations.ts index f0893a9418f55..0c26ebf146e30 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/create_alerts_migrations.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/create_alerts_migrations.ts @@ -24,11 +24,8 @@ import { import { createAlertsIndex, deleteAllAlerts, -} from '../../../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../../common/services/security_solution'; +} from '../../../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; interface CreateResponse { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/delete_alerts_migrations.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/delete_alerts_migrations.ts index f9435756bd13e..e7330d33081bc 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/delete_alerts_migrations.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/delete_alerts_migrations.ts @@ -18,8 +18,8 @@ import { createAlertsIndex, deleteAllAlerts, waitFor, -} from '../../../../../../../../common/utils/security_solution'; -import { createUserAndRole } from '../../../../../../../../common/services/security_solution'; +} from '../../../../../../../config/services/detections_response'; +import { createUserAndRole } from '../../../../../../../config/services/common'; interface CreateResponse { index: string; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/deprecations.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/deprecations.ts index cf4ac9e255ea9..6cee497f9ffc3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/deprecations.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/deprecations.ts @@ -11,7 +11,7 @@ import type { DeprecationsDetails } from '@kbn/core/server'; import { createAlertsIndex, deleteAllAlerts, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/finalize_alerts_migrations.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/finalize_alerts_migrations.ts index 12a55696d473c..4a5bfb31967fe 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/finalize_alerts_migrations.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/finalize_alerts_migrations.ts @@ -18,11 +18,8 @@ import { createAlertsIndex, deleteAllAlerts, waitFor, -} from '../../../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../../common/services/security_solution'; +} from '../../../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../../config/services/common'; interface StatusResponse { index: string; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/get_alerts_migration_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/get_alerts_migration_status.ts index 48b2783fef41c..d1972ad3ab4bc 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/get_alerts_migration_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/migrations/get_alerts_migration_status.ts @@ -13,11 +13,8 @@ import { getIndexNameFromLoad } from '../../../../../utils'; import { createAlertsIndex, deleteAllAlerts, -} from '../../../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../../common/services/security_solution'; +} from '../../../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/query_alerts_backword_compatibility.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/query_alerts_backword_compatibility.ts index 0288379884f8e..fd74dc8cd0632 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/query_alerts_backword_compatibility.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/ess_specific_index_logic/query_alerts_backword_compatibility.ts @@ -11,7 +11,7 @@ import { DETECTION_ENGINE_QUERY_SIGNALS_URL } from '@kbn/security-solution-plugi import { createAlertsIndex, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/field_aliases.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/field_aliases.ts index fa3215e8fcd68..5ea4c9c284377 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/field_aliases.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/field_aliases.ts @@ -16,7 +16,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/query_alerts.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/query_alerts.ts index c6f162f5f55d3..c1d036d85974d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/query_alerts.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/query_alerts.ts @@ -16,7 +16,7 @@ import { getAlertStatus } from '../../../utils'; import { createAlertsIndex, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; const query = { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/set_alert_tags.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/set_alert_tags.ts index dec8bf7231e9c..145225d67cb19 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/set_alert_tags.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/set_alert_tags.ts @@ -25,7 +25,7 @@ import { getAlertsByIds, waitForRuleSuccess, getRuleForAlertTesting, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments.ts index 6dd4ef213a1b9..e5c03e8671f10 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments.ts @@ -25,7 +25,7 @@ import { getRuleForAlertTesting, waitForAlertsToBePresent, waitForRuleSuccess, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_ess.ts index 569934bea4985..5f2300d1d8d7b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_ess.ts @@ -8,10 +8,7 @@ import { DETECTION_ENGINE_ALERT_ASSIGNEES_URL } from '@kbn/security-solution-plugin/common/constants'; import { ROLES } from '@kbn/security-solution-plugin/common/test'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../common/services/security_solution'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../config/services/common'; import { setAlertAssignees } from '../../../../utils'; import { createAlertsIndex, @@ -22,7 +19,7 @@ import { getRuleForAlertTesting, waitForAlertsToBePresent, waitForRuleSuccess, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_serverless.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_serverless.ts index bae1be51a8af5..d98a55ee6d9f8 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_serverless.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/assignments/assignments_serverless.ts @@ -18,7 +18,7 @@ import { getRuleForAlertTesting, waitForAlertsToBePresent, waitForRuleSuccess, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/document_level_security.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/document_level_security.ts index 0d7623ef77fa3..9d1f349447b2b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/document_level_security.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/document_level_security.ts @@ -12,7 +12,7 @@ import { SECURITY_FEATURE_ID, } from '@kbn/security-solution-plugin/common/constants'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; -import { deleteAllAlerts } from '../../../../../../common/utils/security_solution'; +import { deleteAllAlerts } from '../../../../../config/services/detections_response'; const roleToAccessSecuritySolution = { name: 'sec_all_spaces', diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_types/basic_license_essentials_tier/date.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_types/basic_license_essentials_tier/date.ts index 8d358feb2b647..7fa2b94343297 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_types/basic_license_essentials_tier/date.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_types/basic_license_essentials_tier/date.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/double/basic_license_essentials_tier/double.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/double/basic_license_essentials_tier/double.ts index f209695e64e41..e916416e20e61 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/double/basic_license_essentials_tier/double.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/double/basic_license_essentials_tier/double.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/float/basic_license_essentials_tier/float.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/float/basic_license_essentials_tier/float.ts index 82676426c226c..525a0742dd2ad 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/float/basic_license_essentials_tier/float.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/float/basic_license_essentials_tier/float.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/integer/basic_license_essentials_tier/integer.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/integer/basic_license_essentials_tier/integer.ts index 6da0e2723a05e..aa0406441f7c4 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/integer/basic_license_essentials_tier/integer.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/integer/basic_license_essentials_tier/integer.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip.ts index abd63b810a1b6..1d2288ce7bfde 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip_array.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip_array.ts index 2682ff71ee2e7..88b08b123c644 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip_array.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/ip_array.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword.ts index d81a2eeb720e1..c6c0386a13b6a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword_array.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword_array.ts index cda491c3ab6a5..a6069271d571f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword_array.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/keyword_array.ts @@ -24,7 +24,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/long.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/long.ts index e93bd60dffcf7..5e97bc4b5f9b7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/long.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/long.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text.ts index e6d8549b20821..6992dd0e2d31f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text.ts @@ -24,7 +24,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text_array.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text_array.ts index 0b5cf46037309..2c41bde8f3d81 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text_array.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/text_array.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_endpoint_exceptions.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_endpoint_exceptions.ts index db46be934d9fa..180924fbe2d0f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_endpoint_exceptions.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_endpoint_exceptions.ts @@ -19,7 +19,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { createListsIndex, deleteAllExceptions, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions.ts index 8b13aa64ac6b2..b47abb7dd474e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions.ts @@ -20,7 +20,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions, removeExceptionListItemServerGeneratedProperties, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions_ess.ts index a1708cf4d6ae0..f3abbcdde8a3b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/create_rule_exceptions_ess.ts @@ -19,7 +19,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exception_comments_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exception_comments_ess.ts index aeecef2a60ade..eae9a64787acb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exception_comments_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exception_comments_ess.ts @@ -19,10 +19,7 @@ import { ROLES } from '@kbn/security-solution-plugin/common/test'; import { getUpdateMinimalExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/request/update_exception_list_item_schema.mock'; import { UpdateExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../../common/services/security_solution'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exceptions_data_integrity.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exceptions_data_integrity.ts index fe88000c9df1d..b137a3955ac46 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exceptions_data_integrity.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/exceptions_data_integrity.ts @@ -23,7 +23,7 @@ import { deleteAllAlerts, deleteAllRules, createRule, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { createListsIndex, deleteAllExceptions, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/find_rule_exception_references.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/find_rule_exception_references.ts index 9df4347efe7bf..7988c342ee9a6 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/find_rule_exception_references.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/find_rule_exception_references.ts @@ -28,7 +28,7 @@ import { deleteAllRules, deleteAllAlerts, createAlertsIndex, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/prebuilt_rules.ts index 5ed8d5d66c5dc..2442eaa010d60 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/prebuilt_rules.ts @@ -28,7 +28,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/rule_exceptions_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/rule_exceptions_execution.ts index 550bb16d1dfe8..d46e87fe0340d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/rule_exceptions_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/rule_exceptions_execution.ts @@ -38,7 +38,7 @@ import { waitForAlertsToBePresent, getAlertsByIds, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { createListsIndex, deleteAllExceptions, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql.ts index 7c0f4f913c613..672f1edb5cf57 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql.ts @@ -55,7 +55,7 @@ import { deleteAllAlerts, waitForRuleFailure, routeWithNamespace, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; import { getMetricsRequest, getMetricsWithRetry } from '../../utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql_alert_suppression.ts index c7a3af5aba1f8..3c1eb718b9aca 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/eql/trial_license_complete_tier/eql_alert_suppression.ts @@ -33,7 +33,7 @@ import { deleteAllRules, deleteAllAlerts, waitForRuleSuccess, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { getEqlRuleForAlertTesting, getOpenAlerts, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql.ts index 40b4d47261676..7d706ce59e11d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql.ts @@ -41,7 +41,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql_suppression.ts index 95f38b43fd99d..3146d8c9b95f0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/esql/trial_license_complete_tier/esql_suppression.ts @@ -38,7 +38,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/frozen_indices_handling/trial_license_complete_tier/frozen_indices_handling.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/frozen_indices_handling/trial_license_complete_tier/frozen_indices_handling.ts index 72ba9482d3f47..534916fd088b4 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/frozen_indices_handling/trial_license_complete_tier/frozen_indices_handling.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/frozen_indices_handling/trial_license_complete_tier/frozen_indices_handling.ts @@ -13,7 +13,7 @@ import { dataGeneratorFactory } from '../../../../utils'; import { deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { moveIndexToFrozenDataTier } from '../../../../utils/frozen_data_tier'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ecs_field_duplication.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ecs_field_duplication.ts index 20801810dc996..88380a8be86fe 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ecs_field_duplication.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ecs_field_duplication.ts @@ -22,8 +22,8 @@ import { getRuleForAlertTesting, waitForAlertsToBePresent, waitForRuleSuccess, -} from '../../../../../../../common/utils/security_solution'; -import { searchAlerts } from '../../../../../../../common/utils/security_solution/detections_response/alerts/search_alerts'; +} from '../../../../../../config/services/detections_response'; +import { searchAlerts } from '../../../../../../config/services/detections_response/alerts/search_alerts'; import { getPreviewAlerts, previewRule } from '../../../../utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ignore_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ignore_fields.ts index c2e8fbeb1f5aa..26e6ee2162337 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ignore_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/ignore_fields.ts @@ -15,7 +15,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; interface Ignore { normal_constant?: string; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/const_keyword.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/const_keyword.ts index de9d220ab8f98..d0f6443f7dd95 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/const_keyword.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/const_keyword.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword.ts index a8d9aad9ce724..30be9b6967b84 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword.ts @@ -24,7 +24,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword_mixed_with_const.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword_mixed_with_const.ts index 429d8423ce610..94c9b054bbcea 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword_mixed_with_const.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/keyword_family/keyword_mixed_with_const.ts @@ -23,7 +23,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../../common/utils/security_solution'; +} from '../../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/non_ecs_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/non_ecs_fields.ts index c8240e08e1303..351140d30aa7c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/non_ecs_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/non_ecs_fields.ts @@ -16,7 +16,7 @@ import { deleteAllRules, deleteAllAlerts, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; const getQueryRule = (docIdToQuery: string) => ({ diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/runtime.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/runtime.ts index 009e2d358392a..d0b6a3feeef22 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/runtime.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/runtime.ts @@ -17,7 +17,7 @@ import { getAlertsById, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/timestamps.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/timestamps.ts index e8e92d4c13406..30942a9fc897f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/timestamps.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/basic_license_essentials_tier/timestamps.ts @@ -25,7 +25,7 @@ import { getRuleForAlertTesting, getAlertsByIds, waitForRulePartialFailure, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/trial_license_complete_tier/synthetic_source.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/trial_license_complete_tier/synthetic_source.ts index 942d068100901..48735019f3805 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/trial_license_complete_tier/synthetic_source.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/general_logic/trial_license_complete_tier/synthetic_source.ts @@ -14,7 +14,7 @@ import { deleteAllRules, deleteAllAlerts, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match.ts index 0082c856a776e..373308ef6cf7e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match.ts @@ -55,7 +55,7 @@ import { deleteAllAlerts, deleteAllRules, createRule, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts index d3e99682375d6..c89dd20ea3c73 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts @@ -26,7 +26,7 @@ import { ThreatMatchRuleCreateProps } from '@kbn/security-solution-plugin/common import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; -import { createRule } from '../../../../../../../common/utils/security_solution'; +import { createRule } from '../../../../../../config/services/detections_response'; import { getOpenAlerts, getPreviewAlerts, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning.ts index ddba293b76321..883a175588e4c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning.ts @@ -50,7 +50,7 @@ import { deleteAllAlerts, waitForRuleFailure, routeWithNamespace, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; import { getMetricsRequest, getMetricsWithRetry } from '../../utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_alert_suppression.ts index 5cfd267981cbf..4cf540578f6dd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_alert_suppression.ts @@ -42,7 +42,7 @@ import { deleteAllAlerts, deleteAllAnomalies, deleteAllRules, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_manual_run.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_manual_run.ts index 1697043de89d1..609b716ed9339 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_manual_run.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/machine_learning_manual_run.ts @@ -27,7 +27,7 @@ import { deleteAllAlerts, deleteAllAnomalies, deleteAllRules, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms.ts index 42b19b478d921..012a4c4d0e2cb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms.ts @@ -30,7 +30,7 @@ import { createRule, deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms_alert_suppression.ts index 7f0b72b50945d..44ddb4dd63e6e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/new_terms/trial_license_complete_tier/new_terms_alert_suppression.ts @@ -27,7 +27,7 @@ import { DETECTION_ENGINE_SIGNALS_STATUS_URL as DETECTION_ENGINE_ALERTS_STATUS_U import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_monitoring'; import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; -import { createRule } from '../../../../../../../common/utils/security_solution'; +import { createRule } from '../../../../../../config/services/detections_response'; import { getOpenAlerts, getPreviewAlerts, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/custom_query.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/custom_query.ts index 5cb8b617c3997..4dd8f99822ada 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/custom_query.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/custom_query.ts @@ -71,7 +71,7 @@ import { deleteAllAlerts, getRuleForAlertTesting, getLuceneRuleForTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/saved_query.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/saved_query.ts index 8e88222c9653b..c13d21c939a30 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/saved_query.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/query/trial_license_complete_tier/saved_query.ts @@ -22,7 +22,7 @@ import { deleteAllRules, deleteAllAlerts, getRuleForAlertTesting, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold.ts index 4138d8ae4ed84..b0ed0bc8c32cd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold.ts @@ -31,7 +31,7 @@ import { createRule, deleteAllRules, deleteAllAlerts, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { getAlerts, getPreviewAlerts, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold_alert_suppression.ts index ed40d7d50b88b..03a244e2bb4a0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/threshold/trial_license_complete_tier/threshold_alert_suppression.ts @@ -24,7 +24,7 @@ import { RuleExecutionStatusEnum } from '@kbn/security-solution-plugin/common/ap import { ALERT_ORIGINAL_TIME } from '@kbn/security-solution-plugin/common/field_maps/field_names'; import { AlertSuppression } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema'; -import { createRule } from '../../../../../../../common/utils/security_solution'; +import { createRule } from '../../../../../../config/services/detections_response'; import { getAlerts, getOpenAlerts, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_gaps/trial_license_complete_tier/manual_rule_run.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_gaps/trial_license_complete_tier/manual_rule_run.ts index 153185456544d..0b2d7e6db3287 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_gaps/trial_license_complete_tier/manual_rule_run.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_gaps/trial_license_complete_tier/manual_rule_run.ts @@ -16,7 +16,7 @@ import { deleteAllRules, createRule, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; const buildSchedule = ( startDate: moment.Moment, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/export_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/export_prebuilt_rules.ts index 57d2e73fe095d..403a691022656 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/export_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/export_prebuilt_rules.ts @@ -11,7 +11,7 @@ import { RuleResponse, } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { binaryToString, createPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_multiple_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_multiple_prebuilt_rules.ts index 4847566cf699b..6da380548fe8c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_multiple_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_multiple_prebuilt_rules.ts @@ -14,7 +14,7 @@ import { installPrebuiltRules, importRulesWithSuccess, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_outdated_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_outdated_prebuilt_rules.ts index d0764ca6a9cac..ed3e9bc604962 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_outdated_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_outdated_prebuilt_rules.ts @@ -13,7 +13,7 @@ import { installPrebuiltRules, importRulesWithSuccess, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_single_prebuilt_rule.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_single_prebuilt_rule.ts index a5829d478acd1..e102bdfab87c7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_single_prebuilt_rule.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_single_prebuilt_rule.ts @@ -17,7 +17,7 @@ import { importRulesWithSuccess, assertImportedRule, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_installing_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_installing_package.ts index 901b73b74dd29..b9c6b3bfef2c9 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_installing_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_installing_package.ts @@ -15,7 +15,7 @@ import { installFleetPackageByUpload, deletePrebuiltRulesFleetPackage, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { PREBUILT_RULE_ASSET_A, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_base_version.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_base_version.ts index f8f4278304274..8fffc520d09ec 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_base_version.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_base_version.ts @@ -13,7 +13,7 @@ import { importRulesWithSuccess, assertImportedRule, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_fields.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_fields.ts index 1932e8764368a..93bc954f27b7d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_fields.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/import_export/import_with_missing_fields.ts @@ -15,7 +15,7 @@ import { importRulesWithSuccess, assertImportedRule, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/install_prebuilt_rules/install_mocked_prebuilt_rule_assets.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/install_prebuilt_rules/install_mocked_prebuilt_rule_assets.ts index 268941d9989c4..26319bb831c30 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/install_prebuilt_rules/install_mocked_prebuilt_rule_assets.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/install_prebuilt_rules/install_mocked_prebuilt_rule_assets.ts @@ -19,7 +19,7 @@ import { installPrebuiltRules, getInstalledRules, } from '../../../../utils'; -import { deleteAllRules, deleteRule } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules, deleteRule } from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const es = getService('es'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_bundled_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_bundled_package.ts index 445b1c8036dc5..5e96113db77cd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_bundled_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_bundled_package.ts @@ -19,7 +19,7 @@ import { getPrebuiltRulesStatus, installPrebuiltRulesPackageByVersion, } from '../../../../../utils'; -import { deleteAllRules } from '../../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../../config/services/detections_response'; import { MOCK_PKG_VERSION } from '../../configs/edge_cases/ess_air_gapped_with_bundled_packages.config'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_large_bundled_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_large_bundled_package.ts index e758b0a5ef7cb..32ebdc5ab4ce0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_large_bundled_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/install_large_bundled_package.ts @@ -12,7 +12,7 @@ import { getPrebuiltRulesAndTimelinesStatus, installPrebuiltRulesAndTimelines, } from '../../../../../utils'; -import { deleteAllRules } from '../../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../../config/services/detections_response'; import { NUM_OF_RULE_IN_MOCK_LARGE_PKG } from '../../configs/edge_cases/ess_air_gapped_with_bundled_large_package.config'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/prerelease_packages.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/prerelease_packages.ts index a310d21d70c7f..843b07df34e58 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/prerelease_packages.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/air_gapped/prerelease_packages.ts @@ -17,7 +17,7 @@ import { installPrebuiltRules, installFleetPackage, } from '../../../../../utils'; -import { deleteAllRules } from '../../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../../config/services/detections_response'; import { MOCK_BETA_PKG_VERSION, MOCK_PKG_VERSION, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/install_package_from_epr.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/install_package_from_epr.ts index 264069d1c4ce8..a33fdd64a3d75 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/install_package_from_epr.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/install_package_from_epr.ts @@ -14,7 +14,7 @@ import { getPrebuiltRulesAndTimelinesStatus, installPrebuiltRulesAndTimelines, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { deleteAllPrebuiltRuleAssets } from '../../../../utils/rules/prebuilt_rules/delete_all_prebuilt_rule_assets'; import { deleteAllTimelines } from '../../../../utils/rules/prebuilt_rules/delete_all_timelines'; import { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/update_package.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/update_package.ts index 2f4be45735ac6..a924c11e9fd00 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/update_package.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/prebuilt_rules_package/update_package.ts @@ -22,7 +22,7 @@ import { performUpgradePrebuiltRules, reviewPrebuiltRulesToInstall, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const es = getService('es'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/get_prebuilt_rule_base_version.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/get_prebuilt_rule_base_version.ts index 359d3cc488353..9cbb0caa549f1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/get_prebuilt_rule_base_version.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/get_prebuilt_rule_base_version.ts @@ -11,7 +11,7 @@ import { ThreeWayDiffOutcome, ThreeWayMergeOutcome, } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { createPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/revert_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/revert_prebuilt_rules.ts index 4bbd743f649fa..4ba129199a7a7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/revert_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/revert_prebuilt_rules/revert_prebuilt_rules.ts @@ -10,7 +10,7 @@ import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common import { deleteAllRules, waitForRulePartialFailure, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { createPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/status/get_prebuilt_rules_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/status/get_prebuilt_rules_status.ts index 03772258bd679..434d1003340dc 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/status/get_prebuilt_rules_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/status/get_prebuilt_rules_status.ts @@ -23,7 +23,7 @@ import { deleteAllRules, createRule, deleteRule, -} from '../../../../../../../common/utils/security_solution'; +} from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/customization/calculate_is_customized.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/customization/calculate_is_customized.ts index 6f42b26bc6441..e6e05a6517c74 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/customization/calculate_is_customized.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/customization/calculate_is_customized.ts @@ -10,7 +10,7 @@ import { BulkActionEditTypeEnum, BulkActionTypeEnum, } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/upgrade_prebuilt_rules/upgrade_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/upgrade_prebuilt_rules/upgrade_prebuilt_rules.ts index 7247f7de8d37a..719156a79c26b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/upgrade_prebuilt_rules/upgrade_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_disabled/upgrade_prebuilt_rules/upgrade_prebuilt_rules.ts @@ -13,7 +13,7 @@ import { QueryRuleCreateFields, } from '@kbn/security-solution-plugin/common/api/detection_engine'; import expect from 'expect'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { createHistoricalPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/calculate_is_customized.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/calculate_is_customized.ts index 38f75baaed2b6..7db14b1407015 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/calculate_is_customized.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/calculate_is_customized.ts @@ -10,7 +10,7 @@ import { BulkActionEditTypeEnum, BulkActionTypeEnum, } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { createPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_prebuilt_rules.ts index d1b431898b1ca..28029819840b5 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_prebuilt_rules.ts @@ -9,7 +9,7 @@ import { getPrebuiltRuleMock, getPrebuiltRuleMockOfType, } from '@kbn/security-solution-plugin/server/lib/detection_engine/prebuilt_rules/mocks'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { createPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_via_bulk_editing.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_via_bulk_editing.ts index 97f4ad9436f69..9e95c73765897 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_via_bulk_editing.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/customize_via_bulk_editing.ts @@ -13,7 +13,7 @@ import { BulkEditActionResponse, } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management'; import { RuleResponse } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { createPrebuiltRuleAssetSavedObjects, createRuleAssetSavedObject, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_notifications/get_prebuilt_rules_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_notifications/get_prebuilt_rules_status.ts index 69d6f85118f05..1cb3057d6065f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_notifications/get_prebuilt_rules_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_notifications/get_prebuilt_rules_status.ts @@ -14,7 +14,7 @@ import { createPrebuiltRuleAssetSavedObjects, installPrebuiltRules, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_all_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_all_prebuilt_rules.ts index e37b09e9f2fb5..9b96b3590f726 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_all_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_all_prebuilt_rules.ts @@ -7,7 +7,7 @@ import expect from 'expect'; import { ModeEnum } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { setUpRuleUpgrade } from '../../../../utils/rules/prebuilt_rules/set_up_rule_upgrade'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets, performUpgradePrebuiltRules } from '../../../../utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_selected_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_selected_prebuilt_rules.ts index 003d188e94391..5dd813baaaf88 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_selected_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/bulk_upgrade_selected_prebuilt_rules.ts @@ -7,7 +7,7 @@ import expect from 'expect'; import { ModeEnum } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { setUpRuleUpgrade } from '../../../../utils/rules/prebuilt_rules/set_up_rule_upgrade'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets, performUpgradePrebuiltRules } from '../../../../utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/common_fields/index.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/common_fields/index.ts index 3e99193009a62..f77bd9d773c1a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/common_fields/index.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/common_fields/index.ts @@ -7,7 +7,7 @@ import { FtrProviderContext } from '../../../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets } from '../../../../../../utils'; -import { deleteAllRules } from '../../../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../../../config/services/detections_response'; import { nameField } from './name'; import { descriptionField } from './description'; import { tagsField } from './tags'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/type_specific_fields/index.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/type_specific_fields/index.ts index 3412a151b14a7..e4647ce896fdb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/type_specific_fields/index.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/type_specific_fields/index.ts @@ -7,7 +7,7 @@ import { FtrProviderContext } from '../../../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets } from '../../../../../../utils'; -import { deleteAllRules } from '../../../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../../../config/services/detections_response'; import { inlineQueryKqlQueryField } from './kql_query.inline_query'; // import { savedQueryKqlQueryField } from './kql_query.saved_query'; import { eqlQueryField } from './eql_query'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/review_prebuilt_rules_upgrade.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/review_prebuilt_rules_upgrade.ts index 50e00c8e9853e..e4374f38ee80a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/review_prebuilt_rules_upgrade.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/review_prebuilt_rules_upgrade.ts @@ -6,7 +6,7 @@ */ import expect from 'expect'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../../ftr_provider_context'; import { deleteAllPrebuiltRuleAssets, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/upgrade_single_prebuilt_rule.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/upgrade_single_prebuilt_rule.ts index b2204d8aa9ab8..a7cc9a67447e1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/upgrade_single_prebuilt_rule.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/upgrade_single_prebuilt_rule.ts @@ -8,7 +8,7 @@ import expect from 'expect'; import type SuperTest from 'supertest'; import { ModeEnum } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { DEFAULT_TEST_RULE_ID, setUpRuleUpgrade, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_installation/perform_installation.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_installation/perform_installation.ts index e4f73238b2425..f9254b3b0d8fe 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_installation/perform_installation.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_installation/perform_installation.ts @@ -13,7 +13,7 @@ import { deleteAllPrebuiltRuleAssets, installPrebuiltRules, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const es = getService('es'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_upgrade/perform_upgrade.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_upgrade/perform_upgrade.ts index 43b3e04ffc187..4c91aaf640d02 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_upgrade/perform_upgrade.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/perform_upgrade/perform_upgrade.ts @@ -14,7 +14,7 @@ import { deleteAllPrebuiltRuleAssets, performUpgradePrebuiltRules, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { setUpRuleUpgrade } from '../../../../utils/rules/prebuilt_rules/set_up_rule_upgrade'; import { createMlRuleThroughAlertingEndpoint } from '../utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_installation/review_installation.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_installation/review_installation.ts index dca2daf70208c..5e2bea7f56110 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_installation/review_installation.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_installation/review_installation.ts @@ -13,7 +13,7 @@ import { deleteAllPrebuiltRuleAssets, reviewPrebuiltRulesToInstall, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const es = getService('es'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_upgrade/review_upgrade.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_upgrade/review_upgrade.ts index dd9c7fa1290fe..ca06fdbd27e79 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_upgrade/review_upgrade.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/review_upgrade/review_upgrade.ts @@ -13,7 +13,7 @@ import { deleteAllPrebuiltRuleAssets, reviewPrebuiltRulesToUpgrade, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { createMlRuleThroughAlertingEndpoint } from '../utils'; import { setUpRuleUpgrade } from '../../../../utils/rules/prebuilt_rules/set_up_rule_upgrade'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/status/status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/status/status.ts index afe410c4dcfe0..98825c027914b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/status/status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/ml_disabled/status/status.ts @@ -13,7 +13,7 @@ import { deleteAllPrebuiltRuleAssets, getPrebuiltRulesStatus, } from '../../../../utils'; -import { deleteAllRules } from '../../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../../config/services/detections_response'; import { createMlRuleThroughAlertingEndpoint } from '../utils'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action.ts index 813b2b12b870e..7c5fb80ab0a6e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action.ts @@ -34,13 +34,13 @@ import { removeServerGeneratedProperties, updateUsername, } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { deleteAllGaps } from '../../../utils/event_log/delete_all_gaps'; import { GapEvent, generateGapsForRule } from '../../../utils/event_log/generate_gaps_for_rule'; -import { getGapsByRuleId } from '../../../../../../common/utils/security_solution/detections_response/rules/get_gaps_by_rule_id'; +import { getGapsByRuleId } from '../../../../../config/services/detections_response/rules/get_gaps_by_rule_id'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run.ts index 6feba532be510..0c45f42fffe55 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run.ts @@ -21,7 +21,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run_ess.ts index 50cd8cf6afc91..8c8d4d31f8ddb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run_ess.ts @@ -17,7 +17,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_ess.ts index 4fe626a8f412a..6ba0ca6f83255 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_ess.ts @@ -16,7 +16,7 @@ import { createRule, deleteAllRules, waitForRuleSuccess, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { binaryToString, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_suppression.ts index 5a3aa7ee82166..cfdbe243e02af 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_suppression.ts @@ -12,7 +12,7 @@ import { } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management'; import { AlertSuppressionMissingFieldsStrategyEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema/common_attributes.gen'; import { getThresholdRuleForAlertTesting, getCustomQueryRuleParams } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_enable_disable.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_enable_disable.ts index 1baa69cd8dfb7..ed188205a45db 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_enable_disable.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_enable_disable.ts @@ -8,7 +8,7 @@ import expect from 'expect'; import { BulkActionTypeEnum } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management'; import { getCustomQueryRuleParams, fetchRule } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_ml_rules_privileges.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_ml_rules_privileges.ts index 3c10ba17dbdc9..bed75b098a75e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_ml_rules_privileges.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_ml_rules_privileges.ts @@ -14,7 +14,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_rules.ts index 9f1f662e40cb6..ae96742c61378 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/create_rules.ts @@ -22,7 +22,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_new_terms.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_new_terms.ts index ef5d32d776ec3..39f39963b5939 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_new_terms.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_new_terms.ts @@ -10,7 +10,7 @@ import expect from '@kbn/expect'; import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; import { getCreateNewTermsRulesSchemaMock } from '@kbn/security-solution-plugin/common/api/detection_engine/model/rule_schema/mocks'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_rules.ts index c09be3fe35016..ca36f28bb0abd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/create_rules.ts @@ -36,11 +36,8 @@ import { waitForAlertsToBePresent, waitForRulePartialFailure, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../common/services/security_solution'; +} from '../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../config/services/common'; export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/preview_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/preview_rules.ts index 6b238146e0dc1..811832c913c46 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/preview_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/preview_rules.ts @@ -10,12 +10,9 @@ import expect from '@kbn/expect'; import { DETECTION_ENGINE_RULES_PREVIEW } from '@kbn/security-solution-plugin/common/constants'; import { ROLES } from '@kbn/security-solution-plugin/common/test'; import { getSimplePreviewRule, getSimpleRulePreviewOutput } from '../../../utils'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../common/services/security_solution'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { EsArchivePathBuilder } from '../../../../../es_archive_path_builder'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules.ts index cdce8189f2703..86f20297c4ca1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules.ts @@ -22,7 +22,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules_bulk.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules_bulk.ts index baf69afc8c97c..71a26609e7991 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules_bulk.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/basic_license_essentials_tier/delete_rules_bulk.ts @@ -19,7 +19,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules.ts index f286f4c08dd00..0eeb5f6202e5b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules.ts @@ -20,7 +20,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk.ts index 8bca5b9f906c8..1f383d77f23ca 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk.ts @@ -23,7 +23,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk_legacy.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk_legacy.ts index 8ad943fef07a2..c55534c3f4275 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk_legacy.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_bulk_legacy.ts @@ -20,7 +20,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_ess.ts index c2a08ac3b00c7..9c188cc6ad0b7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_ess.ts @@ -20,7 +20,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_legacy.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_legacy.ts index e9f0921f76c13..d28d6dfdd8ac8 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_legacy.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_delete/trial_license_complete_tier/delete_rules_legacy.ts @@ -20,7 +20,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/export_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/export_rules.ts index 5b8cc2cb3f384..de7a7e826ed83 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/export_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/export_rules.ts @@ -10,7 +10,7 @@ import expect from 'expect'; import { BaseDefaultableFields } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { binaryToString, getCustomQueryRuleParams, parseNdJson } from '../../../utils'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules.ts index 2666f9d681598..8feb6fc482e48 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules.ts @@ -10,7 +10,7 @@ import expect from 'expect'; import { BaseDefaultableFields } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { getCustomQueryRuleParams, combineToNdJson } from '../../../utils'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules_with_overwrite.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules_with_overwrite.ts index a43c25b35c426..53bbe318504a2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules_with_overwrite.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/basic_license_essentials_tier/import_rules_with_overwrite.ts @@ -8,7 +8,7 @@ import expect from 'expect'; import { DETECTION_ENGINE_RULES_IMPORT_URL } from '@kbn/security-solution-plugin/common/constants'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { combineToNdJson, getCustomQueryRuleParams, fetchRule } from '../../../utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules.ts index 8ecb591272492..024cae54b271e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules.ts @@ -17,7 +17,7 @@ import { deleteAllRules, deleteAllAlerts, waitForRulePartialFailure, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { getWebHookConnectorParams } from '../../../utils/connectors/get_web_hook_connector_params'; import { createConnector } from '../../../utils/connectors'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules_ess.ts index b977137096891..27038c47b4b9c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/export_rules_ess.ts @@ -27,7 +27,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { getWebHookConnectorParams } from '../../../utils/connectors/get_web_hook_connector_params'; import { createConnector } from '../../../utils/connectors'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_connectors.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_connectors.ts index 6f7fefbe31761..b79b9b344ef0b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_connectors.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_connectors.ts @@ -7,7 +7,7 @@ import expect from 'expect'; import { DETECTION_ENGINE_RULES_IMPORT_URL } from '@kbn/security-solution-plugin/common/constants'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; import { combineToNdJson, getCustomQueryRuleParams } from '../../../utils'; import { createConnector, deleteConnector, getConnector } from '../../../utils/connectors'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_export_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_export_rules.ts index b783db0d775b6..19692c73ea30f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_export_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_export_rules.ts @@ -27,11 +27,8 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../common/services/security_solution'; +} from '../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../config/services/common'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules.ts index 29eecc6562e90..fca62b97a55fb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules.ts @@ -27,8 +27,8 @@ import { importRules, importRulesWithSuccess, } from '../../../utils'; -import { createRule } from '../../../../../../common/utils/security_solution'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule } from '../../../../../config/services/detections_response'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { getWebHookConnectorParams } from '../../../utils/connectors/get_web_hook_connector_params'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_ess.ts index f6cc45a077f97..c07fe549add03 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_ess.ts @@ -17,11 +17,8 @@ import { combineToNdJson, getCustomQueryRuleParams, } from '../../../utils'; -import { deleteAllRules, createRule } from '../../../../../../common/utils/security_solution'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../../common/services/security_solution'; +import { deleteAllRules, createRule } from '../../../../../config/services/detections_response'; +import { createUserAndRole, deleteUserAndRole } from '../../../../../config/services/common'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { createConnector } from '../../../utils/connectors'; import { getWebHookConnectorParams } from '../../../utils/connectors/get_web_hook_connector_params'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_with_overwrite.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_with_overwrite.ts index a43c25b35c426..53bbe318504a2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_with_overwrite.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/trial_license_complete_tier/import_rules_with_overwrite.ts @@ -8,7 +8,7 @@ import expect from 'expect'; import { DETECTION_ENGINE_RULES_IMPORT_URL } from '@kbn/security-solution-plugin/common/constants'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { combineToNdJson, getCustomQueryRuleParams, fetchRule } from '../../../utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/basic_license_essentials_tier/coverage_overview.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/basic_license_essentials_tier/coverage_overview.ts index 6019f51165965..7ef7408d82f36 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/basic_license_essentials_tier/coverage_overview.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/basic_license_essentials_tier/coverage_overview.ts @@ -23,7 +23,7 @@ import { createNonSecurityRule, deleteAllPrebuiltRuleAssets, } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { getCoverageOverview } from '../../../utils/rules/get_coverage_overview'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_execution_results.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_execution_results.ts index fbc27828a19e3..f1798f576474b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_execution_results.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_execution_results.ts @@ -30,7 +30,7 @@ import { waitForRulePartialFailure, waitForRuleSuccess, manualRuleRun, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { failedGapExecution, failedRanAfterDisabled, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_management_filters.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_management_filters.ts index a69c848da282c..23f9231e66f43 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_management_filters.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_management/trial_license_complete_tier/get_rule_management_filters.ts @@ -15,7 +15,7 @@ import { installMockPrebuiltRules, deleteAllPrebuiltRuleAssets, } from '../../../utils'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/basic_license_essentials_tier/patch_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/basic_license_essentials_tier/patch_rules.ts index f4536821dcaaa..a235fa4b6c35d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/basic_license_essentials_tier/patch_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/basic_license_essentials_tier/patch_rules.ts @@ -7,7 +7,7 @@ import expect from 'expect'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { createHistoricalPrebuiltRuleAssetSavedObjects, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules.ts index a6a64857f6721..8e0a1f0eabcb1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules.ts @@ -36,7 +36,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules_ess.ts index d28358519e307..29fc604bb931e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules_ess.ts @@ -28,7 +28,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/find_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/find_rules.ts index 59dd94614850f..5003ef7c775fb 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/find_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/find_rules.ts @@ -16,7 +16,7 @@ import { removeServerGeneratedProperties, updateUsername, } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/read_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/read_rules.ts index 98fd58e4315d6..a328643125ac1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/read_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/basic_license_essentials_tier/read_rules.ts @@ -22,7 +22,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules.ts index aca24dd61289f..07755d1006c20 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules.ts @@ -16,7 +16,7 @@ import { updateUsername, removeServerGeneratedProperties, } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules_ess.ts index 2800066f266d6..914c279270b00 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/find_rules_ess.ts @@ -25,7 +25,7 @@ import { getRuleSavedObjectWithLegacyInvestigationFieldsEmptyArray, checkInvestigationFieldSoValue, } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules.ts index e1295331ef98b..5e65463b096f6 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules.ts @@ -21,7 +21,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules_ess.ts index f6b3d282e0f5a..0b15580ce7537 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/read_rules_ess.ts @@ -28,7 +28,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/resolve_read_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/resolve_read_rules.ts index d2deacaae27af..c416a5407e4b9 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/resolve_read_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_read/trial_license_complete_tier/resolve_read_rules.ts @@ -13,7 +13,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; const spaceId = '714-space'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/basic_license_essentials_tier/update_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/basic_license_essentials_tier/update_rules.ts index 4aa264238ffad..c884cd297f5b1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/basic_license_essentials_tier/update_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/basic_license_essentials_tier/update_rules.ts @@ -27,7 +27,7 @@ import { deleteAllRules, createRule, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules.ts index af9929f87832d..36256c6c7b5b3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules.ts @@ -38,7 +38,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules_ess.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules_ess.ts index 4272345759f0e..04ea8af6ef61a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules_ess.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules_ess.ts @@ -28,7 +28,7 @@ import { deleteAllRules, deleteAllAlerts, createRule, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/all_types.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/all_types.ts index b5b373a05cd17..fdcbeb21ff4d4 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/all_types.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/all_types.ts @@ -12,7 +12,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/detection_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/detection_rules.ts index 14f87469402c1..dea8f5d4156d6 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/detection_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/detection_rules.ts @@ -24,7 +24,7 @@ import { deleteAllRules, deleteAllAlerts, getRuleForAlertTesting, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/security_lists.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/security_lists.ts index 513ab6446ea73..d7db8714f40c6 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/security_lists.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/task_based/security_lists.ts @@ -21,7 +21,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/all_types.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/all_types.ts index e12667e760e04..487611fe3898d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/all_types.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/all_types.ts @@ -13,7 +13,7 @@ import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_status.ts index f59882c45ef3e..8e78498f8ccb5 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_status.ts @@ -35,7 +35,7 @@ import { getRuleForAlertTesting, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_upgrade_status.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_upgrade_status.ts index c7a433f407838..cf5f20e8c86d9 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_upgrade_status.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rule_upgrade_status.ts @@ -16,7 +16,7 @@ import { createPrebuiltRuleAssetSavedObjects, installPrebuiltRules, } from '../../../utils'; -import { deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../../config/services/detections_response'; /** * Test suite for detection rule upgrade status telemetry. diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules.ts index d58114fbf77c8..2d7d57964c5c5 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules.ts @@ -43,7 +43,7 @@ import { waitForRuleSuccess, waitForAlertsToBePresent, getRuleForAlertTesting, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules_legacy_action.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules_legacy_action.ts index 29f8c34abbe3e..0a2c5ced21a7f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules_legacy_action.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/detection_rules_legacy_action.ts @@ -37,7 +37,7 @@ import { getRuleForAlertTesting, waitForRuleSuccess, waitForAlertsToBePresent, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; import { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/exceptions_metrics.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/exceptions_metrics.ts index e3d4f7b822177..370e1b61b67f3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/exceptions_metrics.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/usage_collector/exceptions_metrics.ts @@ -14,7 +14,7 @@ import { getCreateExceptionListItemMinimalSchemaMock } from '@kbn/lists-plugin/c import { ExceptionMetricsSchema } from '@kbn/security-solution-plugin/server/usage/exceptions/types'; import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; import { deleteAllEventLogExecutionEvents } from '../../../utils'; -import { createRule, deleteAllRules } from '../../../../../../common/utils/security_solution'; +import { createRule, deleteAllRules } from '../../../../../config/services/detections_response'; import { deleteAllExceptions } from '../../../../lists_and_exception_lists/utils'; import { getCustomQueryRuleParams } from '../../../utils'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/user_roles/trial_license_complete_tier/read_privileges.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/user_roles/trial_license_complete_tier/read_privileges.ts index 51a7a9ab1330f..23ba7e759f71e 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/user_roles/trial_license_complete_tier/read_privileges.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/user_roles/trial_license_complete_tier/read_privileges.ts @@ -9,10 +9,7 @@ import expect from '@kbn/expect'; import { DETECTION_ENGINE_PRIVILEGES_URL } from '@kbn/security-solution-plugin/common/constants'; import { ROLES } from '@kbn/security-solution-plugin/common/test'; -import { - createUserAndRole, - deleteUserAndRole, -} from '../../../../../common/services/security_solution'; +import { createUserAndRole, deleteUserAndRole } from '../../../../config/services/common'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/get_alerts.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/get_alerts.ts index 70caaa4edfd2c..d31f3d813617f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/get_alerts.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/get_alerts.ts @@ -15,7 +15,7 @@ import { import type { RuleResponse } from '@kbn/security-solution-plugin/common/api/detection_engine'; import { refreshIndex } from '..'; -import { getAlertsByIds, waitForRuleStatus } from '../../../../../common/utils/security_solution'; +import { getAlertsByIds, waitForRuleStatus } from '../../../../config/services/detections_response'; export type GetAlerts = ( supertest: SuperTest.Agent, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts index c4a9b7d2a8548..3dc54742cf589 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts @@ -8,7 +8,7 @@ import type { ToolingLog } from '@kbn/tooling-log'; import type SuperTest from 'supertest'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; export const waitForAlertToComplete = async ( supertest: SuperTest.Agent, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts index 3f21fe91161d2..c9cb0e0cd0b5a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts @@ -8,7 +8,7 @@ import type { ToolingLog } from '@kbn/tooling-log'; import type SuperTest from 'supertest'; import { getCases } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/case'; -import { waitFor } from '../../../../common/utils/security_solution/detections_response'; +import { waitFor } from '../../../config/services/detections_response'; export const waitForCases = async (supertest: SuperTest.Agent, log: ToolingLog): Promise => { await waitFor( diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/connectors/create_connector.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/connectors/create_connector.ts index 850697d8fef47..3445a46b74f98 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/connectors/create_connector.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/connectors/create_connector.ts @@ -6,7 +6,7 @@ */ import type SuperTest from 'supertest'; -import { withSpaceUrl } from '../../../../../common/utils/security_solution/spaces'; +import { withSpaceUrl } from '../../../../config/services/detections_response'; export interface CreateConnectorBody { readonly name: string; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/count_down_es.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/count_down_es.ts index a5dfc937e4c35..9a021ab26dfbc 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/count_down_es.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/count_down_es.ts @@ -7,7 +7,7 @@ import type { TransportResult } from '@elastic/elasticsearch'; import type { ToolingLog } from '@kbn/tooling-log'; -import { countDownTest } from '../../../../common/utils/security_solution'; +import { countDownTest } from '../../../config/services/detections_response'; /** * Does a plain countdown and checks against es queries for either conflicts in the error diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/event_log/wait_for_event_log_execute_complete.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/event_log/wait_for_event_log_execute_complete.ts index ca8941f1bdabd..f2abc803b0b97 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/event_log/wait_for_event_log_execute_complete.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/event_log/wait_for_event_log_execute_complete.ts @@ -8,7 +8,7 @@ import type { ToolingLog } from '@kbn/tooling-log'; import type { Client } from '@elastic/elasticsearch'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; import { getEventLogExecuteCompleteById } from './get_event_log_execute_complete_by_id'; /** diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_endpoint_entries.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_endpoint_entries.ts index 442d341815c2f..de129c98c5d21 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_endpoint_entries.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_endpoint_entries.ts @@ -16,7 +16,7 @@ import type { import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants'; import { createExceptionListItem } from '../item/create_exception_list_item'; -import { waitFor } from '../../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../../config/services/detections_response'; import { createExceptionList } from './create_exception_list'; /** diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_entries.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_entries.ts index 36aa1fb0e0652..f7b5b47fa5fec 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_entries.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/exception_list_and_item/list/create_container_with_entries.ts @@ -13,7 +13,7 @@ import type { ListArray, NonEmptyEntriesArray } from '@kbn/securitysolution-io-t import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants'; import { createExceptionList } from './create_exception_list'; import { createExceptionListItem } from '../item/create_exception_list_item'; -import { waitFor } from '../../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../../config/services/detections_response'; /** * Convenience testing function where you can pass in just the endpoint entries and you will diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/create_rule_with_exception_entries.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/create_rule_with_exception_entries.ts index a04ac5950596e..62d86475802bd 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/create_rule_with_exception_entries.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/create_rule_with_exception_entries.ts @@ -18,7 +18,7 @@ import { createContainerWithEntries, createContainerWithEndpointEntries, } from '../exception_list_and_item'; -import { createRule } from '../../../../../common/utils/security_solution'; +import { createRule } from '../../../../config/services/detections_response'; /** * Convenience testing function where you can pass in just the entries and you will diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_eql_rule_for_alert_testing.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_eql_rule_for_alert_testing.ts index a371250dfc36b..5a800043055a2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_eql_rule_for_alert_testing.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_eql_rule_for_alert_testing.ts @@ -6,7 +6,7 @@ */ import type { EqlRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { getRuleForAlertTesting } from '../../../../../common/utils/security_solution'; +import { getRuleForAlertTesting } from '../../../../config/services/detections_response'; /** * This is a typical alert testing rule that is easy for most basic testing of output of EQL alerts. diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_saved_query_rule_for_alert_testing.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_saved_query_rule_for_alert_testing.ts index b83f728d980e1..39b76956a4172 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_saved_query_rule_for_alert_testing.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_saved_query_rule_for_alert_testing.ts @@ -6,7 +6,7 @@ */ import type { SavedQueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { getRuleForAlertTesting } from '../../../../../common/utils/security_solution'; +import { getRuleForAlertTesting } from '../../../../config/services/detections_response'; /** * This is a typical alert testing rule that is easy for most basic testing of output of Saved Query alerts. diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threat_match_rule_for_alert_testing.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threat_match_rule_for_alert_testing.ts index 638b951e539d2..c94d1861f7d28 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threat_match_rule_for_alert_testing.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threat_match_rule_for_alert_testing.ts @@ -6,7 +6,7 @@ */ import type { ThreatMatchRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { getRuleForAlertTesting } from '../../../../../common/utils/security_solution'; +import { getRuleForAlertTesting } from '../../../../config/services/detections_response'; /** * This is a typical alert testing rule that is easy for most basic testing of output of Threat Match alerts. diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threshold_rule_for_alert_testing.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threshold_rule_for_alert_testing.ts index b834f48d8b006..a1267c6cab8ed 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threshold_rule_for_alert_testing.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/get_threshold_rule_for_alert_testing.ts @@ -6,7 +6,7 @@ */ import type { ThresholdRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { getRuleForAlertTesting } from '../../../../../common/utils/security_solution'; +import { getRuleForAlertTesting } from '../../../../config/services/detections_response'; /** * This is a typical signal testing rule that is easy for most basic testing of output of Threshold alerts. diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/rule_gaps.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/rule_gaps.ts index be9c40a98de91..bd4631ea7c1af 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/rule_gaps.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/rules/rule_gaps.ts @@ -16,7 +16,7 @@ import { } from '@kbn/alerting-plugin/common'; import { ScheduleBackfillResponseBody } from '@kbn/alerting-plugin/common/routes/backfill/apis/schedule'; import { FindBackfillResponse } from '@kbn/alerting-plugin/common/routes/backfill/apis/find'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; export interface TimeRange { startDate: moment.Moment; endDate: moment.Moment; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/wait_for_index_to_populate.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/wait_for_index_to_populate.ts index 41d78f9986a26..332e9aeb6cb1c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/wait_for_index_to_populate.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/wait_for_index_to_populate.ts @@ -7,7 +7,7 @@ import type { ToolingLog } from '@kbn/tooling-log'; import type { Client } from '@elastic/elasticsearch'; -import { waitFor } from '../../../../common/utils/security_solution'; +import { waitFor } from '../../../config/services/detections_response'; /** * Waits for the given index to contain documents diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/monitoring/trial_license_complete_tier/privileged_users/utils.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/monitoring/trial_license_complete_tier/privileged_users/utils.ts index 83d6e9eed8a60..1c436eb81b411 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/monitoring/trial_license_complete_tier/privileged_users/utils.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/monitoring/trial_license_complete_tier/privileged_users/utils.ts @@ -10,7 +10,7 @@ import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common/src/constants'; import { API_VERSIONS } from '@kbn/security-solution-plugin/common/constants'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; import { FtrProviderContext } from '../../../../../ftr_provider_context'; export const PrivMonUtils = ( diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_engine_schedule_now.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_engine_schedule_now.ts index abbc62c59ebf9..8c29092027264 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_engine_schedule_now.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_engine_schedule_now.ts @@ -6,7 +6,7 @@ */ import { v4 as uuidv4 } from 'uuid'; -import { deleteAllAlerts, deleteAllRules } from '../../../../../common/utils/security_solution'; +import { deleteAllAlerts, deleteAllRules } from '../../../../config/services/detections_response'; import { buildDocument, createAndSyncRuleAndAlertsFactory, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_entity_calculation.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_entity_calculation.ts index 8a2fadb6f6b30..fd80c0860e8db 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_entity_calculation.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_entity_calculation.ts @@ -12,7 +12,7 @@ import { RISK_SCORE_ENTITY_CALCULATION_URL } from '@kbn/security-solution-plugin import { v4 as uuidv4 } from 'uuid'; import { EntityRiskScoreRecord } from '@kbn/security-solution-plugin/common/api/entity_analytics/common'; import { dataGeneratorFactory } from '../../../detections_response/utils'; -import { deleteAllAlerts, deleteAllRules } from '../../../../../common/utils/security_solution'; +import { deleteAllAlerts, deleteAllRules } from '../../../../config/services/detections_response'; import { buildDocument, createAndSyncRuleAndAlertsFactory, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts index 7671d28907185..389f7095a1c52 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_score_preview.ts @@ -16,7 +16,7 @@ import { createAlertsIndex, deleteAllAlerts, deleteAllRules, -} from '../../../../../common/utils/security_solution'; +} from '../../../../config/services/detections_response'; import { assetCriticalityRouteHelpersFactory, buildDocument, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts index 183768306b7f3..11d85bedb10b7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution.ts @@ -8,7 +8,10 @@ import expect from '@kbn/expect'; import { v4 as uuidv4 } from 'uuid'; import { dataGeneratorFactory } from '../../../../detections_response/utils'; -import { deleteAllRules, deleteAllAlerts } from '../../../../../../common/utils/security_solution'; +import { + deleteAllRules, + deleteAllAlerts, +} from '../../../../../config/services/detections_response'; import { buildDocument, createAndSyncRuleAndAlertsFactory, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution_nondefault_spaces.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution_nondefault_spaces.ts index 91f67f1d93a87..27975a9b88d7f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution_nondefault_spaces.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/risk_scoring_task/task_execution_nondefault_spaces.ts @@ -8,7 +8,10 @@ import expect from '@kbn/expect'; import { v4 as uuidv4 } from 'uuid'; import { dataGeneratorFactory } from '../../../../detections_response/utils'; -import { deleteAllRules, deleteAllAlerts } from '../../../../../../common/utils/security_solution'; +import { + deleteAllRules, + deleteAllAlerts, +} from '../../../../../config/services/detections_response'; import { buildDocument, createAndSyncRuleAndAlertsFactory, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/telemetry_usage.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/telemetry_usage.ts index bfab40164e2b4..f427f622dd67d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/telemetry_usage.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/telemetry_usage.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { v4 as uuidv4 } from 'uuid'; import { dataGeneratorFactory } from '../../../detections_response/utils'; -import { deleteAllRules, deleteAllAlerts } from '../../../../../common/utils/security_solution'; +import { deleteAllRules, deleteAllAlerts } from '../../../../config/services/detections_response'; import { buildDocument, createAndSyncRuleAndAlertsFactory, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts index a54afcafeb11d..641ebf19a8b03 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/asset_criticality.ts @@ -30,7 +30,7 @@ import type { ToolingLog } from '@kbn/tooling-log'; import querystring from 'querystring'; import { SupertestWithoutAuthProviderType } from '@kbn/ftr-common-functional-services'; import { IndicesIndexSettings, MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types'; -import { routeWithNamespace, waitFor } from '../../../../common/utils/security_solution'; +import { routeWithNamespace, waitFor } from '../../../config/services/detections_response'; export const getAssetCriticalityIndex = (namespace?: string) => `.asset-criticality.asset-criticality-${namespace ?? 'default'}`; diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/entity_analytics.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/entity_analytics.ts index 50c833994b723..ed88086091827 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/entity_analytics.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/entity_analytics.ts @@ -14,7 +14,7 @@ import { ENTITY_ANALYTICS_INTERNAL_RUN_MIGRATIONS_ROUTE, API_VERSIONS, } from '@kbn/security-solution-plugin/common/constants'; -import { routeWithNamespace } from '../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../config/services/detections_response'; export const entityAnalyticsRouteHelpersFactory = ( supertest: SuperTest.Agent, diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/risk_engine.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/risk_engine.ts index a11f9247e3799..f965ca07ffb45 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/risk_engine.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/risk_engine.ts @@ -40,7 +40,7 @@ import { countDownTest, waitFor, routeWithNamespace, -} from '../../../../common/utils/security_solution'; +} from '../../../config/services/detections_response'; const sanitizeScore = (score: Partial): Partial => { const { diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/apis.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/apis.ts index 1e8e690d0be93..f8ec0f7b6ac57 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/apis.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/apis.ts @@ -24,7 +24,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; const configureTest = (test: SuperTest.Test, user: User | undefined) => { const configuredTest = test diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/helpers.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/helpers.ts index 1e9e327bc295b..ccf7395413e90 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/helpers.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/attack_discovery/schedules/utils/helpers.ts @@ -16,7 +16,7 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { countDownTest, routeWithNamespace, -} from '../../../../../../common/utils/security_solution'; +} from '../../../../../config/services/detections_response'; import { getAttackDiscoverySchedulesApis } from './apis'; import { getSimpleAttackDiscoverySchedule } from '../mocks'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/evaluations.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/evaluations.ts index f613344f874c2..f186453dcb547 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/evaluations.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/evaluations.ts @@ -22,7 +22,7 @@ import { setupKnowledgeBase, } from '../../knowledge_base/entries/utils/helpers'; -import { routeWithNamespace } from '../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../config/services/detections_response'; import { loadEvalKnowledgeBaseEntries } from '../data/kb_entries'; import { waitForEvaluationComplete } from './utils'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/utils.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/utils.ts index 6fb62168346bf..dab2b4356a758 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/utils.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/utils.ts @@ -13,7 +13,7 @@ import { GetEvaluateResponse, } from '@kbn/elastic-assistant-common'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { routeWithNamespace, waitFor } from '../../../../../common/utils/security_solution'; +import { routeWithNamespace, waitFor } from '../../../../config/services/detections_response'; export const waitForEvaluationComplete = async ({ evaluationId, diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/bulk_actions_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/bulk_actions_entry.ts index f8c4da5ce3340..e1f6e6fb70f6a 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/bulk_actions_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/bulk_actions_entry.ts @@ -17,7 +17,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Performs bulk actions on Knowledge Base entries diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/create_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/create_entry.ts index 7489cd36083f8..c8ab93291d493 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/create_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/create_entry.ts @@ -16,7 +16,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Creates a Knowledge Base Entry diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/delete_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/delete_entry.ts index 80d98cb2ad493..e49fadb983303 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/delete_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/delete_entry.ts @@ -16,7 +16,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Delete Knowledge Base Entry diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/find_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/find_entry.ts index 5e88e2437597c..0f5a495e2d2a7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/find_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/find_entry.ts @@ -16,7 +16,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Finds Knowledge Base Entries diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/get_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/get_entry.ts index 33c21d95b538d..d944499e03958 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/get_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/get_entry.ts @@ -16,7 +16,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Get Knowledge Base Entry diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/helpers.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/helpers.ts index 9143dccc441d4..d0b5357155339 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/helpers.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/helpers.ts @@ -20,7 +20,7 @@ import type SuperTest from 'supertest'; import { SUPPORTED_TRAINED_MODELS } from '@kbn/test-suites-xpack-platform/functional/services/ml/api'; import { MachineLearningProvider } from '@kbn/test-suites-xpack-platform/api_integration/services/ml'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; export const TINY_ELSER = { ...SUPPORTED_TRAINED_MODELS.TINY_ELSER, diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/update_entry.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/update_entry.ts index c0486a820fecb..ac5e5208a5280 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/update_entry.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/utils/update_entry.ts @@ -16,7 +16,7 @@ import { } from '@kbn/elastic-assistant-common'; import type { User } from '../../../utils/auth/types'; -import { routeWithNamespace } from '../../../../../../common/utils/security_solution'; +import { routeWithNamespace } from '../../../../../config/services/detections_response'; /** * Updates a Knowledge Base Entry diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/basic_license_essentials_tier/task_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/basic_license_essentials_tier/task_execution.ts index 7f4acf99f897d..6f4cf332d848c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/basic_license_essentials_tier/task_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/basic_license_essentials_tier/task_execution.ts @@ -10,7 +10,7 @@ import { TaskStatus } from '@kbn/task-manager-plugin/server'; import type { MlGetTrainedModelsResponse } from '@elastic/elasticsearch/lib/api/types'; import { SUPPORTED_TRAINED_MODELS } from '@kbn/test-suites-xpack-platform/functional/services/ml/api'; import { FtrProviderContext } from '../../../../ftr_provider_context'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext): void => { const esSupertest = getService('esSupertest'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/trial_license_complete_tier/task_execution.ts b/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/trial_license_complete_tier/task_execution.ts index a2152b114cbd2..319579717f379 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/trial_license_complete_tier/task_execution.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/genai/nlp_cleanup_task/trial_license_complete_tier/task_execution.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../ftr_provider_context'; -import { waitFor } from '../../../../../common/utils/security_solution'; +import { waitFor } from '../../../../config/services/detections_response'; export default ({ getService }: FtrProviderContext) => { const kibanaServer = getService('kibanaServer'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/lists_and_exception_lists/utils.ts b/x-pack/test/security_solution_api_integration/test_suites/lists_and_exception_lists/utils.ts index e11b35280fcbe..4f8e3fc4f4c76 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/lists_and_exception_lists/utils.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/lists_and_exception_lists/utils.ts @@ -33,7 +33,7 @@ import { Client } from '@elastic/elasticsearch'; import { ToolingLog } from '@kbn/tooling-log'; import { getImportListItemAsBuffer } from '@kbn/lists-plugin/common/schemas/request/import_list_item_schema.mock'; import { encodeHitVersion } from '@kbn/securitysolution-es-utils'; -import { countDownTest, withSpaceUrl } from '../../../common/utils/security_solution'; +import { countDownTest, withSpaceUrl } from '../../config/services/detections_response'; /** * Creates the lists and lists items index for use inside of beforeEach blocks of tests diff --git a/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/get_prebuilt_rules.ts b/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/get_prebuilt_rules.ts index bbc5ae468068f..4de469fef6f84 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/get_prebuilt_rules.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/get_prebuilt_rules.ts @@ -9,7 +9,7 @@ import expect from 'expect'; import { v4 as uuidv4 } from 'uuid'; import { RuleTranslationResult } from '@kbn/security-solution-plugin/common/siem_migrations/constants'; import { RuleMigrationRuleData } from '@kbn/security-solution-plugin/common/siem_migrations/model/rule_migration.gen'; -import { deleteAllRules } from '../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../config/services/detections_response'; import { createMigrationRules, defaultElasticRule, diff --git a/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/install.ts b/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/install.ts index 2f6ee6ac9d064..12f81c1f6fb8f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/install.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/siem_migrations/rules/trial_license_complete_tier/install.ts @@ -13,7 +13,7 @@ import { } from '@kbn/security-solution-plugin/common/siem_migrations/model/rule_migration.gen'; import { RuleTranslationResult } from '@kbn/security-solution-plugin/common/siem_migrations/constants'; import { RuleResponse } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { deleteAllRules } from '../../../../../common/utils/security_solution'; +import { deleteAllRules } from '../../../../config/services/detections_response'; import { createMigrationRules, defaultElasticRule, diff --git a/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/indices_metadata.ts b/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/indices_metadata.ts index 07f6fdd77e931..38462283923a1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/indices_metadata.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/indices_metadata.ts @@ -19,7 +19,7 @@ import { randomIngestPipeline, taskHasRun, waitFor, -} from '../../../../common/utils/security_solution'; +} from '../../../config/services/detections_response'; const TASK_ID = 'security:indices-metadata-telemetry:1.0.0'; const NUM_INDICES = 5; diff --git a/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/ingest_pipeline_stats.ts b/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/ingest_pipeline_stats.ts index e369e78b2cd8d..aa6d1378c1519 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/ingest_pipeline_stats.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/telemetry/tasks/ingest_pipeline_stats.ts @@ -15,7 +15,7 @@ import { randomIngestPipeline, taskHasRun, waitFor, -} from '../../../../common/utils/security_solution'; +} from '../../../config/services/detections_response'; const TASK_ID = 'security:ingest-pipelines-stats-telemetry:1.0.0'; const INGEST_PIPELINES_STATS_EBT = 'telemetry_node_ingest_pipelines_stats_event'; diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_permissions.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_permissions.ts index 0a878dbd2fbd0..ca3ae9a252487 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_permissions.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_permissions.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { IndexedHostsAndAlertsResponse } from '@kbn/security-solution-plugin/common/endpoint/index_data'; import { SecurityRoleName } from '@kbn/security-solution-plugin/common/test'; import { FtrProviderContext } from '../../configs/ftr_provider_context'; -import { createUserAndRole, deleteUserAndRole } from '../../../common/services/security_solution'; +import { createUserAndRole, deleteUserAndRole } from '../../services/roles_users_utils'; import { targetTags } from '../../target_tags'; export default ({ getPageObjects, getService }: FtrProviderContext) => { diff --git a/x-pack/test/security_solution_endpoint/configs/config.base.ts b/x-pack/test/security_solution_endpoint/configs/config.base.ts index ac1bdb818d56e..543468d5b23bf 100644 --- a/x-pack/test/security_solution_endpoint/configs/config.base.ts +++ b/x-pack/test/security_solution_endpoint/configs/config.base.ts @@ -8,7 +8,7 @@ import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; import { Config } from '@kbn/test'; import { FtrConfigProviderContext } from '@kbn/test'; -import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution'; +import { SecuritySolutionEndpointRegistryHelpers } from '../services/endpoint_registry_helpers'; import type { TargetTags } from '../target_tags'; import { PageObjects } from '../page_objects'; import { Services } from '../services'; diff --git a/x-pack/test/security_solution_endpoint/services/endpoint_data_stream_helpers.ts b/x-pack/test/security_solution_endpoint/services/endpoint_data_stream_helpers.ts new file mode 100644 index 0000000000000..a5682ace379b0 --- /dev/null +++ b/x-pack/test/security_solution_endpoint/services/endpoint_data_stream_helpers.ts @@ -0,0 +1,145 @@ +/* + * 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 { Client } from '@elastic/elasticsearch'; +import { AGENTS_INDEX } from '@kbn/fleet-plugin/common'; +import { + alertsIndexPattern, + eventsIndexPattern, + METADATA_DATASTREAM, + METADATA_UNITED_INDEX, + metadataCurrentIndexPattern, + metadataIndexPattern, + policyIndexPattern, + telemetryIndexPattern, +} from '@kbn/security-solution-plugin/common/endpoint/constants'; + +export function SecuritySolutionEndpointDataStreamHelpers() { + function deleteDataStream(getService: (serviceName: 'es') => Client, index: string) { + const client = getService('es'); + return client.transport.request( + { + method: 'DELETE', + path: `_data_stream/${index}`, + }, + { + ignore: [404], + } + ); + } + + async function deleteAllDocsFromIndex(getService: (serviceName: 'es') => Client, index: string) { + const client = getService('es'); + await client.deleteByQuery( + { + query: { + match_all: {}, + }, + index, + wait_for_completion: true, + refresh: true, + }, + { + ignore: [404], + } + ); + } + + async function deleteIndex(getService: (serviceName: 'es') => Client, index: string) { + const client = getService('es'); + await client.indices.delete({ index, ignore_unavailable: true }); + } + + async function deleteMetadataStream(getService: (serviceName: 'es') => Client) { + await deleteDataStream(getService, metadataIndexPattern); + } + + async function deleteAllDocsFromMetadataDatastream(getService: (serviceName: 'es') => Client) { + await deleteAllDocsFromIndex(getService, METADATA_DATASTREAM); + } + + async function deleteAllDocsFromMetadataCurrentIndex(getService: (serviceName: 'es') => Client) { + await deleteAllDocsFromIndex(getService, metadataCurrentIndexPattern); + } + + async function deleteAllDocsFromMetadataUnitedIndex(getService: (serviceName: 'es') => Client) { + await deleteAllDocsFromIndex(getService, METADATA_UNITED_INDEX); + } + + async function deleteEventsStream(getService: (serviceName: 'es') => Client) { + await deleteDataStream(getService, eventsIndexPattern); + } + + async function deleteAlertsStream(getService: (serviceName: 'es') => Client) { + await deleteDataStream(getService, alertsIndexPattern); + } + + async function deletePolicyStream(getService: (serviceName: 'es') => Client) { + await deleteDataStream(getService, policyIndexPattern); + } + + async function deleteTelemetryStream(getService: (serviceName: 'es') => Client) { + await deleteDataStream(getService, telemetryIndexPattern); + } + + function deleteAllDocsFromFleetAgents(getService: (serviceName: 'es') => Client) { + return deleteAllDocsFromIndex(getService, AGENTS_INDEX); + } + + function stopTransform(getService: (serviceName: 'es') => Client, transformId: string) { + const client = getService('es'); + const stopRequest = { + transform_id: transformId, + force: true, + wait_for_completion: true, + allow_no_match: true, + }; + return client.transform.stopTransform(stopRequest); + } + + async function startTransform(getService: (serviceName: 'es') => Client, transformId: string) { + const client = getService('es'); + const transformsResponse = await client.transform.getTransform({ + transform_id: `${transformId}*`, + }); + return Promise.all( + transformsResponse.transforms.map((transform) => { + const t = transform as unknown as { id: string }; + return client.transform.startTransform({ transform_id: t.id }); + }) + ); + } + + function bulkIndex(getService: (serviceName: 'es') => Client, index: string, docs: unknown[]) { + const operations = docs.flatMap((doc) => [{ create: { _index: index } }, doc]); + const client = getService('es'); + + return client.bulk({ + index, + refresh: 'wait_for', + operations, + }); + } + + return { + deleteDataStream, + deleteAllDocsFromIndex, + deleteIndex, + deleteMetadataStream, + deleteAllDocsFromMetadataDatastream, + deleteAllDocsFromMetadataCurrentIndex, + deleteAllDocsFromMetadataUnitedIndex, + deleteEventsStream, + deleteAlertsStream, + deletePolicyStream, + deleteTelemetryStream, + deleteAllDocsFromFleetAgents, + stopTransform, + startTransform, + bulkIndex, + }; +} diff --git a/x-pack/test/security_solution_endpoint/services/endpoint_registry_helpers.ts b/x-pack/test/security_solution_endpoint/services/endpoint_registry_helpers.ts new file mode 100644 index 0000000000000..5032a9a109cef --- /dev/null +++ b/x-pack/test/security_solution_endpoint/services/endpoint_registry_helpers.ts @@ -0,0 +1,87 @@ +/* + * 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 path from 'path'; + +import { + fleetPackageRegistryDockerImage as ingestDockerImage, + defineDockerServersConfig, +} from '@kbn/test'; + +export function SecuritySolutionEndpointRegistryHelpers() { + /** + * This is used by CI to set the docker registry port + * you can also define this environment variable locally when running tests which + * will spin up a local docker package registry locally for you + * if this is defined it takes precedence over the `packageRegistryOverride` variable + */ + const dockerRegistryPort: string | undefined = process.env.FLEET_PACKAGE_REGISTRY_PORT; + + /** + * If you don't want to use the docker image version pinned below and instead want to run your own + * registry or use an external registry you can define this environment variable when running + * the tests to use that registry url instead. + * + * This is particularly useful when a developer needs to test a new package against the kibana + * integration or functional tests. Instead of having to publish a whole new docker image we + * can set this environment variable which will point to the location of where your package registry + * is serving the updated package. + * + * This variable will not and should not be used by CI. CI should always use the pinned docker image below. + */ + const packageRegistryOverride: string | undefined = process.env.PACKAGE_REGISTRY_URL_OVERRIDE; + + const defaultRegistryConfigPath = path.join(__dirname, './fixtures/package_registry_config.yml'); + + const getRegistryUrlFromTestEnv = () => { + let registryUrl: string | undefined; + if (dockerRegistryPort !== undefined) { + registryUrl = `--xpack.fleet.registryUrl=http://localhost:${dockerRegistryPort}`; + } else if (packageRegistryOverride !== undefined) { + registryUrl = `--xpack.fleet.registryUrl=${packageRegistryOverride}`; + } + return registryUrl; + }; + + const isRegistryEnabled = () => { + return getRegistryUrlFromTestEnv() !== undefined; + }; + + return { + createEndpointDockerConfig( + packageRegistryConfig: string = defaultRegistryConfigPath, + dockerImage: string = ingestDockerImage, + dockerArgs: string[] = [] + ) { + const args: string[] = [ + '-v', + `${packageRegistryConfig}:/package-registry/config.yml`, + ...dockerArgs, + ]; + return defineDockerServersConfig({ + registry: { + enabled: !!dockerRegistryPort, + image: dockerImage, + portInContainer: 8080, + port: dockerRegistryPort, + args, + waitForLogLine: 'package manifests loaded', + waitForLogLineTimeoutMs: 60 * 4 * 1000, // 4 minutes, + }, + }); + }, + + getRegistryUrlFromTestEnv, + + getRegistryUrlAsArray(): string[] { + const registryUrl: string | undefined = getRegistryUrlFromTestEnv(); + return registryUrl !== undefined ? [registryUrl] : []; + }, + + isRegistryEnabled, + }; +} diff --git a/x-pack/test/security_solution_endpoint/services/fixtures/package_registry_config.yml b/x-pack/test/security_solution_endpoint/services/fixtures/package_registry_config.yml new file mode 100644 index 0000000000000..a6c51976af986 --- /dev/null +++ b/x-pack/test/security_solution_endpoint/services/fixtures/package_registry_config.yml @@ -0,0 +1,2 @@ +package_paths: + - /packages/package-storage \ No newline at end of file diff --git a/x-pack/test/security_solution_endpoint/services/index.ts b/x-pack/test/security_solution_endpoint/services/index.ts index 20937271c2762..b4515e3d61e4c 100644 --- a/x-pack/test/security_solution_endpoint/services/index.ts +++ b/x-pack/test/security_solution_endpoint/services/index.ts @@ -19,8 +19,8 @@ import { KibanaSupertestWithCertProvider, KibanaSupertestWithCertWithoutAuthProvider, } from './supertest_with_cert'; -import { SecuritySolutionEndpointDataStreamHelpers } from '../../common/services/security_solution/endpoint_data_stream_helpers'; -import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution/endpoint_registry_helpers'; +import { SecuritySolutionEndpointDataStreamHelpers } from './endpoint_data_stream_helpers'; +import { SecuritySolutionEndpointRegistryHelpers } from './endpoint_registry_helpers'; export const services = { ...xPackFunctionalServices, diff --git a/x-pack/test/security_solution_endpoint/services/roles_users_utils.ts b/x-pack/test/security_solution_endpoint/services/roles_users_utils.ts new file mode 100644 index 0000000000000..7de7f0e0b3426 --- /dev/null +++ b/x-pack/test/security_solution_endpoint/services/roles_users_utils.ts @@ -0,0 +1,54 @@ +/* + * 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 { + KNOWN_ESS_ROLE_DEFINITIONS, + KNOWN_SERVERLESS_ROLE_DEFINITIONS, +} from '@kbn/security-solution-plugin/common/test'; +import type { SecurityRoleName } from '@kbn/security-solution-plugin/common/test'; +import { FtrProviderContext } from '../../functional/ftr_provider_context'; + +const KNOWN_ROLE_DEFINITIONS = { + ...KNOWN_SERVERLESS_ROLE_DEFINITIONS, + ...KNOWN_ESS_ROLE_DEFINITIONS, +}; + +/** + * creates a security solution centric role and a user (both having the same name) + * @param getService + * @param role + */ +export const createUserAndRole = async ( + getService: FtrProviderContext['getService'], + role: SecurityRoleName +): Promise => { + const securityService = getService('security'); + const roleDefinition = KNOWN_ROLE_DEFINITIONS[role]; + + await securityService.role.create(role, roleDefinition); + await securityService.user.create(role, { + password: 'changeme', + roles: [role], + full_name: role, + email: 'detections-reader@example.com', + }); +}; + +/** + * Given a roleName and security service this will delete the roleName + * and user + * @param roleName The user and role to delete with the same name + * @param securityService The security service + */ +export const deleteUserAndRole = async ( + getService: FtrProviderContext['getService'], + roleName: SecurityRoleName +): Promise => { + const securityService = getService('security'); + await securityService.user.delete(roleName); + await securityService.role.delete(roleName); +}; diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index f5caf84a4fc2d..64bbdb06a635a 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -25,17 +25,13 @@ ], "kbn_references": [ "@kbn/test-suites-src", - "@kbn/alerting-plugin", - "@kbn/fleet-plugin", "@kbn/security-solution-plugin", "@kbn/spaces-plugin", - "@kbn/task-manager-plugin", "@kbn/test", "@kbn/tooling-log", "@kbn/dev-utils", "@kbn/ftr-common-functional-services", "@kbn/expect", - "@kbn/apm-synthtrace", "@kbn/rule-data-utils", "@kbn/test-subj-selector", "@kbn/rison", @@ -43,7 +39,6 @@ "@kbn/core-http-common", "@kbn/dataset-quality-plugin", "@kbn/ftr-common-functional-ui-services", - "@kbn/search-types", "@kbn/data-quality-plugin", "@kbn/openapi-common", "@kbn/securitysolution-lists-common", @@ -53,5 +48,6 @@ "@kbn/scout-info", "@kbn/test-suites-xpack-platform", "@kbn/ml-string-hash", + "@kbn/apm-synthtrace" ] }