Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] make deprecated paths public #175038

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions x-pack/plugins/fleet/server/routes/agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { FleetAuthz } from '../../../common';
import { API_VERSIONS, INTERNAL_API_ACCESS } from '../../../common/constants';
import { API_VERSIONS } from '../../../common/constants';

import { getRouteRequiredAuthz, type FleetAuthzRouter } from '../../services/security';

Expand Down Expand Up @@ -351,15 +351,14 @@ export const registerAPIRoutes = (router: FleetAuthzRouter, config: FleetConfigT
);
router.versioned
.get({
access: INTERNAL_API_ACCESS,
path: AGENT_API_ROUTES.STATUS_PATTERN_DEPRECATED,
fleetAuthz: {
fleet: { all: true },
},
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: GetAgentStatusRequestSchema },
},
getAgentStatusForAgentPolicyHandler
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/fleet/server/routes/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { TypeOf } from '@kbn/config-schema';
import type { FleetAuthzRouter } from '../../services/security';

import { APP_API_ROUTES } from '../../constants';
import { API_VERSIONS, INTERNAL_API_ACCESS } from '../../../common/constants';
import { API_VERSIONS } from '../../../common/constants';

import { appContextService } from '../../services';
import type { CheckPermissionsResponse, GenerateServiceTokenResponse } from '../../../common/types';
Expand Down Expand Up @@ -141,11 +141,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
fleet: { all: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: {},
},
generateServiceTokenHandler
Expand Down
14 changes: 5 additions & 9 deletions x-pack/plugins/fleet/server/routes/enrollment_api_key/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { FleetAuthzRouter } from '../../services/security';

import { ENROLLMENT_API_KEY_ROUTES } from '../../constants';
import { API_VERSIONS, INTERNAL_API_ACCESS } from '../../../common/constants';
import { API_VERSIONS } from '../../../common/constants';

import {
GetEnrollmentAPIKeysRequestSchema,
Expand Down Expand Up @@ -91,11 +91,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
fleet: { readEnrollmentTokens: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: GetOneEnrollmentAPIKeyRequestSchema },
},
getOneEnrollmentApiKeyHandler
Expand All @@ -107,11 +106,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
fleet: { all: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: DeleteEnrollmentAPIKeyRequestSchema },
},
deleteEnrollmentApiKeyHandler
Expand All @@ -123,11 +121,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
fleet: { readEnrollmentTokens: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: GetEnrollmentAPIKeysRequestSchema },
},
getEnrollmentApiKeysHandler
Expand All @@ -139,11 +136,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
fleet: { all: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: PostEnrollmentAPIKeyRequestSchema },
},
postEnrollmentApiKeyHandler
Expand Down
8 changes: 3 additions & 5 deletions x-pack/plugins/fleet/server/routes/epm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { IKibanaResponse } from '@kbn/core/server';

import { API_VERSIONS, INTERNAL_API_ACCESS } from '../../../common/constants';
import { API_VERSIONS } from '../../../common/constants';

import type { FleetAuthz } from '../../../common';

Expand Down Expand Up @@ -361,11 +361,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
integrations: { upgradePackages: true, writePackageSettings: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: UpdatePackageRequestSchemaDeprecated },
},
async (context, request, response) => {
Expand Down Expand Up @@ -415,11 +414,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
fleetAuthz: {
integrations: { removePackages: true },
},
access: INTERNAL_API_ACCESS,
})
.addVersion(
{
version: API_VERSIONS.internal.v1,
version: API_VERSIONS.public.v1,
validate: { request: DeletePackageRequestSchemaDeprecated },
},
async (context, request, response) => {
Expand Down