Skip to content

Commit 4db648f

Browse files
committed
update epm filepath route
1 parent 71a2f3a commit 4db648f

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

x-pack/plugins/ingest_manager/common/constants/routes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ export const FLEET_API_ROOT = `${API_ROOT}/fleet`;
1313
// EPM API routes
1414
const EPM_PACKAGES_MANY = `${EPM_API_ROOT}/packages`;
1515
const EPM_PACKAGES_ONE = `${EPM_PACKAGES_MANY}/{pkgkey}`;
16+
const EPM_PACKAGES_FILE = `${EPM_PACKAGES_MANY}/{pkgName}/{pkgVersion}`;
1617
export const EPM_API_ROUTES = {
1718
LIST_PATTERN: EPM_PACKAGES_MANY,
1819
INFO_PATTERN: EPM_PACKAGES_ONE,
1920
INSTALL_PATTERN: EPM_PACKAGES_ONE,
2021
DELETE_PATTERN: EPM_PACKAGES_ONE,
21-
FILEPATH_PATTERN: `${EPM_PACKAGES_ONE}/{filePath*}`,
22+
FILEPATH_PATTERN: `${EPM_PACKAGES_FILE}/{filePath*}`,
2223
CATEGORIES_PATTERN: `${EPM_API_ROOT}/categories`,
2324
};
2425

x-pack/plugins/ingest_manager/server/routes/epm/handlers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ export const getFileHandler: RequestHandler<TypeOf<typeof GetFileRequestSchema.p
7575
response
7676
) => {
7777
try {
78-
const { pkgkey, filePath } = request.params;
79-
const [pkgName, pkgVersion] = pkgkey.split('-');
78+
const { pkgName, pkgVersion, filePath } = request.params;
8079
const registryResponse = await getFile(`/package/${pkgName}/${pkgVersion}/${filePath}`);
8180
const contentType = registryResponse.headers.get('Content-Type');
8281
const customResponseObj: CustomHttpResponseOptions<typeof registryResponse.body> = {

x-pack/plugins/ingest_manager/server/types/rest_spec/epm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const GetPackagesRequestSchema = {
1313

1414
export const GetFileRequestSchema = {
1515
params: schema.object({
16-
pkgkey: schema.string(),
16+
pkgName: schema.string(),
17+
pkgVersion: schema.string(),
1718
filePath: schema.string(),
1819
}),
1920
};

x-pack/test/epm_api_integration/apis/file.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function({ getService }: FtrProviderContext) {
2828
const supertest = getService('supertest');
2929
await supertest
3030
.get(
31-
'/api/ingest_manager/epm/packages/auditd-2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png'
31+
'/api/ingest_manager/epm/packages/auditd/2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png'
3232
)
3333
.set('kbn-xsrf', 'xxx')
3434
.expect('Content-Type', 'image/png')
@@ -46,7 +46,7 @@ export default function({ getService }: FtrProviderContext) {
4646

4747
const supertest = getService('supertest');
4848
await supertest
49-
.get('/api/ingest_manager/epm/packages/auditd-2.0.4/img/icon.svg')
49+
.get('/api/ingest_manager/epm/packages/auditd/2.0.4/img/icon.svg')
5050
.set('kbn-xsrf', 'xxx')
5151
.expect('Content-Type', 'image/svg');
5252
});
@@ -60,7 +60,7 @@ export default function({ getService }: FtrProviderContext) {
6060
const supertest = getService('supertest');
6161
await supertest
6262
.get(
63-
'/api/ingest_manager/epm/packages/auditd-2.0.4/auditbeat/rules/sample-rules-linux-32bit.conf'
63+
'/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/rules/sample-rules-linux-32bit.conf'
6464
)
6565
.set('kbn-xsrf', 'xxx')
6666
.expect('Content-Type', 'application/json; charset=utf-8')
@@ -78,7 +78,7 @@ export default function({ getService }: FtrProviderContext) {
7878

7979
const supertest = getService('supertest');
8080
await supertest
81-
.get('/api/ingest_manager/epm/packages/auditd-2.0.4/auditbeat/config/config.yml')
81+
.get('/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/config/config.yml')
8282
.set('kbn-xsrf', 'xxx')
8383
.expect('Content-Type', 'text/yaml; charset=UTF-8')
8484
.expect(200);
@@ -94,7 +94,7 @@ export default function({ getService }: FtrProviderContext) {
9494
const supertest = getService('supertest');
9595
await supertest
9696
.get(
97-
'/api/ingest_manager/epm/packages/auditd-2.0.4/kibana/visualization/b21e0c70-c252-11e7-8692-232bd1143e8a-ecs.json'
97+
'/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/visualization/b21e0c70-c252-11e7-8692-232bd1143e8a-ecs.json'
9898
)
9999
.set('kbn-xsrf', 'xxx')
100100
.expect('Content-Type', 'application/json; charset=utf-8')
@@ -111,7 +111,7 @@ export default function({ getService }: FtrProviderContext) {
111111
const supertest = getService('supertest');
112112
await supertest
113113
.get(
114-
'/api/ingest_manager/epm/packages/auditd-2.0.4/kibana/dashboard/7de391b0-c1ca-11e7-8995-936807a28b16-ecs.json'
114+
'/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/dashboard/7de391b0-c1ca-11e7-8995-936807a28b16-ecs.json'
115115
)
116116
.set('kbn-xsrf', 'xxx')
117117
.expect('Content-Type', 'application/json; charset=utf-8')
@@ -126,7 +126,7 @@ export default function({ getService }: FtrProviderContext) {
126126

127127
const supertest = getService('supertest');
128128
await supertest
129-
.get('/api/ingest_manager/epm/packages/auditd-2.0.4/kibana/index-pattern/auditbeat-*.json')
129+
.get('/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/index-pattern/auditbeat-*.json')
130130
.set('kbn-xsrf', 'xxx')
131131
.expect('Content-Type', 'application/json; charset=utf-8')
132132
.expect(200);
@@ -141,7 +141,7 @@ export default function({ getService }: FtrProviderContext) {
141141
const supertest = getService('supertest');
142142
await supertest
143143
.get(
144-
'/api/ingest_manager/epm/packages/auditd-2.0.4/kibana/search/0f10c430-c1c3-11e7-8995-936807a28b16-ecs.json'
144+
'/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/search/0f10c430-c1c3-11e7-8995-936807a28b16-ecs.json'
145145
)
146146
.set('kbn-xsrf', 'xxx')
147147
.expect('Content-Type', 'application/json; charset=utf-8')

0 commit comments

Comments
 (0)