diff --git a/x-pack/plugins/fleet/common/constants/routes.ts b/x-pack/plugins/fleet/common/constants/routes.ts index 61d50d0f9e073..4b40b4fb51092 100644 --- a/x-pack/plugins/fleet/common/constants/routes.ts +++ b/x-pack/plugins/fleet/common/constants/routes.ts @@ -171,11 +171,6 @@ export const ENROLLMENT_API_KEY_ROUTES = { LIST_PATTERN: `${API_ROOT}/enrollment_api_keys`, INFO_PATTERN: `${API_ROOT}/enrollment_api_keys/{keyId}`, DELETE_PATTERN: `${API_ROOT}/enrollment_api_keys/{keyId}`, - // deprecated since 8.0 - CREATE_PATTERN_DEPRECATED: `${API_ROOT}/enrollment-api-keys`, - LIST_PATTERN_DEPRECATED: `${API_ROOT}/enrollment-api-keys`, - INFO_PATTERN_DEPRECATED: `${API_ROOT}/enrollment-api-keys/{keyId}`, - DELETE_PATTERN_DEPRECATED: `${API_ROOT}/enrollment-api-keys/{keyId}`, }; export const UNINSTALL_TOKEN_ROUTES = { diff --git a/x-pack/plugins/fleet/server/routes/enrollment_api_key/index.ts b/x-pack/plugins/fleet/server/routes/enrollment_api_key/index.ts index bcf4448420919..2d4c7c990c531 100644 --- a/x-pack/plugins/fleet/server/routes/enrollment_api_key/index.ts +++ b/x-pack/plugins/fleet/server/routes/enrollment_api_key/index.ts @@ -154,72 +154,4 @@ export const registerRoutes = (router: FleetAuthzRouter) => { }, postEnrollmentApiKeyHandler ); - - router.versioned - .get({ - path: ENROLLMENT_API_KEY_ROUTES.INFO_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { readEnrollmentTokens: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: GetOneEnrollmentAPIKeyRequestSchema }, - }, - getOneEnrollmentApiKeyHandler - ); - - router.versioned - .delete({ - path: ENROLLMENT_API_KEY_ROUTES.DELETE_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { allAgents: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: DeleteEnrollmentAPIKeyRequestSchema }, - }, - deleteEnrollmentApiKeyHandler - ); - - router.versioned - .get({ - path: ENROLLMENT_API_KEY_ROUTES.LIST_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { readEnrollmentTokens: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: GetEnrollmentAPIKeysRequestSchema }, - }, - getEnrollmentApiKeysHandler - ); - - router.versioned - .post({ - path: ENROLLMENT_API_KEY_ROUTES.CREATE_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { allAgents: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: PostEnrollmentAPIKeyRequestSchema }, - }, - postEnrollmentApiKeyHandler - ); }; diff --git a/x-pack/test/fleet_api_integration/apis/enrollment_api_keys/crud.ts b/x-pack/test/fleet_api_integration/apis/enrollment_api_keys/crud.ts index 9cb11df2b34de..24d1520d8d6f8 100644 --- a/x-pack/test/fleet_api_integration/apis/enrollment_api_keys/crud.ts +++ b/x-pack/test/fleet_api_integration/apis/enrollment_api_keys/crud.ts @@ -285,32 +285,5 @@ export default function (providerContext: FtrProviderContext) { }); }); }); - - describe('deprecated API', () => { - let keyId: string; - before(async () => { - const { body: apiResponse } = await supertest - .post(`/api/fleet/enrollment-api-keys`) - .set('kbn-xsrf', 'xxx') - .send({ - policy_id: 'policy1', - }) - .expect(200); - keyId = apiResponse.item.id; - }); - - it('should get and delete with deprecated API', async () => { - await supertest.get(`/api/fleet/enrollment-api-keys`).set('kbn-xsrf', 'xxx').expect(200); - await supertest - .get(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}`) - .set('kbn-xsrf', 'xxx') - .expect(200); - - await supertest - .delete(`/api/fleet/enrollment-api-keys/${keyId}`) - .set('kbn-xsrf', 'xxx') - .expect(200); - }); - }); }); }