-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Reporting] Separate internal and public API endpoints in Reporting (#…
…162288) ## Summary Closes #160827 Closes #134517 Closes #149942 In this PR, the following API endpoints are moved into an internal namespace: | New endpoint path | Previous | |---|---| | `/internal/reporting/diagnose/browser` | `/api/reporting/diagnose/browser` | | `/internal/reporting/diagnose/screenshot` | `/api/reporting/diagnose/screenshot` | | `/internal/reporting/generate/immediate/csv_searchsource` | `/api/reporting/v1/generate/immediate/csv_searchsource` | | `/internal/reporting/generate/{exportTypeId}` | `/api/reporting/generate/{exportTypeId}` | | `/internal/reporting/jobs/count` | `/api/reporting/jobs/count` | | `/internal/reporting/jobs/delete/{jobId}` | `/api/reporting/jobs/delete/{jobId}` | | `/internal/reporting/jobs/info/{jobId}` | `/api/reporting/jobs/info/{jobId}` | | `/internal/reporting/jobs/list` | `/api/reporting/jobs/list` | Support for the public APIs continues: | Public endpoint path | |---| | `/api/reporting/generate/{exportTypeId}` | | `/api/reporting/jobs/delete/{jobId}` | | `/api/reporting/jobs/download/{jobId}` | ## Other changes 1. Set access options on the routes 2. Removed API Counter functional tests, which were skipped to begin with. 3. Replaced functional tests with Jest integration tests. 4. Consolidated code in the generation routes by creating the `getJobParams` method of the `RequestHandler` class. 5. Added a new test for `getJobParams` 6. Consolidated code in the job management routes 7. Added new code for shared helpers in job management routes 8. Reorganized libs used for route handlers: ``` routes/lib/request_handler.ts => routes/common/generate/request_handler.ts routes/lib/job_management_pre_routing.ts => routes/common/jobs/job_management_pre_routing.ts routes/lib/jobs_query.ts => routes/common/jobs/jobs_query.ts routes/lib/get_document_payload.ts => routes/common/jobs/get_document_payload.ts routes/lib/get_counter.ts => routes/common/get_counter.ts routes/lib/authorized_user_pre_routing.ts => routes/common/authorized_user_pre_routing.ts routes/lib/get_user.ts => routes/common/get_user.ts ``` ## Release Note Updated API endpoint paths for Reporting to clarify which routes are public and which are not. Make sure that any custom script or application that uses Reporting endpoints only uses the public endpoints. --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
fcb592d
commit a2e4279
Showing
51 changed files
with
1,553 additions
and
857 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
const prefixInternalPath = '/internal/reporting'; | ||
export const INTERNAL_ROUTES = { | ||
MIGRATE: { | ||
MIGRATE_ILM_POLICY: prefixInternalPath + '/deprecations/migrate_ilm_policy', | ||
GET_ILM_POLICY_STATUS: prefixInternalPath + '/ilm_policy_status', | ||
}, | ||
DIAGNOSE: { | ||
BROWSER: prefixInternalPath + '/diagnose/browser', | ||
SCREENSHOT: prefixInternalPath + '/diagnose/screenshot', | ||
}, | ||
JOBS: { | ||
COUNT: prefixInternalPath + '/jobs/count', | ||
LIST: prefixInternalPath + '/jobs/list', | ||
INFO_PREFIX: prefixInternalPath + '/jobs/info', // docId is added to the final path | ||
DELETE_PREFIX: prefixInternalPath + '/jobs/delete', // docId is added to the final path | ||
DOWNLOAD_PREFIX: prefixInternalPath + '/jobs/download', // docId is added to the final path | ||
}, | ||
DOWNLOAD_CSV: prefixInternalPath + '/generate/immediate/csv_searchsource', | ||
GENERATE_PREFIX: prefixInternalPath + '/generate', // exportTypeId is added to the final path | ||
}; | ||
|
||
const prefixPublicPath = '/api/reporting'; | ||
export const PUBLIC_ROUTES = { | ||
/** | ||
* Public endpoint for POST URL strings and automated report generation | ||
* exportTypeId is added to the final path | ||
*/ | ||
GENERATE_PREFIX: prefixPublicPath + `/generate`, | ||
JOBS: { | ||
/** | ||
* Public endpoint used by Watcher and automated report downloads | ||
* jobId is added to the final path | ||
*/ | ||
DOWNLOAD_PREFIX: prefixPublicPath + `/jobs/download`, | ||
/** | ||
* Public endpoint potentially used to delete a report after download in automation | ||
* jobId is added to the final path | ||
*/ | ||
DELETE_PREFIX: prefixPublicPath + `/jobs/delete`, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.