From f7ec6f174725b85edf5ab3c878f3dd0773f8c889 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 8 Sep 2021 09:30:53 -0500 Subject: [PATCH 1/6] skip flaky test. #111496 --- .../security_and_spaces/tests/alerting/get.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts index 0400557209348c8..5925f2bcc812f28 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts @@ -21,7 +21,8 @@ export default function createGetTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); - describe('get', () => { + // FLAKY https://github.com/elastic/kibana/issues/111496 + describe.skip('get', () => { const objectRemover = new ObjectRemover(supertest); afterEach(() => objectRemover.removeAll()); From a8afa42d8a8a2c40e7ddedb66c7499a16decc5ff Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:11:58 -0400 Subject: [PATCH 2/6] [Enterprise Search] Update internal routes to use `/internal` prefix over `/api` (#111035) (#111522) * Convert App Search server routes to new prefix * Update frontend route prefixes for App Search * Convert Workplace Search server routes to new prefix * Update frontend route prefixes for Workplace Search * Convert Enterprise Search server routes to new prefix * Update frontend route prefixes for Enterprise Search Co-authored-by: Scotty Bollinger --- .../analytics/analytics_logic.test.ts | 8 +- .../components/analytics/analytics_logic.ts | 4 +- .../analytics_tables/shared_columns.tsx | 2 +- .../test_helpers/shared_columns_tests.tsx | 4 +- .../api_logs/api_logs_logic.test.ts | 2 +- .../components/api_logs/api_logs_logic.ts | 2 +- .../add_domain/add_domain_logic.test.ts | 2 +- .../components/add_domain/add_domain_logic.ts | 17 +- .../components/add_domain/utils.test.ts | 4 +- .../crawler/components/add_domain/utils.ts | 2 +- .../components/crawl_rules_table.test.tsx | 4 +- .../crawler/components/crawl_rules_table.tsx | 6 +- .../components/entry_points_table.test.tsx | 4 +- .../crawler/components/entry_points_table.tsx | 4 +- .../automatic_crawl_scheduler_logic.ts | 6 +- .../manage_crawls_popover_logic.ts | 2 +- .../components/sitemaps_table.test.tsx | 4 +- .../crawler/components/sitemaps_table.tsx | 4 +- .../components/crawler/crawler_logic.test.ts | 6 +- .../components/crawler/crawler_logic.ts | 8 +- .../crawler/crawler_overview_logic.test.ts | 2 +- .../crawler/crawler_overview_logic.ts | 2 +- .../crawler_single_domain_logic.test.ts | 6 +- .../crawler/crawler_single_domain_logic.ts | 8 +- .../credentials/credentials_logic.test.ts | 14 +- .../credentials/credentials_logic.ts | 10 +- .../curations/curation/curation_logic.test.ts | 4 +- .../curations/curation/curation_logic.ts | 4 +- .../curations/curations_logic.test.ts | 26 ++- .../components/curations/curations_logic.ts | 6 +- .../document_creation_logic.ts | 2 +- .../documents/document_detail_logic.test.ts | 6 +- .../documents/document_detail_logic.ts | 4 +- .../search_experience/search_experience.tsx | 2 +- .../components/engine/engine_logic.test.ts | 2 +- .../components/engine/engine_logic.ts | 2 +- .../engine_creation_logic.test.ts | 4 +- .../engine_creation/engine_creation_logic.ts | 2 +- .../engine_overview_logic.test.ts | 2 +- .../engine_overview/engine_overview_logic.ts | 2 +- .../tables/meta_engines_table_logic.test.ts | 2 +- .../tables/meta_engines_table_logic.ts | 2 +- .../components/engines/engines_logic.test.ts | 6 +- .../components/engines/engines_logic.ts | 6 +- .../log_retention/log_retention_logic.test.ts | 4 +- .../log_retention/log_retention_logic.ts | 4 +- .../meta_engine_creation_logic.test.ts | 4 +- .../meta_engine_creation_logic.ts | 4 +- .../relevance_tuning_logic.test.ts | 10 +- .../relevance_tuning_logic.ts | 8 +- .../result_settings_logic.test.ts | 4 +- .../result_settings/result_settings_logic.ts | 4 +- .../sample_response/sample_response_logic.ts | 2 +- .../role_mappings/role_mappings_logic.test.ts | 40 ++-- .../role_mappings/role_mappings_logic.ts | 12 +- .../sample_engine_creation_cta_logic.test.ts | 6 +- .../sample_engine_creation_cta_logic.ts | 2 +- .../reindex_job/reindex_job_logic.test.ts | 2 +- .../schema/reindex_job/reindex_job_logic.ts | 4 +- .../schema/schema_base_logic.test.ts | 2 +- .../components/schema/schema_base_logic.ts | 2 +- .../components/schema/schema_logic.test.ts | 2 +- .../components/schema/schema_logic.ts | 2 +- .../components/search/search_logic.test.ts | 2 +- .../components/search/search_logic.ts | 2 +- .../search_ui/search_ui_logic.test.ts | 2 +- .../components/search_ui/search_ui_logic.ts | 2 +- .../source_engines_logic.test.ts | 8 +- .../source_engines/source_engines_logic.ts | 8 +- .../synonyms/synonyms_logic.test.ts | 15 +- .../components/synonyms/synonyms_logic.ts | 8 +- .../recursively_fetch_engines/index.test.ts | 21 ++- .../shared/http/http_logic.test.ts | 14 +- .../applications/shared/http/http_logic.ts | 2 +- .../shared/telemetry/telemetry_logic.test.ts | 2 +- .../shared/telemetry/telemetry_logic.ts | 2 +- .../add_source/add_source_logic.test.ts | 50 +++-- .../components/add_source/add_source_logic.ts | 24 +-- .../display_settings_logic.test.ts | 4 +- .../display_settings_logic.ts | 4 +- .../components/schema/schema_logic.test.ts | 20 +- .../components/schema/schema_logic.ts | 12 +- .../components/source_settings.test.tsx | 4 +- .../components/source_settings.tsx | 6 +- .../content_sources/source_logic.test.ts | 43 +++-- .../views/content_sources/source_logic.ts | 18 +- .../content_sources/sources_logic.test.ts | 21 ++- .../views/content_sources/sources_logic.ts | 12 +- .../views/groups/group_logic.test.ts | 10 +- .../views/groups/group_logic.ts | 19 +- .../views/groups/groups_logic.test.ts | 10 +- .../views/groups/groups_logic.ts | 23 ++- .../oauth_authorize_logic.test.ts | 6 +- .../oauth_authorize/oauth_authorize_logic.ts | 2 +- .../views/overview/overview_logic.test.ts | 2 +- .../views/overview/overview_logic.ts | 2 +- .../role_mappings/role_mappings_logic.test.ts | 14 +- .../role_mappings/role_mappings_logic.ts | 19 +- .../search_authorize_logic.test.ts | 6 +- .../views/security/security_logic.test.ts | 4 +- .../views/security/security_logic.ts | 2 +- .../views/settings/settings_logic.test.ts | 26 ++- .../views/settings/settings_logic.ts | 12 +- .../enterprise_search/public/plugin.ts | 2 +- .../server/__mocks__/router.mock.ts | 2 +- .../server/lib/route_config_helpers.ts | 4 +- .../routes/app_search/analytics.test.ts | 8 +- .../server/routes/app_search/analytics.ts | 4 +- .../server/routes/app_search/api_logs.test.ts | 4 +- .../server/routes/app_search/api_logs.ts | 2 +- .../server/routes/app_search/crawler.test.ts | 52 +++--- .../server/routes/app_search/crawler.ts | 26 +-- .../app_search/crawler_crawl_rules.test.ts | 12 +- .../routes/app_search/crawler_crawl_rules.ts | 6 +- .../app_search/crawler_entry_points.test.ts | 12 +- .../routes/app_search/crawler_entry_points.ts | 6 +- .../app_search/crawler_sitemaps.test.ts | 12 +- .../routes/app_search/crawler_sitemaps.ts | 8 +- .../routes/app_search/credentials.test.ts | 20 +- .../server/routes/app_search/credentials.ts | 10 +- .../routes/app_search/curations.test.ts | 24 +-- .../server/routes/app_search/curations.ts | 12 +- .../routes/app_search/documents.test.ts | 12 +- .../server/routes/app_search/documents.ts | 6 +- .../server/routes/app_search/engines.test.ts | 20 +- .../server/routes/app_search/engines.ts | 10 +- .../routes/app_search/onboarding.test.ts | 4 +- .../server/routes/app_search/onboarding.ts | 2 +- .../routes/app_search/result_settings.test.ts | 8 +- .../routes/app_search/result_settings.ts | 4 +- .../routes/app_search/role_mappings.test.ts | 24 +-- .../server/routes/app_search/role_mappings.ts | 12 +- .../server/routes/app_search/schema.test.ts | 12 +- .../server/routes/app_search/schema.ts | 6 +- .../server/routes/app_search/search.test.ts | 4 +- .../server/routes/app_search/search.ts | 4 +- .../routes/app_search/search_settings.test.ts | 12 +- .../routes/app_search/search_settings.ts | 6 +- .../routes/app_search/search_ui.test.ts | 4 +- .../server/routes/app_search/search_ui.ts | 2 +- .../server/routes/app_search/settings.test.ts | 8 +- .../server/routes/app_search/settings.ts | 4 +- .../routes/app_search/source_engines.test.ts | 12 +- .../routes/app_search/source_engines.ts | 6 +- .../server/routes/app_search/synonyms.test.ts | 16 +- .../server/routes/app_search/synonyms.ts | 8 +- .../enterprise_search/config_data.test.ts | 4 +- .../routes/enterprise_search/config_data.ts | 2 +- .../enterprise_search/telemetry.test.ts | 4 +- .../routes/enterprise_search/telemetry.ts | 2 +- .../routes/workplace_search/groups.test.ts | 36 ++-- .../server/routes/workplace_search/groups.ts | 18 +- .../routes/workplace_search/oauth.test.ts | 12 +- .../server/routes/workplace_search/oauth.ts | 6 +- .../routes/workplace_search/overview.test.ts | 4 +- .../routes/workplace_search/overview.ts | 2 +- .../workplace_search/role_mappings.test.ts | 24 +-- .../routes/workplace_search/role_mappings.ts | 12 +- .../routes/workplace_search/security.test.ts | 12 +- .../routes/workplace_search/security.ts | 6 +- .../routes/workplace_search/settings.test.ts | 16 +- .../routes/workplace_search/settings.ts | 8 +- .../routes/workplace_search/sources.test.ts | 176 +++++++++--------- .../server/routes/workplace_search/sources.ts | 88 ++++----- 164 files changed, 873 insertions(+), 793 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts index 921a0892bb89052..7b877419a297761 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts @@ -163,7 +163,7 @@ describe('AnalyticsLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/analytics/queries', + '/internal/app_search/engines/test-engine/analytics/queries', { query: { start: DEFAULT_START_DATE, @@ -185,7 +185,7 @@ describe('AnalyticsLogic', () => { AnalyticsLogic.actions.loadAnalyticsData(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/analytics/queries', + '/internal/app_search/engines/test-engine/analytics/queries', { query: { start: '1970-01-01', @@ -229,7 +229,7 @@ describe('AnalyticsLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/analytics/queries/some-query', + '/internal/app_search/engines/test-engine/analytics/queries/some-query', { query: { start: DEFAULT_START_DATE, @@ -248,7 +248,7 @@ describe('AnalyticsLogic', () => { AnalyticsLogic.actions.loadQueryData('some-query'); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/analytics/queries/some-query', + '/internal/app_search/engines/test-engine/analytics/queries/some-query', { query: { start: '1970-12-30', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.ts index bb89e9735934f0c..3f6436424a63b14 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.ts @@ -158,7 +158,7 @@ export const AnalyticsLogic = kea { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/curations/find_or_create', + '/internal/app_search/engines/some-engine/curations/find_or_create', { query: { query: 'some search' }, } @@ -63,7 +63,7 @@ export const runActionColumnTests = (wrapper: ReactWrapper) => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/curations/find_or_create', + '/internal/app_search/engines/some-engine/curations/find_or_create', { query: { query: '""' }, } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts index 5af5dca3e97dc3d..2f3aedc8fa11dcf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts @@ -154,7 +154,7 @@ describe('ApiLogsLogic', () => { ApiLogsLogic.actions.fetchApiLogs(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/api_logs', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/api_logs', { query: { 'page[current]': 1, 'filters[date][from]': '1970-01-01T00:00:00.000Z', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.ts index a9186bd4d66cfc8..86c8ec8c5fbd183 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.ts @@ -104,7 +104,7 @@ export const ApiLogsLogic = kea>({ const { engineName } = EngineLogic.values; try { - const response = await http.get(`/api/app_search/engines/${engineName}/api_logs`, { + const response = await http.get(`/internal/app_search/engines/${engineName}/api_logs`, { query: { 'page[current]': values.meta.page.current, 'filters[date][from]': getDateString(-1), diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts index b2dc665fc2b8507..633c8de5e565575 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts @@ -286,7 +286,7 @@ describe('AddDomainLogic', () => { await nextTick(); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/domains', + '/internal/app_search/engines/some-engine/crawler/domains', { query: { respond_with: 'crawler_details', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.ts index 23bc147a7291d2b..020515b2cad8761 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.ts @@ -204,7 +204,7 @@ export const AddDomainLogic = kea { expect(result).toEqual('https://elastic.co'); expect(http.post).toHaveBeenCalledTimes(1); - expect(http.post).toHaveBeenCalledWith('/api/app_search/crawler/validate_url', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/crawler/validate_url', { body: JSON.stringify({ url: 'https://elastic.co', checks: ['tcp', 'url_request'] }), }); }); @@ -69,7 +69,7 @@ describe('getDomainWithProtocol', () => { expect(result).toEqual('http://elastic.co'); expect(http.post).toHaveBeenCalledTimes(2); - expect(http.post).toHaveBeenLastCalledWith('/api/app_search/crawler/validate_url', { + expect(http.post).toHaveBeenLastCalledWith('/internal/app_search/crawler/validate_url', { body: JSON.stringify({ url: 'http://elastic.co', checks: ['tcp', 'url_request'] }), }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/utils.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/utils.ts index b0dc8418c4ca9f6..47613d3d2b67351 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/utils.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/utils.ts @@ -36,7 +36,7 @@ export const getDomainWithProtocol = async (domain: string) => { if (!domain.startsWith('https://') && !domain.startsWith('http://')) { try { - const route = '/api/app_search/crawler/validate_url'; + const route = '/internal/app_search/crawler/validate_url'; const checks = ['tcp', 'url_request']; const httpsCheckData: CrawlerDomainValidationResultFromServer = await http.post(route, { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.test.tsx index 90998a31fa2738b..27624a088ddd714 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.test.tsx @@ -176,10 +176,10 @@ describe('CrawlRulesTable', () => { rule: CrawlerRules.beginsWith, }; expect(table.prop('deleteRoute')(crawlRule)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/crawl_rules/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/crawl_rules/1' ); expect(table.prop('updateRoute')(crawlRule)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/crawl_rules/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/crawl_rules/1' ); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.tsx index 9af8cb66fdc4f28..d8d5d9d10b3b72b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_rules_table.tsx @@ -149,10 +149,10 @@ export const CrawlRulesTable: React.FC = ({ }, ]; - const crawlRulesRoute = `/api/app_search/engines/${engineName}/crawler/domains/${domainId}/crawl_rules`; - const domainRoute = `/api/app_search/engines/${engineName}/crawler/domains/${domainId}`; + const crawlRulesRoute = `/internal/app_search/engines/${engineName}/crawler/domains/${domainId}/crawl_rules`; + const domainRoute = `/internal/app_search/engines/${engineName}/crawler/domains/${domainId}`; const getCrawlRuleRoute = (crawlRule: CrawlRule) => - `/api/app_search/engines/${engineName}/crawler/domains/${domainId}/crawl_rules/${crawlRule.id}`; + `/internal/app_search/engines/${engineName}/crawler/domains/${domainId}/crawl_rules/${crawlRule.id}`; return ( { const entryPoint = { id: '1', value: '/whatever' }; expect(table.prop('deleteRoute')(entryPoint)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/entry_points/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/entry_points/1' ); expect(table.prop('updateRoute')(entryPoint)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/entry_points/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/entry_points/1' ); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/entry_points_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/entry_points_table.tsx index 7657a23ce47891d..d8e4790b842b466 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/entry_points_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/entry_points_table.tsx @@ -62,10 +62,10 @@ export const EntryPointsTable: React.FC = ({ }, ]; - const entryPointsRoute = `/api/app_search/engines/${engineName}/crawler/domains/${domain.id}/entry_points`; + const entryPointsRoute = `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}/entry_points`; const getEntryPointRoute = (entryPoint: EntryPoint) => - `/api/app_search/engines/${engineName}/crawler/domains/${domain.id}/entry_points/${entryPoint.id}`; + `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}/entry_points/${entryPoint.id}`; return ( { const sitemap = { id: '1', url: '/whatever' }; expect(table.prop('deleteRoute')(sitemap)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/sitemaps/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/sitemaps/1' ); expect(table.prop('updateRoute')(sitemap)).toEqual( - '/api/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/sitemaps/1' + '/internal/app_search/engines/my-engine/crawler/domains/6113e1407a2f2e6f42489794/sitemaps/1' ); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/sitemaps_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/sitemaps_table.tsx index eaa1526299fcd18..8637fda449ebafa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/sitemaps_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/sitemaps_table.tsx @@ -54,9 +54,9 @@ export const SitemapsTable: React.FC = ({ domain, engineName }, ]; - const sitemapsRoute = `/api/app_search/engines/${engineName}/crawler/domains/${domain.id}/sitemaps`; + const sitemapsRoute = `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}/sitemaps`; const getSitemapRoute = (sitemap: Sitemap) => - `/api/app_search/engines/${engineName}/crawler/domains/${domain.id}/sitemaps/${sitemap.id}`; + `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}/sitemaps/${sitemap.id}`; return ( { CrawlerLogic.actions.fetchCrawlerData(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/crawler'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/crawler'); expect(CrawlerLogic.actions.onReceiveCrawlerData).toHaveBeenCalledWith( MOCK_CLIENT_CRAWLER_DATA ); @@ -190,7 +190,7 @@ describe('CrawlerLogic', () => { await nextTick(); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/crawl_requests' + '/internal/app_search/engines/some-engine/crawler/crawl_requests' ); expect(CrawlerLogic.actions.getLatestCrawlRequests).toHaveBeenCalled(); }); @@ -218,7 +218,7 @@ describe('CrawlerLogic', () => { await nextTick(); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/crawl_requests/cancel' + '/internal/app_search/engines/some-engine/crawler/crawl_requests/cancel' ); expect(CrawlerLogic.actions.getLatestCrawlRequests).toHaveBeenCalled(); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.ts index b9782d84a74cc91..902058593fe46d2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.ts @@ -104,7 +104,7 @@ export const CrawlerLogic = kea>({ const { engineName } = EngineLogic.values; try { - const response = await http.get(`/api/app_search/engines/${engineName}/crawler`); + const response = await http.get(`/internal/app_search/engines/${engineName}/crawler`); const crawlerData = crawlerDataServerToClient(response); @@ -118,7 +118,7 @@ export const CrawlerLogic = kea>({ const { engineName } = EngineLogic.values; try { - await http.post(`/api/app_search/engines/${engineName}/crawler/crawl_requests`); + await http.post(`/internal/app_search/engines/${engineName}/crawler/crawl_requests`); actions.getLatestCrawlRequests(); } catch (e) { flashAPIErrors(e); @@ -129,7 +129,7 @@ export const CrawlerLogic = kea>({ const { engineName } = EngineLogic.values; try { - await http.post(`/api/app_search/engines/${engineName}/crawler/crawl_requests/cancel`); + await http.post(`/internal/app_search/engines/${engineName}/crawler/crawl_requests/cancel`); actions.getLatestCrawlRequests(); } catch (e) { flashAPIErrors(e); @@ -152,7 +152,7 @@ export const CrawlerLogic = kea>({ try { const crawlRequestsFromServer: CrawlRequestFromServer[] = await http.get( - `/api/app_search/engines/${engineName}/crawler/crawl_requests` + `/internal/app_search/engines/${engineName}/crawler/crawl_requests` ); const crawlRequests = crawlRequestsFromServer.map(crawlRequestServerToClient); actions.onReceiveCrawlRequests(crawlRequests); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts index d5026ad1170738e..9a5d99abdd4690a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts @@ -67,7 +67,7 @@ describe('CrawlerOverviewLogic', () => { await nextTick(); expect(http.delete).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/domains/1234', + '/internal/app_search/engines/some-engine/crawler/domains/1234', { query: { respond_with: 'crawler_details' }, } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts index 79e3326347d683e..5f9dbdd01efc78b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts @@ -32,7 +32,7 @@ export const CrawlerOverviewLogic = kea { await nextTick(); expect(http.delete).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/domains/1234' + '/internal/app_search/engines/some-engine/crawler/domains/1234' ); expect(flashSuccessToast).toHaveBeenCalled(); @@ -194,7 +194,7 @@ describe('CrawlerSingleDomainLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/domains/507f1f77bcf86cd799439011' + '/internal/app_search/engines/some-engine/crawler/domains/507f1f77bcf86cd799439011' ); expect(CrawlerSingleDomainLogic.actions.onReceiveDomainData).toHaveBeenCalledWith({ id: '507f1f77bcf86cd799439011', @@ -242,7 +242,7 @@ describe('CrawlerSingleDomainLogic', () => { await nextTick(); expect(http.put).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/crawler/domains/507f1f77bcf86cd799439011', + '/internal/app_search/engines/some-engine/crawler/domains/507f1f77bcf86cd799439011', { body: JSON.stringify({ deduplication_enabled: true, deduplication_fields: ['title'] }), } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts index e9c74c864b1b231..1939e418fec7932 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts @@ -74,7 +74,9 @@ export const CrawlerSingleDomainLogic = kea< const { engineName } = EngineLogic.values; try { - await http.delete(`/api/app_search/engines/${engineName}/crawler/domains/${domain.id}`); + await http.delete( + `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}` + ); flashSuccessToast(getDeleteDomainSuccessMessage(domain.url)); KibanaLogic.values.navigateToUrl(generateEnginePath(ENGINE_CRAWLER_PATH)); @@ -88,7 +90,7 @@ export const CrawlerSingleDomainLogic = kea< try { const response = await http.get( - `/api/app_search/engines/${engineName}/crawler/domains/${domainId}` + `/internal/app_search/engines/${engineName}/crawler/domains/${domainId}` ); const domainData = crawlerDomainServerToClient(response); @@ -109,7 +111,7 @@ export const CrawlerSingleDomainLogic = kea< try { const response = await http.put( - `/api/app_search/engines/${engineName}/crawler/domains/${domain.id}`, + `/internal/app_search/engines/${engineName}/crawler/domains/${domain.id}`, { body: JSON.stringify(payload), } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts index a12c174b9478ca1..3afa531239dc100 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts @@ -1049,7 +1049,7 @@ describe('CredentialsLogic', () => { http.get.mockReturnValue(Promise.resolve({ meta, results })); CredentialsLogic.actions.fetchCredentials(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/credentials', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/credentials', { query: { 'page[current]': 1, 'page[size]': 10, @@ -1079,7 +1079,7 @@ describe('CredentialsLogic', () => { http.get.mockReturnValue(Promise.resolve(credentialsDetails)); CredentialsLogic.actions.fetchDetails(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/credentials/details'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/credentials/details'); await nextTick(); expect(CredentialsLogic.actions.setCredentialsDetails).toHaveBeenCalledWith( credentialsDetails @@ -1106,7 +1106,7 @@ describe('CredentialsLogic', () => { http.delete.mockReturnValue(Promise.resolve()); CredentialsLogic.actions.deleteApiKey(tokenName); - expect(http.delete).toHaveBeenCalledWith(`/api/app_search/credentials/${tokenName}`); + expect(http.delete).toHaveBeenCalledWith(`/internal/app_search/credentials/${tokenName}`); await nextTick(); expect(CredentialsLogic.actions.fetchCredentials).toHaveBeenCalled(); @@ -1137,7 +1137,7 @@ describe('CredentialsLogic', () => { http.post.mockReturnValue(Promise.resolve(createdToken)); CredentialsLogic.actions.onApiTokenChange(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/credentials', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/credentials', { body: JSON.stringify(createdToken), }); await nextTick(); @@ -1164,7 +1164,7 @@ describe('CredentialsLogic', () => { http.put.mockReturnValue(Promise.resolve(updatedToken)); CredentialsLogic.actions.onApiTokenChange(); - expect(http.put).toHaveBeenCalledWith('/api/app_search/credentials/test-key', { + expect(http.put).toHaveBeenCalledWith('/internal/app_search/credentials/test-key', { body: JSON.stringify(updatedToken), }); await nextTick(); @@ -1196,7 +1196,7 @@ describe('CredentialsLogic', () => { mount({ activeApiToken: { ...correctAdminToken, ...extraData } }); CredentialsLogic.actions.onApiTokenChange(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/credentials', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/credentials', { body: JSON.stringify(correctAdminToken), }); }); @@ -1215,7 +1215,7 @@ describe('CredentialsLogic', () => { mount({ activeApiToken: { ...correctSearchToken, ...extraData } }); CredentialsLogic.actions.onApiTokenChange(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/credentials', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/credentials', { body: JSON.stringify(correctSearchToken), }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts index 60282bc0a3316b2..52e1b1825b18097 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts @@ -239,7 +239,7 @@ export const CredentialsLogic = kea({ 'page[current]': meta.page.current, 'page[size]': meta.page.size, }; - const response = await http.get('/api/app_search/credentials', { query }); + const response = await http.get('/internal/app_search/credentials', { query }); actions.setCredentialsData(response.meta, response.results); } catch (e) { flashAPIErrors(e); @@ -248,7 +248,7 @@ export const CredentialsLogic = kea({ fetchDetails: async () => { try { const { http } = HttpLogic.values; - const response = await http.get('/api/app_search/credentials/details'); + const response = await http.get('/internal/app_search/credentials/details'); actions.setCredentialsDetails(response); } catch (e) { @@ -258,7 +258,7 @@ export const CredentialsLogic = kea({ deleteApiKey: async (tokenName) => { try { const { http } = HttpLogic.values; - await http.delete(`/api/app_search/credentials/${tokenName}`); + await http.delete(`/internal/app_search/credentials/${tokenName}`); actions.fetchCredentials(); flashSuccessToast(DELETE_MESSAGE(tokenName)); @@ -287,11 +287,11 @@ export const CredentialsLogic = kea({ const body = JSON.stringify(data); if (id) { - const response = await http.put(`/api/app_search/credentials/${name}`, { body }); + const response = await http.put(`/internal/app_search/credentials/${name}`, { body }); actions.onApiTokenUpdateSuccess(response); flashSuccessToast(UPDATE_MESSAGE(name)); } else { - const response = await http.post('/api/app_search/credentials', { body }); + const response = await http.post('/internal/app_search/credentials', { body }); actions.onApiTokenCreateSuccess(response); flashSuccessToast(CREATE_MESSAGE(name)); } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts index c733294af291000..8fa57e52a26a111 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts @@ -287,7 +287,7 @@ describe('CurationLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/curations/cur-123456789', + '/internal/app_search/engines/some-engine/curations/cur-123456789', { query: { skip_record_analytics: 'true' }, } @@ -329,7 +329,7 @@ describe('CurationLogic', () => { await nextTick(); expect(http.put).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/curations/cur-123456789', + '/internal/app_search/engines/some-engine/curations/cur-123456789', { body: '{"queries":["a","b","c"],"query":"b","promoted":["d","e","f"],"hidden":["g"]}', // Uses state currently in CurationLogic } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.ts index 12ff380ccb389f3..c49fc76d0687456 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.ts @@ -169,7 +169,7 @@ export const CurationLogic = kea { CurationsLogic.actions.loadCurations(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/curations', { - query: { - 'page[current]': 1, - 'page[size]': 10, - }, - }); + expect(http.get).toHaveBeenCalledWith( + '/internal/app_search/engines/some-engine/curations', + { + query: { + 'page[current]': 1, + 'page[size]': 10, + }, + } + ); expect(CurationsLogic.actions.onCurationsLoad).toHaveBeenCalledWith( MOCK_CURATIONS_RESPONSE ); @@ -151,7 +154,7 @@ describe('CurationsLogic', () => { await nextTick(); expect(http.delete).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/curations/some-curation-id' + '/internal/app_search/engines/some-engine/curations/some-curation-id' ); expect(CurationsLogic.actions.loadCurations).toHaveBeenCalled(); expect(flashSuccessToast).toHaveBeenCalledWith('Your curation was deleted'); @@ -189,9 +192,12 @@ describe('CurationsLogic', () => { expect(clearFlashMessages).toHaveBeenCalled(); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/some-engine/curations', { - body: '{"queries":["some query"]}', - }); + expect(http.post).toHaveBeenCalledWith( + '/internal/app_search/engines/some-engine/curations', + { + body: '{"queries":["some query"]}', + } + ); expect(navigateToUrl).toHaveBeenCalledWith('/engines/some-engine/curations/some-cur-id'); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts index 89d170a83a4c8b8..a98f83396b3b885 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts @@ -75,7 +75,7 @@ export const CurationsLogic = kea { const body = JSON.stringify({ documents: documentsChunk }); - return http.post(`/api/app_search/engines/${engineName}/documents`, { body }); + return http.post(`/internal/app_search/engines/${engineName}/documents`, { body }); }); try { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts index 1608e4fb08aacb5..5705e5ae2ee9897 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts @@ -65,7 +65,7 @@ describe('DocumentDetailLogic', () => { DocumentDetailLogic.actions.getDocumentDetails('1'); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/engine1/documents/1'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/engine1/documents/1'); await nextTick(); expect(DocumentDetailLogic.actions.setFields).toHaveBeenCalledWith(fields); }); @@ -99,7 +99,9 @@ describe('DocumentDetailLogic', () => { mount(); DocumentDetailLogic.actions.deleteDocument('1'); - expect(http.delete).toHaveBeenCalledWith('/api/app_search/engines/engine1/documents/1'); + expect(http.delete).toHaveBeenCalledWith( + '/internal/app_search/engines/engine1/documents/1' + ); await nextTick(); expect(flashSuccessToast).toHaveBeenCalledWith('Your document was deleted'); expect(navigateToUrl).toHaveBeenCalledWith('/engines/engine1/documents'); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts index 2bc9155c81c7b01..25c16a7df2c5031 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts @@ -60,7 +60,7 @@ export const DocumentDetailLogic = kea({ try { const { http } = HttpLogic.values; const response = await http.get( - `/api/app_search/engines/${engineName}/documents/${documentId}` + `/internal/app_search/engines/${engineName}/documents/${documentId}` ); actions.setFields(response.fields); } catch (e) { @@ -87,7 +87,7 @@ export const DocumentDetailLogic = kea({ if (window.confirm(CONFIRM_DELETE)) { try { const { http } = HttpLogic.values; - await http.delete(`/api/app_search/engines/${engineName}/documents/${documentId}`); + await http.delete(`/internal/app_search/engines/${engineName}/documents/${documentId}`); flashSuccessToast(DELETE_SUCCESS); navigateToUrl(generateEnginePath(ENGINE_DOCUMENTS_PATH)); } catch (e) { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.tsx index 8416974ad7a2e89..ed2a1ed54f06d3c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.tsx @@ -53,7 +53,7 @@ const DEFAULT_SORT_OPTIONS: SortOption[] = [ export const SearchExperience: React.FC = () => { const { engine } = useValues(EngineLogic); const { http } = useValues(HttpLogic); - const endpointBase = http.basePath.prepend('/api/app_search/search-ui'); + const endpointBase = http.basePath.prepend('/internal/app_search/search-ui'); const [showCustomizationModal, setShowCustomizationModal] = useState(false); const openCustomizationModal = () => setShowCustomizationModal(true); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts index 0189edbbf871f70..bd15f50fe78e3b2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts @@ -210,7 +210,7 @@ describe('EngineLogic', () => { EngineLogic.actions.initializeEngine(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine'); expect(EngineLogic.actions.setEngineData).toHaveBeenCalledWith(mockEngineData); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.ts index bfa77450176f64f..c20cc763f3c9028 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.ts @@ -132,7 +132,7 @@ export const EngineLogic = kea>({ const { http } = HttpLogic.values; try { - const response = await http.get(`/api/app_search/engines/${engineName}`); + const response = await http.get(`/internal/app_search/engines/${engineName}`); actions.setEngineData(response); } catch (error) { if (error?.response?.status >= 400 && error?.response?.status < 500) { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts index 2001ac3646e5fb0..7d7ddb77cab857a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts @@ -117,13 +117,13 @@ describe('EngineCreationLogic', () => { jest.clearAllMocks(); }); - it('POSTS to /api/app_search/engines', () => { + it('POSTS to /internal/app_search/engines', () => { const body = JSON.stringify({ name: EngineCreationLogic.values.name, language: EngineCreationLogic.values.language, }); EngineCreationLogic.actions.submitEngine(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines', { body }); + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines', { body }); }); it('calls onEngineCreationSuccess on valid submission', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts index 4e41cdf4c3949ad..96be98053c56c0f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts @@ -73,7 +73,7 @@ export const EngineCreationLogic = kea { EngineOverviewLogic.actions.loadOverviewMetrics(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/overview'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/overview'); expect(EngineOverviewLogic.actions.onOverviewMetricsLoad).toHaveBeenCalledWith( mockEngineMetrics ); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.ts index 3f9c2e43a332b99..73cfef8530521a2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.ts @@ -84,7 +84,7 @@ export const EngineOverviewLogic = kea { expect(mockRecursivelyFetchEngines).toHaveBeenCalledWith( expect.objectContaining({ - endpoint: '/api/app_search/engines/test-engine-1/source_engines', + endpoint: '/internal/app_search/engines/test-engine-1/source_engines', }) ); expect(MetaEnginesTableLogic.actions.addSourceEngines).toHaveBeenCalledWith({ diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.ts index af4d0119a94af39..94205a5392b6387 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.ts @@ -84,7 +84,7 @@ export const MetaEnginesTableLogic = kea< }, fetchSourceEngines: ({ engineName }) => { recursivelyFetchEngines({ - endpoint: `/api/app_search/engines/${engineName}/source_engines`, + endpoint: `/internal/app_search/engines/${engineName}/source_engines`, onComplete: (sourceEngines) => { actions.addSourceEngines({ [engineName]: sourceEngines }); actions.displayRow(engineName); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts index d29c8a96f1c600b..f3dc8a378a7d304 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts @@ -137,7 +137,7 @@ describe('EnginesLogic', () => { EnginesLogic.actions.deleteEngine(MOCK_ENGINE); await nextTick(); - expect(http.delete).toHaveBeenCalledWith('/api/app_search/engines/hello-world'); + expect(http.delete).toHaveBeenCalledWith('/internal/app_search/engines/hello-world'); expect(EnginesLogic.actions.onDeleteEngineSuccess).toHaveBeenCalledWith(MOCK_ENGINE); }); @@ -161,7 +161,7 @@ describe('EnginesLogic', () => { EnginesLogic.actions.loadEngines(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines', { query: { type: 'indexed', 'page[current]': 1, @@ -191,7 +191,7 @@ describe('EnginesLogic', () => { EnginesLogic.actions.loadMetaEngines(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines', { query: { type: 'meta', 'page[current]': 1, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts index f9b691147161fce..507b83cc8b5cfeb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts @@ -105,7 +105,7 @@ export const EnginesLogic = kea>({ let response; try { - response = await http.delete(`/api/app_search/engines/${engine.name}`); + response = await http.delete(`/internal/app_search/engines/${engine.name}`); } catch (e) { flashAPIErrors(e); } @@ -119,7 +119,7 @@ export const EnginesLogic = kea>({ const { enginesMeta } = values; try { - const response = await http.get('/api/app_search/engines', { + const response = await http.get('/internal/app_search/engines', { query: { type: 'indexed', 'page[current]': enginesMeta.page.current, @@ -136,7 +136,7 @@ export const EnginesLogic = kea>({ const { metaEnginesMeta } = values; try { - const response = await http.get('/api/app_search/engines', { + const response = await http.get('/internal/app_search/engines', { query: { type: 'meta', 'page[current]': metaEnginesMeta.page.current, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts index 4e2382c23edbdee..251fd93069afef5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts @@ -196,7 +196,7 @@ describe('LogRetentionLogic', () => { LogRetentionLogic.actions.saveLogRetention(LogRetentionOptions.Analytics, true); - expect(http.put).toHaveBeenCalledWith('/api/app_search/log_settings', { + expect(http.put).toHaveBeenCalledWith('/internal/app_search/log_settings', { body: JSON.stringify({ analytics: { enabled: true, @@ -320,7 +320,7 @@ describe('LogRetentionLogic', () => { jest.runAllTimers(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/log_settings'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/log_settings'); expect(LogRetentionLogic.actions.updateLogRetention).toHaveBeenCalledWith( TYPICAL_CLIENT_LOG_RETENTION ); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts index aa1be3f8cdc6417..af2fdfed7865101 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts @@ -74,7 +74,7 @@ export const LogRetentionLogic = kea { mount({ rawName: 'test', selectedIndexedEngineNames: ['foo'] }); }); - it('POSTS to /api/app_search/engines', () => { + it('POSTS to /internal/app_search/engines', () => { const body = JSON.stringify({ name: 'test', type: 'meta', source_engines: ['foo'], }); MetaEngineCreationLogic.actions.submitEngine(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines', { body }); + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines', { body }); }); it('calls onEngineCreationSuccess on valid submission', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts index 4df3bc4bff162a1..95ef53d82cc472e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts @@ -92,7 +92,7 @@ export const MetaEngineCreationLogic = kea< let response: { results: EngineDetails[]; meta: Meta } | undefined; try { - response = await http.get('/api/app_search/engines', { + response = await http.get('/internal/app_search/engines', { query: { type: 'indexed', 'page[current]': page, 'page[size]': DEFAULT_META.page.size }, }); } catch (e) { @@ -127,7 +127,7 @@ export const MetaEngineCreationLogic = kea< }); try { - await http.post('/api/app_search/engines', { body }); + await http.post('/internal/app_search/engines', { body }); actions.onEngineCreationSuccess(); } catch (e) { flashAPIErrors(e); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts index e2493b6404f7d37..7590633b7afef4a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts @@ -300,7 +300,7 @@ describe('RelevanceTuningLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/search_settings/details' + '/internal/app_search/engines/test-engine/search_settings/details' ); expect(RelevanceTuningLogic.actions.onInitializeRelevanceTuning).toHaveBeenCalledWith({ ...relevanceTuningProps, @@ -388,7 +388,7 @@ describe('RelevanceTuningLogic', () => { await nextTick(); expect(RelevanceTuningLogic.actions.setResultsLoading).toHaveBeenCalledWith(true); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/test-engine/search', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines/test-engine/search', { body: JSON.stringify(searchSettingsWithoutNewBoostProp), query: { query: 'foo', @@ -418,7 +418,7 @@ describe('RelevanceTuningLogic', () => { jest.runAllTimers(); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/test-engine/search', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines/test-engine/search', { body: '{}', query: { query: 'foo', @@ -528,7 +528,7 @@ describe('RelevanceTuningLogic', () => { await nextTick(); expect(http.put).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/search_settings', + '/internal/app_search/engines/test-engine/search_settings', { body: JSON.stringify(searchSettingsWithoutNewBoostProp), } @@ -587,7 +587,7 @@ describe('RelevanceTuningLogic', () => { await nextTick(); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/search_settings/reset' + '/internal/app_search/engines/test-engine/search_settings/reset' ); expect(flashSuccessToast).toHaveBeenCalledWith('Relevance was reset to default values', { text: 'The changes will impact your results shortly.', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts index 02903b4588ed42d..02df792f515a298 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts @@ -245,7 +245,7 @@ export const RelevanceTuningLogic = kea< const { http } = HttpLogic.values; const { engineName } = EngineLogic.values; - const url = `/api/app_search/engines/${engineName}/search_settings/details`; + const url = `/internal/app_search/engines/${engineName}/search_settings/details`; try { const response = await http.get(url); @@ -269,7 +269,7 @@ export const RelevanceTuningLogic = kea< const { engineName } = EngineLogic.values; const { http } = HttpLogic.values; const { search_fields: searchFields, boosts } = removeBoostStateProps(values.searchSettings); - const url = `/api/app_search/engines/${engineName}/search`; + const url = `/internal/app_search/engines/${engineName}/search`; actions.setResultsLoading(true); @@ -307,7 +307,7 @@ export const RelevanceTuningLogic = kea< const { http } = HttpLogic.values; const { engineName } = EngineLogic.values; - const url = `/api/app_search/engines/${engineName}/search_settings`; + const url = `/internal/app_search/engines/${engineName}/search_settings`; try { const response = await http.put(url, { @@ -331,7 +331,7 @@ export const RelevanceTuningLogic = kea< const { http } = HttpLogic.values; const { engineName } = EngineLogic.values; - const url = `/api/app_search/engines/${engineName}/search_settings/reset`; + const url = `/internal/app_search/engines/${engineName}/search_settings/reset`; try { const response = await http.post(url); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts index 5ce6fd932891776..94d5e84c67f6dbe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts @@ -835,7 +835,7 @@ describe('ResultSettingsLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/result_settings/details' + '/internal/app_search/engines/test-engine/result_settings/details' ); expect(ResultSettingsLogic.actions.initializeResultFields).toHaveBeenCalledWith( serverFieldResultSettings, @@ -910,7 +910,7 @@ describe('ResultSettingsLogic', () => { await nextTick(); expect(http.put).toHaveBeenCalledWith( - '/api/app_search/engines/test-engine/result_settings', + '/internal/app_search/engines/test-engine/result_settings', { body: JSON.stringify({ result_fields: serverResultFields, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts index 216c43e1d307287..49a09b8a7a3f506 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts @@ -292,7 +292,7 @@ export const ResultSettingsLogic = kea { expect(RoleMappingsLogic.values.dataLoading).toEqual(true); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/role_mappings/enable_role_based_access' + '/internal/app_search/role_mappings/enable_role_based_access' ); await nextTick(); expect(setRoleMappingsSpy).toHaveBeenCalledWith(mappingsServerProps); @@ -406,7 +406,7 @@ describe('RoleMappingsLogic', () => { http.get.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.initializeRoleMappings(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/role_mappings'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/role_mappings'); await nextTick(); expect(setRoleMappingsDataSpy).toHaveBeenCalledWith(mappingsServerProps); }); @@ -492,7 +492,7 @@ describe('RoleMappingsLogic', () => { http.post.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveMapping(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/role_mappings', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/role_mappings', { body: JSON.stringify(body), }); await nextTick(); @@ -513,9 +513,12 @@ describe('RoleMappingsLogic', () => { http.put.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveMapping(); - expect(http.put).toHaveBeenCalledWith(`/api/app_search/role_mappings/${asRoleMapping.id}`, { - body: JSON.stringify(body), - }); + expect(http.put).toHaveBeenCalledWith( + `/internal/app_search/role_mappings/${asRoleMapping.id}`, + { + body: JSON.stringify(body), + } + ); await nextTick(); expect(initializeRoleMappingsSpy).toHaveBeenCalled(); @@ -535,13 +538,16 @@ describe('RoleMappingsLogic', () => { http.put.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveMapping(); - expect(http.put).toHaveBeenCalledWith(`/api/app_search/role_mappings/${asRoleMapping.id}`, { - body: JSON.stringify({ - ...body, - accessAllEngines: false, - engines: [engine.name], - }), - }); + expect(http.put).toHaveBeenCalledWith( + `/internal/app_search/role_mappings/${asRoleMapping.id}`, + { + body: JSON.stringify({ + ...body, + accessAllEngines: false, + engines: [engine.name], + }), + } + ); }); it('handles error', async () => { @@ -582,7 +588,7 @@ describe('RoleMappingsLogic', () => { http.post.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveUser(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/single_user_role_mapping', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/single_user_role_mapping', { body: JSON.stringify({ roleMapping: { engines: [], @@ -613,7 +619,7 @@ describe('RoleMappingsLogic', () => { http.put.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveUser(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/single_user_role_mapping', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/single_user_role_mapping', { body: JSON.stringify({ roleMapping: { engines: [], @@ -666,7 +672,9 @@ describe('RoleMappingsLogic', () => { http.delete.mockReturnValue(Promise.resolve({})); RoleMappingsLogic.actions.handleDeleteMapping(roleMappingId); - expect(http.delete).toHaveBeenCalledWith(`/api/app_search/role_mappings/${roleMappingId}`); + expect(http.delete).toHaveBeenCalledWith( + `/internal/app_search/role_mappings/${roleMappingId}` + ); await nextTick(); expect(initializeRoleMappingsSpy).toHaveBeenCalled(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts index 8647f4f1df35792..6dac9e481f7efcf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts @@ -354,7 +354,7 @@ export const RoleMappingsLogic = kea ({ enableRoleBasedAccess: async () => { const { http } = HttpLogic.values; - const route = '/api/app_search/role_mappings/enable_role_based_access'; + const route = '/internal/app_search/role_mappings/enable_role_based_access'; try { const response = await http.post(route); @@ -365,7 +365,7 @@ export const RoleMappingsLogic = kea { const { http } = HttpLogic.values; - const route = '/api/app_search/role_mappings'; + const route = '/internal/app_search/role_mappings'; try { const response = await http.get(route); @@ -391,7 +391,7 @@ export const RoleMappingsLogic = kea { const { http } = HttpLogic.values; - const route = `/api/app_search/role_mappings/${roleMappingId}`; + const route = `/internal/app_search/role_mappings/${roleMappingId}`; try { await http.delete(route); @@ -425,8 +425,8 @@ export const RoleMappingsLogic = kea { describe('listeners', () => { describe('createSampleEngine', () => { - it('POSTS to /api/app_search/engines', () => { + it('POSTS to /internal/app_search/engines', () => { const body = JSON.stringify({ seed_sample_engine: true, }); SampleEngineCreationCtaLogic.actions.createSampleEngine(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/onboarding_complete', { body }); + expect(http.post).toHaveBeenCalledWith('/internal/app_search/onboarding_complete', { + body, + }); }); it('calls onSampleEngineCreationSuccess on valid submission', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts index bea85ea4fb3a539..6f960abac56f9ab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts @@ -52,7 +52,7 @@ export const SampleEngineCreationCtaLogic = kea< const body = JSON.stringify({ seed_sample_engine: true }); try { - await http.post('/api/app_search/onboarding_complete', { + await http.post('/internal/app_search/onboarding_complete', { body, }); actions.onSampleEngineCreationSuccess(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts index f01c735aeca8e7f..706dc3549badcaa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts @@ -103,7 +103,7 @@ describe('ReindexJobLogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/reindex_job/some-job-id' + '/internal/app_search/engines/some-engine/reindex_job/some-job-id' ); expect(ReindexJobLogic.actions.onLoadSuccess).toHaveBeenCalledWith(MOCK_RESPONSE); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.ts index 8cc76f7f6e94f17..fb50c9390a8d9d1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.ts @@ -53,7 +53,9 @@ export const ReindexJobLogic = kea { SchemaBaseLogic.actions.loadSchema(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/schema'); + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/schema'); expect(SchemaBaseLogic.actions.onSchemaLoad).toHaveBeenCalledWith(MOCK_RESPONSE); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.ts index c2196c01d402b6f..b9107666a881bfa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.ts @@ -56,7 +56,7 @@ export const SchemaBaseLogic = kea { SchemaLogic.actions.updateSchema(); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/some-engine/schema', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/schema', { body: '{}', }); expect(SchemaLogic.actions.onSchemaLoad).toHaveBeenCalledWith(MOCK_RESPONSE); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.ts index 3dcafd6782afd77..b26fd9206458244 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.ts @@ -146,7 +146,7 @@ export const SchemaLogic = kea>({ clearFlashMessages(); try { - const response = await http.post(`/api/app_search/engines/${engineName}/schema`, { + const response = await http.post(`/internal/app_search/engines/${engineName}/schema`, { body: JSON.stringify(schema), }); actions.onSchemaLoad(response); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts index 5b3c0a766fbe11b..d4f5ee29f74677c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts @@ -90,7 +90,7 @@ describe('SearchLogic', () => { jest.runAllTimers(); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/some-engine/search', { + expect(http.post).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/search', { query: { query: 'hello world' }, }); expect(logic.actions.onSearch).toHaveBeenCalledWith(MOCK_SEARCH_RESPONSE); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.ts index 52aedc165968934..424baedf210f50e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.ts @@ -61,7 +61,7 @@ export const SearchLogic = kea>({ const { engineName } = EngineLogic.values; try { - const response = await http.post(`/api/app_search/engines/${engineName}/search`, { + const response = await http.post(`/internal/app_search/engines/${engineName}/search`, { query: { query }, }); actions.onSearch(response); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts index aefe3c94f89ccdd..33144d4188ec148 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts @@ -160,7 +160,7 @@ describe('SearchUILogic', () => { await nextTick(); expect(http.get).toHaveBeenCalledWith( - '/api/app_search/engines/engine1/search_ui/field_config' + '/internal/app_search/engines/engine1/search_ui/field_config' ); expect(SearchUILogic.actions.onFieldDataLoaded).toHaveBeenCalledWith({ validFields: ['test'], diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.ts index e6225614fdc1860..7a3e429d842f8bf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.ts @@ -103,7 +103,7 @@ export const SearchUILogic = kea> return; } - const url = `/api/app_search/engines/${engineName}/search_ui/field_config`; + const url = `/internal/app_search/engines/${engineName}/search_ui/field_config`; try { const initialFieldValues = await http.get(url); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts index eababb9d93c582f..75d3c46ef72eed2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts @@ -227,7 +227,7 @@ describe('SourceEnginesLogic', () => { expect(mockRecursivelyFetchEngines).toHaveBeenCalledWith( expect.objectContaining({ - endpoint: '/api/app_search/engines/some-engine/source_engines', + endpoint: '/internal/app_search/engines/some-engine/source_engines', }) ); expect(SourceEnginesLogic.actions.onSourceEnginesFetch).toHaveBeenCalledWith([ @@ -245,7 +245,7 @@ describe('SourceEnginesLogic', () => { expect(mockRecursivelyFetchEngines).toHaveBeenCalledWith( expect.objectContaining({ - endpoint: '/api/app_search/engines', + endpoint: '/internal/app_search/engines', query: { type: 'indexed' }, }) ); @@ -283,7 +283,7 @@ describe('SourceEnginesLogic', () => { await nextTick(); expect(http.post).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/source_engines/bulk_create', + '/internal/app_search/engines/some-engine/source_engines/bulk_create', { body: JSON.stringify({ source_engine_slugs: ['source-engine-3', 'source-engine-4'] }), } @@ -341,7 +341,7 @@ describe('SourceEnginesLogic', () => { await nextTick(); expect(http.delete).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/source_engines/source-engine-2' + '/internal/app_search/engines/some-engine/source_engines/source-engine-2' ); expect(SourceEnginesLogic.actions.onSourceEngineRemove).toHaveBeenCalledWith( 'source-engine-2' diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts index 21ae24357bcea9d..af3c955258cf800 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts @@ -132,7 +132,7 @@ export const SourceEnginesLogic = kea< const { engineName } = EngineLogic.values; try { - await http.post(`/api/app_search/engines/${engineName}/source_engines/bulk_create`, { + await http.post(`/internal/app_search/engines/${engineName}/source_engines/bulk_create`, { body: JSON.stringify({ source_engine_slugs: sourceEngineNames, }), @@ -155,13 +155,13 @@ export const SourceEnginesLogic = kea< const { engineName } = EngineLogic.values; recursivelyFetchEngines({ - endpoint: `/api/app_search/engines/${engineName}/source_engines`, + endpoint: `/internal/app_search/engines/${engineName}/source_engines`, onComplete: (engines) => actions.onSourceEnginesFetch(engines), }); }, fetchIndexedEngines: () => { recursivelyFetchEngines({ - endpoint: '/api/app_search/engines', + endpoint: '/internal/app_search/engines', onComplete: (engines) => actions.setIndexedEngines(engines), query: { type: 'indexed' }, }); @@ -172,7 +172,7 @@ export const SourceEnginesLogic = kea< try { await http.delete( - `/api/app_search/engines/${engineName}/source_engines/${sourceEngineName}` + `/internal/app_search/engines/${engineName}/source_engines/${sourceEngineName}` ); actions.onSourceEngineRemove(sourceEngineName); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts index 630a069d0c5e8c5..0ff84ad4cb9cb0f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts @@ -137,7 +137,7 @@ describe('SynonymsLogic', () => { SynonymsLogic.actions.loadSynonyms(); await nextTick(); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/synonyms', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/synonyms', { query: { 'page[current]': 1, 'page[size]': 12, @@ -178,9 +178,12 @@ describe('SynonymsLogic', () => { SynonymsLogic.actions.createSynonymSet(['a', 'b', 'c']); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/app_search/engines/some-engine/synonyms', { - body: '{"synonyms":["a","b","c"]}', - }); + expect(http.post).toHaveBeenCalledWith( + '/internal/app_search/engines/some-engine/synonyms', + { + body: '{"synonyms":["a","b","c"]}', + } + ); expect(SynonymsLogic.actions.onSynonymSetSuccess).toHaveBeenCalledWith( 'Synonym set created' ); @@ -221,7 +224,7 @@ describe('SynonymsLogic', () => { await nextTick(); expect(http.put).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/synonyms/some-synonym-id', + '/internal/app_search/engines/some-engine/synonyms/some-synonym-id', { body: '{"synonyms":["hello","world"]}', } @@ -266,7 +269,7 @@ describe('SynonymsLogic', () => { await nextTick(); expect(http.delete).toHaveBeenCalledWith( - '/api/app_search/engines/some-engine/synonyms/some-synonym-id' + '/internal/app_search/engines/some-engine/synonyms/some-synonym-id' ); expect(SynonymsLogic.actions.onSynonymSetSuccess).toHaveBeenCalledWith( 'Synonym set deleted' diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.ts index fc407dcfc38b3da..123a2e50fdf2f55 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.ts @@ -115,7 +115,7 @@ export const SynonymsLogic = kea> const { engineName } = EngineLogic.values; try { - const response = await http.get(`/api/app_search/engines/${engineName}/synonyms`, { + const response = await http.get(`/internal/app_search/engines/${engineName}/synonyms`, { query: { 'page[current]': meta.page.current, 'page[size]': meta.page.size, @@ -132,7 +132,7 @@ export const SynonymsLogic = kea> clearFlashMessages(); try { - await http.post(`/api/app_search/engines/${engineName}/synonyms`, { + await http.post(`/internal/app_search/engines/${engineName}/synonyms`, { body: JSON.stringify({ synonyms }), }); actions.onSynonymSetSuccess(CREATE_SUCCESS); @@ -147,7 +147,7 @@ export const SynonymsLogic = kea> clearFlashMessages(); try { - await http.put(`/api/app_search/engines/${engineName}/synonyms/${id}`, { + await http.put(`/internal/app_search/engines/${engineName}/synonyms/${id}`, { body: JSON.stringify({ synonyms }), }); actions.onSynonymSetSuccess(UPDATE_SUCCESS); @@ -162,7 +162,7 @@ export const SynonymsLogic = kea> clearFlashMessages(); try { - await http.delete(`/api/app_search/engines/${engineName}/synonyms/${id}`); + await http.delete(`/internal/app_search/engines/${engineName}/synonyms/${id}`); actions.onSynonymSetSuccess(DELETE_SUCCESS); } catch (e) { actions.onSynonymSetError(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts index a73dd075115eed2..555a880d544f487 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts @@ -46,18 +46,21 @@ describe('recursivelyFetchEngines', () => { .mockReturnValueOnce(Promise.resolve(MOCK_PAGE_3)); recursivelyFetchEngines({ - endpoint: '/api/app_search/engines/some-engine/source_engines', + endpoint: '/internal/app_search/engines/some-engine/source_engines', onComplete: MOCK_CALLBACK, }); await nextTick(); expect(http.get).toHaveBeenCalledTimes(3); // Called once for each page - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/source_engines', { - query: { - 'page[current]': 1, - 'page[size]': 25, - }, - }); + expect(http.get).toHaveBeenCalledWith( + '/internal/app_search/engines/some-engine/source_engines', + { + query: { + 'page[current]': 1, + 'page[size]': 25, + }, + } + ); expect(MOCK_CALLBACK).toHaveBeenCalledWith([ { name: 'source-engine-1' }, @@ -68,12 +71,12 @@ describe('recursivelyFetchEngines', () => { it('passes optional query params', () => { recursivelyFetchEngines({ - endpoint: '/api/app_search/engines/some-engine/engines', + endpoint: '/internal/app_search/engines/some-engine/engines', onComplete: MOCK_CALLBACK, query: { type: 'indexed' }, }); - expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/engines', { + expect(http.get).toHaveBeenCalledWith('/internal/app_search/engines/some-engine/engines', { query: { 'page[current]': 1, 'page[size]': 25, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.test.ts index 836705e98da94fb..8e1b59096b18036 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.test.ts @@ -93,7 +93,7 @@ describe('HttpLogic', () => { it('sets errorConnecting to true if the response header is true', async () => { const httpResponse = { - response: { url: '/api/app_search/engines', headers: { get: () => 'true' } }, + response: { url: '/internal/app_search/engines', headers: { get: () => 'true' } }, }; await expect(interceptedResponse(httpResponse)).rejects.toEqual(httpResponse); @@ -102,7 +102,10 @@ describe('HttpLogic', () => { it('sets errorConnecting to false if the response header is false', async () => { const httpResponse = { - response: { url: '/api/workplace_search/overview', headers: { get: () => 'false' } }, + response: { + url: '/internal/workplace_search/overview', + headers: { get: () => 'false' }, + }, }; await expect(interceptedResponse(httpResponse)).rejects.toEqual(httpResponse); @@ -140,7 +143,7 @@ describe('HttpLogic', () => { it('sets readOnlyMode to true if the response header is true', async () => { const httpResponse = { - response: { url: '/api/app_search/engines', headers: { get: () => 'true' } }, + response: { url: '/internal/app_search/engines', headers: { get: () => 'true' } }, }; await expect(interceptedResponse(httpResponse)).resolves.toEqual(httpResponse); @@ -149,7 +152,10 @@ describe('HttpLogic', () => { it('sets readOnlyMode to false if the response header is false', async () => { const httpResponse = { - response: { url: '/api/workplace_search/overview', headers: { get: () => 'false' } }, + response: { + url: '/internal/workplace_search/overview', + headers: { get: () => 'false' }, + }, }; await expect(interceptedResponse(httpResponse)).resolves.toEqual(httpResponse); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.ts index ea3c84c1e053456..d18408a78b0d86e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/http/http_logic.ts @@ -128,5 +128,5 @@ const isEnterpriseSearchApi = (httpResponse: HttpResponse) => { if (!httpResponse.response) return false; // Typically this means Kibana has stopped working, in which case we short-circuit early to prevent errors const { url } = httpResponse.response; - return url.includes('/api/app_search/') || url.includes('/api/workplace_search/'); + return url.includes('/internal/app_search/') || url.includes('/internal/workplace_search/'); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts index d80750d068f2b5a..d8d04427077305c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts @@ -28,7 +28,7 @@ describe('Telemetry logic', () => { product: 'enterprise_search', }); - expect(http.put).toHaveBeenCalledWith('/api/enterprise_search/stats', { + expect(http.put).toHaveBeenCalledWith('/internal/enterprise_search/stats', { headers, body: '{"product":"enterprise_search","action":"viewed","metric":"setup_guide"}', }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.ts index 343eb21bae107d7..cdd2f6e09c0a17b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.ts @@ -37,7 +37,7 @@ export const TelemetryLogic = kea>({ const { http } = HttpLogic.values; try { const body = JSON.stringify({ product, action, metric }); - await http.put('/api/enterprise_search/stats', { headers, body }); + await http.put('/internal/enterprise_search/stats', { headers, body }); } catch (error) { throw new Error('Unable to send telemetry'); } diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts index 950412e84f87053..63eba575f0c37b9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts @@ -308,7 +308,7 @@ describe('AddSourceLogic', () => { const { serviceName, indexPermissions, serviceType } = response; http.get.mockReturnValue(Promise.resolve(response)); AddSourceLogic.actions.saveSourceParams(queryString, params, true); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/sources/create', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/sources/create', { query: { ...params, kibana_host: '', @@ -347,7 +347,7 @@ describe('AddSourceLogic', () => { }) ); AddSourceLogic.actions.saveSourceParams(queryString, params, true); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/sources/create', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/sources/create', { query: { ...params, kibana_host: '', @@ -407,7 +407,7 @@ describe('AddSourceLogic', () => { AddSourceLogic.actions.getSourceConfigData('github'); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/settings/connectors/github' + '/internal/workplace_search/org/settings/connectors/github' ); await nextTick(); expect(setSourceConfigDataSpy).toHaveBeenCalledWith(sourceConfigData); @@ -444,8 +444,10 @@ describe('AddSourceLogic', () => { expect(clearFlashMessages).toHaveBeenCalled(); expect(AddSourceLogic.values.buttonLoading).toEqual(true); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/github/prepare', - { query } + '/internal/workplace_search/org/sources/github/prepare', + { + query, + } ); await nextTick(); expect(setSourceConnectDataSpy).toHaveBeenCalledWith(sourceConnectData); @@ -465,8 +467,10 @@ describe('AddSourceLogic', () => { }; expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/github/prepare', - { query } + '/internal/workplace_search/org/sources/github/prepare', + { + query, + } ); }); @@ -491,7 +495,7 @@ describe('AddSourceLogic', () => { AddSourceLogic.actions.getSourceReConnectData('github'); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/github/reauth_prepare', + '/internal/workplace_search/org/sources/github/reauth_prepare', { query: { kibana_host: '', @@ -523,7 +527,7 @@ describe('AddSourceLogic', () => { AddSourceLogic.actions.getPreContentSourceConfigData(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/pre_sources/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/pre_sources/123'); await nextTick(); expect(setPreContentSourceConfigDataSpy).toHaveBeenCalledWith(config); }); @@ -568,7 +572,7 @@ describe('AddSourceLogic', () => { expect( http.put ).toHaveBeenCalledWith( - `/api/workplace_search/org/settings/connectors/${sourceConfigData.serviceType}`, + `/internal/workplace_search/org/settings/connectors/${sourceConfigData.serviceType}`, { body: JSON.stringify(params) } ); @@ -591,9 +595,12 @@ describe('AddSourceLogic', () => { consumer_key: sourceConfigData.configuredFields?.consumerKey, }; - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/org/settings/connectors', { - body: JSON.stringify(createParams), - }); + expect(http.post).toHaveBeenCalledWith( + '/internal/workplace_search/org/settings/connectors', + { + body: JSON.stringify(createParams), + } + ); }); it('handles error', async () => { @@ -644,7 +651,7 @@ describe('AddSourceLogic', () => { expect(clearFlashMessages).toHaveBeenCalled(); expect(AddSourceLogic.values.buttonLoading).toEqual(true); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/org/create_source', { + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/org/create_source', { body: JSON.stringify({ ...params }), }); await nextTick(); @@ -677,16 +684,19 @@ describe('AddSourceLogic', () => { AddSourceLogic.actions.getSourceConnectData('github', jest.fn()); - expect( - http.get - ).toHaveBeenCalledWith('/api/workplace_search/account/sources/github/prepare', { query }); + expect(http.get).toHaveBeenCalledWith( + '/internal/workplace_search/account/sources/github/prepare', + { + query, + } + ); }); it('getSourceReConnectData', () => { AddSourceLogic.actions.getSourceReConnectData('123'); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/123/reauth_prepare', + '/internal/workplace_search/account/sources/123/reauth_prepare', { query: { kibana_host: '', @@ -699,13 +709,13 @@ describe('AddSourceLogic', () => { mount({ preContentSourceId: '123' }); AddSourceLogic.actions.getPreContentSourceConfigData(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/account/pre_sources/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/account/pre_sources/123'); }); it('createContentSource', () => { AddSourceLogic.actions.createContentSource('github', jest.fn()); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/account/create_source', { + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/account/create_source', { body: JSON.stringify({ service_type: 'github' }), }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts index 0aa7cbcf5f1c709..e63e58adb38e2e3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.ts @@ -393,7 +393,7 @@ export const AddSourceLogic = kea { - const route = `/api/workplace_search/org/settings/connectors/${serviceType}`; + const route = `/internal/workplace_search/org/settings/connectors/${serviceType}`; try { const response = await HttpLogic.values.http.get(route); @@ -408,8 +408,8 @@ export const AddSourceLogic = kea { const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/reauth_prepare` - : `/api/workplace_search/account/sources/${sourceId}/reauth_prepare`; + ? `/internal/workplace_search/org/sources/${sourceId}/reauth_prepare` + : `/internal/workplace_search/account/sources/${sourceId}/reauth_prepare`; const query = { kibana_host: kibanaHost, @@ -449,8 +449,8 @@ export const AddSourceLogic = kea { DisplaySettingsLogic.actions.initializeDisplaySettings(); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/display_settings/config' + '/internal/workplace_search/org/sources/source123/display_settings/config' ); await nextTick(); expect(onInitializeDisplaySettingsSpy).toHaveBeenCalledWith({ @@ -397,7 +397,7 @@ describe('DisplaySettingsLogic', () => { DisplaySettingsLogic.actions.initializeDisplaySettings(); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/display_settings/config' + '/internal/workplace_search/account/sources/source123/display_settings/config' ); await nextTick(); expect(onInitializeDisplaySettingsSpy).toHaveBeenCalledWith({ diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.ts index 28d10b1566b6cb1..2d7667e08d8f859 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.ts @@ -377,8 +377,8 @@ export const DisplaySettingsLogic = kea< } = SourceLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/display_settings/config` - : `/api/workplace_search/account/sources/${sourceId}/display_settings/config`; + ? `/internal/workplace_search/org/sources/${sourceId}/display_settings/config` + : `/internal/workplace_search/account/sources/${sourceId}/display_settings/config`; try { const response = await HttpLogic.values.http.get(route); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts index 142e50d52c9dbb2..549ffe0546d7c1f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts @@ -208,7 +208,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.initializeSchema(); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/schemas' + '/internal/workplace_search/org/sources/source123/schemas' ); await nextTick(); expect(onInitializeSchemaSpy).toHaveBeenCalledWith(serverResponse); @@ -222,7 +222,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.initializeSchema(); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/schemas' + '/internal/workplace_search/account/sources/source123/schemas' ); await nextTick(); expect(onInitializeSchemaSpy).toHaveBeenCalledWith(serverResponse); @@ -254,12 +254,12 @@ describe('SchemaLogic', () => { ); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/schemas' + '/internal/workplace_search/org/sources/source123/schemas' ); await initPromise; expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/reindex_job/123' + '/internal/workplace_search/org/sources/source123/reindex_job/123' ); await promise; @@ -285,12 +285,12 @@ describe('SchemaLogic', () => { ); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/schemas' + '/internal/workplace_search/account/sources/source123/schemas' ); await initPromise; expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/reindex_job/123' + '/internal/workplace_search/account/sources/source123/reindex_job/123' ); await promise; @@ -365,7 +365,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.setServerField(schema, ADD); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/schemas', + '/internal/workplace_search/org/sources/source123/schemas', { body: JSON.stringify({ ...schema }), } @@ -383,7 +383,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.setServerField(schema, ADD); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/schemas', + '/internal/workplace_search/account/sources/source123/schemas', { body: JSON.stringify({ ...schema }), } @@ -424,7 +424,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.setServerField(schema, UPDATE); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/org/sources/source123/schemas', + '/internal/workplace_search/org/sources/source123/schemas', { body: JSON.stringify({ ...schema }), } @@ -442,7 +442,7 @@ describe('SchemaLogic', () => { SchemaLogic.actions.setServerField(schema, UPDATE); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/source123/schemas', + '/internal/workplace_search/account/sources/source123/schemas', { body: JSON.stringify({ ...schema }), } diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.ts index 114d63a3ce14238..173f5df162caa4b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.ts @@ -271,8 +271,8 @@ export const SchemaLogic = kea>({ } = SourceLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/schemas` - : `/api/workplace_search/account/sources/${sourceId}/schemas`; + ? `/internal/workplace_search/org/sources/${sourceId}/schemas` + : `/internal/workplace_search/account/sources/${sourceId}/schemas`; try { const response = await http.get(route); @@ -285,8 +285,8 @@ export const SchemaLogic = kea>({ const { isOrganization } = AppLogic.values; const { http } = HttpLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/reindex_job/${activeReindexJobId}` - : `/api/workplace_search/account/sources/${sourceId}/reindex_job/${activeReindexJobId}`; + ? `/internal/workplace_search/org/sources/${sourceId}/reindex_job/${activeReindexJobId}` + : `/internal/workplace_search/account/sources/${sourceId}/reindex_job/${activeReindexJobId}`; try { await actions.initializeSchema(); @@ -329,8 +329,8 @@ export const SchemaLogic = kea>({ const { sourceId } = values; const successMessage = isAdding ? SCHEMA_FIELD_ADDED_MESSAGE : SCHEMA_UPDATED_MESSAGE; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/schemas` - : `/api/workplace_search/account/sources/${sourceId}/schemas`; + ? `/internal/workplace_search/org/sources/${sourceId}/schemas` + : `/internal/workplace_search/account/sources/${sourceId}/schemas`; const emptyReindexJob = { percentageComplete: 100, diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx index 0276e75e4d2190e..883c8631365ebeb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx @@ -188,7 +188,7 @@ describe('SourceSettings', () => { const wrapper = shallow(); expect(wrapper.find('[data-test-subj="DownloadDiagnosticsButton"]').prop('href')).toEqual( - '/api/workplace_search/org/sources/123/download_diagnostics' + '/internal/workplace_search/org/sources/123/download_diagnostics' ); }); @@ -200,7 +200,7 @@ describe('SourceSettings', () => { const wrapper = shallow(); expect(wrapper.find('[data-test-subj="DownloadDiagnosticsButton"]').prop('href')).toEqual( - '/api/workplace_search/account/sources/123/download_diagnostics' + '/internal/workplace_search/account/sources/123/download_diagnostics' ); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.tsx index 70bfb7509438680..ea12dabb8600132 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.tsx @@ -119,8 +119,10 @@ export const SourceSettings: React.FC = () => { const { clientId, clientSecret, publicKey, consumerKey, baseUrl } = configuredFields || {}; const diagnosticsPath = isOrganization - ? http.basePath.prepend(`/api/workplace_search/org/sources/${id}/download_diagnostics`) - : http.basePath.prepend(`/api/workplace_search/account/sources/${id}/download_diagnostics`); + ? http.basePath.prepend(`/internal/workplace_search/org/sources/${id}/download_diagnostics`) + : http.basePath.prepend( + `/internal/workplace_search/account/sources/${id}/download_diagnostics` + ); const handleNameChange = (e: ChangeEvent) => setValue(e.target.value); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts index adeddb08dcb7996..94ec730ef256c99 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts @@ -136,7 +136,7 @@ describe('SourceLogic', () => { http.get.mockReturnValue(promise); SourceLogic.actions.initializeSource(contentSource.id); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/sources/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/sources/123'); await promise; expect(onInitializeSourceSpy).toHaveBeenCalledWith(contentSource); }); @@ -149,7 +149,7 @@ describe('SourceLogic', () => { http.get.mockReturnValue(promise); SourceLogic.actions.initializeSource(contentSource.id); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/account/sources/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/account/sources/123'); await promise; expect(onInitializeSourceSpy).toHaveBeenCalledWith(contentSource); }); @@ -168,7 +168,7 @@ describe('SourceLogic', () => { http.get.mockReturnValue(promise); SourceLogic.actions.initializeSource(contentSource.id); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/account/sources/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/account/sources/123'); await promise; expect(initializeFederatedSummarySpy).toHaveBeenCalledWith(contentSource.id); }); @@ -233,7 +233,7 @@ describe('SourceLogic', () => { SourceLogic.actions.initializeFederatedSummary(contentSource.id); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/123/federated_summary' + '/internal/workplace_search/account/sources/123/federated_summary' ); await promise; expect(onUpdateSummarySpy).toHaveBeenCalledWith(contentSource.summary); @@ -270,9 +270,12 @@ describe('SourceLogic', () => { http.post.mockReturnValue(promise); await searchContentSourceDocuments({ sourceId: contentSource.id }, mockBreakpoint); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/org/sources/123/documents', { - body: JSON.stringify({ query: '', page: meta.page }), - }); + expect(http.post).toHaveBeenCalledWith( + '/internal/workplace_search/org/sources/123/documents', + { + body: JSON.stringify({ query: '', page: meta.page }), + } + ); await promise; expect(actions.setSearchResults).toHaveBeenCalledWith(searchServerResponse); @@ -286,7 +289,7 @@ describe('SourceLogic', () => { SourceLogic.actions.searchContentSourceDocuments(contentSource.id); await searchContentSourceDocuments({ sourceId: contentSource.id }, mockBreakpoint); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/123/documents', + '/internal/workplace_search/account/sources/123/documents', { body: JSON.stringify({ query: '', page: meta.page }), } @@ -322,9 +325,12 @@ describe('SourceLogic', () => { http.patch.mockReturnValue(promise); SourceLogic.actions.updateContentSource(contentSource.id, contentSource); - expect(http.patch).toHaveBeenCalledWith('/api/workplace_search/org/sources/123/settings', { - body: JSON.stringify({ content_source: contentSource }), - }); + expect(http.patch).toHaveBeenCalledWith( + '/internal/workplace_search/org/sources/123/settings', + { + body: JSON.stringify({ content_source: contentSource }), + } + ); await promise; expect(onUpdateSourceNameSpy).toHaveBeenCalledWith(contentSource.name); }); @@ -337,9 +343,12 @@ describe('SourceLogic', () => { http.patch.mockReturnValue(promise); SourceLogic.actions.updateContentSource(contentSource.id, { indexing: { enabled: true } }); - expect(http.patch).toHaveBeenCalledWith('/api/workplace_search/org/sources/123/settings', { - body: JSON.stringify({ content_source: { indexing: { enabled: true } } }), - }); + expect(http.patch).toHaveBeenCalledWith( + '/internal/workplace_search/org/sources/123/settings', + { + body: JSON.stringify({ content_source: { indexing: { enabled: true } } }), + } + ); await promise; expect(onUpdateSourceNameSpy).not.toHaveBeenCalledWith(contentSource.name); }); @@ -353,7 +362,7 @@ describe('SourceLogic', () => { SourceLogic.actions.updateContentSource(contentSource.id, contentSource); expect(http.patch).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/123/settings', + '/internal/workplace_search/account/sources/123/settings', { body: JSON.stringify({ content_source: contentSource }), } @@ -388,7 +397,7 @@ describe('SourceLogic', () => { SourceLogic.actions.removeContentSource(contentSource.id); expect(clearFlashMessages).toHaveBeenCalled(); - expect(http.delete).toHaveBeenCalledWith('/api/workplace_search/org/sources/123'); + expect(http.delete).toHaveBeenCalledWith('/internal/workplace_search/org/sources/123'); await promise; expect(flashSuccessToast).toHaveBeenCalled(); expect(setButtonNotLoadingSpy).toHaveBeenCalled(); @@ -403,7 +412,7 @@ describe('SourceLogic', () => { SourceLogic.actions.removeContentSource(contentSource.id); expect(clearFlashMessages).toHaveBeenCalled(); - expect(http.delete).toHaveBeenCalledWith('/api/workplace_search/account/sources/123'); + expect(http.delete).toHaveBeenCalledWith('/internal/workplace_search/account/sources/123'); await promise; expect(setButtonNotLoadingSpy).toHaveBeenCalled(); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.ts index 6040f319357d990..5c947b68f23332c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.ts @@ -153,8 +153,8 @@ export const SourceLogic = kea>({ initializeSource: async ({ sourceId }) => { const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}` - : `/api/workplace_search/account/sources/${sourceId}`; + ? `/internal/workplace_search/org/sources/${sourceId}` + : `/internal/workplace_search/account/sources/${sourceId}`; try { const response = await HttpLogic.values.http.get(route); @@ -182,7 +182,7 @@ export const SourceLogic = kea>({ } }, initializeFederatedSummary: async ({ sourceId }) => { - const route = `/api/workplace_search/account/sources/${sourceId}/federated_summary`; + const route = `/internal/workplace_search/account/sources/${sourceId}/federated_summary`; try { const response = await HttpLogic.values.http.get(route); actions.onUpdateSummary(response.summary); @@ -195,8 +195,8 @@ export const SourceLogic = kea>({ const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/documents` - : `/api/workplace_search/account/sources/${sourceId}/documents`; + ? `/internal/workplace_search/org/sources/${sourceId}/documents` + : `/internal/workplace_search/account/sources/${sourceId}/documents`; const { contentFilterValue: query, @@ -215,8 +215,8 @@ export const SourceLogic = kea>({ updateContentSource: async ({ sourceId, source }) => { const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/settings` - : `/api/workplace_search/account/sources/${sourceId}/settings`; + ? `/internal/workplace_search/org/sources/${sourceId}/settings` + : `/internal/workplace_search/account/sources/${sourceId}/settings`; try { const response = await HttpLogic.values.http.patch(route, { @@ -233,8 +233,8 @@ export const SourceLogic = kea>({ clearFlashMessages(); const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}` - : `/api/workplace_search/account/sources/${sourceId}`; + ? `/internal/workplace_search/org/sources/${sourceId}` + : `/internal/workplace_search/account/sources/${sourceId}`; try { const response = await HttpLogic.values.http.delete(route); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts index bc18fade742aa64..53f16a303f70a42 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts @@ -164,7 +164,7 @@ describe('SourcesLogic', () => { http.get.mockReturnValue(promise); SourcesLogic.actions.initializeSources(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/sources'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/sources'); await promise; expect(pollForSourceStatusChangesSpy).toHaveBeenCalled(); expect(onInitializeSourcesSpy).toHaveBeenCalledWith(contentSources); @@ -176,7 +176,7 @@ describe('SourcesLogic', () => { http.get.mockReturnValue(promise); SourcesLogic.actions.initializeSources(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/account/sources'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/account/sources'); }); it('handles error', async () => { @@ -205,9 +205,12 @@ describe('SourcesLogic', () => { http.put.mockReturnValue(promise); SourcesLogic.actions.setSourceSearchability(id, true); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/org/sources/123/searchable', { - body: JSON.stringify({ searchable: true }), - }); + expect(http.put).toHaveBeenCalledWith( + '/internal/workplace_search/org/sources/123/searchable', + { + body: JSON.stringify({ searchable: true }), + } + ); await promise; expect(onSetSearchability).toHaveBeenCalledWith(id, true); }); @@ -219,7 +222,7 @@ describe('SourcesLogic', () => { SourcesLogic.actions.setSourceSearchability(id, true); expect(http.put).toHaveBeenCalledWith( - '/api/workplace_search/account/sources/123/searchable', + '/internal/workplace_search/account/sources/123/searchable', { body: JSON.stringify({ searchable: true }), } @@ -257,7 +260,7 @@ describe('SourcesLogic', () => { jest.advanceTimersByTime(POLLING_INTERVAL); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/sources/status'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/sources/status'); await promise; expect(setServerSourceStatusesSpy).toHaveBeenCalledWith(contentSources); }); @@ -289,7 +292,7 @@ describe('SourcesLogic', () => { http.get.mockReturnValue(promise); fetchSourceStatuses(true); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/sources/status'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/sources/status'); await promise; expect(setServerSourceStatusesSpy).toHaveBeenCalledWith(contentSources); }); @@ -299,7 +302,7 @@ describe('SourcesLogic', () => { http.get.mockReturnValue(promise); fetchSourceStatuses(false); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/account/sources/status'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/account/sources/status'); }); it('handles error', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.ts index 14c79b75dff8e3a..9a88f6238bcc415 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.ts @@ -158,8 +158,8 @@ export const SourcesLogic = kea>( initializeSources: async () => { const { isOrganization } = AppLogic.values; const route = isOrganization - ? '/api/workplace_search/org/sources' - : '/api/workplace_search/account/sources'; + ? '/internal/workplace_search/org/sources' + : '/internal/workplace_search/account/sources'; try { const response = await HttpLogic.values.http.get(route); @@ -194,8 +194,8 @@ export const SourcesLogic = kea>( setSourceSearchability: async ({ sourceId, searchable }) => { const { isOrganization } = AppLogic.values; const route = isOrganization - ? `/api/workplace_search/org/sources/${sourceId}/searchable` - : `/api/workplace_search/account/sources/${sourceId}/searchable`; + ? `/internal/workplace_search/org/sources/${sourceId}/searchable` + : `/internal/workplace_search/account/sources/${sourceId}/searchable`; try { await HttpLogic.values.http.put(route, { @@ -242,8 +242,8 @@ export const SourcesLogic = kea>( export const fetchSourceStatuses = async (isOrganization: boolean) => { const route = isOrganization - ? '/api/workplace_search/org/sources/status' - : '/api/workplace_search/account/sources/status'; + ? '/internal/workplace_search/org/sources/status' + : '/internal/workplace_search/account/sources/status'; let response; try { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts index 6184dada8f11151..088936443ccd349 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts @@ -185,7 +185,7 @@ describe('GroupLogic', () => { http.get.mockReturnValue(Promise.resolve(group)); GroupLogic.actions.initializeGroup(sourceIds[0]); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/groups/123'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/groups/123'); await nextTick(); expect(onInitializeGroupSpy).toHaveBeenCalledWith(group); }); @@ -219,7 +219,7 @@ describe('GroupLogic', () => { http.delete.mockReturnValue(Promise.resolve(true)); GroupLogic.actions.deleteGroup(); - expect(http.delete).toHaveBeenCalledWith('/api/workplace_search/groups/123'); + expect(http.delete).toHaveBeenCalledWith('/internal/workplace_search/groups/123'); await nextTick(); expect(navigateToUrl).toHaveBeenCalledWith(GROUPS_PATH); @@ -246,7 +246,7 @@ describe('GroupLogic', () => { http.put.mockReturnValue(Promise.resolve(group)); GroupLogic.actions.updateGroupName(); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/groups/123', { + expect(http.put).toHaveBeenCalledWith('/internal/workplace_search/groups/123', { body: JSON.stringify({ group: { name: 'new name' } }), }); @@ -277,7 +277,7 @@ describe('GroupLogic', () => { http.post.mockReturnValue(Promise.resolve(group)); GroupLogic.actions.saveGroupSources(); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/groups/123/share', { + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/groups/123/share', { body: JSON.stringify({ content_source_ids: sourceIds }), }); @@ -310,7 +310,7 @@ describe('GroupLogic', () => { http.put.mockReturnValue(Promise.resolve(group)); GroupLogic.actions.saveGroupSourcePrioritization(); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/groups/123/boosts', { + expect(http.put).toHaveBeenCalledWith('/internal/workplace_search/groups/123/boosts', { body: JSON.stringify({ content_source_boosts: [ [sourceIds[0], 1], diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts index f8ec50b309725b8..96b9213d30afc56 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts @@ -174,7 +174,9 @@ export const GroupLogic = kea>({ listeners: ({ actions, values }) => ({ initializeGroup: async ({ groupId }) => { try { - const response = await HttpLogic.values.http.get(`/api/workplace_search/groups/${groupId}`); + const response = await HttpLogic.values.http.get( + `/internal/workplace_search/groups/${groupId}` + ); actions.onInitializeGroup(response); } catch (e) { const NOT_FOUND_MESSAGE = i18n.translate( @@ -196,7 +198,7 @@ export const GroupLogic = kea>({ group: { id, name }, } = values; try { - await HttpLogic.values.http.delete(`/api/workplace_search/groups/${id}`); + await HttpLogic.values.http.delete(`/internal/workplace_search/groups/${id}`); const GROUP_DELETED_MESSAGE = i18n.translate( 'xpack.enterpriseSearch.workplaceSearch.groups.groupDeleted', { @@ -218,9 +220,12 @@ export const GroupLogic = kea>({ } = values; try { - const response = await HttpLogic.values.http.put(`/api/workplace_search/groups/${id}`, { - body: JSON.stringify({ group: { name: groupNameInputValue } }), - }); + const response = await HttpLogic.values.http.put( + `/internal/workplace_search/groups/${id}`, + { + body: JSON.stringify({ group: { name: groupNameInputValue } }), + } + ); actions.onGroupNameChanged(response); const GROUP_RENAMED_MESSAGE = i18n.translate( @@ -243,7 +248,7 @@ export const GroupLogic = kea>({ try { const response = await HttpLogic.values.http.post( - `/api/workplace_search/groups/${id}/share`, + `/internal/workplace_search/groups/${id}/share`, { body: JSON.stringify({ content_source_ids: selectedGroupSources }), } @@ -275,7 +280,7 @@ export const GroupLogic = kea>({ try { const response = await HttpLogic.values.http.put( - `/api/workplace_search/groups/${id}/boosts`, + `/internal/workplace_search/groups/${id}/boosts`, { body: JSON.stringify({ content_source_boosts: boosts }), } diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts index c4a860368ff8be7..c8b725f7131a6ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts @@ -222,7 +222,7 @@ describe('GroupsLogic', () => { http.get.mockReturnValue(Promise.resolve(groupsResponse)); GroupsLogic.actions.initializeGroups(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/groups'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/groups'); await nextTick(); expect(onInitializeGroupsSpy).toHaveBeenCalledWith(groupsResponse); }); @@ -270,7 +270,7 @@ describe('GroupsLogic', () => { GroupsLogic.actions.getSearchResults(); jest.advanceTimersByTime(TIMEOUT); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/groups/search', payload); + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/groups/search', payload); expect(setSearchResultsSpy).toHaveBeenCalledWith(groups); }); @@ -284,7 +284,7 @@ describe('GroupsLogic', () => { // Account for `breakpoint` that debounces filter value. jest.advanceTimersByTime(TIMEOUT); await nextTick(); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/groups/search', payload); + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/groups/search', payload); expect(setSearchResultsSpy).toHaveBeenCalledWith(groups); }); @@ -305,7 +305,7 @@ describe('GroupsLogic', () => { http.get.mockReturnValue(Promise.resolve(users)); GroupsLogic.actions.fetchGroupUsers('123'); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/groups/123/group_users'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/groups/123/group_users'); await nextTick(); expect(setGroupUsersSpy).toHaveBeenCalledWith(users); }); @@ -328,7 +328,7 @@ describe('GroupsLogic', () => { http.post.mockReturnValue(Promise.resolve(groups[0])); GroupsLogic.actions.saveNewGroup(); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/groups', { + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/groups', { body: JSON.stringify({ group_name: GROUP_NAME }), headers, }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts index 36061bc18196b8f..19c16f6147dcca8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts @@ -255,7 +255,7 @@ export const GroupsLogic = kea>({ listeners: ({ actions, values }) => ({ initializeGroups: async () => { try { - const response = await HttpLogic.values.http.get('/api/workplace_search/groups'); + const response = await HttpLogic.values.http.get('/internal/workplace_search/groups'); actions.onInitializeGroups(response); } catch (e) { flashAPIErrors(e); @@ -288,13 +288,16 @@ export const GroupsLogic = kea>({ }; try { - const response = await HttpLogic.values.http.post('/api/workplace_search/groups/search', { - body: JSON.stringify({ - page, - search, - }), - headers, - }); + const response = await HttpLogic.values.http.post( + '/internal/workplace_search/groups/search', + { + body: JSON.stringify({ + page, + search, + }), + headers, + } + ); actions.setSearchResults(response); } catch (e) { @@ -305,7 +308,7 @@ export const GroupsLogic = kea>({ actions.setAllGroupLoading(true); try { const response = await HttpLogic.values.http.get( - `/api/workplace_search/groups/${groupId}/group_users` + `/internal/workplace_search/groups/${groupId}/group_users` ); actions.setGroupUsers(response); } catch (e) { @@ -314,7 +317,7 @@ export const GroupsLogic = kea>({ }, saveNewGroup: async () => { try { - const response = await HttpLogic.values.http.post('/api/workplace_search/groups', { + const response = await HttpLogic.values.http.post('/internal/workplace_search/groups', { body: JSON.stringify({ group_name: values.newGroupName }), headers, }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts index 3d31cb7d88225ea..747feb9bc588004 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts @@ -119,7 +119,7 @@ describe('OAuthAuthorizeLogic', () => { OAuthAuthorizeLogic.actions.initializeOAuthPreAuth(entSearchStateParam); expect(clearFlashMessages).toHaveBeenCalled(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: parsedQueryParams, }); await nextTick(); @@ -130,7 +130,7 @@ describe('OAuthAuthorizeLogic', () => { http.get.mockReturnValue(Promise.resolve(successRedirectResponse)); OAuthAuthorizeLogic.actions.initializeOAuthPreAuth(entSearchStateParam); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: parsedQueryParams, }); await nextTick(); @@ -143,7 +143,7 @@ describe('OAuthAuthorizeLogic', () => { OAuthAuthorizeLogic.actions.initializeOAuthPreAuth(entSearchStateParam); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: parsedQueryParams, }); await nextTick(); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.ts index b63c17538387d6d..e21cde02481a0c9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.ts @@ -48,7 +48,7 @@ interface OAuthAuthorizeActions { setHasError(): void; } -export const oauthAuthorizeRoute = '/api/workplace_search/oauth/authorize'; +export const oauthAuthorizeRoute = '/internal/workplace_search/oauth/authorize'; export const OAuthAuthorizeLogic = kea>({ path: ['enterprise_search', 'workplace_search', 'oauth_authorize_logic'], diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts index 1a4a182636283e3..f10918a1afe2d31 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts @@ -63,7 +63,7 @@ describe('OverviewLogic', () => { await OverviewLogic.actions.initializeOverview(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/overview'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/overview'); expect(setServerDataSpy).toHaveBeenCalled(); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.ts index 1ecd344a451249d..196de02646804b0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.ts @@ -97,7 +97,7 @@ export const OverviewLogic = kea> listeners: ({ actions }) => ({ initializeOverview: async () => { try { - const response = await HttpLogic.values.http.get('/api/workplace_search/overview'); + const response = await HttpLogic.values.http.get('/internal/workplace_search/overview'); actions.setServerData(response); } catch (e) { flashAPIErrors(e); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts index a412411488b8dfe..1cf1adfd00200c1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts @@ -343,7 +343,7 @@ describe('RoleMappingsLogic', () => { expect(RoleMappingsLogic.values.dataLoading).toEqual(true); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/org/role_mappings/enable_role_based_access' + '/internal/workplace_search/org/role_mappings/enable_role_based_access' ); await nextTick(); expect(setRoleMappingsSpy).toHaveBeenCalledWith(mappingsServerProps); @@ -364,7 +364,7 @@ describe('RoleMappingsLogic', () => { http.get.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.initializeRoleMappings(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/role_mappings'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/role_mappings'); await nextTick(); expect(setRoleMappingsDataSpy).toHaveBeenCalledWith(mappingsServerProps); }); @@ -440,7 +440,7 @@ describe('RoleMappingsLogic', () => { http.post.mockReturnValue(Promise.resolve(mappingsServerProps)); RoleMappingsLogic.actions.handleSaveMapping(); - expect(http.post).toHaveBeenCalledWith('/api/workplace_search/org/role_mappings', { + expect(http.post).toHaveBeenCalledWith('/internal/workplace_search/org/role_mappings', { body: JSON.stringify({ roleType: 'admin', allGroups: false, @@ -467,7 +467,7 @@ describe('RoleMappingsLogic', () => { RoleMappingsLogic.actions.handleSaveMapping(); expect(http.put).toHaveBeenCalledWith( - `/api/workplace_search/org/role_mappings/${wsRoleMapping.id}`, + `/internal/workplace_search/org/role_mappings/${wsRoleMapping.id}`, { body: JSON.stringify({ roleType: 'admin', @@ -524,7 +524,7 @@ describe('RoleMappingsLogic', () => { RoleMappingsLogic.actions.handleSaveUser(); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/org/single_user_role_mapping', + '/internal/workplace_search/org/single_user_role_mapping', { body: JSON.stringify({ roleMapping: { @@ -558,7 +558,7 @@ describe('RoleMappingsLogic', () => { RoleMappingsLogic.actions.handleSaveUser(); expect(http.post).toHaveBeenCalledWith( - '/api/workplace_search/org/single_user_role_mapping', + '/internal/workplace_search/org/single_user_role_mapping', { body: JSON.stringify({ roleMapping: { @@ -614,7 +614,7 @@ describe('RoleMappingsLogic', () => { RoleMappingsLogic.actions.handleDeleteMapping(roleMappingId); expect(http.delete).toHaveBeenCalledWith( - `/api/workplace_search/org/role_mappings/${roleMappingId}` + `/internal/workplace_search/org/role_mappings/${roleMappingId}` ); await nextTick(); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.ts index 29b448bc0684a02..64cec5100164709 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.ts @@ -354,7 +354,7 @@ export const RoleMappingsLogic = kea ({ enableRoleBasedAccess: async () => { const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/role_mappings/enable_role_based_access'; + const route = '/internal/workplace_search/org/role_mappings/enable_role_based_access'; try { const response = await http.post(route); @@ -365,7 +365,7 @@ export const RoleMappingsLogic = kea { const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/role_mappings'; + const route = '/internal/workplace_search/org/role_mappings'; try { const response = await http.get(route); @@ -392,7 +392,7 @@ export const RoleMappingsLogic = kea { const { http } = HttpLogic.values; - const route = `/api/workplace_search/org/role_mappings/${roleMappingId}`; + const route = `/internal/workplace_search/org/role_mappings/${roleMappingId}`; try { await http.delete(route); @@ -425,8 +425,8 @@ export const RoleMappingsLogic = kea { SearchAuthorizeLogic.actions.initializeSearchAuth(searchOAuth, entSearchStateParam); expect(clearFlashMessages).toHaveBeenCalled(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: preAuthQuery, }); await nextTick(); @@ -84,7 +84,7 @@ describe('SearchAuthorizeLogic', () => { http.get.mockReturnValue(Promise.resolve(successRedirectResponse)); SearchAuthorizeLogic.actions.initializeSearchAuth(searchOAuth, entSearchStateParam); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: preAuthQuery, }); await nextTick(); @@ -100,7 +100,7 @@ describe('SearchAuthorizeLogic', () => { SearchAuthorizeLogic.actions.initializeSearchAuth(searchOAuth, entSearchStateParam); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/oauth/authorize', { + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/oauth/authorize', { query: preAuthQuery, }); await nextTick(); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts index ecb97cea528b949..bc45609e9e83d58 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts @@ -118,7 +118,7 @@ describe('SecurityLogic', () => { SecurityLogic.actions.initializeSourceRestrictions(); expect(http.get).toHaveBeenCalledWith( - '/api/workplace_search/org/security/source_restrictions' + '/internal/workplace_search/org/security/source_restrictions' ); await nextTick(); expect(setServerPropsSpy).toHaveBeenCalledWith(serverProps); @@ -143,7 +143,7 @@ describe('SecurityLogic', () => { SecurityLogic.actions.saveSourceRestrictions(); expect(http.patch).toHaveBeenCalledWith( - '/api/workplace_search/org/security/source_restrictions', + '/internal/workplace_search/org/security/source_restrictions', { body: JSON.stringify(serverProps), } diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.ts index 2d5c2d5a212c9fa..e06504edbf0acf3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.ts @@ -60,7 +60,7 @@ interface SecurityActions { resetState(): void; } -const route = '/api/workplace_search/org/security/source_restrictions'; +const route = '/internal/workplace_search/org/security/source_restrictions'; export const SecurityLogic = kea>({ path: ['enterprise_search', 'workplace_search', 'security_logic'], diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts index e56b1df1ab873c8..ebb790b59c1fa35 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts @@ -122,7 +122,7 @@ describe('SettingsLogic', () => { http.get.mockReturnValue(Promise.resolve(configuredSources)); SettingsLogic.actions.initializeSettings(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/settings'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/settings'); await nextTick(); expect(setServerPropsSpy).toHaveBeenCalledWith(configuredSources); }); @@ -145,7 +145,7 @@ describe('SettingsLogic', () => { http.get.mockReturnValue(Promise.resolve(serverProps)); SettingsLogic.actions.initializeConnectors(); - expect(http.get).toHaveBeenCalledWith('/api/workplace_search/org/settings/connectors'); + expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/org/settings/connectors'); await nextTick(); expect(onInitializeConnectorsSpy).toHaveBeenCalledWith(serverProps); }); @@ -168,7 +168,7 @@ describe('SettingsLogic', () => { SettingsLogic.actions.updateOrgName(); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/org/settings/customize', { + expect(http.put).toHaveBeenCalledWith('/internal/workplace_search/org/settings/customize', { body: JSON.stringify({ name: NAME }), }); await nextTick(); @@ -194,9 +194,12 @@ describe('SettingsLogic', () => { SettingsLogic.actions.updateOrgIcon(); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/org/settings/upload_images', { - body: JSON.stringify({ icon: ICON }), - }); + expect(http.put).toHaveBeenCalledWith( + '/internal/workplace_search/org/settings/upload_images', + { + body: JSON.stringify({ icon: ICON }), + } + ); await nextTick(); expect(flashSuccessToast).toHaveBeenCalledWith(ORG_UPDATED_MESSAGE); expect(setIconSpy).toHaveBeenCalledWith(ICON); @@ -220,9 +223,12 @@ describe('SettingsLogic', () => { SettingsLogic.actions.updateOrgLogo(); - expect(http.put).toHaveBeenCalledWith('/api/workplace_search/org/settings/upload_images', { - body: JSON.stringify({ logo: LOGO }), - }); + expect(http.put).toHaveBeenCalledWith( + '/internal/workplace_search/org/settings/upload_images', + { + body: JSON.stringify({ logo: LOGO }), + } + ); await nextTick(); expect(flashSuccessToast).toHaveBeenCalledWith(ORG_UPDATED_MESSAGE); expect(setLogoSpy).toHaveBeenCalledWith(LOGO); @@ -273,7 +279,7 @@ describe('SettingsLogic', () => { expect(clearFlashMessages).toHaveBeenCalled(); expect(http.put).toHaveBeenCalledWith( - '/api/workplace_search/org/settings/oauth_application', + '/internal/workplace_search/org/settings/oauth_application', { body: JSON.stringify({ oauth_application: { name, confidential, redirect_uri: redirectUri }, diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.ts index 886f81129ee17a5..4faaca58ab8a072 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.ts @@ -84,7 +84,7 @@ interface SettingsValues { iconButtonLoading: boolean; } -const imageRoute = '/api/workplace_search/org/settings/upload_images'; +const imageRoute = '/internal/workplace_search/org/settings/upload_images'; export const SettingsLogic = kea>({ actions: { @@ -197,7 +197,7 @@ export const SettingsLogic = kea> listeners: ({ actions, values }) => ({ initializeSettings: async () => { const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/settings'; + const route = '/internal/workplace_search/org/settings'; try { const response = await http.get(route); @@ -208,7 +208,7 @@ export const SettingsLogic = kea> }, initializeConnectors: async () => { const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/settings/connectors'; + const route = '/internal/workplace_search/org/settings/connectors'; try { const response = await http.get(route); @@ -220,7 +220,7 @@ export const SettingsLogic = kea> updateOrgName: async () => { clearFlashMessages(); const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/settings/customize'; + const route = '/internal/workplace_search/org/settings/customize'; const { orgNameInputValue: name } = values; const body = JSON.stringify({ name }); @@ -265,7 +265,7 @@ export const SettingsLogic = kea> }, updateOauthApplication: async () => { const { http } = HttpLogic.values; - const route = '/api/workplace_search/org/settings/oauth_application'; + const route = '/internal/workplace_search/org/settings/oauth_application'; const oauthApplication = values.oauthApplication || ({} as IOauthApplication); const { name, redirectUri, confidential } = oauthApplication; const body = JSON.stringify({ @@ -284,7 +284,7 @@ export const SettingsLogic = kea> }, deleteSourceConfig: async ({ serviceType, name }) => { const { http } = HttpLogic.values; - const route = `/api/workplace_search/org/settings/connectors/${serviceType}`; + const route = `/internal/workplace_search/org/settings/connectors/${serviceType}`; try { await http.delete(route); diff --git a/x-pack/plugins/enterprise_search/public/plugin.ts b/x-pack/plugins/enterprise_search/public/plugin.ts index 0ca878882b0621f..115e0e0875543e3 100644 --- a/x-pack/plugins/enterprise_search/public/plugin.ts +++ b/x-pack/plugins/enterprise_search/public/plugin.ts @@ -191,7 +191,7 @@ export class EnterpriseSearchPlugin implements Plugin { if (this.hasInitialized) return; // We've already made an initial call try { - this.data = await http.get('/api/enterprise_search/config_data'); + this.data = await http.get('/internal/enterprise_search/config_data'); this.hasInitialized = true; } catch { this.data.errorConnecting = true; diff --git a/x-pack/plugins/enterprise_search/server/__mocks__/router.mock.ts b/x-pack/plugins/enterprise_search/server/__mocks__/router.mock.ts index 5c19ca7062b65b2..43a08aa90ce6f7c 100644 --- a/x-pack/plugins/enterprise_search/server/__mocks__/router.mock.ts +++ b/x-pack/plugins/enterprise_search/server/__mocks__/router.mock.ts @@ -97,7 +97,7 @@ export class MockRouter { */ // const mockRouter = new MockRouter({ // method: 'get', -// path: '/api/app_search/test', +// path: '/internal/app_search/test', // }); // // beforeEach(() => { diff --git a/x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts b/x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts index ab5bbc994a1037a..87defff89bad4ab 100644 --- a/x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts +++ b/x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts @@ -38,7 +38,7 @@ interface ConfigWithoutBodyOptions * * Example: * router.put({ - * path: '/api/app_search/engines/{engineName}/example', + * path: '/internal/app_search/engines/{engineName}/example', * validate: { * params: schema.object({ * engineName: schema.string(), @@ -52,7 +52,7 @@ interface ConfigWithoutBodyOptions * This helper applies that pattern, while maintaining existing options: * * router.put(skipBodyValidation({ - * path: '/api/app_search/engines/{engineName}/example', + * path: '/internal/app_search/engines/{engineName}/example', * validate: { * params: schema.object({ * engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.test.ts index 8e4a7dba165b103..c0313876f400733 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerAnalyticsRoutes } from './analytics'; describe('analytics routes', () => { - describe('GET /api/app_search/engines/{engineName}/analytics/queries', () => { + describe('GET /internal/app_search/engines/{engineName}/analytics/queries', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/analytics/queries', + path: '/internal/app_search/engines/{engineName}/analytics/queries', }); registerAnalyticsRoutes({ @@ -62,14 +62,14 @@ describe('analytics routes', () => { }); }); - describe('GET /api/app_search/engines/{engineName}/analytics/queries/{query}', () => { + describe('GET /internal/app_search/engines/{engineName}/analytics/queries/{query}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/analytics/queries/{query}', + path: '/internal/app_search/engines/{engineName}/analytics/queries/{query}', }); registerAnalyticsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.ts index cce6c59bb90d71d..f6a03ad5674eb00 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/analytics.ts @@ -25,7 +25,7 @@ export function registerAnalyticsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/analytics/queries', + path: '/internal/app_search/engines/{engineName}/analytics/queries', validate: { params: schema.object({ engineName: schema.string(), @@ -40,7 +40,7 @@ export function registerAnalyticsRoutes({ router.get( { - path: '/api/app_search/engines/{engineName}/analytics/queries/{query}', + path: '/internal/app_search/engines/{engineName}/analytics/queries/{query}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.test.ts index 3152b371c2fbb09..9d2fb6d292e3125 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerApiLogsRoutes } from './api_logs'; describe('API logs routes', () => { - describe('GET /api/app_search/engines/{engineName}/api_logs', () => { + describe('GET /internal/app_search/engines/{engineName}/api_logs', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/api_logs', + path: '/internal/app_search/engines/{engineName}/api_logs', }); registerApiLogsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.ts index d57ecb29294beb3..e0803ade141d33e 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/api_logs.ts @@ -15,7 +15,7 @@ export function registerApiLogsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/api_logs', + path: '/internal/app_search/engines/{engineName}/api_logs', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts index d50d7b7cee22560..5dff1b934ae5a4c 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts @@ -10,14 +10,14 @@ import { mockDependencies, mockRequestHandler, MockRouter } from '../../__mocks_ import { registerCrawlerRoutes } from './crawler'; describe('crawler routes', () => { - describe('GET /api/app_search/engines/{name}/crawler', () => { + describe('GET /internal/app_search/engines/{name}/crawler', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/crawler', + path: '/internal/app_search/engines/{name}/crawler', }); registerCrawlerRoutes({ @@ -43,14 +43,14 @@ describe('crawler routes', () => { }); }); - describe('GET /api/app_search/engines/{name}/crawler/crawl_requests', () => { + describe('GET /internal/app_search/engines/{name}/crawler/crawl_requests', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/crawler/crawl_requests', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests', }); registerCrawlerRoutes({ @@ -76,14 +76,14 @@ describe('crawler routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/crawler/crawl_requests', () => { + describe('POST /internal/app_search/engines/{name}/crawler/crawl_requests', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{name}/crawler/crawl_requests', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests', }); registerCrawlerRoutes({ @@ -109,14 +109,14 @@ describe('crawler routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/crawler/crawl_requests/cancel', () => { + describe('POST /internal/app_search/engines/{name}/crawler/crawl_requests/cancel', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{name}/crawler/crawl_requests/cancel', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests/cancel', }); registerCrawlerRoutes({ @@ -142,14 +142,14 @@ describe('crawler routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/crawler/domains', () => { + describe('POST /internal/app_search/engines/{name}/crawler/domains', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{name}/crawler/domains', + path: '/internal/app_search/engines/{name}/crawler/domains', }); registerCrawlerRoutes({ @@ -198,14 +198,14 @@ describe('crawler routes', () => { }); }); - describe('DELETE /api/app_search/engines/{name}/crawler/domains/{id}', () => { + describe('DELETE /internal/app_search/engines/{name}/crawler/domains/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', }); registerCrawlerRoutes({ @@ -244,14 +244,14 @@ describe('crawler routes', () => { }); }); - describe('PUT /api/app_search/engines/{name}/crawler/domains/{id}', () => { + describe('PUT /internal/app_search/engines/{name}/crawler/domains/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', }); registerCrawlerRoutes({ @@ -302,14 +302,14 @@ describe('crawler routes', () => { }); }); - describe('GET /api/app_search/engines/{name}/crawler/domains/{id}', () => { + describe('GET /internal/app_search/engines/{name}/crawler/domains/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', }); registerCrawlerRoutes({ @@ -340,14 +340,14 @@ describe('crawler routes', () => { }); }); - describe('POST /api/app_search/crawler/validate_url', () => { + describe('POST /internal/app_search/crawler/validate_url', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/crawler/validate_url', + path: '/internal/app_search/crawler/validate_url', }); registerCrawlerRoutes({ @@ -377,14 +377,14 @@ describe('crawler routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/crawler/process_crawls', () => { + describe('POST /internal/app_search/engines/{name}/crawler/process_crawls', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{name}/crawler/process_crawls', + path: '/internal/app_search/engines/{name}/crawler/process_crawls', }); registerCrawlerRoutes({ @@ -424,14 +424,14 @@ describe('crawler routes', () => { }); }); - describe('GET /api/app_search/engines/{name}/crawler/crawl_schedule', () => { + describe('GET /internal/app_search/engines/{name}/crawler/crawl_schedule', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', }); registerCrawlerRoutes({ @@ -461,14 +461,14 @@ describe('crawler routes', () => { }); }); - describe('PUT /api/app_search/engines/{name}/crawler/crawl_schedule', () => { + describe('PUT /internal/app_search/engines/{name}/crawler/crawl_schedule', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', }); registerCrawlerRoutes({ @@ -516,14 +516,14 @@ describe('crawler routes', () => { }); }); - describe('DELETE /api/app_search/engines/{name}/crawler/crawl_schedule', () => { + describe('DELETE /internal/app_search/engines/{name}/crawler/crawl_schedule', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', }); registerCrawlerRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts index cf90ffdea412a77..72a48a013636ca1 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts @@ -15,7 +15,7 @@ export function registerCrawlerRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{name}/crawler', + path: '/internal/app_search/engines/{name}/crawler', validate: { params: schema.object({ name: schema.string(), @@ -29,7 +29,7 @@ export function registerCrawlerRoutes({ router.get( { - path: '/api/app_search/engines/{name}/crawler/crawl_requests', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests', validate: { params: schema.object({ name: schema.string(), @@ -43,7 +43,7 @@ export function registerCrawlerRoutes({ router.post( { - path: '/api/app_search/engines/{name}/crawler/crawl_requests', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests', validate: { params: schema.object({ name: schema.string(), @@ -57,7 +57,7 @@ export function registerCrawlerRoutes({ router.post( { - path: '/api/app_search/engines/{name}/crawler/crawl_requests/cancel', + path: '/internal/app_search/engines/{name}/crawler/crawl_requests/cancel', validate: { params: schema.object({ name: schema.string(), @@ -71,7 +71,7 @@ export function registerCrawlerRoutes({ router.post( { - path: '/api/app_search/engines/{name}/crawler/domains', + path: '/internal/app_search/engines/{name}/crawler/domains', validate: { params: schema.object({ name: schema.string(), @@ -96,7 +96,7 @@ export function registerCrawlerRoutes({ router.get( { - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', validate: { params: schema.object({ name: schema.string(), @@ -111,7 +111,7 @@ export function registerCrawlerRoutes({ router.delete( { - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', validate: { params: schema.object({ name: schema.string(), @@ -129,7 +129,7 @@ export function registerCrawlerRoutes({ router.put( { - path: '/api/app_search/engines/{name}/crawler/domains/{id}', + path: '/internal/app_search/engines/{name}/crawler/domains/{id}', validate: { params: schema.object({ name: schema.string(), @@ -156,7 +156,7 @@ export function registerCrawlerRoutes({ router.post( { - path: '/api/app_search/crawler/validate_url', + path: '/internal/app_search/crawler/validate_url', validate: { body: schema.object({ url: schema.string(), @@ -171,7 +171,7 @@ export function registerCrawlerRoutes({ router.post( { - path: '/api/app_search/engines/{name}/crawler/process_crawls', + path: '/internal/app_search/engines/{name}/crawler/process_crawls', validate: { params: schema.object({ name: schema.string(), @@ -188,7 +188,7 @@ export function registerCrawlerRoutes({ router.get( { - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', validate: { params: schema.object({ name: schema.string(), @@ -202,7 +202,7 @@ export function registerCrawlerRoutes({ router.put( { - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', validate: { params: schema.object({ name: schema.string(), @@ -220,7 +220,7 @@ export function registerCrawlerRoutes({ router.delete( { - path: '/api/app_search/engines/{name}/crawler/crawl_schedule', + path: '/internal/app_search/engines/{name}/crawler/crawl_schedule', validate: { params: schema.object({ name: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.test.ts index ec131c7cd198186..db554d1cec93fba 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.test.ts @@ -10,14 +10,14 @@ import { mockDependencies, mockRequestHandler, MockRouter } from '../../__mocks_ import { registerCrawlerCrawlRulesRoutes } from './crawler_crawl_rules'; describe('crawler crawl rules routes', () => { - describe('POST /api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', () => { + describe('POST /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', }); registerCrawlerCrawlRulesRoutes({ @@ -53,7 +53,7 @@ describe('crawler crawl rules routes', () => { }); }); - describe('PUT /api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', () => { + describe('PUT /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -61,7 +61,7 @@ describe('crawler crawl rules routes', () => { mockRouter = new MockRouter({ method: 'put', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', }); registerCrawlerCrawlRulesRoutes({ @@ -98,7 +98,7 @@ describe('crawler crawl rules routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -106,7 +106,7 @@ describe('crawler crawl rules routes', () => { mockRouter = new MockRouter({ method: 'delete', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', }); registerCrawlerCrawlRulesRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.ts index 9367ba44925580d..a360129b0752333 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_crawl_rules.ts @@ -15,7 +15,7 @@ export function registerCrawlerCrawlRulesRoutes({ }: RouteDependencies) { router.post( { - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules', validate: { params: schema.object({ engineName: schema.string(), @@ -39,7 +39,7 @@ export function registerCrawlerCrawlRulesRoutes({ router.put( { path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', validate: { params: schema.object({ engineName: schema.string(), @@ -65,7 +65,7 @@ export function registerCrawlerCrawlRulesRoutes({ router.delete( { path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/crawl_rules/{crawlRuleId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.test.ts index cdfb397b47c7e70..d59a8e32045ecc5 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.test.ts @@ -10,14 +10,14 @@ import { mockDependencies, mockRequestHandler, MockRouter } from '../../__mocks_ import { registerCrawlerEntryPointRoutes } from './crawler_entry_points'; describe('crawler entry point routes', () => { - describe('POST /api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', () => { + describe('POST /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', }); registerCrawlerEntryPointRoutes({ @@ -51,7 +51,7 @@ describe('crawler entry point routes', () => { }); }); - describe('PUT /api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', () => { + describe('PUT /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -59,7 +59,7 @@ describe('crawler entry point routes', () => { mockRouter = new MockRouter({ method: 'put', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', }); registerCrawlerEntryPointRoutes({ @@ -93,7 +93,7 @@ describe('crawler entry point routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -101,7 +101,7 @@ describe('crawler entry point routes', () => { mockRouter = new MockRouter({ method: 'delete', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', }); registerCrawlerEntryPointRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.ts index 88cb58f70953c9a..224a79bbf6cb801 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_entry_points.ts @@ -15,7 +15,7 @@ export function registerCrawlerEntryPointRoutes({ }: RouteDependencies) { router.post( { - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points', validate: { params: schema.object({ engineName: schema.string(), @@ -37,7 +37,7 @@ export function registerCrawlerEntryPointRoutes({ router.put( { path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', validate: { params: schema.object({ engineName: schema.string(), @@ -60,7 +60,7 @@ export function registerCrawlerEntryPointRoutes({ router.delete( { path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/entry_points/{entryPointId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.test.ts index 21ff58e2d85efbd..88fef87e604700f 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.test.ts @@ -10,14 +10,14 @@ import { mockDependencies, mockRequestHandler, MockRouter } from '../../__mocks_ import { registerCrawlerSitemapRoutes } from './crawler_sitemaps'; describe('crawler sitemap routes', () => { - describe('POST /api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', () => { + describe('POST /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', }); registerCrawlerSitemapRoutes({ @@ -51,7 +51,7 @@ describe('crawler sitemap routes', () => { }); }); - describe('PUT /api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', () => { + describe('PUT /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -59,7 +59,7 @@ describe('crawler sitemap routes', () => { mockRouter = new MockRouter({ method: 'put', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', }); registerCrawlerSitemapRoutes({ @@ -93,7 +93,7 @@ describe('crawler sitemap routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -101,7 +101,7 @@ describe('crawler sitemap routes', () => { mockRouter = new MockRouter({ method: 'delete', path: - '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', }); registerCrawlerSitemapRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.ts index ab4c390243d377a..c3ae90349b95aca 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler_sitemaps.ts @@ -15,7 +15,7 @@ export function registerCrawlerSitemapRoutes({ }: RouteDependencies) { router.post( { - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', + path: '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps', validate: { params: schema.object({ engineName: schema.string(), @@ -36,7 +36,8 @@ export function registerCrawlerSitemapRoutes({ router.put( { - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', + path: + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', validate: { params: schema.object({ engineName: schema.string(), @@ -58,7 +59,8 @@ export function registerCrawlerSitemapRoutes({ router.delete( { - path: '/api/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', + path: + '/internal/app_search/engines/{engineName}/crawler/domains/{domainId}/sitemaps/{sitemapId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.test.ts index 18fce922e470d66..292d9200f2a4edb 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerCredentialsRoutes } from './credentials'; describe('credentials routes', () => { - describe('GET /api/app_search/credentials', () => { + describe('GET /internal/app_search/credentials', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/credentials', + path: '/internal/app_search/credentials', }); registerCredentialsRoutes({ @@ -50,14 +50,14 @@ describe('credentials routes', () => { }); }); - describe('POST /api/app_search/credentials', () => { + describe('POST /internal/app_search/credentials', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/credentials', + path: '/internal/app_search/credentials', }); registerCredentialsRoutes({ @@ -162,14 +162,14 @@ describe('credentials routes', () => { }); }); - describe('GET /api/app_search/credentials/details', () => { + describe('GET /internal/app_search/credentials/details', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/credentials/details', + path: '/internal/app_search/credentials/details', }); registerCredentialsRoutes({ @@ -185,14 +185,14 @@ describe('credentials routes', () => { }); }); - describe('PUT /api/app_search/credentials/{name}', () => { + describe('PUT /internal/app_search/credentials/{name}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/credentials/{name}', + path: '/internal/app_search/credentials/{name}', }); registerCredentialsRoutes({ @@ -297,14 +297,14 @@ describe('credentials routes', () => { }); }); - describe('DELETE /api/app_search/credentials/{name}', () => { + describe('DELETE /internal/app_search/credentials/{name}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/credentials/{name}', + path: '/internal/app_search/credentials/{name}', }); registerCredentialsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.ts index 22edb16f0aca65e..b1916479a39ac43 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/credentials.ts @@ -37,7 +37,7 @@ export function registerCredentialsRoutes({ // Credentials API router.get( { - path: '/api/app_search/credentials', + path: '/internal/app_search/credentials', validate: { query: schema.object({ 'page[current]': schema.number(), @@ -51,7 +51,7 @@ export function registerCredentialsRoutes({ ); router.post( { - path: '/api/app_search/credentials', + path: '/internal/app_search/credentials', validate: { body: tokenSchema, }, @@ -64,7 +64,7 @@ export function registerCredentialsRoutes({ // TODO: It would be great to remove this someday router.get( { - path: '/api/app_search/credentials/details', + path: '/internal/app_search/credentials/details', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -75,7 +75,7 @@ export function registerCredentialsRoutes({ // Single credential API router.put( { - path: '/api/app_search/credentials/{name}', + path: '/internal/app_search/credentials/{name}', validate: { params: schema.object({ name: schema.string(), @@ -89,7 +89,7 @@ export function registerCredentialsRoutes({ ); router.delete( { - path: '/api/app_search/credentials/{name}', + path: '/internal/app_search/credentials/{name}', validate: { params: schema.object({ name: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/curations.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/curations.test.ts index 08e123a98cd3142..b930b449e97d1f6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/curations.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/curations.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerCurationsRoutes } from './curations'; describe('curations routes', () => { - describe('GET /api/app_search/engines/{engineName}/curations', () => { + describe('GET /internal/app_search/engines/{engineName}/curations', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/curations', + path: '/internal/app_search/engines/{engineName}/curations', }); registerCurationsRoutes({ @@ -50,14 +50,14 @@ describe('curations routes', () => { }); }); - describe('POST /api/app_search/engines/{engineName}/curations', () => { + describe('POST /internal/app_search/engines/{engineName}/curations', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/curations', + path: '/internal/app_search/engines/{engineName}/curations', }); registerCurationsRoutes({ @@ -107,14 +107,14 @@ describe('curations routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/curations/{curationId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/curations/{curationId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', }); registerCurationsRoutes({ @@ -130,14 +130,14 @@ describe('curations routes', () => { }); }); - describe('GET /api/app_search/engines/{engineName}/curations/{curationId}', () => { + describe('GET /internal/app_search/engines/{engineName}/curations/{curationId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', }); registerCurationsRoutes({ @@ -153,14 +153,14 @@ describe('curations routes', () => { }); }); - describe('PUT /api/app_search/engines/{engineName}/curations/{curationId}', () => { + describe('PUT /internal/app_search/engines/{engineName}/curations/{curationId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', }); registerCurationsRoutes({ @@ -195,14 +195,14 @@ describe('curations routes', () => { }); }); - describe('GET /api/app_search/engines/{engineName}/curations/find_or_create', () => { + describe('GET /internal/app_search/engines/{engineName}/curations/find_or_create', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/curations/find_or_create', + path: '/internal/app_search/engines/{engineName}/curations/find_or_create', }); registerCurationsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/curations.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/curations.ts index 83c40b0fbc3d47a..b6ef8c8acafa5d3 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/curations.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/curations.ts @@ -15,7 +15,7 @@ export function registerCurationsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/curations', + path: '/internal/app_search/engines/{engineName}/curations', validate: { params: schema.object({ engineName: schema.string(), @@ -33,7 +33,7 @@ export function registerCurationsRoutes({ router.post( { - path: '/api/app_search/engines/{engineName}/curations', + path: '/internal/app_search/engines/{engineName}/curations', validate: { params: schema.object({ engineName: schema.string(), @@ -50,7 +50,7 @@ export function registerCurationsRoutes({ router.delete( { - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', validate: { params: schema.object({ engineName: schema.string(), @@ -65,7 +65,7 @@ export function registerCurationsRoutes({ router.get( { - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', validate: { query: schema.object({ skip_record_analytics: schema.string(), @@ -83,7 +83,7 @@ export function registerCurationsRoutes({ router.put( { - path: '/api/app_search/engines/{engineName}/curations/{curationId}', + path: '/internal/app_search/engines/{engineName}/curations/{curationId}', validate: { params: schema.object({ engineName: schema.string(), @@ -104,7 +104,7 @@ export function registerCurationsRoutes({ router.get( { - path: '/api/app_search/engines/{engineName}/curations/find_or_create', + path: '/internal/app_search/engines/{engineName}/curations/find_or_create', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/documents.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/documents.test.ts index b584412a7a8f37c..efccb5d3f6e3cc2 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/documents.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/documents.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerDocumentsRoutes, registerDocumentRoutes } from './documents'; describe('documents routes', () => { - describe('POST /api/app_search/engines/{engineName}/documents', () => { + describe('POST /internal/app_search/engines/{engineName}/documents', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/documents', + path: '/internal/app_search/engines/{engineName}/documents', }); registerDocumentsRoutes({ @@ -35,14 +35,14 @@ describe('documents routes', () => { }); describe('document routes', () => { - describe('GET /api/app_search/engines/{engineName}/documents/{documentId}', () => { + describe('GET /internal/app_search/engines/{engineName}/documents/{documentId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/documents/{documentId}', + path: '/internal/app_search/engines/{engineName}/documents/{documentId}', }); registerDocumentRoutes({ @@ -58,14 +58,14 @@ describe('document routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/documents/{documentId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/documents/{documentId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{engineName}/documents/{documentId}', + path: '/internal/app_search/engines/{engineName}/documents/{documentId}', }); registerDocumentRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/documents.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/documents.ts index 929e9f7aef69034..f0af2fb35181379 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/documents.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/documents.ts @@ -17,7 +17,7 @@ export function registerDocumentsRoutes({ }: RouteDependencies) { router.post( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/documents', + path: '/internal/app_search/engines/{engineName}/documents', validate: { params: schema.object({ engineName: schema.string(), @@ -36,7 +36,7 @@ export function registerDocumentRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/documents/{documentId}', + path: '/internal/app_search/engines/{engineName}/documents/{documentId}', validate: { params: schema.object({ engineName: schema.string(), @@ -50,7 +50,7 @@ export function registerDocumentRoutes({ ); router.delete( { - path: '/api/app_search/engines/{engineName}/documents/{documentId}', + path: '/internal/app_search/engines/{engineName}/documents/{documentId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/engines.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/engines.test.ts index c653cad5c1c0d7e..7c8a611cebb3ea6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/engines.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/engines.test.ts @@ -10,7 +10,7 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerEnginesRoutes } from './engines'; describe('engine routes', () => { - describe('GET /api/app_search/engines', () => { + describe('GET /internal/app_search/engines', () => { const mockRequest = { query: { type: 'indexed', @@ -25,7 +25,7 @@ describe('engine routes', () => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines', + path: '/internal/app_search/engines', }); registerEnginesRoutes({ @@ -98,14 +98,14 @@ describe('engine routes', () => { }); }); - describe('POST /api/app_search/engines', () => { + describe('POST /internal/app_search/engines', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines', + path: '/internal/app_search/engines', }); registerEnginesRoutes({ @@ -176,14 +176,14 @@ describe('engine routes', () => { }); }); - describe('GET /api/app_search/engines/{name}', () => { + describe('GET /internal/app_search/engines/{name}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}', + path: '/internal/app_search/engines/{name}', }); registerEnginesRoutes({ @@ -199,14 +199,14 @@ describe('engine routes', () => { }); }); - describe('DELETE /api/app_search/engines/{name}', () => { + describe('DELETE /internal/app_search/engines/{name}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{name}', + path: '/internal/app_search/engines/{name}', }); registerEnginesRoutes({ @@ -237,14 +237,14 @@ describe('engine routes', () => { }); }); - describe('GET /api/app_search/engines/{name}/overview', () => { + describe('GET /internal/app_search/engines/{name}/overview', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/overview', + path: '/internal/app_search/engines/{name}/overview', }); registerEnginesRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/engines.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/engines.ts index 77b055add7d7937..a53379ef44c67ca 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/engines.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/engines.ts @@ -20,7 +20,7 @@ export function registerEnginesRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines', + path: '/internal/app_search/engines', validate: { query: schema.object({ type: schema.oneOf([schema.literal('indexed'), schema.literal('meta')]), @@ -40,7 +40,7 @@ export function registerEnginesRoutes({ router.post( { - path: '/api/app_search/engines', + path: '/internal/app_search/engines', validate: { body: schema.object({ name: schema.string(), @@ -58,7 +58,7 @@ export function registerEnginesRoutes({ // Single engine endpoints router.get( { - path: '/api/app_search/engines/{name}', + path: '/internal/app_search/engines/{name}', validate: { params: schema.object({ name: schema.string(), @@ -71,7 +71,7 @@ export function registerEnginesRoutes({ ); router.delete( { - path: '/api/app_search/engines/{name}', + path: '/internal/app_search/engines/{name}', validate: { params: schema.object({ name: schema.string(), @@ -84,7 +84,7 @@ export function registerEnginesRoutes({ ); router.get( { - path: '/api/app_search/engines/{name}/overview', + path: '/internal/app_search/engines/{name}/overview', validate: { params: schema.object({ name: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.test.ts index 47b480f61341a66..8990a9e1eeab495 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerOnboardingRoutes } from './onboarding'; describe('engine routes', () => { - describe('POST /api/app_search/onboarding_complete', () => { + describe('POST /internal/app_search/onboarding_complete', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/onboarding_complete', + path: '/internal/app_search/onboarding_complete', }); registerOnboardingRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.ts index 147f935a56aed9c..b61c49c06b905ee 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/onboarding.ts @@ -15,7 +15,7 @@ export function registerOnboardingRoutes({ }: RouteDependencies) { router.post( { - path: '/api/app_search/onboarding_complete', + path: '/internal/app_search/onboarding_complete', validate: { body: schema.object({ seed_sample_engine: schema.maybe(schema.boolean()), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.test.ts index 58f69e4abf96830..d82eb06fce68e8d 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.test.ts @@ -22,10 +22,10 @@ const resultFields = { }; describe('result settings routes', () => { - describe('GET /api/app_search/engines/{name}/result_settings/details', () => { + describe('GET /internal/app_search/engines/{name}/result_settings/details', () => { const mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/result_settings/details', + path: '/internal/app_search/engines/{engineName}/result_settings/details', }); beforeEach(() => { @@ -46,10 +46,10 @@ describe('result settings routes', () => { }); }); - describe('PUT /api/app_search/engines/{name}/result_settings', () => { + describe('PUT /internal/app_search/engines/{name}/result_settings', () => { const mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{engineName}/result_settings', + path: '/internal/app_search/engines/{engineName}/result_settings', }); beforeEach(() => { diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.ts index d02844090817345..0a5bd5af8edf641 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/result_settings.ts @@ -17,7 +17,7 @@ export function registerResultSettingsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/result_settings/details', + path: '/internal/app_search/engines/{engineName}/result_settings/details', validate: { params: schema.object({ engineName: schema.string(), @@ -31,7 +31,7 @@ export function registerResultSettingsRoutes({ router.put( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/result_settings', + path: '/internal/app_search/engines/{engineName}/result_settings', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.test.ts index dfb9765f834b64e..ee942a3383845f7 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.test.ts @@ -23,14 +23,14 @@ const roleMappingBaseSchema = { }; describe('role mappings routes', () => { - describe('POST /api/app_search/role_mappings/enable_role_based_access', () => { + describe('POST /internal/app_search/role_mappings/enable_role_based_access', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/role_mappings/enable_role_based_access', + path: '/internal/app_search/role_mappings/enable_role_based_access', }); registerEnableRoleMappingsRoute({ @@ -46,14 +46,14 @@ describe('role mappings routes', () => { }); }); - describe('GET /api/app_search/role_mappings', () => { + describe('GET /internal/app_search/role_mappings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/role_mappings', + path: '/internal/app_search/role_mappings', }); registerRoleMappingsRoute({ @@ -69,14 +69,14 @@ describe('role mappings routes', () => { }); }); - describe('POST /api/app_search/role_mappings', () => { + describe('POST /internal/app_search/role_mappings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/role_mappings', + path: '/internal/app_search/role_mappings', }); registerRoleMappingsRoute({ @@ -104,14 +104,14 @@ describe('role mappings routes', () => { }); }); - describe('PUT /api/app_search/role_mappings/{id}', () => { + describe('PUT /internal/app_search/role_mappings/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/role_mappings/{id}', + path: '/internal/app_search/role_mappings/{id}', }); registerRoleMappingRoute({ @@ -139,14 +139,14 @@ describe('role mappings routes', () => { }); }); - describe('DELETE /api/app_search/role_mappings/{id}', () => { + describe('DELETE /internal/app_search/role_mappings/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/role_mappings/{id}', + path: '/internal/app_search/role_mappings/{id}', }); registerRoleMappingRoute({ @@ -162,14 +162,14 @@ describe('role mappings routes', () => { }); }); - describe('POST /api/app_search/single_user_role_mapping', () => { + describe('POST /internal/app_search/single_user_role_mapping', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/single_user_role_mapping', + path: '/internal/app_search/single_user_role_mapping', }); registerUserRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.ts index d90a005cb253255..9ae935ea3b052c4 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/role_mappings.ts @@ -23,7 +23,7 @@ export function registerEnableRoleMappingsRoute({ }: RouteDependencies) { router.post( { - path: '/api/app_search/role_mappings/enable_role_based_access', + path: '/internal/app_search/role_mappings/enable_role_based_access', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -38,7 +38,7 @@ export function registerRoleMappingsRoute({ }: RouteDependencies) { router.get( { - path: '/api/app_search/role_mappings', + path: '/internal/app_search/role_mappings', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -48,7 +48,7 @@ export function registerRoleMappingsRoute({ router.post( { - path: '/api/app_search/role_mappings', + path: '/internal/app_search/role_mappings', validate: { body: schema.object(roleMappingBaseSchema), }, @@ -65,7 +65,7 @@ export function registerRoleMappingRoute({ }: RouteDependencies) { router.put( { - path: '/api/app_search/role_mappings/{id}', + path: '/internal/app_search/role_mappings/{id}', validate: { body: schema.object(roleMappingBaseSchema), params: schema.object({ @@ -80,7 +80,7 @@ export function registerRoleMappingRoute({ router.delete( { - path: '/api/app_search/role_mappings/{id}', + path: '/internal/app_search/role_mappings/{id}', validate: { params: schema.object({ id: schema.string(), @@ -96,7 +96,7 @@ export function registerRoleMappingRoute({ export function registerUserRoute({ router, enterpriseSearchRequestHandler }: RouteDependencies) { router.post( { - path: '/api/app_search/single_user_role_mapping', + path: '/internal/app_search/single_user_role_mapping', validate: { body: schema.object({ roleMapping: schema.object({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/schema.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/schema.test.ts index 408838a4de31b49..79d445aace90e1d 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/schema.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/schema.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSchemaRoutes } from './schema'; describe('schema routes', () => { - describe('GET /api/app_search/engines/{engineName}/schema', () => { + describe('GET /internal/app_search/engines/{engineName}/schema', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/schema', + path: '/internal/app_search/engines/{engineName}/schema', }); registerSchemaRoutes({ @@ -33,14 +33,14 @@ describe('schema routes', () => { }); }); - describe('POST /api/app_search/engines/{engineName}/schema', () => { + describe('POST /internal/app_search/engines/{engineName}/schema', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/schema', + path: '/internal/app_search/engines/{engineName}/schema', }); registerSchemaRoutes({ @@ -56,14 +56,14 @@ describe('schema routes', () => { }); }); - describe('GET /api/app_search/engines/{engineName}/reindex_job/{reindexJobId}', () => { + describe('GET /internal/app_search/engines/{engineName}/reindex_job/{reindexJobId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/reindex_job/{reindexJobId}', + path: '/internal/app_search/engines/{engineName}/reindex_job/{reindexJobId}', }); registerSchemaRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/schema.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/schema.ts index 74d07bd2bf75d69..98f13e4564cc575 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/schema.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/schema.ts @@ -16,7 +16,7 @@ export function registerSchemaRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/schema', + path: '/internal/app_search/engines/{engineName}/schema', validate: { params: schema.object({ engineName: schema.string(), @@ -30,7 +30,7 @@ export function registerSchemaRoutes({ router.post( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/schema', + path: '/internal/app_search/engines/{engineName}/schema', validate: { params: schema.object({ engineName: schema.string(), @@ -44,7 +44,7 @@ export function registerSchemaRoutes({ router.get( { - path: '/api/app_search/engines/{engineName}/reindex_job/{reindexJobId}', + path: '/internal/app_search/engines/{engineName}/reindex_job/{reindexJobId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search.test.ts index 7c81d20334a5a0c..972bcaa8891be4d 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSearchRoutes } from './search'; describe('search routes', () => { - describe('GET /api/app_search/engines/{engineName}/search', () => { + describe('GET /internal/app_search/engines/{engineName}/search', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/schema', + path: '/internal/app_search/engines/{engineName}/schema', }); registerSearchRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search.ts index 93c7e8facde615d..44432934e9e8b74 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search.ts @@ -17,7 +17,7 @@ export function registerSearchRoutes({ }: RouteDependencies) { router.post( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/search', + path: '/internal/app_search/engines/{engineName}/search', validate: { params: schema.object({ engineName: schema.string(), @@ -37,7 +37,7 @@ export function registerSearchRoutes({ // requests through Kibana's server. router.post( skipBodyValidation({ - path: '/api/app_search/search-ui/api/as/v1/engines/{engineName}/search.json', + path: '/internal/app_search/search-ui/api/as/v1/engines/{engineName}/search.json', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.test.ts index 7ea533af5da757d..56e60db543c5d19 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.test.ts @@ -60,10 +60,10 @@ describe('search settings routes', () => { jest.clearAllMocks(); }); - describe('GET /api/app_search/engines/{name}/search_settings/details', () => { + describe('GET /internal/app_search/engines/{name}/search_settings/details', () => { const mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/search_settings/details', + path: '/internal/app_search/engines/{engineName}/search_settings/details', }); beforeEach(() => { @@ -84,10 +84,10 @@ describe('search settings routes', () => { }); }); - describe('PUT /api/app_search/engines/{name}/search_settings', () => { + describe('PUT /internal/app_search/engines/{name}/search_settings', () => { const mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{engineName}/search_settings', + path: '/internal/app_search/engines/{engineName}/search_settings', }); beforeEach(() => { @@ -109,10 +109,10 @@ describe('search settings routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/search_settings/reset', () => { + describe('POST /internal/app_search/engines/{name}/search_settings/reset', () => { const mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/search_settings/reset', + path: '/internal/app_search/engines/{engineName}/search_settings/reset', }); beforeEach(() => { diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.ts index 31a8cc09ed83952..2dd097a17bf643c 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search_settings.ts @@ -17,7 +17,7 @@ export function registerSearchSettingsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/search_settings/details', + path: '/internal/app_search/engines/{engineName}/search_settings/details', validate: { params: schema.object({ engineName: schema.string(), @@ -31,7 +31,7 @@ export function registerSearchSettingsRoutes({ router.post( { - path: '/api/app_search/engines/{engineName}/search_settings/reset', + path: '/internal/app_search/engines/{engineName}/search_settings/reset', validate: { params: schema.object({ engineName: schema.string(), @@ -45,7 +45,7 @@ export function registerSearchSettingsRoutes({ router.put( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/search_settings', + path: '/internal/app_search/engines/{engineName}/search_settings', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.test.ts index ae308c8397536b7..fa0694fed9d033c 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.test.ts @@ -14,10 +14,10 @@ describe('reference application routes', () => { jest.clearAllMocks(); }); - describe('GET /api/app_search/engines/{engineName}/search_settings/details', () => { + describe('GET /internal/app_search/engines/{engineName}/search_settings/details', () => { const mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/search_ui/field_config', + path: '/internal/app_search/engines/{engineName}/search_ui/field_config', }); beforeEach(() => { diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.ts index 33684843b218aaa..2a9d99e6e58820f 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/search_ui.ts @@ -15,7 +15,7 @@ export function registerSearchUIRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/search_ui/field_config', + path: '/internal/app_search/engines/{engineName}/search_ui/field_config', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/settings.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/settings.test.ts index 6df9a4f16d71069..aff9cd17dd00133 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/settings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/settings.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSettingsRoutes } from './settings'; describe('log settings routes', () => { - describe('GET /api/app_search/log_settings', () => { + describe('GET /internal/app_search/log_settings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/log_settings', + path: '/internal/app_search/log_settings', }); registerSettingsRoutes({ @@ -33,14 +33,14 @@ describe('log settings routes', () => { }); }); - describe('PUT /api/app_search/log_settings', () => { + describe('PUT /internal/app_search/log_settings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/log_settings', + path: '/internal/app_search/log_settings', }); registerSettingsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/settings.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/settings.ts index 8c6812199051fce..b83dfd9d9ef15ca 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/settings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/settings.ts @@ -15,7 +15,7 @@ export function registerSettingsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/log_settings', + path: '/internal/app_search/log_settings', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -25,7 +25,7 @@ export function registerSettingsRoutes({ router.put( { - path: '/api/app_search/log_settings', + path: '/internal/app_search/log_settings', validate: { body: schema.object({ api: schema.maybe( diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts index 5b51048067c00d3..67edcc356e902d6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSourceEnginesRoutes } from './source_engines'; describe('source engine routes', () => { - describe('GET /api/app_search/engines/{name}/source_engines', () => { + describe('GET /internal/app_search/engines/{name}/source_engines', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{name}/source_engines', + path: '/internal/app_search/engines/{name}/source_engines', }); registerSourceEnginesRoutes({ @@ -53,14 +53,14 @@ describe('source engine routes', () => { }); }); - describe('POST /api/app_search/engines/{name}/source_engines/bulk_create', () => { + describe('POST /internal/app_search/engines/{name}/source_engines/bulk_create', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{name}/source_engines/bulk_create', + path: '/internal/app_search/engines/{name}/source_engines/bulk_create', }); registerSourceEnginesRoutes({ @@ -96,14 +96,14 @@ describe('source engine routes', () => { }); }); - describe('DELETE /api/app_search/engines/{name}/source_engines/{source_engine_name}', () => { + describe('DELETE /internal/app_search/engines/{name}/source_engines/{source_engine_name}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{name}/source_engines/{source_engine_name}', + path: '/internal/app_search/engines/{name}/source_engines/{source_engine_name}', }); registerSourceEnginesRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts index 8e55b0e6f1ac6aa..1d41a82287b0e60 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts @@ -15,7 +15,7 @@ export function registerSourceEnginesRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{name}/source_engines', + path: '/internal/app_search/engines/{name}/source_engines', validate: { params: schema.object({ name: schema.string(), @@ -33,7 +33,7 @@ export function registerSourceEnginesRoutes({ router.post( { - path: '/api/app_search/engines/{name}/source_engines/bulk_create', + path: '/internal/app_search/engines/{name}/source_engines/bulk_create', validate: { params: schema.object({ name: schema.string(), @@ -50,7 +50,7 @@ export function registerSourceEnginesRoutes({ router.delete( { - path: '/api/app_search/engines/{name}/source_engines/{source_engine_name}', + path: '/internal/app_search/engines/{name}/source_engines/{source_engine_name}', validate: { params: schema.object({ name: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.test.ts index 53ceefc736d207c..0007b3f27cff0ad 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSynonymsRoutes } from './synonyms'; describe('synonyms routes', () => { - describe('GET /api/app_search/engines/{engineName}/synonyms', () => { + describe('GET /internal/app_search/engines/{engineName}/synonyms', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/app_search/engines/{engineName}/synonyms', + path: '/internal/app_search/engines/{engineName}/synonyms', }); registerSynonymsRoutes({ @@ -50,14 +50,14 @@ describe('synonyms routes', () => { }); }); - describe('POST /api/app_search/engines/{engineName}/synonyms', () => { + describe('POST /internal/app_search/engines/{engineName}/synonyms', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/app_search/engines/{engineName}/synonyms', + path: '/internal/app_search/engines/{engineName}/synonyms', }); registerSynonymsRoutes({ @@ -73,14 +73,14 @@ describe('synonyms routes', () => { }); }); - describe('PUT /api/app_search/engines/{engineName}/synonyms/{synonymId}', () => { + describe('PUT /internal/app_search/engines/{engineName}/synonyms/{synonymId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/app_search/engines/{engineName}/synonyms/{synonymId}', + path: '/internal/app_search/engines/{engineName}/synonyms/{synonymId}', }); registerSynonymsRoutes({ @@ -96,14 +96,14 @@ describe('synonyms routes', () => { }); }); - describe('DELETE /api/app_search/engines/{engineName}/synonyms/{synonymId}', () => { + describe('DELETE /internal/app_search/engines/{engineName}/synonyms/{synonymId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/app_search/engines/{engineName}/synonyms/{synonymId}', + path: '/internal/app_search/engines/{engineName}/synonyms/{synonymId}', }); registerSynonymsRoutes({ diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.ts index d9b0cf1b9289fb7..0c9682bb983d477 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/synonyms.ts @@ -16,7 +16,7 @@ export function registerSynonymsRoutes({ }: RouteDependencies) { router.get( { - path: '/api/app_search/engines/{engineName}/synonyms', + path: '/internal/app_search/engines/{engineName}/synonyms', validate: { params: schema.object({ engineName: schema.string(), @@ -34,7 +34,7 @@ export function registerSynonymsRoutes({ router.post( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/synonyms', + path: '/internal/app_search/engines/{engineName}/synonyms', validate: { params: schema.object({ engineName: schema.string(), @@ -48,7 +48,7 @@ export function registerSynonymsRoutes({ router.put( skipBodyValidation({ - path: '/api/app_search/engines/{engineName}/synonyms/{synonymId}', + path: '/internal/app_search/engines/{engineName}/synonyms/{synonymId}', validate: { params: schema.object({ engineName: schema.string(), @@ -63,7 +63,7 @@ export function registerSynonymsRoutes({ router.delete( { - path: '/api/app_search/engines/{engineName}/synonyms/{synonymId}', + path: '/internal/app_search/engines/{engineName}/synonyms/{synonymId}', validate: { params: schema.object({ engineName: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.test.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.test.ts index b3d2733e233b32c..9244ba2301132c5 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.test.ts @@ -21,7 +21,7 @@ describe('Enterprise Search Config Data API', () => { beforeEach(() => { mockRouter = new MockRouter({ method: 'get', - path: '/api/enterprise_search/config_data', + path: '/internal/enterprise_search/config_data', }); registerConfigDataRoute({ @@ -30,7 +30,7 @@ describe('Enterprise Search Config Data API', () => { }); }); - describe('GET /api/enterprise_search/config_data', () => { + describe('GET /internal/enterprise_search/config_data', () => { it('returns an initial set of config data from Enterprise Search', async () => { const mockData = { ...DEFAULT_INITIAL_APP_DATA, diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.ts index e2cbd409bd396bc..95ab8e3c3a5a9ec 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/config_data.ts @@ -11,7 +11,7 @@ import { RouteDependencies } from '../../plugin'; export function registerConfigDataRoute({ router, config, log }: RouteDependencies) { router.get( { - path: '/api/enterprise_search/config_data', + path: '/internal/enterprise_search/config_data', validate: false, }, async (context, request, response) => { diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.test.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.test.ts index 53ddc21cba3994f..d8c38204f75a9d0 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.test.ts @@ -29,7 +29,7 @@ describe('Enterprise Search Telemetry API', () => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/enterprise_search/stats', + path: '/internal/enterprise_search/stats', }); registerTelemetryRoute({ @@ -40,7 +40,7 @@ describe('Enterprise Search Telemetry API', () => { }); }); - describe('PUT /api/enterprise_search/stats', () => { + describe('PUT /internal/enterprise_search/stats', () => { it('increments the saved objects counter for App Search', async () => { (incrementUICounter as jest.Mock).mockImplementation(jest.fn(() => successResponse)); diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.ts index e15be8fcd0d8b89..4b272293c7d5f34 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/telemetry.ts @@ -23,7 +23,7 @@ const productToTelemetryMap = { export function registerTelemetryRoute({ router, getSavedObjectsService }: RouteDependencies) { router.put( { - path: '/api/enterprise_search/stats', + path: '/internal/enterprise_search/stats', validate: { body: schema.object({ product: schema.oneOf([ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts index 27e05cee1ba0ae3..40ee46c7a9ffded 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts @@ -17,14 +17,14 @@ import { } from './groups'; describe('groups routes', () => { - describe('GET /api/workplace_search/groups', () => { + describe('GET /internal/workplace_search/groups', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/groups', + path: '/internal/workplace_search/groups', }); registerGroupsRoute({ @@ -40,14 +40,14 @@ describe('groups routes', () => { }); }); - describe('POST /api/workplace_search/groups', () => { + describe('POST /internal/workplace_search/groups', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/groups', + path: '/internal/workplace_search/groups', }); registerGroupsRoute({ @@ -74,14 +74,14 @@ describe('groups routes', () => { }); }); - describe('POST /api/workplace_search/groups/search', () => { + describe('POST /internal/workplace_search/groups/search', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/groups/search', + path: '/internal/workplace_search/groups/search', }); registerSearchGroupsRoute({ @@ -128,14 +128,14 @@ describe('groups routes', () => { }); }); - describe('GET /api/workplace_search/groups/{id}', () => { + describe('GET /internal/workplace_search/groups/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', }); registerGroupRoute({ @@ -151,14 +151,14 @@ describe('groups routes', () => { }); }); - describe('PUT /api/workplace_search/groups/{id}', () => { + describe('PUT /internal/workplace_search/groups/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', }); registerGroupRoute({ @@ -187,14 +187,14 @@ describe('groups routes', () => { }); }); - describe('DELETE /api/workplace_search/groups/{id}', () => { + describe('DELETE /internal/workplace_search/groups/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', }); registerGroupRoute({ @@ -210,14 +210,14 @@ describe('groups routes', () => { }); }); - describe('GET /api/workplace_search/groups/{id}/group_users', () => { + describe('GET /internal/workplace_search/groups/{id}/group_users', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/groups/{id}/group_users', + path: '/internal/workplace_search/groups/{id}/group_users', }); registerGroupUsersRoute({ @@ -233,14 +233,14 @@ describe('groups routes', () => { }); }); - describe('POST /api/workplace_search/groups/{id}/share', () => { + describe('POST /internal/workplace_search/groups/{id}/share', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/groups/{id}/share', + path: '/internal/workplace_search/groups/{id}/share', }); registerShareGroupRoute({ @@ -268,14 +268,14 @@ describe('groups routes', () => { }); }); - describe('PUT /api/workplace_search/groups/{id}/boosts', () => { + describe('PUT /internal/workplace_search/groups/{id}/boosts', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/groups/{id}/boosts', + path: '/internal/workplace_search/groups/{id}/boosts', }); registerBoostsGroupRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts index c6332fa1287a04c..c5c161cf7b2f877 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts @@ -12,7 +12,7 @@ import { RouteDependencies } from '../../plugin'; export function registerGroupsRoute({ router, enterpriseSearchRequestHandler }: RouteDependencies) { router.get( { - path: '/api/workplace_search/groups', + path: '/internal/workplace_search/groups', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -22,7 +22,7 @@ export function registerGroupsRoute({ router, enterpriseSearchRequestHandler }: router.post( { - path: '/api/workplace_search/groups', + path: '/internal/workplace_search/groups', validate: { body: schema.object({ group_name: schema.string(), @@ -41,7 +41,7 @@ export function registerSearchGroupsRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/groups/search', + path: '/internal/workplace_search/groups/search', validate: { body: schema.object({ page: schema.object({ @@ -65,7 +65,7 @@ export function registerSearchGroupsRoute({ export function registerGroupRoute({ router, enterpriseSearchRequestHandler }: RouteDependencies) { router.get( { - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', validate: { params: schema.object({ id: schema.string(), @@ -79,7 +79,7 @@ export function registerGroupRoute({ router, enterpriseSearchRequestHandler }: R router.put( { - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', validate: { params: schema.object({ id: schema.string(), @@ -98,7 +98,7 @@ export function registerGroupRoute({ router, enterpriseSearchRequestHandler }: R router.delete( { - path: '/api/workplace_search/groups/{id}', + path: '/internal/workplace_search/groups/{id}', validate: { params: schema.object({ id: schema.string(), @@ -117,7 +117,7 @@ export function registerGroupUsersRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/groups/{id}/group_users', + path: '/internal/workplace_search/groups/{id}/group_users', validate: { params: schema.object({ id: schema.string(), @@ -136,7 +136,7 @@ export function registerShareGroupRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/groups/{id}/share', + path: '/internal/workplace_search/groups/{id}/share', validate: { params: schema.object({ id: schema.string(), @@ -158,7 +158,7 @@ export function registerBoostsGroupRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/groups/{id}/boosts', + path: '/internal/workplace_search/groups/{id}/boosts', validate: { params: schema.object({ id: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.test.ts index b239377f6469dc6..ab9d5e20cfe92b6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.test.ts @@ -14,7 +14,7 @@ import { } from './oauth'; describe('oauth routes', () => { - describe('GET /api/workplace_search/oauth/authorize', () => { + describe('GET /internal/workplace_search/oauth/authorize', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -22,7 +22,7 @@ describe('oauth routes', () => { mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', }); registerOAuthAuthorizeRoute({ @@ -59,7 +59,7 @@ describe('oauth routes', () => { }); }); - describe('POST /api/workplace_search/oauth/authorize', () => { + describe('POST /internal/workplace_search/oauth/authorize', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -67,7 +67,7 @@ describe('oauth routes', () => { mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', }); registerOAuthAuthorizeAcceptRoute({ @@ -100,7 +100,7 @@ describe('oauth routes', () => { }); }); - describe('DELETE /api/workplace_search/oauth/authorize', () => { + describe('DELETE /internal/workplace_search/oauth/authorize', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -108,7 +108,7 @@ describe('oauth routes', () => { mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', }); registerOAuthAuthorizeDenyRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.ts index a94b46349998121..5c2277278bb13ae 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/oauth.ts @@ -15,7 +15,7 @@ export function registerOAuthAuthorizeRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', validate: { query: schema.object({ access_type: schema.maybe(schema.string()), @@ -42,7 +42,7 @@ export function registerOAuthAuthorizeAcceptRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', validate: { body: schema.object({ client_id: schema.string(), @@ -65,7 +65,7 @@ export function registerOAuthAuthorizeDenyRoute({ }: RouteDependencies) { router.delete( { - path: '/api/workplace_search/oauth/authorize', + path: '/internal/workplace_search/oauth/authorize', validate: { body: schema.object({ client_id: schema.string(), diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.test.ts index bdf885648dff7fc..0b4010bd1a09f7d 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.test.ts @@ -10,14 +10,14 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerOverviewRoute } from './overview'; describe('Overview route', () => { - describe('GET /api/workplace_search/overview', () => { + describe('GET /internal/workplace_search/overview', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/overview', + path: '/internal/workplace_search/overview', }); registerOverviewRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.ts index 6a601da6427e702..74185439c2f37e8 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/overview.ts @@ -13,7 +13,7 @@ export function registerOverviewRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/overview', + path: '/internal/workplace_search/overview', validate: false, }, enterpriseSearchRequestHandler.createRequest({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.test.ts index ef8f1bd63f5d386..4130a6ba12097de 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.test.ts @@ -15,14 +15,14 @@ import { } from './role_mappings'; describe('role mappings routes', () => { - describe('POST /api/workplace_search/org/role_mappings/enable_role_based_access', () => { + describe('POST /internal/workplace_search/org/role_mappings/enable_role_based_access', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/role_mappings/enable_role_based_access', + path: '/internal/workplace_search/org/role_mappings/enable_role_based_access', }); registerOrgEnableRoleMappingsRoute({ @@ -38,14 +38,14 @@ describe('role mappings routes', () => { }); }); - describe('GET /api/workplace_search/org/role_mappings', () => { + describe('GET /internal/workplace_search/org/role_mappings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/role_mappings', + path: '/internal/workplace_search/org/role_mappings', }); registerOrgRoleMappingsRoute({ @@ -61,14 +61,14 @@ describe('role mappings routes', () => { }); }); - describe('POST /api/workplace_search/org/role_mappings', () => { + describe('POST /internal/workplace_search/org/role_mappings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/role_mappings', + path: '/internal/workplace_search/org/role_mappings', }); registerOrgRoleMappingsRoute({ @@ -84,14 +84,14 @@ describe('role mappings routes', () => { }); }); - describe('PUT /api/workplace_search/org/role_mappings/{id}', () => { + describe('PUT /internal/workplace_search/org/role_mappings/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/role_mappings/{id}', + path: '/internal/workplace_search/org/role_mappings/{id}', }); registerOrgRoleMappingRoute({ @@ -107,14 +107,14 @@ describe('role mappings routes', () => { }); }); - describe('DELETE /api/workplace_search/org/role_mappings/{id}', () => { + describe('DELETE /internal/workplace_search/org/role_mappings/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/org/role_mappings/{id}', + path: '/internal/workplace_search/org/role_mappings/{id}', }); registerOrgRoleMappingRoute({ @@ -130,14 +130,14 @@ describe('role mappings routes', () => { }); }); - describe('POST /api/workplace_search/org/single_user_role_mapping', () => { + describe('POST /internal/workplace_search/org/single_user_role_mapping', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/single_user_role_mapping', + path: '/internal/workplace_search/org/single_user_role_mapping', }); registerOrgUserRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.ts index e6f4919ed2a2fe6..a08ffb2109683b2 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/role_mappings.ts @@ -23,7 +23,7 @@ export function registerOrgEnableRoleMappingsRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/org/role_mappings/enable_role_based_access', + path: '/internal/workplace_search/org/role_mappings/enable_role_based_access', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -38,7 +38,7 @@ export function registerOrgRoleMappingsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/role_mappings', + path: '/internal/workplace_search/org/role_mappings', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -48,7 +48,7 @@ export function registerOrgRoleMappingsRoute({ router.post( { - path: '/api/workplace_search/org/role_mappings', + path: '/internal/workplace_search/org/role_mappings', validate: { body: schema.object(roleMappingBaseSchema), }, @@ -65,7 +65,7 @@ export function registerOrgRoleMappingRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/org/role_mappings/{id}', + path: '/internal/workplace_search/org/role_mappings/{id}', validate: { body: schema.object(roleMappingBaseSchema), params: schema.object({ @@ -80,7 +80,7 @@ export function registerOrgRoleMappingRoute({ router.delete( { - path: '/api/workplace_search/org/role_mappings/{id}', + path: '/internal/workplace_search/org/role_mappings/{id}', validate: { params: schema.object({ id: schema.string(), @@ -99,7 +99,7 @@ export function registerOrgUserRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/org/single_user_role_mapping', + path: '/internal/workplace_search/org/single_user_role_mapping', validate: { body: schema.object({ roleMapping: schema.object({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.test.ts index a1615499c56a290..744f0e689cd82a6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.test.ts @@ -10,7 +10,7 @@ import { MockRouter, mockRequestHandler, mockDependencies } from '../../__mocks_ import { registerSecurityRoute, registerSecuritySourceRestrictionsRoute } from './security'; describe('security routes', () => { - describe('GET /api/workplace_search/org/security', () => { + describe('GET /internal/workplace_search/org/security', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -18,7 +18,7 @@ describe('security routes', () => { mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/security', + path: '/internal/workplace_search/org/security', }); registerSecurityRoute({ @@ -36,7 +36,7 @@ describe('security routes', () => { }); }); - describe('GET /api/workplace_search/org/security/source_restrictions', () => { + describe('GET /internal/workplace_search/org/security/source_restrictions', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -44,7 +44,7 @@ describe('security routes', () => { mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/security/source_restrictions', + path: '/internal/workplace_search/org/security/source_restrictions', }); registerSecuritySourceRestrictionsRoute({ @@ -62,7 +62,7 @@ describe('security routes', () => { }); }); - describe('PATCH /api/workplace_search/org/security/source_restrictions', () => { + describe('PATCH /internal/workplace_search/org/security/source_restrictions', () => { let mockRouter: MockRouter; beforeEach(() => { @@ -70,7 +70,7 @@ describe('security routes', () => { mockRouter = new MockRouter({ method: 'patch', - path: '/api/workplace_search/org/security/source_restrictions', + path: '/internal/workplace_search/org/security/source_restrictions', }); registerSecuritySourceRestrictionsRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.ts index b823ca796175e9d..7c9bf7f462a0634 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/security.ts @@ -15,7 +15,7 @@ export function registerSecurityRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/security', + path: '/internal/workplace_search/org/security', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -30,7 +30,7 @@ export function registerSecuritySourceRestrictionsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/security/source_restrictions', + path: '/internal/workplace_search/org/security/source_restrictions', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -40,7 +40,7 @@ export function registerSecuritySourceRestrictionsRoute({ router.patch( { - path: '/api/workplace_search/org/security/source_restrictions', + path: '/internal/workplace_search/org/security/source_restrictions', validate: { body: schema.object({ isEnabled: schema.boolean(), diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.test.ts index 858bd71c50c447e..205b7b244ab45b7 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.test.ts @@ -15,14 +15,14 @@ import { } from './settings'; describe('settings routes', () => { - describe('GET /api/workplace_search/org/settings', () => { + describe('GET /internal/workplace_search/org/settings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/settings', + path: '/internal/workplace_search/org/settings', }); registerOrgSettingsRoute({ @@ -38,14 +38,14 @@ describe('settings routes', () => { }); }); - describe('PUT /api/workplace_search/org/settings/customize', () => { + describe('PUT /internal/workplace_search/org/settings/customize', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/settings/customize', + path: '/internal/workplace_search/org/settings/customize', }); registerOrgSettingsCustomizeRoute({ @@ -68,14 +68,14 @@ describe('settings routes', () => { }); }); - describe('PUT /api/workplace_search/org/settings/upload_images', () => { + describe('PUT /internal/workplace_search/org/settings/upload_images', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/settings/upload_images', + path: '/internal/workplace_search/org/settings/upload_images', }); registerOrgSettingsUploadImagesRoute({ @@ -98,14 +98,14 @@ describe('settings routes', () => { }); }); - describe('PUT /api/workplace_search/org/settings/oauth_application', () => { + describe('PUT /internal/workplace_search/org/settings/oauth_application', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/settings/oauth_application', + path: '/internal/workplace_search/org/settings/oauth_application', }); registerOrgSettingsOauthApplicationRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.ts index 83b633a61ba5993..5a2a5309ee35da7 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/settings.ts @@ -17,7 +17,7 @@ export function registerOrgSettingsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/settings', + path: '/internal/workplace_search/org/settings', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -32,7 +32,7 @@ export function registerOrgSettingsCustomizeRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/org/settings/customize', + path: '/internal/workplace_search/org/settings/customize', validate: { body: schema.object({ name: schema.string(), @@ -51,7 +51,7 @@ export function registerOrgSettingsUploadImagesRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/org/settings/upload_images', + path: '/internal/workplace_search/org/settings/upload_images', validate: { body: schema.object({ logo: schema.maybe(schema.nullable(schema.string())), @@ -76,7 +76,7 @@ export function registerOrgSettingsOauthApplicationRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/org/settings/oauth_application', + path: '/internal/workplace_search/org/settings/oauth_application', validate: { body: schema.object({ oauth_application: schema.object({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.test.ts index a68a7716933f809..706bc8a4853a726 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.test.ts @@ -56,14 +56,14 @@ const mockConfig = { }; describe('sources routes', () => { - describe('GET /api/workplace_search/account/sources', () => { + describe('GET /internal/workplace_search/account/sources', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources', + path: '/internal/workplace_search/account/sources', }); registerAccountSourcesRoute({ @@ -79,14 +79,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/status', () => { + describe('GET /internal/workplace_search/account/sources/status', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/status', + path: '/internal/workplace_search/account/sources/status', }); registerAccountSourcesStatusRoute({ @@ -102,14 +102,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{id}', () => { + describe('GET /internal/workplace_search/account/sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{id}', + path: '/internal/workplace_search/account/sources/{id}', }); registerAccountSourceRoute({ @@ -125,14 +125,14 @@ describe('sources routes', () => { }); }); - describe('DELETE /api/workplace_search/account/sources/{id}', () => { + describe('DELETE /internal/workplace_search/account/sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/account/sources/{id}', + path: '/internal/workplace_search/account/sources/{id}', }); registerAccountSourceRoute({ @@ -148,14 +148,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/account/create_source', () => { + describe('POST /internal/workplace_search/account/create_source', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/account/create_source', + path: '/internal/workplace_search/account/create_source', }); registerAccountCreateSourceRoute({ @@ -187,14 +187,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/account/sources/{id}/documents', () => { + describe('POST /internal/workplace_search/account/sources/{id}/documents', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/account/sources/{id}/documents', + path: '/internal/workplace_search/account/sources/{id}/documents', }); registerAccountSourceDocumentsRoute({ @@ -227,14 +227,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{id}/federated_summary', () => { + describe('GET /internal/workplace_search/account/sources/{id}/federated_summary', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{id}/federated_summary', + path: '/internal/workplace_search/account/sources/{id}/federated_summary', }); registerAccountSourceFederatedSummaryRoute({ @@ -250,14 +250,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{id}/reauth_prepare', () => { + describe('GET /internal/workplace_search/account/sources/{id}/reauth_prepare', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{id}/reauth_prepare', + path: '/internal/workplace_search/account/sources/{id}/reauth_prepare', }); registerAccountSourceReauthPrepareRoute({ @@ -273,14 +273,14 @@ describe('sources routes', () => { }); }); - describe('PATCH /api/workplace_search/account/sources/{id}/settings', () => { + describe('PATCH /internal/workplace_search/account/sources/{id}/settings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'patch', - path: '/api/workplace_search/account/sources/{id}/settings', + path: '/internal/workplace_search/account/sources/{id}/settings', }); registerAccountSourceSettingsRoute({ @@ -309,14 +309,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/pre_sources/{id}', () => { + describe('GET /internal/workplace_search/account/pre_sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/pre_sources/{id}', + path: '/internal/workplace_search/account/pre_sources/{id}', }); registerAccountPreSourceRoute({ @@ -332,14 +332,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{serviceType}/prepare', () => { + describe('GET /internal/workplace_search/account/sources/{serviceType}/prepare', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{serviceType}/prepare', + path: '/internal/workplace_search/account/sources/{serviceType}/prepare', }); registerAccountPrepareSourcesRoute({ @@ -355,14 +355,14 @@ describe('sources routes', () => { }); }); - describe('PUT /api/workplace_search/account/sources/{id}/searchable', () => { + describe('PUT /internal/workplace_search/account/sources/{id}/searchable', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/account/sources/{id}/searchable', + path: '/internal/workplace_search/account/sources/{id}/searchable', }); registerAccountSourceSearchableRoute({ @@ -389,14 +389,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{id}/display_settings/config', () => { + describe('GET /internal/workplace_search/account/sources/{id}/display_settings/config', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{id}/display_settings/config', + path: '/internal/workplace_search/account/sources/{id}/display_settings/config', }); registerAccountSourceDisplaySettingsConfig({ @@ -412,14 +412,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/account/sources/{id}/display_settings/config', () => { + describe('POST /internal/workplace_search/account/sources/{id}/display_settings/config', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/account/sources/{id}/display_settings/config', + path: '/internal/workplace_search/account/sources/{id}/display_settings/config', }); registerAccountSourceDisplaySettingsConfig({ @@ -455,14 +455,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{id}/schemas', () => { + describe('GET /internal/workplace_search/account/sources/{id}/schemas', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{id}/schemas', + path: '/internal/workplace_search/account/sources/{id}/schemas', }); registerAccountSourceSchemasRoute({ @@ -478,14 +478,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/account/sources/{id}/schemas', () => { + describe('POST /internal/workplace_search/account/sources/{id}/schemas', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/account/sources/{id}/schemas', + path: '/internal/workplace_search/account/sources/{id}/schemas', }); registerAccountSourceSchemasRoute({ @@ -508,14 +508,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', () => { + describe('GET /internal/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', + path: '/internal/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', }); registerAccountSourceReindexJobRoute({ @@ -540,14 +540,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/account/sources/{sourceId}/download_diagnostics', () => { + describe('GET /internal/workplace_search/account/sources/{sourceId}/download_diagnostics', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/account/sources/{sourceId}/download_diagnostics', + path: '/internal/workplace_search/account/sources/{sourceId}/download_diagnostics', }); registerAccountSourceDownloadDiagnosticsRoute({ @@ -564,14 +564,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources', () => { + describe('GET /internal/workplace_search/org/sources', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources', + path: '/internal/workplace_search/org/sources', }); registerOrgSourcesRoute({ @@ -587,14 +587,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/status', () => { + describe('GET /internal/workplace_search/org/sources/status', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/status', + path: '/internal/workplace_search/org/sources/status', }); registerOrgSourcesStatusRoute({ @@ -610,14 +610,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{id}', () => { + describe('GET /internal/workplace_search/org/sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{id}', + path: '/internal/workplace_search/org/sources/{id}', }); registerOrgSourceRoute({ @@ -633,14 +633,14 @@ describe('sources routes', () => { }); }); - describe('DELETE /api/workplace_search/org/sources/{id}', () => { + describe('DELETE /internal/workplace_search/org/sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/org/sources/{id}', + path: '/internal/workplace_search/org/sources/{id}', }); registerOrgSourceRoute({ @@ -656,14 +656,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/create_source', () => { + describe('POST /internal/workplace_search/org/create_source', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/create_source', + path: '/internal/workplace_search/org/create_source', }); registerOrgCreateSourceRoute({ @@ -695,14 +695,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/sources/{id}/documents', () => { + describe('POST /internal/workplace_search/org/sources/{id}/documents', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/sources/{id}/documents', + path: '/internal/workplace_search/org/sources/{id}/documents', }); registerOrgSourceDocumentsRoute({ @@ -735,14 +735,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{id}/federated_summary', () => { + describe('GET /internal/workplace_search/org/sources/{id}/federated_summary', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{id}/federated_summary', + path: '/internal/workplace_search/org/sources/{id}/federated_summary', }); registerOrgSourceFederatedSummaryRoute({ @@ -758,14 +758,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{id}/reauth_prepare', () => { + describe('GET /internal/workplace_search/org/sources/{id}/reauth_prepare', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{id}/reauth_prepare', + path: '/internal/workplace_search/org/sources/{id}/reauth_prepare', }); registerOrgSourceReauthPrepareRoute({ @@ -781,14 +781,14 @@ describe('sources routes', () => { }); }); - describe('PATCH /api/workplace_search/org/sources/{id}/settings', () => { + describe('PATCH /internal/workplace_search/org/sources/{id}/settings', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'patch', - path: '/api/workplace_search/org/sources/{id}/settings', + path: '/internal/workplace_search/org/sources/{id}/settings', }); registerOrgSourceSettingsRoute({ @@ -817,14 +817,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/pre_sources/{id}', () => { + describe('GET /internal/workplace_search/org/pre_sources/{id}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/pre_sources/{id}', + path: '/internal/workplace_search/org/pre_sources/{id}', }); registerOrgPreSourceRoute({ @@ -840,14 +840,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{serviceType}/prepare', () => { + describe('GET /internal/workplace_search/org/sources/{serviceType}/prepare', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{serviceType}/prepare', + path: '/internal/workplace_search/org/sources/{serviceType}/prepare', }); registerOrgPrepareSourcesRoute({ @@ -863,14 +863,14 @@ describe('sources routes', () => { }); }); - describe('PUT /api/workplace_search/org/sources/{id}/searchable', () => { + describe('PUT /internal/workplace_search/org/sources/{id}/searchable', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/sources/{id}/searchable', + path: '/internal/workplace_search/org/sources/{id}/searchable', }); registerOrgSourceSearchableRoute({ @@ -897,14 +897,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{id}/display_settings/config', () => { + describe('GET /internal/workplace_search/org/sources/{id}/display_settings/config', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{id}/display_settings/config', + path: '/internal/workplace_search/org/sources/{id}/display_settings/config', }); registerOrgSourceDisplaySettingsConfig({ @@ -920,14 +920,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/sources/{id}/display_settings/config', () => { + describe('POST /internal/workplace_search/org/sources/{id}/display_settings/config', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/sources/{id}/display_settings/config', + path: '/internal/workplace_search/org/sources/{id}/display_settings/config', }); registerOrgSourceDisplaySettingsConfig({ @@ -963,14 +963,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{id}/schemas', () => { + describe('GET /internal/workplace_search/org/sources/{id}/schemas', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{id}/schemas', + path: '/internal/workplace_search/org/sources/{id}/schemas', }); registerOrgSourceSchemasRoute({ @@ -986,14 +986,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/sources/{id}/schemas', () => { + describe('POST /internal/workplace_search/org/sources/{id}/schemas', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/sources/{id}/schemas', + path: '/internal/workplace_search/org/sources/{id}/schemas', }); registerOrgSourceSchemasRoute({ @@ -1016,14 +1016,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', () => { + describe('GET /internal/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', + path: '/internal/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', }); registerOrgSourceReindexJobRoute({ @@ -1039,14 +1039,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/sources/{sourceId}/download_diagnostics', () => { + describe('GET /internal/workplace_search/org/sources/{sourceId}/download_diagnostics', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/sources/{sourceId}/download_diagnostics', + path: '/internal/workplace_search/org/sources/{sourceId}/download_diagnostics', }); registerOrgSourceDownloadDiagnosticsRoute({ @@ -1063,14 +1063,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/settings/connectors', () => { + describe('GET /internal/workplace_search/org/settings/connectors', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', }); registerOrgSourceOauthConfigurationsRoute({ @@ -1086,14 +1086,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/settings/connectors', () => { + describe('POST /internal/workplace_search/org/settings/connectors', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', }); registerOrgSourceOauthConfigurationsRoute({ @@ -1116,14 +1116,14 @@ describe('sources routes', () => { }); }); - describe('PUT /api/workplace_search/org/settings/connectors', () => { + describe('PUT /internal/workplace_search/org/settings/connectors', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', }); registerOrgSourceOauthConfigurationsRoute({ @@ -1146,14 +1146,14 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/org/settings/connectors/{serviceType}', () => { + describe('GET /internal/workplace_search/org/settings/connectors/{serviceType}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', }); registerOrgSourceOauthConfigurationRoute({ @@ -1169,14 +1169,14 @@ describe('sources routes', () => { }); }); - describe('POST /api/workplace_search/org/settings/connectors/{serviceType}', () => { + describe('POST /internal/workplace_search/org/settings/connectors/{serviceType}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'post', - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', }); registerOrgSourceOauthConfigurationRoute({ @@ -1199,14 +1199,14 @@ describe('sources routes', () => { }); }); - describe('PUT /api/workplace_search/org/settings/connectors/{serviceType}', () => { + describe('PUT /internal/workplace_search/org/settings/connectors/{serviceType}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'put', - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', }); registerOrgSourceOauthConfigurationRoute({ @@ -1229,14 +1229,14 @@ describe('sources routes', () => { }); }); - describe('DELETE /api/workplace_search/org/settings/connectors/{serviceType}', () => { + describe('DELETE /internal/workplace_search/org/settings/connectors/{serviceType}', () => { let mockRouter: MockRouter; beforeEach(() => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'delete', - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', }); registerOrgSourceOauthConfigurationRoute({ @@ -1252,7 +1252,7 @@ describe('sources routes', () => { }); }); - describe('GET /api/workplace_search/sources/create', () => { + describe('GET /internal/workplace_search/sources/create', () => { const tokenPackage = 'some_encrypted_secrets'; const mockRequest = { @@ -1268,7 +1268,7 @@ describe('sources routes', () => { jest.clearAllMocks(); mockRouter = new MockRouter({ method: 'get', - path: '/api/workplace_search/sources/create', + path: '/internal/workplace_search/sources/create', }); registerOauthConnectorParamsRoute({ diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.ts index cb56f54a1df6afb..28a5d621b117ca6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/sources.ts @@ -89,7 +89,7 @@ export function registerAccountSourcesRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources', + path: '/internal/workplace_search/account/sources', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -104,7 +104,7 @@ export function registerAccountSourcesStatusRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/status', + path: '/internal/workplace_search/account/sources/status', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -119,7 +119,7 @@ export function registerAccountSourceRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{id}', + path: '/internal/workplace_search/account/sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -133,7 +133,7 @@ export function registerAccountSourceRoute({ router.delete( { - path: '/api/workplace_search/account/sources/{id}', + path: '/internal/workplace_search/account/sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -152,7 +152,7 @@ export function registerAccountCreateSourceRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/account/create_source', + path: '/internal/workplace_search/account/create_source', validate: { body: schema.object({ service_type: schema.string(), @@ -176,7 +176,7 @@ export function registerAccountSourceDocumentsRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/account/sources/{id}/documents', + path: '/internal/workplace_search/account/sources/{id}/documents', validate: { body: schema.object({ query: schema.string(), @@ -199,7 +199,7 @@ export function registerAccountSourceFederatedSummaryRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{id}/federated_summary', + path: '/internal/workplace_search/account/sources/{id}/federated_summary', validate: { params: schema.object({ id: schema.string(), @@ -218,7 +218,7 @@ export function registerAccountSourceReauthPrepareRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{id}/reauth_prepare', + path: '/internal/workplace_search/account/sources/{id}/reauth_prepare', validate: { params: schema.object({ id: schema.string(), @@ -240,7 +240,7 @@ export function registerAccountSourceSettingsRoute({ }: RouteDependencies) { router.patch( { - path: '/api/workplace_search/account/sources/{id}/settings', + path: '/internal/workplace_search/account/sources/{id}/settings', validate: { body: sourceSettingsSchema, params: schema.object({ @@ -260,7 +260,7 @@ export function registerAccountPreSourceRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/pre_sources/{id}', + path: '/internal/workplace_search/account/pre_sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -279,7 +279,7 @@ export function registerAccountPrepareSourcesRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{serviceType}/prepare', + path: '/internal/workplace_search/account/sources/{serviceType}/prepare', validate: { params: schema.object({ serviceType: schema.string(), @@ -302,7 +302,7 @@ export function registerAccountSourceSearchableRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/account/sources/{id}/searchable', + path: '/internal/workplace_search/account/sources/{id}/searchable', validate: { body: schema.object({ searchable: schema.boolean(), @@ -324,7 +324,7 @@ export function registerAccountSourceDisplaySettingsConfig({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{id}/display_settings/config', + path: '/internal/workplace_search/account/sources/{id}/display_settings/config', validate: { params: schema.object({ id: schema.string(), @@ -338,7 +338,7 @@ export function registerAccountSourceDisplaySettingsConfig({ router.post( { - path: '/api/workplace_search/account/sources/{id}/display_settings/config', + path: '/internal/workplace_search/account/sources/{id}/display_settings/config', validate: { body: displaySettingsSchema, params: schema.object({ @@ -358,7 +358,7 @@ export function registerAccountSourceSchemasRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{id}/schemas', + path: '/internal/workplace_search/account/sources/{id}/schemas', validate: { params: schema.object({ id: schema.string(), @@ -372,7 +372,7 @@ export function registerAccountSourceSchemasRoute({ router.post( { - path: '/api/workplace_search/account/sources/{id}/schemas', + path: '/internal/workplace_search/account/sources/{id}/schemas', validate: { body: schemaValuesSchema, params: schema.object({ @@ -392,7 +392,7 @@ export function registerAccountSourceReindexJobRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', + path: '/internal/workplace_search/account/sources/{sourceId}/reindex_job/{jobId}', validate: { params: schema.object({ sourceId: schema.string(), @@ -412,7 +412,7 @@ export function registerAccountSourceDownloadDiagnosticsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/account/sources/{sourceId}/download_diagnostics', + path: '/internal/workplace_search/account/sources/{sourceId}/download_diagnostics', validate: { params: schema.object({ sourceId: schema.string(), @@ -433,7 +433,7 @@ export function registerOrgSourcesRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources', + path: '/internal/workplace_search/org/sources', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -448,7 +448,7 @@ export function registerOrgSourcesStatusRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/status', + path: '/internal/workplace_search/org/sources/status', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -463,7 +463,7 @@ export function registerOrgSourceRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{id}', + path: '/internal/workplace_search/org/sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -477,7 +477,7 @@ export function registerOrgSourceRoute({ router.delete( { - path: '/api/workplace_search/org/sources/{id}', + path: '/internal/workplace_search/org/sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -496,7 +496,7 @@ export function registerOrgCreateSourceRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/org/create_source', + path: '/internal/workplace_search/org/create_source', validate: { body: schema.object({ service_type: schema.string(), @@ -520,7 +520,7 @@ export function registerOrgSourceDocumentsRoute({ }: RouteDependencies) { router.post( { - path: '/api/workplace_search/org/sources/{id}/documents', + path: '/internal/workplace_search/org/sources/{id}/documents', validate: { body: schema.object({ query: schema.string(), @@ -543,7 +543,7 @@ export function registerOrgSourceFederatedSummaryRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{id}/federated_summary', + path: '/internal/workplace_search/org/sources/{id}/federated_summary', validate: { params: schema.object({ id: schema.string(), @@ -562,7 +562,7 @@ export function registerOrgSourceReauthPrepareRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{id}/reauth_prepare', + path: '/internal/workplace_search/org/sources/{id}/reauth_prepare', validate: { params: schema.object({ id: schema.string(), @@ -584,7 +584,7 @@ export function registerOrgSourceSettingsRoute({ }: RouteDependencies) { router.patch( { - path: '/api/workplace_search/org/sources/{id}/settings', + path: '/internal/workplace_search/org/sources/{id}/settings', validate: { body: sourceSettingsSchema, params: schema.object({ @@ -604,7 +604,7 @@ export function registerOrgPreSourceRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/pre_sources/{id}', + path: '/internal/workplace_search/org/pre_sources/{id}', validate: { params: schema.object({ id: schema.string(), @@ -623,7 +623,7 @@ export function registerOrgPrepareSourcesRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{serviceType}/prepare', + path: '/internal/workplace_search/org/sources/{serviceType}/prepare', validate: { params: schema.object({ serviceType: schema.string(), @@ -647,7 +647,7 @@ export function registerOrgSourceSearchableRoute({ }: RouteDependencies) { router.put( { - path: '/api/workplace_search/org/sources/{id}/searchable', + path: '/internal/workplace_search/org/sources/{id}/searchable', validate: { body: schema.object({ searchable: schema.boolean(), @@ -669,7 +669,7 @@ export function registerOrgSourceDisplaySettingsConfig({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{id}/display_settings/config', + path: '/internal/workplace_search/org/sources/{id}/display_settings/config', validate: { params: schema.object({ id: schema.string(), @@ -683,7 +683,7 @@ export function registerOrgSourceDisplaySettingsConfig({ router.post( { - path: '/api/workplace_search/org/sources/{id}/display_settings/config', + path: '/internal/workplace_search/org/sources/{id}/display_settings/config', validate: { body: displaySettingsSchema, params: schema.object({ @@ -703,7 +703,7 @@ export function registerOrgSourceSchemasRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{id}/schemas', + path: '/internal/workplace_search/org/sources/{id}/schemas', validate: { params: schema.object({ id: schema.string(), @@ -717,7 +717,7 @@ export function registerOrgSourceSchemasRoute({ router.post( { - path: '/api/workplace_search/org/sources/{id}/schemas', + path: '/internal/workplace_search/org/sources/{id}/schemas', validate: { body: schemaValuesSchema, params: schema.object({ @@ -737,7 +737,7 @@ export function registerOrgSourceReindexJobRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', + path: '/internal/workplace_search/org/sources/{sourceId}/reindex_job/{jobId}', validate: { params: schema.object({ sourceId: schema.string(), @@ -757,7 +757,7 @@ export function registerOrgSourceDownloadDiagnosticsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/sources/{sourceId}/download_diagnostics', + path: '/internal/workplace_search/org/sources/{sourceId}/download_diagnostics', validate: { params: schema.object({ sourceId: schema.string(), @@ -777,7 +777,7 @@ export function registerOrgSourceOauthConfigurationsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', validate: false, }, enterpriseSearchRequestHandler.createRequest({ @@ -787,7 +787,7 @@ export function registerOrgSourceOauthConfigurationsRoute({ router.post( { - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', validate: { body: oauthConfigSchema, }, @@ -799,7 +799,7 @@ export function registerOrgSourceOauthConfigurationsRoute({ router.put( { - path: '/api/workplace_search/org/settings/connectors', + path: '/internal/workplace_search/org/settings/connectors', validate: { body: oauthConfigSchema, }, @@ -816,7 +816,7 @@ export function registerOrgSourceOauthConfigurationRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', validate: { params: schema.object({ serviceType: schema.string(), @@ -830,7 +830,7 @@ export function registerOrgSourceOauthConfigurationRoute({ router.post( { - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', validate: { params: schema.object({ serviceType: schema.string(), @@ -845,7 +845,7 @@ export function registerOrgSourceOauthConfigurationRoute({ router.put( { - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', validate: { params: schema.object({ serviceType: schema.string(), @@ -860,7 +860,7 @@ export function registerOrgSourceOauthConfigurationRoute({ router.delete( { - path: '/api/workplace_search/org/settings/connectors/{serviceType}', + path: '/internal/workplace_search/org/settings/connectors/{serviceType}', validate: { params: schema.object({ serviceType: schema.string(), @@ -880,7 +880,7 @@ export function registerOauthConnectorParamsRoute({ }: RouteDependencies) { router.get( { - path: '/api/workplace_search/sources/create', + path: '/internal/workplace_search/sources/create', validate: { query: schema.object({ kibana_host: schema.string(), From d6e333524dc0017865fd29f39fdce2432500ed8e Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Wed, 8 Sep 2021 17:20:42 +0200 Subject: [PATCH 3/6] Fix flaky migrations tests (#111365) (#111523) # Conflicts: # src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts --- .../integration_tests/batch_size_bytes.test.ts | 2 ++ .../saved_objects/migrationsv2/test_helpers/retry.test.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts b/src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts index 015c1047315520b..ead46627e324dba 100644 --- a/src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts +++ b/src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts @@ -67,6 +67,8 @@ describe('migration v2', () => { await root.setup(); await expect(root.start()).resolves.toBeTruthy(); + // After plugins start, some saved objects are deleted/recreated, so we + // wait a bit for the count to settle. await new Promise((resolve) => setTimeout(resolve, 5000)); const esClient: ElasticsearchClient = esServer.es.getClient(); diff --git a/src/core/server/saved_objects/migrationsv2/test_helpers/retry.test.ts b/src/core/server/saved_objects/migrationsv2/test_helpers/retry.test.ts index ff5bf3d01c641af..8294a61caae6e96 100644 --- a/src/core/server/saved_objects/migrationsv2/test_helpers/retry.test.ts +++ b/src/core/server/saved_objects/migrationsv2/test_helpers/retry.test.ts @@ -8,8 +8,7 @@ import { retryAsync } from './retry_async'; -// FLAKY: https://github.com/elastic/kibana/issues/110970 -describe.skip('retry', () => { +describe('retry', () => { it('retries throwing functions until they succeed', async () => { let i = 0; await expect( @@ -53,6 +52,8 @@ describe.skip('retry', () => { }, { retryAttempts: 3, retryDelayMs: 100 } ); - expect(Date.now() - now).toBeGreaterThanOrEqual(200); + // Would expect it to take 200ms but seems like timing inaccuracies + // sometimes causes the duration to be measured as 199ms + expect(Date.now() - now).toBeGreaterThanOrEqual(199); }); }); From 75bfc090ed7d83312b6c0c4dbb5a3cf981e98a0a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:23:33 -0400 Subject: [PATCH 4/6] [App Search] Crawler overview empty state needs an EuiSpacer (#111498) (#111528) Co-authored-by: Orhan Toy --- .../app_search/components/crawler/crawler_overview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx index 78e093f4199dae1..be4e1743748b78f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx @@ -86,6 +86,7 @@ export const CrawlerOverview: React.FC = () => {

+ From 05ff8339d1a9d1aa1771f496619bb68fb66fdcb8 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:29:37 -0400 Subject: [PATCH 5/6] [CI] Buildkite ES Snapshots Pipelines (#100843) (#111547) Co-authored-by: Brian Seeders --- .buildkite/pipelines/es_snapshots/build.yml | 5 + .buildkite/pipelines/es_snapshots/promote.yml | 12 +++ .buildkite/pipelines/es_snapshots/verify.yml | 102 ++++++++++++++++++ .buildkite/scripts/build_kibana_plugins.sh | 0 .../scripts/download_build_artifacts.sh | 4 +- .buildkite/scripts/lifecycle/pre_command.sh | 5 + .buildkite/scripts/steps/build_kibana.sh | 8 ++ .../steps/es_snapshots/bucket_config.js | 4 + .../scripts/steps/es_snapshots/build.sh | 101 +++++++++++++++++ .../steps/es_snapshots/create_manifest.js | 90 ++++++++++++++++ .../scripts/steps/es_snapshots/promote.sh | 13 +++ .../steps/es_snapshots/promote_manifest.js | 46 ++++++++ .../steps/es_snapshots/trigger_promote.sh | 20 ++++ .../scripts/steps/functional/oss-cigroup.sh | 16 +++ .../scripts/steps/functional/xpack-cigroup.sh | 18 ++++ .../scripts/steps/test/api_integration.sh | 11 ++ .buildkite/scripts/steps/test/jest.sh | 8 ++ .../scripts/steps/test/jest_integration.sh | 8 ++ 18 files changed, 469 insertions(+), 2 deletions(-) create mode 100644 .buildkite/pipelines/es_snapshots/build.yml create mode 100644 .buildkite/pipelines/es_snapshots/promote.yml create mode 100755 .buildkite/pipelines/es_snapshots/verify.yml mode change 100644 => 100755 .buildkite/scripts/build_kibana_plugins.sh create mode 100755 .buildkite/scripts/steps/build_kibana.sh create mode 100644 .buildkite/scripts/steps/es_snapshots/bucket_config.js create mode 100755 .buildkite/scripts/steps/es_snapshots/build.sh create mode 100644 .buildkite/scripts/steps/es_snapshots/create_manifest.js create mode 100755 .buildkite/scripts/steps/es_snapshots/promote.sh create mode 100644 .buildkite/scripts/steps/es_snapshots/promote_manifest.js create mode 100644 .buildkite/scripts/steps/es_snapshots/trigger_promote.sh create mode 100755 .buildkite/scripts/steps/functional/oss-cigroup.sh create mode 100755 .buildkite/scripts/steps/functional/xpack-cigroup.sh create mode 100755 .buildkite/scripts/steps/test/api_integration.sh create mode 100755 .buildkite/scripts/steps/test/jest.sh create mode 100755 .buildkite/scripts/steps/test/jest_integration.sh diff --git a/.buildkite/pipelines/es_snapshots/build.yml b/.buildkite/pipelines/es_snapshots/build.yml new file mode 100644 index 000000000000000..2bc555de8bf5d88 --- /dev/null +++ b/.buildkite/pipelines/es_snapshots/build.yml @@ -0,0 +1,5 @@ +steps: + - command: .buildkite/scripts/steps/es_snapshots/build.sh + label: Build ES Snapshot + agents: + queue: c2-8 diff --git a/.buildkite/pipelines/es_snapshots/promote.yml b/.buildkite/pipelines/es_snapshots/promote.yml new file mode 100644 index 000000000000000..5a003321246a18a --- /dev/null +++ b/.buildkite/pipelines/es_snapshots/promote.yml @@ -0,0 +1,12 @@ +steps: + - block: 'Promote' + prompt: "Enter the details for the snapshot you'd like to promote" + if: "build.env('ES_SNAPSHOT_MANIFEST') == null" + # Later, this could be a dropdown dynamically filled with recent builds + fields: + - text: 'ES_SNAPSHOT_MANIFEST' + key: 'ES_SNAPSHOT_MANIFEST' + hint: 'URL pointing to the manifest to promote' + required: true + - label: Promote Snapshot + command: .buildkite/scripts/steps/es_snapshots/promote.sh diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml new file mode 100755 index 000000000000000..c87c810b53a19d6 --- /dev/null +++ b/.buildkite/pipelines/es_snapshots/verify.yml @@ -0,0 +1,102 @@ +env: + IGNORE_SHIP_CI_STATS_ERROR: 'true' +steps: + - block: 'Verify' + prompt: "Enter the details for the snapshot you'd like to verify" + if: "build.env('ES_SNAPSHOT_MANIFEST') == null" + # Later, this could be a dropdown dynamically filled with recent builds + fields: + - text: 'ES_SNAPSHOT_MANIFEST' + key: 'ES_SNAPSHOT_MANIFEST' + hint: 'URL pointing to the manifest to promote' + required: true + + - command: .buildkite/scripts/lifecycle/pre_build.sh + label: Pre-Build + + - wait + + - command: .buildkite/scripts/steps/build_kibana.sh + label: Build Kibana Distribution and Plugins + agents: + queue: c2-8 + key: build + if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" + + - command: .buildkite/scripts/steps/functional/xpack-cigroup.sh + label: 'Default CI Group' + parallelism: 13 + agents: + queue: ci-group-6 + artifact_paths: target/junit/**/*.xml + depends_on: build + key: default-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack-cigroup.sh + label: 'Docker CI Group' + agents: + queue: ci-group-6 + artifact_paths: target/junit/**/*.xml + depends_on: build + key: default-cigroup-docker + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss-cigroup.sh + label: 'OSS CI Group' + parallelism: 12 + agents: + queue: ci-group-4d + artifact_paths: target/junit/**/*.xml + depends_on: build + key: oss-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/test/jest_integration.sh + label: 'Jest Integration Tests' + agents: + queue: jest + artifact_paths: target/junit/**/*.xml + key: jest-integration + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/test/api_integration.sh + label: 'API Integration Tests' + agents: + queue: jest + artifact_paths: target/junit/**/*.xml + key: api-integration + + - command: .buildkite/scripts/steps/es_snapshots/trigger_promote.sh + label: Trigger promotion + depends_on: + - default-cigroup + - default-cigroup-docker + - oss-cigroup + - jest-integration + - api-integration + + - wait: ~ + continue_on_failure: true + + - plugins: + - junit-annotate#v1.9.0: + artifacts: target/junit/**/*.xml + + - wait: ~ + continue_on_failure: true + + - command: .buildkite/scripts/lifecycle/post_build.sh + label: Post-Build diff --git a/.buildkite/scripts/build_kibana_plugins.sh b/.buildkite/scripts/build_kibana_plugins.sh old mode 100644 new mode 100755 diff --git a/.buildkite/scripts/download_build_artifacts.sh b/.buildkite/scripts/download_build_artifacts.sh index 6a6b7246753f669..1e7525fff25ea86 100755 --- a/.buildkite/scripts/download_build_artifacts.sh +++ b/.buildkite/scripts/download_build_artifacts.sh @@ -7,8 +7,8 @@ if [[ ! -d "$KIBANA_BUILD_LOCATION/bin" ]]; then cd "$WORKSPACE" - buildkite-agent artifact download kibana-default.tar.gz . - buildkite-agent artifact download kibana-default-plugins.tar.gz . + buildkite-agent artifact download kibana-default.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + buildkite-agent artifact download kibana-default-plugins.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" mkdir -p "$KIBANA_BUILD_LOCATION" tar -xzf kibana-default.tar.gz -C "$KIBANA_BUILD_LOCATION" --strip=1 diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index b0113e6b169649c..759f1e7b4ff9ee2 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -72,3 +72,8 @@ if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then source .buildkite/scripts/common/setup_bazel.sh fi fi + +PIPELINE_PRE_COMMAND=${PIPELINE_PRE_COMMAND:-".buildkite/scripts/lifecycle/pipelines/$BUILDKITE_PIPELINE_SLUG/pre_command.sh"} +if [[ -f "$PIPELINE_PRE_COMMAND" ]]; then + source "$PIPELINE_PRE_COMMAND" +fi diff --git a/.buildkite/scripts/steps/build_kibana.sh b/.buildkite/scripts/steps/build_kibana.sh new file mode 100755 index 000000000000000..5896dcac5d4447c --- /dev/null +++ b/.buildkite/scripts/steps/build_kibana.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh +.buildkite/scripts/build_kibana.sh +.buildkite/scripts/build_kibana_plugins.sh +.buildkite/scripts/post_build_kibana.sh diff --git a/.buildkite/scripts/steps/es_snapshots/bucket_config.js b/.buildkite/scripts/steps/es_snapshots/bucket_config.js new file mode 100644 index 000000000000000..a18d1182c4a8963 --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/bucket_config.js @@ -0,0 +1,4 @@ +module.exports = { + BASE_BUCKET_DAILY: 'kibana-ci-es-snapshots-daily', + BASE_BUCKET_PERMANENT: 'kibana-ci-es-snapshots-permanent', +}; diff --git a/.buildkite/scripts/steps/es_snapshots/build.sh b/.buildkite/scripts/steps/es_snapshots/build.sh new file mode 100755 index 000000000000000..91b5004594a6ddf --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/build.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo "--- Cloning Elasticsearch and preparing workspace" + +cd .. +destination="$(pwd)/es-build" +rm -rf "$destination" +mkdir -p "$destination" + +mkdir -p elasticsearch && cd elasticsearch + +export ELASTICSEARCH_BRANCH="${ELASTICSEARCH_BRANCH:-$BUILDKITE_BRANCH}" + +if [[ ! -d .git ]]; then + git init + git remote add origin https://github.com/elastic/elasticsearch.git +fi +git fetch origin --depth 1 "$ELASTICSEARCH_BRANCH" +git reset --hard FETCH_HEAD + +ELASTICSEARCH_GIT_COMMIT="$(git rev-parse HEAD)" +export ELASTICSEARCH_GIT_COMMIT + +ELASTICSEARCH_GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" +export ELASTICSEARCH_GIT_COMMIT_SHORT + +# These turn off automation in the Elasticsearch repo +export BUILD_NUMBER="" +export JENKINS_URL="" +export BUILD_URL="" +export JOB_NAME="" +export NODE_NAME="" +export DOCKER_BUILDKIT="" + +# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it +export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)" + +export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH" +export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA" + +# The Elasticsearch Dockerfile needs to be built with root privileges, but Docker on our servers is running using a non-root user +# So, let's use docker-in-docker to temporarily create a privileged docker daemon to run `docker build` on +# We have to do this, because there's no `docker build --privileged` or similar + +echo "--- Setting up Docker-in-Docker for Elasticsearch" + +docker rm -f dind || true # If there's an old daemon running that somehow didn't get cleaned up, lets remove it first +CERTS_DIR="$HOME/dind-certs" +rm -rf "$CERTS_DIR" +docker run -d --rm --privileged --name dind --userns host -p 2377:2376 -e DOCKER_TLS_CERTDIR=/certs -v "$CERTS_DIR":/certs docker:dind + +trap "docker rm -f dind" EXIT + +export DOCKER_TLS_VERIFY=true +export DOCKER_CERT_PATH="$CERTS_DIR/client" +export DOCKER_TLS_CERTDIR="$CERTS_DIR" +export DOCKER_HOST=localhost:2377 + +echo "--- Build Elasticsearch" +./gradlew -Dbuild.docker=true assemble --parallel + +echo "--- Create distribution archives" +find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elasticsearch-*-*-*-*.zip' \) -not -path '*no-jdk*' -not -path '*build-context*' -exec cp {} "$destination" \; + +ls -alh "$destination" + +echo "--- Create docker image archives" +docker images "docker.elastic.co/elasticsearch/elasticsearch" +docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz' +docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz' + +echo "--- Create checksums for snapshot files" +cd "$destination" +find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \; + +cd "$BUILDKITE_BUILD_CHECKOUT_PATH" +node "$(dirname "${0}")/create_manifest.js" "$destination" + +ES_SNAPSHOT_MANIFEST="$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)" + +cat << EOF | buildkite-agent annotate --style "info" + - \`ELASTICSEARCH_BRANCH\` - \`$ELASTICSEARCH_BRANCH\` + - \`ELASTICSEARCH_GIT_COMMIT\` - \`$ELASTICSEARCH_GIT_COMMIT\` + - \`ES_SNAPSHOT_MANIFEST\` - \`$ES_SNAPSHOT_MANIFEST\` + - \`ES_SNAPSHOT_VERSION\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_VERSION)\` + - \`ES_SNAPSHOT_ID\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_ID)\` +EOF + +cat << EOF | buildkite-agent pipeline upload +steps: + - trigger: 'kibana-elasticsearch-snapshot-verify' + async: true + build: + env: + ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST' + branch: '$BUILDKITE_BRANCH' +EOF diff --git a/.buildkite/scripts/steps/es_snapshots/create_manifest.js b/.buildkite/scripts/steps/es_snapshots/create_manifest.js new file mode 100644 index 000000000000000..3173737e984e8d4 --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/create_manifest.js @@ -0,0 +1,90 @@ +const fs = require('fs'); +const { execSync } = require('child_process'); +const { BASE_BUCKET_DAILY } = require('./bucket_config.js'); + +(async () => { + console.log('--- Create ES Snapshot Manifest'); + + const destination = process.argv[2] || __dirname + '/test'; + + const ES_BRANCH = process.env.ELASTICSEARCH_BRANCH; + const GIT_COMMIT = process.env.ELASTICSEARCH_GIT_COMMIT; + const GIT_COMMIT_SHORT = process.env.ELASTICSEARCH_GIT_COMMIT_SHORT; + + let VERSION = ''; + let SNAPSHOT_ID = ''; + let DESTINATION = ''; + + const now = new Date(); + + // format: yyyyMMdd-HHmmss + const date = [ + now.getFullYear(), + (now.getMonth() + 1).toString().padStart(2, '0'), + now.getDate().toString().padStart(2, '0'), + '-', + now.getHours().toString().padStart(2, '0'), + now.getMinutes().toString().padStart(2, '0'), + now.getSeconds().toString().padStart(2, '0'), + ].join(''); + + try { + const files = fs.readdirSync(destination); + const manifestEntries = files + .filter((filename) => !filename.match(/.sha512$/)) + .filter((filename) => !filename.match(/.json$/)) + .map((filename) => { + const parts = filename.replace('elasticsearch-oss', 'oss').split('-'); + + VERSION = VERSION || parts[1]; + SNAPSHOT_ID = SNAPSHOT_ID || `${date}_${GIT_COMMIT_SHORT}`; + DESTINATION = DESTINATION || `${VERSION}/archives/${SNAPSHOT_ID}`; + + return { + filename: filename, + checksum: filename + '.sha512', + url: `https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/${filename}`, + version: parts[1], + platform: parts[3], + architecture: parts[4].split('.')[0], + license: parts[0] == 'oss' ? 'oss' : 'default', + }; + }); + + const manifest = { + id: SNAPSHOT_ID, + bucket: `${BASE_BUCKET_DAILY}/${DESTINATION}`.toString(), + branch: ES_BRANCH, + sha: GIT_COMMIT, + sha_short: GIT_COMMIT_SHORT, + version: VERSION, + generated: now.toISOString(), + archives: manifestEntries, + }; + + const manifestJSON = JSON.stringify(manifest, null, 2); + fs.writeFileSync(`${destination}/manifest.json`, manifestJSON); + + console.log('Manifest:', manifestJSON); + + execSync( + ` + set -euo pipefail + + echo '--- Upload files to GCS' + cd "${destination}" + gsutil -m cp -r *.* gs://${BASE_BUCKET_DAILY}/${DESTINATION} + cp manifest.json manifest-latest.json + gsutil cp manifest-latest.json gs://${BASE_BUCKET_DAILY}/${VERSION} + + buildkite-agent meta-data set ES_SNAPSHOT_MANIFEST 'https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/manifest.json' + buildkite-agent meta-data set ES_SNAPSHOT_VERSION '${VERSION}' + buildkite-agent meta-data set ES_SNAPSHOT_ID '${SNAPSHOT_ID}' + `, + { shell: '/bin/bash' } + ); + } catch (ex) { + console.error(ex); + process.exit(1); + } +})(); diff --git a/.buildkite/scripts/steps/es_snapshots/promote.sh b/.buildkite/scripts/steps/es_snapshots/promote.sh new file mode 100755 index 000000000000000..20f79d1a4e2e407 --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/promote.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euo pipefail + +export ES_SNAPSHOT_MANIFEST="${ES_SNAPSHOT_MANIFEST:-"$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"}" + +cat << EOF | buildkite-agent annotate --style "info" + This promotion is for the following snapshot manifest: + + $ES_SNAPSHOT_MANIFEST +EOF + +node "$(dirname "${0}")/promote_manifest.js" "$ES_SNAPSHOT_MANIFEST" diff --git a/.buildkite/scripts/steps/es_snapshots/promote_manifest.js b/.buildkite/scripts/steps/es_snapshots/promote_manifest.js new file mode 100644 index 000000000000000..ce14935dd1b848b --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/promote_manifest.js @@ -0,0 +1,46 @@ +const fs = require('fs'); +const { execSync } = require('child_process'); +const { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } = require('./bucket_config.js'); + +(async () => { + try { + const MANIFEST_URL = process.argv[2]; + + if (!MANIFEST_URL) { + throw Error('Manifest URL missing'); + } + + const tempDir = fs.mkdtempSync('snapshot-promotion'); + process.chdir(tempDir); + + execSync(`curl '${MANIFEST_URL}' > manifest.json`); + + const manifestJson = fs.readFileSync('manifest.json').toString(); + const manifest = JSON.parse(manifestJson); + const { id, bucket, version } = manifest; + + const manifestPermanentJson = manifestJson + .split(BASE_BUCKET_DAILY) + .join(BASE_BUCKET_PERMANENT) + .split(`${version}/archives/${id}`) + .join(version); // e.g. replaceAll + + fs.writeFileSync('manifest-permanent.json', manifestPermanentJson); + + execSync( + ` + set -euo pipefail + cp manifest.json manifest-latest-verified.json + gsutil cp manifest-latest-verified.json gs://${BASE_BUCKET_DAILY}/${version}/ + rm manifest.json + cp manifest-permanent.json manifest.json + gsutil -m cp -r gs://${bucket}/* gs://${BASE_BUCKET_PERMANENT}/${version}/ + gsutil cp manifest.json gs://${BASE_BUCKET_PERMANENT}/${version}/ + `, + { shell: '/bin/bash' } + ); + } catch (ex) { + console.error(ex); + process.exit(1); + } +})(); diff --git a/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh b/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh new file mode 100644 index 000000000000000..1e8256d8c6645bb --- /dev/null +++ b/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -euo pipefail + +# If ES_SNAPSHOT_MANIFEST is set dynamically during the verify job, rather than provided during the trigger, +# such as if you provide it as input during a manual build, +# the ES_SNAPSHOT_MANIFEST env var will be empty in the context of the pipeline. +# So, we'll trigger with a script instead, so that we can ensure ES_SNAPSHOT_MANIFEST is populated. + +export ES_SNAPSHOT_MANIFEST="${ES_SNAPSHOT_MANIFEST:-"$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"}" + +cat << EOF | buildkite-agent pipeline upload +steps: + - trigger: 'kibana-elasticsearch-snapshot-promote' + async: true + build: + env: + ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST' + branch: '$BUILDKITE_BRANCH' +EOF diff --git a/.buildkite/scripts/steps/functional/oss-cigroup.sh b/.buildkite/scripts/steps/functional/oss-cigroup.sh new file mode 100755 index 000000000000000..b4c643868ff7ddb --- /dev/null +++ b/.buildkite/scripts/steps/functional/oss-cigroup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh +.buildkite/scripts/download_build_artifacts.sh + +export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} +export JOB=kibana-oss-ciGroup${CI_GROUP} + +echo "--- OSS CI Group $CI_GROUP" + +node scripts/functional_tests \ + --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "ciGroup$CI_GROUP" diff --git a/.buildkite/scripts/steps/functional/xpack-cigroup.sh b/.buildkite/scripts/steps/functional/xpack-cigroup.sh new file mode 100755 index 000000000000000..e6ef0bba87904a9 --- /dev/null +++ b/.buildkite/scripts/steps/functional/xpack-cigroup.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh +.buildkite/scripts/download_build_artifacts.sh + +export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} +export JOB=kibana-default-ciGroup${CI_GROUP} + +echo "--- Default CI Group $CI_GROUP" + +cd "$XPACK_DIR" + +node scripts/functional_tests \ + --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "ciGroup$CI_GROUP" diff --git a/.buildkite/scripts/steps/test/api_integration.sh b/.buildkite/scripts/steps/test/api_integration.sh new file mode 100755 index 000000000000000..4bf1ed1406ac53d --- /dev/null +++ b/.buildkite/scripts/steps/test/api_integration.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +echo '--- API Integration Tests' +node scripts/functional_tests \ + --config test/api_integration/config.js \ + --bail \ + --debug diff --git a/.buildkite/scripts/steps/test/jest.sh b/.buildkite/scripts/steps/test/jest.sh new file mode 100755 index 000000000000000..ab9be759b43a5e0 --- /dev/null +++ b/.buildkite/scripts/steps/test/jest.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +echo '--- Jest' +node scripts/jest --ci --verbose --maxWorkers=13 diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh new file mode 100755 index 000000000000000..eb243e55670e32e --- /dev/null +++ b/.buildkite/scripts/steps/test/jest_integration.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +echo '--- Jest Integration Tests' +node scripts/jest_integration --ci --verbose From c2a189e9d15653065ed22daa394876040dc9fc61 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Wed, 8 Sep 2021 11:46:08 -0400 Subject: [PATCH 6/6] Revert "[CI] Buildkite ES Snapshots Pipelines (#100843) (#111547)" (#111563) This reverts commit 05ff8339d1a9d1aa1771f496619bb68fb66fdcb8. --- .buildkite/pipelines/es_snapshots/build.yml | 5 - .buildkite/pipelines/es_snapshots/promote.yml | 12 --- .buildkite/pipelines/es_snapshots/verify.yml | 102 ------------------ .buildkite/scripts/build_kibana_plugins.sh | 0 .../scripts/download_build_artifacts.sh | 4 +- .buildkite/scripts/lifecycle/pre_command.sh | 5 - .buildkite/scripts/steps/build_kibana.sh | 8 -- .../steps/es_snapshots/bucket_config.js | 4 - .../scripts/steps/es_snapshots/build.sh | 101 ----------------- .../steps/es_snapshots/create_manifest.js | 90 ---------------- .../scripts/steps/es_snapshots/promote.sh | 13 --- .../steps/es_snapshots/promote_manifest.js | 46 -------- .../steps/es_snapshots/trigger_promote.sh | 20 ---- .../scripts/steps/functional/oss-cigroup.sh | 16 --- .../scripts/steps/functional/xpack-cigroup.sh | 18 ---- .../scripts/steps/test/api_integration.sh | 11 -- .buildkite/scripts/steps/test/jest.sh | 8 -- .../scripts/steps/test/jest_integration.sh | 8 -- 18 files changed, 2 insertions(+), 469 deletions(-) delete mode 100644 .buildkite/pipelines/es_snapshots/build.yml delete mode 100644 .buildkite/pipelines/es_snapshots/promote.yml delete mode 100755 .buildkite/pipelines/es_snapshots/verify.yml mode change 100755 => 100644 .buildkite/scripts/build_kibana_plugins.sh delete mode 100755 .buildkite/scripts/steps/build_kibana.sh delete mode 100644 .buildkite/scripts/steps/es_snapshots/bucket_config.js delete mode 100755 .buildkite/scripts/steps/es_snapshots/build.sh delete mode 100644 .buildkite/scripts/steps/es_snapshots/create_manifest.js delete mode 100755 .buildkite/scripts/steps/es_snapshots/promote.sh delete mode 100644 .buildkite/scripts/steps/es_snapshots/promote_manifest.js delete mode 100644 .buildkite/scripts/steps/es_snapshots/trigger_promote.sh delete mode 100755 .buildkite/scripts/steps/functional/oss-cigroup.sh delete mode 100755 .buildkite/scripts/steps/functional/xpack-cigroup.sh delete mode 100755 .buildkite/scripts/steps/test/api_integration.sh delete mode 100755 .buildkite/scripts/steps/test/jest.sh delete mode 100755 .buildkite/scripts/steps/test/jest_integration.sh diff --git a/.buildkite/pipelines/es_snapshots/build.yml b/.buildkite/pipelines/es_snapshots/build.yml deleted file mode 100644 index 2bc555de8bf5d88..000000000000000 --- a/.buildkite/pipelines/es_snapshots/build.yml +++ /dev/null @@ -1,5 +0,0 @@ -steps: - - command: .buildkite/scripts/steps/es_snapshots/build.sh - label: Build ES Snapshot - agents: - queue: c2-8 diff --git a/.buildkite/pipelines/es_snapshots/promote.yml b/.buildkite/pipelines/es_snapshots/promote.yml deleted file mode 100644 index 5a003321246a18a..000000000000000 --- a/.buildkite/pipelines/es_snapshots/promote.yml +++ /dev/null @@ -1,12 +0,0 @@ -steps: - - block: 'Promote' - prompt: "Enter the details for the snapshot you'd like to promote" - if: "build.env('ES_SNAPSHOT_MANIFEST') == null" - # Later, this could be a dropdown dynamically filled with recent builds - fields: - - text: 'ES_SNAPSHOT_MANIFEST' - key: 'ES_SNAPSHOT_MANIFEST' - hint: 'URL pointing to the manifest to promote' - required: true - - label: Promote Snapshot - command: .buildkite/scripts/steps/es_snapshots/promote.sh diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml deleted file mode 100755 index c87c810b53a19d6..000000000000000 --- a/.buildkite/pipelines/es_snapshots/verify.yml +++ /dev/null @@ -1,102 +0,0 @@ -env: - IGNORE_SHIP_CI_STATS_ERROR: 'true' -steps: - - block: 'Verify' - prompt: "Enter the details for the snapshot you'd like to verify" - if: "build.env('ES_SNAPSHOT_MANIFEST') == null" - # Later, this could be a dropdown dynamically filled with recent builds - fields: - - text: 'ES_SNAPSHOT_MANIFEST' - key: 'ES_SNAPSHOT_MANIFEST' - hint: 'URL pointing to the manifest to promote' - required: true - - - command: .buildkite/scripts/lifecycle/pre_build.sh - label: Pre-Build - - - wait - - - command: .buildkite/scripts/steps/build_kibana.sh - label: Build Kibana Distribution and Plugins - agents: - queue: c2-8 - key: build - if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" - - - command: .buildkite/scripts/steps/functional/xpack-cigroup.sh - label: 'Default CI Group' - parallelism: 13 - agents: - queue: ci-group-6 - artifact_paths: target/junit/**/*.xml - depends_on: build - key: default-cigroup - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack-cigroup.sh - label: 'Docker CI Group' - agents: - queue: ci-group-6 - artifact_paths: target/junit/**/*.xml - depends_on: build - key: default-cigroup-docker - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: .buildkite/scripts/steps/functional/oss-cigroup.sh - label: 'OSS CI Group' - parallelism: 12 - agents: - queue: ci-group-4d - artifact_paths: target/junit/**/*.xml - depends_on: build - key: oss-cigroup - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: .buildkite/scripts/steps/test/jest_integration.sh - label: 'Jest Integration Tests' - agents: - queue: jest - artifact_paths: target/junit/**/*.xml - key: jest-integration - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: .buildkite/scripts/steps/test/api_integration.sh - label: 'API Integration Tests' - agents: - queue: jest - artifact_paths: target/junit/**/*.xml - key: api-integration - - - command: .buildkite/scripts/steps/es_snapshots/trigger_promote.sh - label: Trigger promotion - depends_on: - - default-cigroup - - default-cigroup-docker - - oss-cigroup - - jest-integration - - api-integration - - - wait: ~ - continue_on_failure: true - - - plugins: - - junit-annotate#v1.9.0: - artifacts: target/junit/**/*.xml - - - wait: ~ - continue_on_failure: true - - - command: .buildkite/scripts/lifecycle/post_build.sh - label: Post-Build diff --git a/.buildkite/scripts/build_kibana_plugins.sh b/.buildkite/scripts/build_kibana_plugins.sh old mode 100755 new mode 100644 diff --git a/.buildkite/scripts/download_build_artifacts.sh b/.buildkite/scripts/download_build_artifacts.sh index 1e7525fff25ea86..6a6b7246753f669 100755 --- a/.buildkite/scripts/download_build_artifacts.sh +++ b/.buildkite/scripts/download_build_artifacts.sh @@ -7,8 +7,8 @@ if [[ ! -d "$KIBANA_BUILD_LOCATION/bin" ]]; then cd "$WORKSPACE" - buildkite-agent artifact download kibana-default.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" - buildkite-agent artifact download kibana-default-plugins.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + buildkite-agent artifact download kibana-default.tar.gz . + buildkite-agent artifact download kibana-default-plugins.tar.gz . mkdir -p "$KIBANA_BUILD_LOCATION" tar -xzf kibana-default.tar.gz -C "$KIBANA_BUILD_LOCATION" --strip=1 diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 759f1e7b4ff9ee2..b0113e6b169649c 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -72,8 +72,3 @@ if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then source .buildkite/scripts/common/setup_bazel.sh fi fi - -PIPELINE_PRE_COMMAND=${PIPELINE_PRE_COMMAND:-".buildkite/scripts/lifecycle/pipelines/$BUILDKITE_PIPELINE_SLUG/pre_command.sh"} -if [[ -f "$PIPELINE_PRE_COMMAND" ]]; then - source "$PIPELINE_PRE_COMMAND" -fi diff --git a/.buildkite/scripts/steps/build_kibana.sh b/.buildkite/scripts/steps/build_kibana.sh deleted file mode 100755 index 5896dcac5d4447c..000000000000000 --- a/.buildkite/scripts/steps/build_kibana.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh -.buildkite/scripts/build_kibana.sh -.buildkite/scripts/build_kibana_plugins.sh -.buildkite/scripts/post_build_kibana.sh diff --git a/.buildkite/scripts/steps/es_snapshots/bucket_config.js b/.buildkite/scripts/steps/es_snapshots/bucket_config.js deleted file mode 100644 index a18d1182c4a8963..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/bucket_config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - BASE_BUCKET_DAILY: 'kibana-ci-es-snapshots-daily', - BASE_BUCKET_PERMANENT: 'kibana-ci-es-snapshots-permanent', -}; diff --git a/.buildkite/scripts/steps/es_snapshots/build.sh b/.buildkite/scripts/steps/es_snapshots/build.sh deleted file mode 100755 index 91b5004594a6ddf..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/build.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -source .buildkite/scripts/common/util.sh - -echo "--- Cloning Elasticsearch and preparing workspace" - -cd .. -destination="$(pwd)/es-build" -rm -rf "$destination" -mkdir -p "$destination" - -mkdir -p elasticsearch && cd elasticsearch - -export ELASTICSEARCH_BRANCH="${ELASTICSEARCH_BRANCH:-$BUILDKITE_BRANCH}" - -if [[ ! -d .git ]]; then - git init - git remote add origin https://github.com/elastic/elasticsearch.git -fi -git fetch origin --depth 1 "$ELASTICSEARCH_BRANCH" -git reset --hard FETCH_HEAD - -ELASTICSEARCH_GIT_COMMIT="$(git rev-parse HEAD)" -export ELASTICSEARCH_GIT_COMMIT - -ELASTICSEARCH_GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" -export ELASTICSEARCH_GIT_COMMIT_SHORT - -# These turn off automation in the Elasticsearch repo -export BUILD_NUMBER="" -export JENKINS_URL="" -export BUILD_URL="" -export JOB_NAME="" -export NODE_NAME="" -export DOCKER_BUILDKIT="" - -# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it -export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)" - -export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH" -export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA" - -# The Elasticsearch Dockerfile needs to be built with root privileges, but Docker on our servers is running using a non-root user -# So, let's use docker-in-docker to temporarily create a privileged docker daemon to run `docker build` on -# We have to do this, because there's no `docker build --privileged` or similar - -echo "--- Setting up Docker-in-Docker for Elasticsearch" - -docker rm -f dind || true # If there's an old daemon running that somehow didn't get cleaned up, lets remove it first -CERTS_DIR="$HOME/dind-certs" -rm -rf "$CERTS_DIR" -docker run -d --rm --privileged --name dind --userns host -p 2377:2376 -e DOCKER_TLS_CERTDIR=/certs -v "$CERTS_DIR":/certs docker:dind - -trap "docker rm -f dind" EXIT - -export DOCKER_TLS_VERIFY=true -export DOCKER_CERT_PATH="$CERTS_DIR/client" -export DOCKER_TLS_CERTDIR="$CERTS_DIR" -export DOCKER_HOST=localhost:2377 - -echo "--- Build Elasticsearch" -./gradlew -Dbuild.docker=true assemble --parallel - -echo "--- Create distribution archives" -find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elasticsearch-*-*-*-*.zip' \) -not -path '*no-jdk*' -not -path '*build-context*' -exec cp {} "$destination" \; - -ls -alh "$destination" - -echo "--- Create docker image archives" -docker images "docker.elastic.co/elasticsearch/elasticsearch" -docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz' -docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz' - -echo "--- Create checksums for snapshot files" -cd "$destination" -find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \; - -cd "$BUILDKITE_BUILD_CHECKOUT_PATH" -node "$(dirname "${0}")/create_manifest.js" "$destination" - -ES_SNAPSHOT_MANIFEST="$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)" - -cat << EOF | buildkite-agent annotate --style "info" - - \`ELASTICSEARCH_BRANCH\` - \`$ELASTICSEARCH_BRANCH\` - - \`ELASTICSEARCH_GIT_COMMIT\` - \`$ELASTICSEARCH_GIT_COMMIT\` - - \`ES_SNAPSHOT_MANIFEST\` - \`$ES_SNAPSHOT_MANIFEST\` - - \`ES_SNAPSHOT_VERSION\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_VERSION)\` - - \`ES_SNAPSHOT_ID\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_ID)\` -EOF - -cat << EOF | buildkite-agent pipeline upload -steps: - - trigger: 'kibana-elasticsearch-snapshot-verify' - async: true - build: - env: - ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST' - branch: '$BUILDKITE_BRANCH' -EOF diff --git a/.buildkite/scripts/steps/es_snapshots/create_manifest.js b/.buildkite/scripts/steps/es_snapshots/create_manifest.js deleted file mode 100644 index 3173737e984e8d4..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/create_manifest.js +++ /dev/null @@ -1,90 +0,0 @@ -const fs = require('fs'); -const { execSync } = require('child_process'); -const { BASE_BUCKET_DAILY } = require('./bucket_config.js'); - -(async () => { - console.log('--- Create ES Snapshot Manifest'); - - const destination = process.argv[2] || __dirname + '/test'; - - const ES_BRANCH = process.env.ELASTICSEARCH_BRANCH; - const GIT_COMMIT = process.env.ELASTICSEARCH_GIT_COMMIT; - const GIT_COMMIT_SHORT = process.env.ELASTICSEARCH_GIT_COMMIT_SHORT; - - let VERSION = ''; - let SNAPSHOT_ID = ''; - let DESTINATION = ''; - - const now = new Date(); - - // format: yyyyMMdd-HHmmss - const date = [ - now.getFullYear(), - (now.getMonth() + 1).toString().padStart(2, '0'), - now.getDate().toString().padStart(2, '0'), - '-', - now.getHours().toString().padStart(2, '0'), - now.getMinutes().toString().padStart(2, '0'), - now.getSeconds().toString().padStart(2, '0'), - ].join(''); - - try { - const files = fs.readdirSync(destination); - const manifestEntries = files - .filter((filename) => !filename.match(/.sha512$/)) - .filter((filename) => !filename.match(/.json$/)) - .map((filename) => { - const parts = filename.replace('elasticsearch-oss', 'oss').split('-'); - - VERSION = VERSION || parts[1]; - SNAPSHOT_ID = SNAPSHOT_ID || `${date}_${GIT_COMMIT_SHORT}`; - DESTINATION = DESTINATION || `${VERSION}/archives/${SNAPSHOT_ID}`; - - return { - filename: filename, - checksum: filename + '.sha512', - url: `https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/${filename}`, - version: parts[1], - platform: parts[3], - architecture: parts[4].split('.')[0], - license: parts[0] == 'oss' ? 'oss' : 'default', - }; - }); - - const manifest = { - id: SNAPSHOT_ID, - bucket: `${BASE_BUCKET_DAILY}/${DESTINATION}`.toString(), - branch: ES_BRANCH, - sha: GIT_COMMIT, - sha_short: GIT_COMMIT_SHORT, - version: VERSION, - generated: now.toISOString(), - archives: manifestEntries, - }; - - const manifestJSON = JSON.stringify(manifest, null, 2); - fs.writeFileSync(`${destination}/manifest.json`, manifestJSON); - - console.log('Manifest:', manifestJSON); - - execSync( - ` - set -euo pipefail - - echo '--- Upload files to GCS' - cd "${destination}" - gsutil -m cp -r *.* gs://${BASE_BUCKET_DAILY}/${DESTINATION} - cp manifest.json manifest-latest.json - gsutil cp manifest-latest.json gs://${BASE_BUCKET_DAILY}/${VERSION} - - buildkite-agent meta-data set ES_SNAPSHOT_MANIFEST 'https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/manifest.json' - buildkite-agent meta-data set ES_SNAPSHOT_VERSION '${VERSION}' - buildkite-agent meta-data set ES_SNAPSHOT_ID '${SNAPSHOT_ID}' - `, - { shell: '/bin/bash' } - ); - } catch (ex) { - console.error(ex); - process.exit(1); - } -})(); diff --git a/.buildkite/scripts/steps/es_snapshots/promote.sh b/.buildkite/scripts/steps/es_snapshots/promote.sh deleted file mode 100755 index 20f79d1a4e2e407..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/promote.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -export ES_SNAPSHOT_MANIFEST="${ES_SNAPSHOT_MANIFEST:-"$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"}" - -cat << EOF | buildkite-agent annotate --style "info" - This promotion is for the following snapshot manifest: - - $ES_SNAPSHOT_MANIFEST -EOF - -node "$(dirname "${0}")/promote_manifest.js" "$ES_SNAPSHOT_MANIFEST" diff --git a/.buildkite/scripts/steps/es_snapshots/promote_manifest.js b/.buildkite/scripts/steps/es_snapshots/promote_manifest.js deleted file mode 100644 index ce14935dd1b848b..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/promote_manifest.js +++ /dev/null @@ -1,46 +0,0 @@ -const fs = require('fs'); -const { execSync } = require('child_process'); -const { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } = require('./bucket_config.js'); - -(async () => { - try { - const MANIFEST_URL = process.argv[2]; - - if (!MANIFEST_URL) { - throw Error('Manifest URL missing'); - } - - const tempDir = fs.mkdtempSync('snapshot-promotion'); - process.chdir(tempDir); - - execSync(`curl '${MANIFEST_URL}' > manifest.json`); - - const manifestJson = fs.readFileSync('manifest.json').toString(); - const manifest = JSON.parse(manifestJson); - const { id, bucket, version } = manifest; - - const manifestPermanentJson = manifestJson - .split(BASE_BUCKET_DAILY) - .join(BASE_BUCKET_PERMANENT) - .split(`${version}/archives/${id}`) - .join(version); // e.g. replaceAll - - fs.writeFileSync('manifest-permanent.json', manifestPermanentJson); - - execSync( - ` - set -euo pipefail - cp manifest.json manifest-latest-verified.json - gsutil cp manifest-latest-verified.json gs://${BASE_BUCKET_DAILY}/${version}/ - rm manifest.json - cp manifest-permanent.json manifest.json - gsutil -m cp -r gs://${bucket}/* gs://${BASE_BUCKET_PERMANENT}/${version}/ - gsutil cp manifest.json gs://${BASE_BUCKET_PERMANENT}/${version}/ - `, - { shell: '/bin/bash' } - ); - } catch (ex) { - console.error(ex); - process.exit(1); - } -})(); diff --git a/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh b/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh deleted file mode 100644 index 1e8256d8c6645bb..000000000000000 --- a/.buildkite/scripts/steps/es_snapshots/trigger_promote.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -# If ES_SNAPSHOT_MANIFEST is set dynamically during the verify job, rather than provided during the trigger, -# such as if you provide it as input during a manual build, -# the ES_SNAPSHOT_MANIFEST env var will be empty in the context of the pipeline. -# So, we'll trigger with a script instead, so that we can ensure ES_SNAPSHOT_MANIFEST is populated. - -export ES_SNAPSHOT_MANIFEST="${ES_SNAPSHOT_MANIFEST:-"$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"}" - -cat << EOF | buildkite-agent pipeline upload -steps: - - trigger: 'kibana-elasticsearch-snapshot-promote' - async: true - build: - env: - ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST' - branch: '$BUILDKITE_BRANCH' -EOF diff --git a/.buildkite/scripts/steps/functional/oss-cigroup.sh b/.buildkite/scripts/steps/functional/oss-cigroup.sh deleted file mode 100755 index b4c643868ff7ddb..000000000000000 --- a/.buildkite/scripts/steps/functional/oss-cigroup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh -.buildkite/scripts/download_build_artifacts.sh - -export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} -export JOB=kibana-oss-ciGroup${CI_GROUP} - -echo "--- OSS CI Group $CI_GROUP" - -node scripts/functional_tests \ - --bail \ - --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ - --include-tag "ciGroup$CI_GROUP" diff --git a/.buildkite/scripts/steps/functional/xpack-cigroup.sh b/.buildkite/scripts/steps/functional/xpack-cigroup.sh deleted file mode 100755 index e6ef0bba87904a9..000000000000000 --- a/.buildkite/scripts/steps/functional/xpack-cigroup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh -.buildkite/scripts/download_build_artifacts.sh - -export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} -export JOB=kibana-default-ciGroup${CI_GROUP} - -echo "--- Default CI Group $CI_GROUP" - -cd "$XPACK_DIR" - -node scripts/functional_tests \ - --bail \ - --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ - --include-tag "ciGroup$CI_GROUP" diff --git a/.buildkite/scripts/steps/test/api_integration.sh b/.buildkite/scripts/steps/test/api_integration.sh deleted file mode 100755 index 4bf1ed1406ac53d..000000000000000 --- a/.buildkite/scripts/steps/test/api_integration.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh - -echo '--- API Integration Tests' -node scripts/functional_tests \ - --config test/api_integration/config.js \ - --bail \ - --debug diff --git a/.buildkite/scripts/steps/test/jest.sh b/.buildkite/scripts/steps/test/jest.sh deleted file mode 100755 index ab9be759b43a5e0..000000000000000 --- a/.buildkite/scripts/steps/test/jest.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh - -echo '--- Jest' -node scripts/jest --ci --verbose --maxWorkers=13 diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh deleted file mode 100755 index eb243e55670e32e..000000000000000 --- a/.buildkite/scripts/steps/test/jest_integration.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -.buildkite/scripts/bootstrap.sh - -echo '--- Jest Integration Tests' -node scripts/jest_integration --ci --verbose