From c1d66902abee2f40a57021a98849cb9c28a04af3 Mon Sep 17 00:00:00 2001 From: Kfir Peled <61654899+kfirpeled@users.noreply.github.com> Date: Sun, 17 Apr 2022 16:30:31 +0300 Subject: [PATCH] [Cloud Posture] refactoring cspm plugin apis to internal (#130434) * refactoring cspm plugin apis to internal * fix tests * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../plugins/cloud_security_posture/common/constants.ts | 9 +++++---- .../server/routes/benchmarks/benchmarks.test.ts | 2 +- .../configuration/update_rules_configuration.test.ts | 2 +- .../server/routes/findings/findings.test.ts | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index 6f916f4911b7d..3b51a6d45c9bc 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -5,10 +5,11 @@ * 2.0. */ -export const STATS_ROUTE_PATH = '/api/csp/stats'; -export const FINDINGS_ROUTE_PATH = '/api/csp/findings'; -export const BENCHMARKS_ROUTE_PATH = '/api/csp/benchmarks'; -export const UPDATE_RULES_CONFIG_ROUTE_PATH = '/api/csp/update_rules_config'; +export const STATS_ROUTE_PATH = '/internal/cloud_security_posture/stats'; +export const FINDINGS_ROUTE_PATH = '/internal/cloud_security_posture/findings'; +export const BENCHMARKS_ROUTE_PATH = '/internal/cloud_security_posture/benchmarks'; +export const UPDATE_RULES_CONFIG_ROUTE_PATH = + '/internal/cloud_security_posture/update_rules_config'; export const CSP_FINDINGS_INDEX_NAME = 'findings'; export const CIS_KUBERNETES_PACKAGE_NAME = 'cis_kubernetes_benchmark'; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts index 7dd6ee757a695..4ed7bdb000344 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.test.ts @@ -88,7 +88,7 @@ describe('benchmarks API', () => { const [config] = router.get.mock.calls[0]; - expect(config.path).toEqual('/api/csp/benchmarks'); + expect(config.path).toEqual('/internal/cloud_security_posture/benchmarks'); }); it('should accept to a user with fleet.all privilege', async () => { diff --git a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.test.ts b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.test.ts index 18d89b1dcab77..fda7edcf5d877 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.test.ts @@ -58,7 +58,7 @@ describe('Update rules configuration API', () => { const [config, _] = router.post.mock.calls[0]; - expect(config.path).toEqual('/api/csp/update_rules_config'); + expect(config.path).toEqual('/internal/cloud_security_posture/update_rules_config'); }); it('should accept to a user with fleet.all privilege', async () => { diff --git a/x-pack/plugins/cloud_security_posture/server/routes/findings/findings.test.ts b/x-pack/plugins/cloud_security_posture/server/routes/findings/findings.test.ts index 5810e7467f20a..35d359929af99 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/findings/findings.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/findings/findings.test.ts @@ -54,7 +54,7 @@ describe('findings API', () => { const [config, _] = router.get.mock.calls[0]; - expect(config.path).toEqual('/api/csp/findings'); + expect(config.path).toEqual('/internal/cloud_security_posture/findings'); }); it('should accept to a user with fleet.all privilege', async () => {