From 4b24857e51c8341b0a57cfbe27b6b8b889911d59 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 13:13:34 +0300 Subject: [PATCH 01/27] finish feature --- .../src/deprecations_client.ts | 72 ++++++-- .../core-deprecations-common/src/types.ts | 29 +++- .../src/deprecations/api_deprecations.ts | 89 ++++++++++ .../src/deprecations/config_deprecations.ts | 50 ++++++ .../src/deprecations/i18n_texts.ts | 156 ++++++++++++++++++ .../src/deprecations/index.ts | 11 ++ .../src/deprecations_service.ts | 55 +++--- .../src/routes/get.ts | 41 +++-- .../src/routes/index.ts | 14 +- .../src/routes/post_validation_handler.ts | 51 ++++++ .../src/routes/resolve_deprecated_api.ts | 52 ++++++ .../core-http-router-server-internal/index.ts | 7 +- .../src/request.ts | 6 + .../src/router.ts | 72 +++++--- .../versioned_router/core_versioned_route.ts | 13 +- .../versioned_router/core_versioned_router.ts | 11 +- .../src/versioned_router/types.ts | 10 +- .../src/http_server.ts | 47 +++++- .../src/http_service.ts | 8 +- .../core-http-server-internal/src/types.ts | 7 + packages/core/http/core-http-server/index.ts | 1 + .../core-http-server/src/http_contract.ts | 9 + .../http/core-http-server/src/router/index.ts | 2 +- .../core-http-server/src/router/request.ts | 8 +- .../http/core-http-server/src/router/route.ts | 51 +++++- .../core-http-server/src/router/router.ts | 13 +- .../core-http-server/src/versioning/types.ts | 22 +-- .../src/plugin_context.ts | 1 + .../core-root-server-internal/src/server.ts | 9 +- .../src/usage_stats_client.ts | 9 +- .../src/core_usage_data_service.ts | 13 ++ .../src/core_usage_stats_client.ts | 43 +++++ .../core-usage-data-server/index.ts | 1 + .../src/core_usage_stats.ts | 13 ++ .../core-usage-data-server/src/index.ts | 2 +- .../src/setup_contract.ts | 15 +- .../core/fetch_deprecated_api_counters.ts | 65 ++++++++ .../server/collectors/core/index.ts | 1 + .../server/collectors/index.ts | 2 +- .../kibana_usage_collection/server/plugin.ts | 4 + .../deprecation_details_flyout.tsx | 37 ++++- .../kibana_deprecations_table.tsx | 13 ++ .../resolution_table_cell.tsx | 71 ++++++-- 43 files changed, 1049 insertions(+), 157 deletions(-) create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/index.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts create mode 100644 src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts diff --git a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts index f1f473d726b7e..38a1078621edc 100644 --- a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts +++ b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts @@ -8,7 +8,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { HttpStart } from '@kbn/core-http-browser'; +import type { HttpFetchOptionsWithPath, HttpStart } from '@kbn/core-http-browser'; import type { DomainDeprecationDetails, DeprecationsGetResponse, @@ -28,6 +28,7 @@ export class DeprecationsClient { private fetchDeprecations = async (): Promise => { const { deprecations } = await this.http.fetch('/api/deprecations/', { + query: { apiVersion: '2023-10-31' }, asSystemRequest: true, }); @@ -47,23 +48,15 @@ export class DeprecationsClient { return typeof details.correctiveActions.api === 'object'; }; - public resolveDeprecation = async ( + private getResolveFetchDetails = ( details: DomainDeprecationDetails - ): Promise => { + ): HttpFetchOptionsWithPath | undefined => { const { domainId, correctiveActions } = details; - // explicit check required for TS type guard - if (typeof correctiveActions.api !== 'object') { - return { - status: 'fail', - reason: i18n.translate('core.deprecations.noCorrectiveAction', { - defaultMessage: 'This deprecation cannot be resolved automatically.', - }), - }; - } - const { body, method, path, omitContextFromBody = false } = correctiveActions.api; - try { - await this.http.fetch({ + if (correctiveActions.api) { + const { body, method, path, omitContextFromBody = false } = correctiveActions.api; + + return { path, method, asSystemRequest: true, @@ -71,7 +64,54 @@ export class DeprecationsClient { ...body, ...(omitContextFromBody ? {} : { deprecationDetails: { domainId } }), }), - }); + }; + } + + if (correctiveActions.mark_as_resolved_api) { + const { routeMethod, routePath, routeVersion, apiTotalCalls, totalMarkedAsResolved } = + correctiveActions.mark_as_resolved_api; + const incrementBy = apiTotalCalls - totalMarkedAsResolved; + + return { + path: '/api/deprecations/mark_as_resolved/', + method: 'POST', + asSystemRequest: true, + body: JSON.stringify({ + domainId, + routeMethod, + routePath, + routeVersion, + incrementBy, + }), + }; + } + }; + + public resolveDeprecation = async ( + details: DomainDeprecationDetails + ): Promise => { + const { correctiveActions } = details; + const noCorrectiveActionFail = { + status: 'fail' as const, + reason: i18n.translate('core.deprecations.noCorrectiveAction', { + defaultMessage: 'This deprecation cannot be resolved automatically or marked as resolved.', + }), + }; + + if ( + typeof correctiveActions.api !== 'object' && + typeof correctiveActions.mark_as_resolved_api !== 'object' + ) { + return noCorrectiveActionFail; + } + + try { + const fetchParams = this.getResolveFetchDetails(details); + if (!fetchParams) { + return noCorrectiveActionFail; + } + + await this.http.fetch(fetchParams); return { status: 'ok' }; } catch (err) { return { diff --git a/packages/core/deprecations/core-deprecations-common/src/types.ts b/packages/core/deprecations/core-deprecations-common/src/types.ts index bf9a4a673d721..f00c74523cdcf 100644 --- a/packages/core/deprecations/core-deprecations-common/src/types.ts +++ b/packages/core/deprecations/core-deprecations-common/src/types.ts @@ -39,7 +39,7 @@ export interface BaseDeprecationDetails { * Predefined types are necessary to reduce having similar definitions with different keywords * across kibana deprecations. */ - deprecationType?: 'config' | 'feature'; + deprecationType?: 'config' | 'api' | 'feature'; /** (optional) link to the documentation for more details on the deprecation. */ documentationUrl?: string; /** (optional) specify the fix for this deprecation requires a full kibana restart. */ @@ -70,9 +70,31 @@ export interface BaseDeprecationDetails { * Check the README for writing deprecations in `src/core/server/deprecations/README.mdx` */ manualSteps: string[]; + /** + * (optional) The api to be called to mark the deprecation as resolved + * This corrective action when called should not resolve the deprecation + * instead it helps users track manually deprecated apis + * If the API used does resolve the deprecation use `correctiveActions.api` + */ + mark_as_resolved_api?: { + apiTotalCalls: number; + totalMarkedAsResolved: number; + timestamp: Date | number | string; + routePath: string; + routeMethod: string; + routeVersion?: string; + }; }; } +/** + * @public + */ +export interface ApiDeprecationDetails extends BaseDeprecationDetails { + apiId: string; + deprecationType: 'api'; +} + /** * @public */ @@ -91,7 +113,10 @@ export interface FeatureDeprecationDetails extends BaseDeprecationDetails { /** * @public */ -export type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails; +export type DeprecationsDetails = + | ConfigDeprecationDetails + | ApiDeprecationDetails + | FeatureDeprecationDetails; /** * @public diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts new file mode 100644 index 0000000000000..591faf0d799bc --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts @@ -0,0 +1,89 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { Logger } from '@kbn/logging'; +import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; +import type { RouterDeprecatedRouteDetails } from '@kbn/core-http-server'; +import type { DeprecationsFactory } from '../deprecations_factory'; +import { + getApiDeprecationMessage, + getApiDeprecationsManualSteps, + getApiDeprecationTitle, +} from './i18n_texts'; +interface ApiDeprecationsServiceDeps { + logger: Logger; + deprecationsFactory: DeprecationsFactory; + http: InternalHttpServiceSetup; + coreUsageData: InternalCoreUsageDataSetup; +} + +export const buildApiDeprecationId = ({ + routePath, + routeMethod, + routeVersion, +}: Pick): string => { + return [routeVersion || 'unversioned', routeMethod, routePath].join('|'); +}; + +export const registerApiDeprecationsInfo = ({ + deprecationsFactory, + http, + coreUsageData, +}: ApiDeprecationsServiceDeps): void => { + const deprecationsRegistery = deprecationsFactory.getRegistry('core.api_deprecations'); + + deprecationsRegistery.registerDeprecations({ + getDeprecations: async () => { + const deprecatedRoutes = http.getRegisteredDeprecatedApis(); + const usageClient = coreUsageData.getClient(); + const deprecatedApiUsageStats = await usageClient.getDeprecatedApiUsageStats(); + + return deprecatedApiUsageStats + .filter(({ apiTotalCalls, totalMarkedAsResolved }) => { + return apiTotalCalls > totalMarkedAsResolved; + }) + .filter(({ apiId }) => + deprecatedRoutes.some((routeDetails) => buildApiDeprecationId(routeDetails) === apiId) + ) + .map((apiUsageStats) => { + const { apiId, apiTotalCalls, totalMarkedAsResolved } = apiUsageStats; + const routeDeprecationDetails = deprecatedRoutes.find( + (routeDetails) => buildApiDeprecationId(routeDetails) === apiId + )!; + const { routeVersion, routePath, routeDeprecationOptions, routeMethod } = + routeDeprecationDetails; + const defaultLevel = + routeDeprecationOptions.reason.type === 'remove' ? 'critical' : 'warning'; + const deprecationLevel = routeDeprecationOptions.severity || defaultLevel; + + return { + apiId, + title: getApiDeprecationTitle(routeDeprecationDetails), + level: deprecationLevel, + message: getApiDeprecationMessage(routeDeprecationDetails, apiUsageStats), + documentationUrl: routeDeprecationOptions.documentationUrl, + correctiveActions: { + manualSteps: getApiDeprecationsManualSteps(routeDeprecationDetails), + mark_as_resolved_api: { + routePath, + routeMethod, + routeVersion, + apiTotalCalls, + totalMarkedAsResolved, + timestamp: new Date(), + }, + }, + deprecationType: 'api', + domainId: 'core.routes-deprecations', + }; + }); + }, + }); +}; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.ts new file mode 100644 index 0000000000000..f9df0edacd9d1 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.ts @@ -0,0 +1,50 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { IConfigService } from '@kbn/config'; +import { DeprecationsFactory } from '../deprecations_factory'; + +interface RegisterConfigDeprecationsInfo { + deprecationsFactory: DeprecationsFactory; + configService: IConfigService; +} + +export const registerConfigDeprecationsInfo = ({ + deprecationsFactory, + configService, +}: RegisterConfigDeprecationsInfo) => { + const handledDeprecatedConfigs = configService.getHandledDeprecatedConfigs(); + + for (const [domainId, deprecationsContexts] of handledDeprecatedConfigs) { + const deprecationsRegistry = deprecationsFactory.getRegistry(domainId); + deprecationsRegistry.registerDeprecations({ + getDeprecations: () => { + return deprecationsContexts.map( + ({ + configPath, + title = `${domainId} has a deprecated setting`, + level, + message, + correctiveActions, + documentationUrl, + }) => ({ + configPath, + title, + level, + message, + correctiveActions, + documentationUrl, + deprecationType: 'config', + requireRestart: true, + }) + ); + }, + }); + } +}; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts new file mode 100644 index 0000000000000..3737c230c588c --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts @@ -0,0 +1,156 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { RouterDeprecatedRouteDetails } from '@kbn/core-http-server'; +import { CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; +import { i18n } from '@kbn/i18n'; +import moment from 'moment'; + +export const getApiDeprecationTitle = (details: RouterDeprecatedRouteDetails) => { + const { routePath, routeMethod } = details; + const routeWithMethod = `${routeMethod.toUpperCase()} ${routePath}`; + const deprecationTypeText = getApiDeprecationTypeText(details); + + return i18n.translate('core.deprecations.deprecations.apiDeprecationInfoTitle', { + defaultMessage: 'The "{routeWithMethod}" route {deprecationTypeText}', + values: { + routeWithMethod, + deprecationTypeText, + }, + }); +}; + +export const getApiDeprecationTypeText = (details: RouterDeprecatedRouteDetails) => { + const { routeDeprecationOptions } = details; + const deprecationType = routeDeprecationOptions.reason.type; + + return i18n.translate('core.deprecations.deprecations.apiDeprecationType', { + defaultMessage: + '{deprecationType, select, remove {will be removed} bump {has a new version bump} migrate {has been migrated to a different API} other {has been marked as deprecated}}', + values: { deprecationType }, + }); +}; + +export const getApiDeprecationMessage = ( + details: RouterDeprecatedRouteDetails, + apiUsageStats: CoreDeprecatedApiUsageStats +) => { + const { routePath, routeMethod } = details; + const { apiLastCalledAt, apiTotalCalls, markedAsResolvedLastCalledAt, totalMarkedAsResolved } = + apiUsageStats; + + const diff = apiTotalCalls - totalMarkedAsResolved; + const wasResolvedBefore = totalMarkedAsResolved > 0; + const routeWithMethod = `${routeMethod.toUpperCase()} ${routePath}`; + + const messages = [ + i18n.translate('core.deprecations.deprecations.apiDeprecationApiCallsDetailsMessage', { + defaultMessage: + 'The API {routeWithMethod} has been called {apiTotalCalls} times. The last time the API was called was on {apiLastCalledAt}.', + values: { + routeWithMethod, + apiTotalCalls, + apiLastCalledAt: moment(apiLastCalledAt).format('LLLL Z'), + }, + }), + ]; + + if (wasResolvedBefore) { + messages.push( + i18n.translate( + 'core.deprecations.deprecations.apiDeprecationPreviouslyMarkedAsResolvedMessage', + { + defaultMessage: + 'The api has been called {timeSinceLastResolved} times since the last time it was marked as resolved on {markedAsResolvedLastCalledAt}', + values: { + timeSinceLastResolved: diff, + markedAsResolvedLastCalledAt: moment(markedAsResolvedLastCalledAt).format('LLLL Z'), + }, + } + ) + ); + } + + return messages.join('\n'); +}; + +export const getApiDeprecationsManualSteps = (details: RouterDeprecatedRouteDetails): string[] => { + const { routeDeprecationOptions, routePath } = details; + const { documentationUrl } = routeDeprecationOptions; + const deprecationType = routeDeprecationOptions.reason.type; + + const manualSteps = [ + i18n.translate('core.deprecations.deprecations.manualSteps.apiIseprecatedStep', { + defaultMessage: 'This API {deprecationTypeText}', + values: { deprecationTypeText: getApiDeprecationTypeText(details) }, + }), + ]; + + switch (deprecationType) { + case 'bump': { + const { newApiVersion } = routeDeprecationOptions.reason; + manualSteps.push( + i18n.translate('core.deprecations.deprecations.manualSteps.bumpTypeExplainationStep', { + defaultMessage: + 'A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version', + }), + i18n.translate('core.deprecations.deprecations.manualSteps.bumpDetailsStep', { + defaultMessage: 'This API {routePath} has a new version "{newApiVersion}".', + values: { routePath, newApiVersion }, + }) + ); + break; + } + case 'remove': { + manualSteps.push( + i18n.translate('core.deprecations.deprecations.manualSteps.removeTypeExplainationStep', { + defaultMessage: + 'This API will be completely removed. You will no longer be able to use it in the future.', + }) + ); + break; + } + case 'migrate': { + const { newApiPath, newApiMethod } = routeDeprecationOptions.reason; + manualSteps.push( + i18n.translate('core.deprecations.deprecations.manualSteps.migrateTypeExplainationStep', { + defaultMessage: + 'This API will be migrated to a different API and will be removed in the future in favor of the other API.', + }), + i18n.translate('core.deprecations.deprecations.manualSteps.migrateDetailsStep', { + defaultMessage: 'This API {routePath} has been migrated to {newApiMethod} {newApiPath}', + values: { newApiMethod: newApiMethod.toUpperCase(), newApiPath }, + }) + ); + break; + } + } + + if (documentationUrl) { + manualSteps.push( + i18n.translate('core.deprecations.deprecations.manualSteps.documentationStep', { + defaultMessage: + 'Click the learn more documentation link for more details on addressing the deprecated API.', + }) + ); + } + + manualSteps.push( + i18n.translate('core.deprecations.deprecations.manualSteps.markAsResolvedStep', { + defaultMessage: + 'Once you are no longer using the deprecated API. You can click on the "Mark as Resolved" button to track if the API is still getting called.', + }), + i18n.translate('core.deprecations.deprecations.manualSteps.deprecationWillBeHiddenStep', { + defaultMessage: + 'The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.', + }) + ); + + return manualSteps; +}; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/index.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/index.ts new file mode 100644 index 0000000000000..aecf3d5b299a2 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/index.ts @@ -0,0 +1,11 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { buildApiDeprecationId, registerApiDeprecationsInfo } from './api_deprecations'; +export { registerConfigDeprecationsInfo } from './config_deprecations'; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts index 4c8f564943ab1..3e35102b4238c 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts @@ -19,9 +19,11 @@ import type { DeprecationRegistryProvider, DeprecationsClient, } from '@kbn/core-deprecations-server'; +import { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import { DeprecationsFactory } from './deprecations_factory'; import { registerRoutes } from './routes'; import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; +import { registerApiDeprecationsInfo, registerConfigDeprecationsInfo } from './deprecations'; export interface InternalDeprecationsServiceStart { /** @@ -40,6 +42,7 @@ export type InternalDeprecationsServiceSetup = DeprecationRegistryProvider; /** @internal */ export interface DeprecationsSetupDeps { http: InternalHttpServiceSetup; + coreUsageData: InternalCoreUsageDataSetup; } /** @internal */ @@ -55,7 +58,10 @@ export class DeprecationsService this.configService = coreContext.configService; } - public async setup({ http }: DeprecationsSetupDeps): Promise { + public async setup({ + http, + coreUsageData, + }: DeprecationsSetupDeps): Promise { this.logger.debug('Setting up Deprecations service'); const config = await firstValueFrom( @@ -69,8 +75,19 @@ export class DeprecationsService }, }); - registerRoutes({ http }); - this.registerConfigDeprecationsInfo(this.deprecationsFactory); + registerRoutes({ http, coreUsageData }); + + registerConfigDeprecationsInfo({ + deprecationsFactory: this.deprecationsFactory, + configService: this.configService, + }); + + registerApiDeprecationsInfo({ + deprecationsFactory: this.deprecationsFactory, + logger: this.logger, + http, + coreUsageData, + }); const deprecationsFactory = this.deprecationsFactory; return { @@ -87,6 +104,7 @@ export class DeprecationsService if (!this.deprecationsFactory) { throw new Error('`setup` must be called before `start`'); } + return { asScopedToClient: this.createScopedDeprecations(), }; @@ -107,35 +125,4 @@ export class DeprecationsService }; }; } - - private registerConfigDeprecationsInfo(deprecationsFactory: DeprecationsFactory) { - const handledDeprecatedConfigs = this.configService.getHandledDeprecatedConfigs(); - - for (const [domainId, deprecationsContexts] of handledDeprecatedConfigs) { - const deprecationsRegistry = deprecationsFactory.getRegistry(domainId); - deprecationsRegistry.registerDeprecations({ - getDeprecations: () => { - return deprecationsContexts.map( - ({ - configPath, - title = `${domainId} has a deprecated setting`, - level, - message, - correctiveActions, - documentationUrl, - }) => ({ - configPath, - title, - level, - message, - correctiveActions, - documentationUrl, - deprecationType: 'config', - requireRestart: true, - }) - ); - }, - }); - } - } } diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts index ed3cd061b633b..a2ec443e55594 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts @@ -11,19 +11,34 @@ import type { DeprecationsGetResponse } from '@kbn/core-deprecations-common'; import type { InternalDeprecationRouter } from '../internal_types'; export const registerGetRoute = (router: InternalDeprecationRouter) => { - router.get( - { + router.versioned + .get({ path: '/', - validate: false, - }, - async (context, req, res) => { - const deprecationsClient = (await context.core).deprecations.client; + access: 'public', + enableQueryVersion: true, + }) + .addVersion( + { + validate: false, + version: '2023-10-31', + options: { + deprecated: { + documentationUrl: 'https://google2.com', + severity: 'warning', + reason: { + type: 'bump', + newApiVersion: '2024-10-13', + }, + }, + }, + }, + async (context, req, res) => { + const deprecationsClient = (await context.core).deprecations.client; + const body: DeprecationsGetResponse = { + deprecations: await deprecationsClient.getAllDeprecations(), + }; - const body: DeprecationsGetResponse = { - deprecations: await deprecationsClient.getAllDeprecations(), - }; - - return res.ok({ body }); - } - ); + return res.ok({ body }); + } + ); }; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/index.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/index.ts index e1a925610327f..f812bbfd15acd 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/index.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/index.ts @@ -8,10 +8,22 @@ */ import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; +import { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalDeprecationRequestHandlerContext } from '../internal_types'; import { registerGetRoute } from './get'; +import { registerMarkAsResolvedRoute } from './resolve_deprecated_api'; +import { registerApiDeprecationsPostValidationHandler } from './post_validation_handler'; -export function registerRoutes({ http }: { http: InternalHttpServiceSetup }) { +export function registerRoutes({ + http, + coreUsageData, +}: { + http: InternalHttpServiceSetup; + coreUsageData: InternalCoreUsageDataSetup; +}) { const router = http.createRouter('/api/deprecations'); registerGetRoute(router); + + registerApiDeprecationsPostValidationHandler({ http, coreUsageData }); + registerMarkAsResolvedRoute(router, { coreUsageData }); } diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts new file mode 100644 index 0000000000000..52e261e3da983 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts @@ -0,0 +1,51 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-server-internal'; +import type { CoreKibanaRequest } from '@kbn/core-http-router-server-internal'; +import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; +import { isObject } from 'lodash'; +import { RouteDeprecationInfo } from '@kbn/core-http-server/src/router/route'; +import { buildApiDeprecationId } from '../deprecations'; + +interface Dependencies { + coreUsageData: InternalCoreUsageDataSetup; + http: InternalHttpServiceSetup; +} + +/** + * listens to http post validation events to increment deprecated api calls + * This will keep track of any called deprecated API. + */ +export const registerApiDeprecationsPostValidationHandler = ({ + coreUsageData, + http, +}: Dependencies) => { + http.registerOnPostValidation(createRouteDeprecationsHandler({ coreUsageData })); +}; + +export function createRouteDeprecationsHandler({ + coreUsageData, +}: { + coreUsageData: InternalCoreUsageDataSetup; +}) { + return (req: CoreKibanaRequest, { deprecated }: { deprecated?: RouteDeprecationInfo }) => { + if (deprecated && isObject(deprecated)) { + const counterName = buildApiDeprecationId({ + routeMethod: req.route.method, + routePath: req.route.path, + routeVersion: req.apiVersion, + }); + + const client = coreUsageData.getClient(); + // no await we just fire it off. + client.incrementDeprecatedApi(counterName, { resolved: false }); + } + }; +} diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts new file mode 100644 index 0000000000000..b8eda6de94294 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts @@ -0,0 +1,52 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { schema } from '@kbn/config-schema'; +import { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; +import type { InternalDeprecationRouter } from '../internal_types'; +import { buildApiDeprecationId } from '../deprecations'; + +export const registerMarkAsResolvedRoute = ( + router: InternalDeprecationRouter, + { coreUsageData }: { coreUsageData: InternalCoreUsageDataSetup } +) => { + router.post( + { + path: '/mark_as_resolved/', + validate: { + body: schema.object({ + domainId: schema.string(), + routePath: schema.string(), + routeMethod: schema.oneOf([ + schema.literal('post'), + schema.literal('put'), + schema.literal('delete'), + schema.literal('patch'), + schema.literal('get'), + schema.literal('options'), + ]), + routeVersion: schema.string(), + incrementBy: schema.number(), + }), + }, + }, + async (_, req, res) => { + const usageClient = coreUsageData.getClient(); + const { routeMethod, routePath, routeVersion, incrementBy } = req.body; + const counterName = buildApiDeprecationId({ + routeMethod, + routePath, + routeVersion, + }); + + await usageClient.incrementDeprecatedApi(counterName, { resolved: true, incrementBy }); + return res.ok(); + } + ); +}; diff --git a/packages/core/http/core-http-router-server-internal/index.ts b/packages/core/http/core-http-router-server-internal/index.ts index 6c684d5f8169c..256e8fb94306f 100644 --- a/packages/core/http/core-http-router-server-internal/index.ts +++ b/packages/core/http/core-http-router-server-internal/index.ts @@ -17,12 +17,7 @@ export { type HandlerResolutionStrategy, } from './src/versioned_router'; export { Router } from './src/router'; -export type { - RouterOptions, - InternalRegistrar, - InternalRegistrarOptions, - InternalRouterRoute, -} from './src/router'; +export type { RouterOptions, InternalRegistrar, InternalRegistrarOptions } from './src/router'; export { isKibanaRequest, isRealRequest, ensureRawRequest, CoreKibanaRequest } from './src/request'; export { isSafeMethod } from './src/route'; export { HapiResponseAdapter } from './src/response_adapter'; diff --git a/packages/core/http/core-http-router-server-internal/src/request.ts b/packages/core/http/core-http-router-server-internal/src/request.ts index 286b900fc24f5..6d4da18d0a33a 100644 --- a/packages/core/http/core-http-router-server-internal/src/request.ts +++ b/packages/core/http/core-http-router-server-internal/src/request.ts @@ -143,6 +143,8 @@ export class CoreKibanaRequest< public readonly rewrittenUrl?: URL; /** {@inheritDoc KibanaRequest.httpVersion} */ public readonly httpVersion: string; + /** {@inheritDoc KibanaRequest.apiVersion} */ + public readonly apiVersion: undefined; /** {@inheritDoc KibanaRequest.protocol} */ public readonly protocol: HttpProtocol; /** {@inheritDoc KibanaRequest.authzResult} */ @@ -185,6 +187,7 @@ export class CoreKibanaRequest< }); this.httpVersion = isRealReq ? request.raw.req.httpVersion : '1.0'; + this.apiVersion = undefined; this.protocol = getProtocolFromHttpVersion(this.httpVersion); this.route = deepFreeze(this.getRouteInfo(request)); @@ -216,6 +219,7 @@ export class CoreKibanaRequest< }, route: this.route, authzResult: this.authzResult, + apiVersion: this.apiVersion, }; } @@ -266,6 +270,8 @@ export class CoreKibanaRequest< xsrfRequired: ((request.route?.settings as RouteOptions)?.app as KibanaRouteOptions)?.xsrfRequired ?? true, // some places in LP call KibanaRequest.from(request) manually. remove fallback to true before v8 + deprecated: ((request.route?.settings as RouteOptions)?.app as KibanaRouteOptions) + ?.deprecated, access: this.getAccess(request), tags: request.route?.settings?.tags || [], security: this.getSecurity(request), diff --git a/packages/core/http/core-http-router-server-internal/src/router.ts b/packages/core/http/core-http-router-server-internal/src/router.ts index bb99de64581be..7fd0a66bc6e99 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.ts @@ -7,6 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ +import { EventEmitter } from 'node:events'; import type { Request, ResponseToolkit } from '@hapi/hapi'; import apm from 'elastic-apm-node'; import { isConfigSchema } from '@kbn/config-schema'; @@ -32,6 +33,7 @@ import { isZod } from '@kbn/zod'; import { validBodyOutput, getRequestValidation } from '@kbn/core-http-server'; import type { RouteSecurityGetter } from '@kbn/core-http-server'; import type { DeepPartial } from '@kbn/utility-types'; +import { RouteDeprecationInfo } from '@kbn/core-http-server/src/router/route'; import { RouteValidator } from './validator'; import { ALLOWED_PUBLIC_VERSION, CoreVersionedRouter } from './versioned_router'; import { CoreKibanaRequest } from './request'; @@ -52,7 +54,7 @@ export type ContextEnhancer< Context extends RequestHandlerContextBase > = (handler: RequestHandler) => RequestHandlerEnhanced; -function getRouteFullPath(routerPath: string, routePath: string) { +export function getRouteFullPath(routerPath: string, routePath: string) { // If router's path ends with slash and route's path starts with slash, // we should omit one of them to have a valid concatenated path. const routePathStartIndex = routerPath.endsWith('/') && routePath.startsWith('/') ? 1 : 0; @@ -147,7 +149,13 @@ export interface RouterOptions { /** @internal */ export interface InternalRegistrarOptions { + /** @default false */ isVersioned: boolean; + /** + * Whether this route should emit "route events" like postValidate + * @default true + */ + events: boolean; } /** @internal */ export type VersionedRouteConfig = Omit< @@ -165,15 +173,9 @@ export type InternalRegistrar ReturnType>; /** @internal */ -export interface InternalRouterRoute extends RouterRoute { - readonly isVersioned: boolean; -} - -/** @internal */ -interface InternalGetRoutesOptions { - /** @default false */ - excludeVersionedRoutes?: boolean; -} +type RouterEvents = + /** Just before registered handlers are called */ + 'onPostValidate'; /** * @internal @@ -181,7 +183,8 @@ interface InternalGetRoutesOptions { export class Router implements IRouter { - public routes: Array> = []; + private static ee = new EventEmitter(); + public routes: Array> = []; public pluginId?: symbol; public get: InternalRegistrar<'get', Context>; public post: InternalRegistrar<'post', Context>; @@ -201,31 +204,39 @@ export class Router( route: InternalRouteConfig, handler: RequestHandler, - { isVersioned }: { isVersioned: boolean } = { isVersioned: false } + internalOptions: InternalRegistrarOptions = { + isVersioned: false, + events: true, + } ) => { route = prepareRouteConfigValidation(route); const routeSchemas = routeSchemasFromRouteConfig(route, method); - const isPublicUnversionedRoute = route.options?.access === 'public' && !isVersioned; + const isPublicUnversionedRoute = + route.options?.access === 'public' && !internalOptions.isVersioned; this.routes.push({ - handler: async (req, responseToolkit) => - await this.handle({ + handler: async (req, responseToolkit) => { + return await this.handle({ routeSchemas, request: req, responseToolkit, isPublicUnversionedRoute, handler: this.enhanceWithContext(handler), - }), + emit: internalOptions.events + ? { onPostValidation: this.emitPostValidate } + : undefined, + }); + }, method, path: getRouteFullPath(this.routerPath, route.path), options: validOptions(method, route), // For the versioned route security is validated in the versioned router - security: isVersioned + security: internalOptions.isVersioned ? route.security : validRouteSecurity(route.security as DeepPartial, route.options), /** Below is added for introspection */ validationSchemas: route.validate, - isVersioned, + isVersioned: internalOptions.isVersioned, }); }; @@ -236,7 +247,15 @@ export class Router void) { + Router.ee.on(event, cb); + } + + public static off(event: RouterEvents, cb: (req: CoreKibanaRequest) => void) { + Router.ee.off(event, cb); + } + + public getRoutes({ excludeVersionedRoutes }: { excludeVersionedRoutes?: boolean } = {}) { if (excludeVersionedRoutes) { return this.routes.filter((route) => !route.isVersioned); } @@ -265,15 +284,28 @@ export class Router { + const postValidate: RouterEvents = 'onPostValidate'; + Router.ee.emit(postValidate, request, routeOptions); + }; + private async handle({ routeSchemas, request, responseToolkit, + emit, isPublicUnversionedRoute, handler, }: { request: Request; responseToolkit: ResponseToolkit; + emit?: { + onPostValidation: (req: KibanaRequest, reqOptions: any) => void; + }; isPublicUnversionedRoute: boolean; handler: RequestHandlerEnhanced< P, @@ -305,6 +337,8 @@ export class Router; - interface InternalVersionedRouteConfig extends VersionedRouteConfig { isDev: boolean; useVersionResolutionStrategyForInternalPaths: Map; @@ -68,7 +65,7 @@ function extractValidationSchemaFromHandler(handler: VersionedRouterRoute['handl } export class CoreVersionedRoute implements VersionedRoute { - private readonly handlers = new Map< + public readonly handlers = new Map< ApiVersion, { fn: RequestHandler; @@ -127,7 +124,7 @@ export class CoreVersionedRoute implements VersionedRoute { security: this.getSecurity, }, this.requestHandler, - { isVersioned: true } + { isVersioned: true, events: false } ); } @@ -230,6 +227,9 @@ export class CoreVersionedRoute implements VersionedRoute { req.query = {}; } + req.apiVersion = version; + this.router.emitPostValidate(req, handler.options.options); + const response = await handler.fn(ctx, req, res); if (this.isDev && validation?.response?.[response.status]?.body) { @@ -280,7 +280,6 @@ export class CoreVersionedRoute implements VersionedRoute { public addVersion(options: Options, handler: RequestHandler): VersionedRoute { this.validateVersion(options.version); options = prepareVersionedRouteValidation(options); - this.handlers.set(options.version, { fn: handler, options, diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts index e9272e17ab18e..869c59fa52dae 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts @@ -10,8 +10,8 @@ import type { VersionedRouter, VersionedRoute, VersionedRouteConfig } from '@kbn/core-http-server'; import { omit } from 'lodash'; import { CoreVersionedRoute } from './core_versioned_route'; -import type { HandlerResolutionStrategy, Method, VersionedRouterRoute } from './types'; -import type { Router } from '../router'; +import type { HandlerResolutionStrategy, Method, Options, VersionedRouterRoute } from './types'; +import { getRouteFullPath, type Router } from '../router'; /** @internal */ export interface VersionedRouterArgs { @@ -98,10 +98,15 @@ export class CoreVersionedRouter implements VersionedRouter { public getRoutes(): VersionedRouterRoute[] { return [...this.routes].map((route) => { return { - path: route.path, + path: getRouteFullPath(this.router.routerPath, route.path), method: route.method, options: omit(route.options, 'path'), + versionsOptions: [...route.handlers.entries()].reduce((acc, [version, { options }]) => { + acc[version] = options; + return acc; + }, {} as Record), handlers: route.getHandlers(), + isVersioned: true, }; }); } diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts index aec1f8b0cf0ab..2ebd8fb062408 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts @@ -16,15 +16,17 @@ import type { export type Method = Exclude; +/** @internal */ +export type Options = AddVersionOpts; + /** @internal */ export interface VersionedRouterRoute { method: string; path: string; options: Omit, 'path'>; - handlers: Array<{ - fn: RequestHandler; - options: AddVersionOpts; - }>; + handlers: Array<{ fn: RequestHandler; options: Options }>; + versionsOptions: Record; + isVersioned: true; } /** diff --git a/packages/core/http/core-http-server-internal/src/http_server.ts b/packages/core/http/core-http-server-internal/src/http_server.ts index 46470bac7c504..46f93d719414c 100644 --- a/packages/core/http/core-http-server-internal/src/http_server.ts +++ b/packages/core/http/core-http-server-internal/src/http_server.ts @@ -35,10 +35,12 @@ import type { HttpServerInfo, HttpAuth, IAuthHeadersStorage, + RouterDeprecatedRouteDetails, + RouteMethod, } from '@kbn/core-http-server'; import { performance } from 'perf_hooks'; import { isBoom } from '@hapi/boom'; -import { identity } from 'lodash'; +import { identity, isObject } from 'lodash'; import { IHttpEluMonitorConfig } from '@kbn/core-http-server/src/elu_monitor'; import { Env } from '@kbn/config'; import { CoreContext } from '@kbn/core-base-server-internal'; @@ -140,6 +142,7 @@ export interface HttpServerSetup { registerAuth: HttpServiceSetup['registerAuth']; registerOnPostAuth: HttpServiceSetup['registerOnPostAuth']; registerOnPreResponse: HttpServiceSetup['registerOnPreResponse']; + getDeprecatedRoutes: HttpServiceSetup['getDeprecatedRoutes']; authRequestHeaders: IAuthHeadersStorage; auth: HttpAuth; getServerInfo: () => HttpServerInfo; @@ -280,6 +283,7 @@ export class HttpServer { return { registerRouter: this.registerRouter.bind(this), + getDeprecatedRoutes: this.getDeprecatedRoutes.bind(this), registerRouterAfterListening: this.registerRouterAfterListening.bind(this), registerStaticDir: this.registerStaticDir.bind(this), staticAssets, @@ -385,6 +389,44 @@ export class HttpServer { } } + private getDeprecatedRoutes(): RouterDeprecatedRouteDetails[] { + const deprecatedRoutes: RouterDeprecatedRouteDetails[] = []; + + for (const router of this.registeredRouters) { + const allRouterRoutes = [ + // exclude so we dont get double entries. + // we need to call the versioned getRoutes to grab the full version options details + router.getRoutes({ excludeVersionedRoutes: true }), + router.versioned.getRoutes(), + ].flat(); + + deprecatedRoutes.push( + ...allRouterRoutes + .flat() + .map((route) => { + if (route.isVersioned === true) { + return Object.entries(route.versionsOptions).map(([version, handlerOptions]) => { + return { route, version, deprecated: handlerOptions.options?.deprecated }; + }); + } + return { route, version: undefined, deprecated: route.options.deprecated }; + }) + .flat() + .filter(({ deprecated }) => isObject(deprecated)) + .flatMap(({ route, deprecated, version }) => { + return { + routeDeprecationOptions: deprecated!, + routeMethod: route.method as RouteMethod, + routePath: route.path, + routeVersion: version, + }; + }) + ); + } + + return deprecatedRoutes; + } + private setupGracefulShutdownHandlers() { this.registerOnPreRouting((request, response, toolkit) => { if (this.stopping || this.stopped) { @@ -693,12 +735,13 @@ export class HttpServer { this.log.debug(`registering route handler for [${route.path}]`); // Hapi does not allow payload validation to be specified for 'head' or 'get' requests const validate = isSafeMethod(route.method) ? undefined : { payload: true }; - const { authRequired, tags, body = {}, timeout } = route.options; + const { authRequired, tags, body = {}, timeout, deprecated } = route.options; const { accepts: allow, override, maxBytes, output, parse } = body; const kibanaRouteOptions: KibanaRouteOptions = { xsrfRequired: route.options.xsrfRequired ?? !isSafeMethod(route.method), access: route.options.access ?? 'internal', + deprecated, security: route.security, }; // Log HTTP API target consumer. diff --git a/packages/core/http/core-http-server-internal/src/http_service.ts b/packages/core/http/core-http-server-internal/src/http_service.ts index 3f803b06f15fd..af310a6792057 100644 --- a/packages/core/http/core-http-server-internal/src/http_service.ts +++ b/packages/core/http/core-http-server-internal/src/http_service.ts @@ -162,7 +162,7 @@ export class HttpService return this.internalPreboot; } - public async setup(deps: SetupDeps) { + public async setup(deps: SetupDeps): Promise { this.requestHandlerContext = deps.context.createContextContainer(); this.configSubscription = this.config$.subscribe(() => { if (this.httpServer.isListening()) { @@ -185,9 +185,11 @@ export class HttpService this.internalSetup = { ...serverContract, - + registerOnPostValidation: (cb) => { + Router.on('onPostValidate', cb); + }, + getRegisteredDeprecatedApis: () => serverContract.getDeprecatedRoutes(), externalUrl: new ExternalUrlConfig(config.externalUrl), - createRouter: ( path: string, pluginId: PluginOpaqueId = this.coreContext.coreId diff --git a/packages/core/http/core-http-server-internal/src/types.ts b/packages/core/http/core-http-server-internal/src/types.ts index 70dde23f035d0..0706af9ad73a2 100644 --- a/packages/core/http/core-http-server-internal/src/types.ts +++ b/packages/core/http/core-http-server-internal/src/types.ts @@ -16,7 +16,10 @@ import type { IContextContainer, HttpServiceSetup, HttpServiceStart, + RouterDeprecatedRouteDetails, } from '@kbn/core-http-server'; +import { CoreKibanaRequest } from '@kbn/core-http-router-server-internal'; +import { RouteDeprecationInfo } from '@kbn/core-http-server/src/router/route'; import type { HttpServerSetup } from './http_server'; import type { ExternalUrlConfig } from './external_url'; import type { InternalStaticAssets } from './static_assets'; @@ -54,6 +57,9 @@ export interface InternalHttpServiceSetup path: string, plugin?: PluginOpaqueId ) => IRouter; + registerOnPostValidation( + cb: (req: CoreKibanaRequest, metadata: { deprecated: RouteDeprecationInfo }) => void + ): void; registerRouterAfterListening: (router: IRouter) => void; registerStaticDir: (path: string, dirPath: string) => void; authRequestHeaders: IAuthHeadersStorage; @@ -65,6 +71,7 @@ export interface InternalHttpServiceSetup contextName: ContextName, provider: IContextProvider ) => IContextContainer; + getRegisteredDeprecatedApis: () => RouterDeprecatedRouteDetails[]; } /** @internal */ diff --git a/packages/core/http/core-http-server/index.ts b/packages/core/http/core-http-server/index.ts index 4ba653fbd534c..b6ec9da75e78a 100644 --- a/packages/core/http/core-http-server/index.ts +++ b/packages/core/http/core-http-server/index.ts @@ -93,6 +93,7 @@ export type { IRouter, RouteRegistrar, RouterRoute, + RouterDeprecatedRouteDetails, IKibanaSocket, KibanaErrorResponseFactory, KibanaRedirectionResponseFactory, diff --git a/packages/core/http/core-http-server/src/http_contract.ts b/packages/core/http/core-http-server/src/http_contract.ts index 72eb70149f529..e2f675bd8d0c0 100644 --- a/packages/core/http/core-http-server/src/http_contract.ts +++ b/packages/core/http/core-http-server/src/http_contract.ts @@ -12,6 +12,7 @@ import type { IContextProvider, IRouter, RequestHandlerContextBase, + RouterDeprecatedRouteDetails, } from './router'; import type { AuthenticationHandler, @@ -359,6 +360,14 @@ export interface HttpServiceSetup< * Provides common {@link HttpServerInfo | information} about the running http server. */ getServerInfo: () => HttpServerInfo; + + /** + * Provides a list of all registered deprecated routes {{@link RouterDeprecatedRouteDetails | information}}. + * The routers will be evaluated everytime this function gets called to + * accommodate for any late route registrations + * @returns {RouterDeprecatedRouteDetails[]} + */ + getDeprecatedRoutes: () => RouterDeprecatedRouteDetails[]; } /** @public */ diff --git a/packages/core/http/core-http-server/src/router/index.ts b/packages/core/http/core-http-server/src/router/index.ts index c26212fa0de81..8384ed838d5fc 100644 --- a/packages/core/http/core-http-server/src/router/index.ts +++ b/packages/core/http/core-http-server/src/router/index.ts @@ -80,7 +80,7 @@ export type { LazyValidator, } from './route_validator'; export { RouteValidationError } from './route_validator'; -export type { IRouter, RouteRegistrar, RouterRoute } from './router'; +export type { IRouter, RouteRegistrar, RouterRoute, RouterDeprecatedRouteDetails } from './router'; export type { IKibanaSocket } from './socket'; export type { KibanaErrorResponseFactory, diff --git a/packages/core/http/core-http-server/src/router/request.ts b/packages/core/http/core-http-server/src/router/request.ts index 5cb84a21be0c3..3c03b978e8ca5 100644 --- a/packages/core/http/core-http-server/src/router/request.ts +++ b/packages/core/http/core-http-server/src/router/request.ts @@ -13,7 +13,7 @@ import type { Observable } from 'rxjs'; import type { RecursiveReadonly } from '@kbn/utility-types'; import type { HttpProtocol } from '../http_contract'; import type { IKibanaSocket } from './socket'; -import type { RouteMethod, RouteConfigOptions, RouteSecurity } from './route'; +import type { RouteMethod, RouteConfigOptions, RouteSecurity, RouteDeprecationInfo } from './route'; import type { Headers } from './headers'; export type RouteSecurityGetter = (request: { @@ -26,6 +26,7 @@ export type InternalRouteSecurity = RouteSecurity | RouteSecurityGetter; * @public */ export interface KibanaRouteOptions extends RouteOptionsApp { + deprecated?: RouteDeprecationInfo; xsrfRequired: boolean; access: 'internal' | 'public'; security?: InternalRouteSecurity; @@ -190,6 +191,11 @@ export interface KibanaRequest< */ readonly rewrittenUrl?: URL; + /** + * The versioned route API version of this request. + */ + readonly apiVersion: string | undefined; + /** * The path parameter of this request. */ diff --git a/packages/core/http/core-http-server/src/router/route.ts b/packages/core/http/core-http-server/src/router/route.ts index 194191e6f423f..a4d349e0d7e65 100644 --- a/packages/core/http/core-http-server/src/router/route.ts +++ b/packages/core/http/core-http-server/src/router/route.ts @@ -113,6 +113,43 @@ export type RouteAccess = 'public' | 'internal'; export type Privilege = string; +/** + * Route Deprecation info + * This information will assist Kibana HTTP API users when upgrading to new versions + * of the Elastic stack (via Upgrade Assistant) and will be surfaced in documentation + * created from HTTP API introspection (like OAS). + */ +export interface RouteDeprecationInfo { + documentationUrl: string; + severity: 'warning' | 'critical'; + reason: VersionBumpDeprecationType | RemovalApiDeprecationType | MigrationApiDeprecationType; +} + +/** + * bump deprecation reason denotes a new version of the API is available + */ +interface VersionBumpDeprecationType { + type: 'bump'; + newApiVersion: string; +} + +/** + * remove deprecation reason denotes the API was fully removed with no replacement + */ +interface RemovalApiDeprecationType { + type: 'remove'; +} + +/** + * migrate deprecation reason denotes the API has been migrated to a different API path + * Please make sure that if you are only incrementing the version of the API to use 'bump' instead + */ +interface MigrationApiDeprecationType { + type: 'migrate'; + newApiPath: string; + newApiMethod: string; +} + /** * A set of privileges that can be used to define complex authorization requirements. * @@ -277,12 +314,18 @@ export interface RouteConfigOptions { description?: string; /** - * Setting this to `true` declares this route to be deprecated. Consumers SHOULD - * refrain from usage of this route. + * Description of deprecations for this HTTP API. * - * @remarks This will be surfaced in OAS documentation. + * @remark This will assist Kibana HTTP API users when upgrading to new versions + * of the Elastic stack (via Upgrade Assistant) and will be surfaced in documentation + * created from HTTP API introspection (like OAS). + * + * Seting this object marks the route as deprecated. + * + * @remarks This may be surfaced in OAS documentation. + * @public */ - deprecated?: boolean; + deprecated?: RouteDeprecationInfo; /** * Whether this route should be treated as "invisible" and excluded from router diff --git a/packages/core/http/core-http-server/src/router/router.ts b/packages/core/http/core-http-server/src/router/router.ts index ba2b5eb906a93..d8b79bee13025 100644 --- a/packages/core/http/core-http-server/src/router/router.ts +++ b/packages/core/http/core-http-server/src/router/router.ts @@ -10,7 +10,7 @@ import type { Request, ResponseObject, ResponseToolkit } from '@hapi/hapi'; import type Boom from '@hapi/boom'; import type { VersionedRouter } from '../versioning'; -import type { RouteConfig, RouteMethod } from './route'; +import type { RouteConfig, RouteDeprecationInfo, RouteMethod } from './route'; import type { RequestHandler, RequestHandlerWrapper } from './request_handler'; import type { RequestHandlerContextBase } from './request_handler_context'; import type { RouteConfigOptions } from './route'; @@ -98,7 +98,7 @@ export interface IRouter RouterRoute[]; + getRoutes: (options?: { excludeVersionedRoutes?: boolean }) => RouterRoute[]; /** * An instance very similar to {@link IRouter} that can be used for versioning HTTP routes @@ -139,4 +139,13 @@ export interface RouterRoute { req: Request, responseToolkit: ResponseToolkit ) => Promise>; + isVersioned: false; +} + +/** @public */ +export interface RouterDeprecatedRouteDetails { + routeDeprecationOptions: RouteDeprecationInfo; + routeMethod: RouteMethod; + routePath: string; + routeVersion?: string; } diff --git a/packages/core/http/core-http-server/src/versioning/types.ts b/packages/core/http/core-http-server/src/versioning/types.ts index 60cbca014e683..fcedb8720e8df 100644 --- a/packages/core/http/core-http-server/src/versioning/types.ts +++ b/packages/core/http/core-http-server/src/versioning/types.ts @@ -9,6 +9,7 @@ import type { ApiVersion } from '@kbn/core-http-common'; import type { MaybePromise } from '@kbn/utility-types'; +import { VersionedRouterRoute } from '@kbn/core-http-router-server-internal'; import type { RouteConfig, RouteMethod, @@ -20,7 +21,7 @@ import type { RouteValidationFunction, LazyValidator, } from '../..'; - +import type { RouteDeprecationInfo } from '../router/route'; type RqCtx = RequestHandlerContextBase; export type { ApiVersion }; @@ -89,17 +90,9 @@ export type VersionedRouteConfig = Omit< */ description?: string; - /** - * Declares this operation to be deprecated. Consumers SHOULD refrain from usage - * of this route. This will be surfaced in OAS documentation. - * - * @default false - */ - deprecated?: boolean; - /** * Release version or date that this route will be removed - * Use with `deprecated: true` + * Use with `deprecated: {@link RouteDeprecationInfo}` * * @default undefined */ @@ -234,6 +227,11 @@ export interface VersionedRouter { * @track-adoption */ delete: VersionedRouteRegistrar<'delete', Ctx>; + + /** + * @public + */ + getRoutes: () => VersionedRouterRoute[]; } /** @public */ @@ -341,6 +339,10 @@ export interface AddVersionOpts { validate: false | VersionedRouteValidation | (() => VersionedRouteValidation); // Provide a way to lazily load validation schemas security?: Exclude['security'], undefined>; + + options?: { + deprecated: RouteDeprecationInfo; + }; } /** diff --git a/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts index 2fcdf384cb897..795047a61fb93 100644 --- a/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts +++ b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts @@ -283,6 +283,7 @@ export function createPluginSetupContext({ deprecations: deps.deprecations.getRegistry(plugin.name), coreUsageData: { registerUsageCounter: deps.coreUsageData.registerUsageCounter, + registerDeprecatedUsageFetch: deps.coreUsageData.registerDeprecatedUsageFetch, }, plugins: { onSetup: (...dependencyNames) => runtimeResolver.onSetup(plugin.name, dependencyNames), diff --git a/packages/core/root/core-root-server-internal/src/server.ts b/packages/core/root/core-root-server-internal/src/server.ts index 447db192c3048..5082a27930e87 100644 --- a/packages/core/root/core-root-server-internal/src/server.ts +++ b/packages/core/root/core-root-server-internal/src/server.ts @@ -276,10 +276,6 @@ export class Server { executionContext: executionContextSetup, }); - const deprecationsSetup = await this.deprecations.setup({ - http: httpSetup, - }); - // setup i18n prior to any other service, to have translations ready const i18nServiceSetup = await this.i18n.setup({ http: httpSetup, pluginPaths }); @@ -303,6 +299,11 @@ export class Server { changedDeprecatedConfigPath$: this.configService.getDeprecatedConfigPath$(), }); + const deprecationsSetup = await this.deprecations.setup({ + http: httpSetup, + coreUsageData: coreUsageDataSetup, + }); + const savedObjectsSetup = await this.savedObjects.setup({ http: httpSetup, elasticsearch: elasticsearchServiceSetup, diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts b/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts index 649e972af2abc..044fb683fb69a 100644 --- a/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts +++ b/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts @@ -8,7 +8,7 @@ */ import type { KibanaRequest } from '@kbn/core-http-server'; -import type { CoreUsageStats } from '@kbn/core-usage-data-server'; +import type { CoreUsageStats, CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; /** @internal */ export interface BaseIncrementOptions { @@ -38,6 +38,13 @@ export type IncrementSavedObjectsExportOptions = BaseIncrementOptions & { export interface ICoreUsageStatsClient { getUsageStats(): Promise; + getDeprecatedApiUsageStats(): Promise; + + incrementDeprecatedApi( + counterName: string, + options: { resolved?: boolean; incrementBy?: number } + ): Promise; + incrementSavedObjectsBulkCreate(options: BaseIncrementOptions): Promise; incrementSavedObjectsBulkGet(options: BaseIncrementOptions): Promise; diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts index 2a10e06567d02..1c1e4feae4809 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts @@ -48,6 +48,8 @@ import { type SavedObjectsServiceStart, } from '@kbn/core-saved-objects-server'; +import { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; +import { DeprecatedApiUsageFetcher } from '@kbn/core-usage-data-server/src/setup_contract'; import { isConfigured } from './is_configured'; import { coreUsageStatsType } from './saved_objects'; import { CoreUsageStatsClient } from './core_usage_stats_client'; @@ -88,6 +90,7 @@ export class CoreUsageDataService private coreUsageStatsClient?: CoreUsageStatsClient; private deprecatedConfigPaths: ChangedDeprecatedPaths = { set: [], unset: [] }; private incrementUsageCounter: CoreIncrementUsageCounter = () => {}; // Initially set to noop + private deprecatedApiUsageFetcher: DeprecatedApiUsageFetcher = async () => []; // Initially set to noop constructor(core: CoreContext) { this.logger = core.logger.get('core-usage-stats-service'); @@ -513,12 +516,21 @@ export class CoreUsageDataService } }; + const registerDeprecatedUsageFetch = (fetchFn: DeprecatedApiUsageFetcher) => { + this.deprecatedApiUsageFetcher = fetchFn; + }; + + const fetchDeprecatedUsageStats = ({ soClient }: { soClient: ISavedObjectsRepository }) => { + return this.deprecatedApiUsageFetcher({ soClient }); + }; + this.coreUsageStatsClient = new CoreUsageStatsClient({ debugLogger: (message: string) => this.logger.debug(message), basePath: http.basePath, repositoryPromise: internalRepositoryPromise, stop$: this.stop$, incrementUsageCounter, + fetchDeprecatedUsageStats, }); const contract: InternalCoreUsageDataSetup = { @@ -526,6 +538,7 @@ export class CoreUsageDataService getClient: () => this.coreUsageStatsClient!, registerUsageCounter, incrementUsageCounter, + registerDeprecatedUsageFetch, }; return contract; diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts index 67ab6d9b30c9c..c7a4134b35dbf 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts @@ -37,6 +37,7 @@ import { takeUntil, tap, } from 'rxjs'; +import { DeprecatedApiUsageFetcher } from '@kbn/core-usage-data-server/src/setup_contract'; export const BULK_CREATE_STATS_PREFIX = 'apiCalls.savedObjectsBulkCreate'; export const BULK_GET_STATS_PREFIX = 'apiCalls.savedObjectsBulkGet'; @@ -108,6 +109,16 @@ export interface CoreUsageEvent { types?: string[]; } +/** + * Interface that models some of the core events (e.g. SO HTTP API calls) + * @internal + */ +export interface CoreUsageDeprecatedApiEvent { + id: string; + resolved: boolean; + incrementBy: number; +} + /** @internal */ export interface CoreUsageStatsClientParams { debugLogger: (message: string) => void; @@ -116,6 +127,7 @@ export interface CoreUsageStatsClientParams { stop$: Observable; incrementUsageCounter: (params: CoreIncrementCounterParams) => void; bufferTimeMs?: number; + fetchDeprecatedUsageStats: DeprecatedApiUsageFetcher; } /** @internal */ @@ -126,6 +138,8 @@ export class CoreUsageStatsClient implements ICoreUsageStatsClient { private readonly fieldsToIncrement$ = new Subject(); private readonly flush$ = new Subject(); private readonly coreUsageEvents$ = new Subject(); + private readonly coreUsageDeprecatedApiCalls$ = new Subject(); + private readonly fetchDeprecatedUsageStats: DeprecatedApiUsageFetcher; constructor({ debugLogger, @@ -134,10 +148,12 @@ export class CoreUsageStatsClient implements ICoreUsageStatsClient { stop$, incrementUsageCounter, bufferTimeMs = DEFAULT_BUFFER_TIME_MS, + fetchDeprecatedUsageStats, }: CoreUsageStatsClientParams) { this.debugLogger = debugLogger; this.basePath = basePath; this.repositoryPromise = repositoryPromise; + this.fetchDeprecatedUsageStats = fetchDeprecatedUsageStats; this.fieldsToIncrement$ .pipe( takeUntil(stop$), @@ -180,6 +196,19 @@ export class CoreUsageStatsClient implements ICoreUsageStatsClient { ) .subscribe(); + this.coreUsageDeprecatedApiCalls$ + .pipe( + takeUntil(stop$), + tap(({ id, incrementBy, resolved }) => { + incrementUsageCounter({ + counterName: id, + counterType: `deprecated_api_call:${resolved ? 'resolved' : 'total'}`, + incrementBy, + }); + }) + ) + .subscribe(); + this.coreUsageEvents$ .pipe( takeUntil(stop$), @@ -215,6 +244,20 @@ export class CoreUsageStatsClient implements ICoreUsageStatsClient { return coreUsageStats; } + public async incrementDeprecatedApi( + id: string, + { resolved = false, incrementBy = 1 }: { resolved: boolean; incrementBy: number } + ) { + const deprecatedField = resolved ? 'deprecated_api_calls_resolved' : 'deprecated_api_calls'; + this.coreUsageDeprecatedApiCalls$.next({ id, resolved, incrementBy }); + this.fieldsToIncrement$.next([`${deprecatedField}.total`]); + } + + public async getDeprecatedApiUsageStats() { + const repository = await this.repositoryPromise; + return await this.fetchDeprecatedUsageStats({ soClient: repository }); + } + public async incrementSavedObjectsBulkCreate(options: BaseIncrementOptions) { await this.updateUsageStats([], BULK_CREATE_STATS_PREFIX, options); } diff --git a/packages/core/usage-data/core-usage-data-server/index.ts b/packages/core/usage-data/core-usage-data-server/index.ts index 77fb0b1066750..77221ec937ab0 100644 --- a/packages/core/usage-data/core-usage-data-server/index.ts +++ b/packages/core/usage-data/core-usage-data-server/index.ts @@ -19,4 +19,5 @@ export type { CoreConfigUsageData, CoreServicesUsageData, CoreUsageStats, + CoreDeprecatedApiUsageStats, } from './src'; diff --git a/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts b/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts index 36409a097129c..39df9d30d19c9 100644 --- a/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts +++ b/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts @@ -146,3 +146,16 @@ export interface CoreUsageStats { 'savedObjectsRepository.resolvedOutcome.notFound'?: number; 'savedObjectsRepository.resolvedOutcome.total'?: number; } + +/** + * @public + * + * CoreDeprecatedApiUsageStats are collected over time while Kibana is running. + */ +export interface CoreDeprecatedApiUsageStats { + apiId: string; + totalMarkedAsResolved: number; + markedAsResolvedLastCalledAt: string; + apiTotalCalls: number; + apiLastCalledAt: string; +} diff --git a/packages/core/usage-data/core-usage-data-server/src/index.ts b/packages/core/usage-data/core-usage-data-server/src/index.ts index 01cd52adbe986..5d4bbcfc64bbc 100644 --- a/packages/core/usage-data/core-usage-data-server/src/index.ts +++ b/packages/core/usage-data/core-usage-data-server/src/index.ts @@ -12,7 +12,7 @@ export type { CoreEnvironmentUsageData, CoreConfigUsageData, } from './core_usage_data'; -export type { CoreUsageStats } from './core_usage_stats'; +export type { CoreUsageStats, CoreDeprecatedApiUsageStats } from './core_usage_stats'; export type { CoreUsageDataSetup, CoreUsageCounter, diff --git a/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts index bd87563792e6d..4964f04aea077 100644 --- a/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts +++ b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts @@ -7,12 +7,12 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ +import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; +import type { CoreDeprecatedApiUsageStats } from './core_usage_stats'; + /** * Internal API for registering the Usage Tracker used for Core's usage data payload. * - * @note This API should never be used to drive application logic and is only - * intended for telemetry purposes. - * * @public */ export interface CoreUsageDataSetup { @@ -21,6 +21,7 @@ export interface CoreUsageDataSetup { * when tracking events. */ registerUsageCounter: (usageCounter: CoreUsageCounter) => void; + registerDeprecatedUsageFetch: DeprecatedApiUsageFetcher; } /** @@ -49,3 +50,11 @@ export interface CoreIncrementCounterParams { * Method to call whenever an event occurs, so the counter can be increased. */ export type CoreIncrementUsageCounter = (params: CoreIncrementCounterParams) => void; + +/** + * @public + * Registers the deprecated API fetcher to be called to grab all the deprecated API usage details. + */ +export type DeprecatedApiUsageFetcher = (params: { + soClient: ISavedObjectsRepository; +}) => Promise; diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts new file mode 100644 index 0000000000000..0057a07d86900 --- /dev/null +++ b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts @@ -0,0 +1,65 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { Logger } from '@kbn/logging'; +import { USAGE_COUNTERS_SAVED_OBJECT_TYPE } from '@kbn/usage-collection-plugin/server'; + +import { CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; +import { createCounterFetcher, CounterEvent } from '../common/counters'; + +const DEPRECATED_API_COUNTERS_FILTER = `${USAGE_COUNTERS_SAVED_OBJECT_TYPE}.attributes.counterType: deprecated_api_call\\:*`; + +const mergeCounter = (counter: CounterEvent, acc?: CoreDeprecatedApiUsageStats) => { + if (acc && acc?.apiId !== counter.counterName) { + throw new Error( + `Failed to merge mismatching counterNames: ${acc.apiId} with ${counter.counterName}` + ); + } + + const isResolvedCounter = counter.counterType.endsWith(':resolved'); + + const totalKey = isResolvedCounter ? 'totalMarkedAsResolved' : 'apiTotalCalls'; + const lastUpdatedKey = isResolvedCounter ? 'markedAsResolvedLastCalledAt' : 'apiLastCalledAt'; + + const finalCounter = { + apiTotalCalls: 0, + apiLastCalledAt: 'unknown', + totalMarkedAsResolved: 0, + markedAsResolvedLastCalledAt: 'unknown', + ...(acc || {}), + }; + + const newPayload = { + [totalKey]: (finalCounter[totalKey] || 0) + counter.total, + [lastUpdatedKey]: counter.lastUpdatedAt, + }; + + return { + apiId: counter.counterName, + ...finalCounter, + ...newPayload, + }; +}; + +function mergeCounters(counters: CounterEvent[]): CoreDeprecatedApiUsageStats[] { + const mergedCounters = counters.reduce((acc, counter) => { + const { counterName } = counter; + const existingCounter = acc[counterName]; + + acc[counterName] = mergeCounter(counter, existingCounter); + + return acc; + }, {} as Record); + + return Object.values(mergedCounters); +} + +export const fetchDeprecatedApiCounterStats = (logger: Logger) => { + return createCounterFetcher(logger, DEPRECATED_API_COUNTERS_FILTER, mergeCounters); +}; diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/index.ts b/src/plugins/kibana_usage_collection/server/collectors/core/index.ts index 0e0f783b0f847..e298560893ccb 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/index.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/index.ts @@ -8,3 +8,4 @@ */ export { registerCoreUsageCollector } from './core_usage_collector'; +export { fetchDeprecatedApiCounterStats } from './fetch_deprecated_api_counters'; diff --git a/src/plugins/kibana_usage_collection/server/collectors/index.ts b/src/plugins/kibana_usage_collection/server/collectors/index.ts index ef5287324ee59..c22fb3b5697f8 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/index.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/index.ts @@ -17,7 +17,7 @@ export { export { registerOpsStatsCollector } from './ops_stats'; export { registerCloudProviderUsageCollector } from './cloud'; export { registerCspCollector } from './csp'; -export { registerCoreUsageCollector } from './core'; +export { registerCoreUsageCollector, fetchDeprecatedApiCounterStats } from './core'; export { registerLocalizationUsageCollector } from './localization'; export { registerConfigUsageCollector } from './config_usage'; export { registerUiCountersUsageCollector } from './ui_counters'; diff --git a/src/plugins/kibana_usage_collection/server/plugin.ts b/src/plugins/kibana_usage_collection/server/plugin.ts index bbfc010c0e065..8a01b047c2744 100644 --- a/src/plugins/kibana_usage_collection/server/plugin.ts +++ b/src/plugins/kibana_usage_collection/server/plugin.ts @@ -43,6 +43,7 @@ import { registerUsageCountersUsageCollector, registerSavedObjectsCountUsageCollector, registerEventLoopDelaysCollector, + fetchDeprecatedApiCounterStats, } from './collectors'; interface KibanaUsageCollectionPluginsDepsSetup { @@ -74,6 +75,9 @@ export class KibanaUsageCollectionPlugin implements Plugin { registerEbtCounters(coreSetup.analytics, usageCollection); this.eventLoopUsageCounter = usageCollection.createUsageCounter('eventLoop'); coreSetup.coreUsageData.registerUsageCounter(usageCollection.createUsageCounter('core')); + coreSetup.coreUsageData.registerDeprecatedUsageFetch( + fetchDeprecatedApiCounterStats(this.logger.get('deprecated-api-usage')) + ); this.registerUsageCollectors( usageCollection, coreSetup, diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx index a6ea9a26c9bb8..2e130b6cd048b 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx @@ -50,6 +50,12 @@ const i18nTexts = { defaultMessage: 'Quick resolve', } ), + markAsResolvedButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.flyout.quickResolveButtonLabel', + { + defaultMessage: 'Mark As Resolved', + } + ), retryQuickResolveButtonLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.flyout.retryQuickResolveButtonLabel', { @@ -97,7 +103,15 @@ const i18nTexts = { ), }; -const getQuickResolveButtonLabel = (deprecationResolutionState?: DeprecationResolutionState) => { +interface AvailableCorrectiveActions { + api: boolean; + manual: boolean; + markAsResolved: boolean; +} +const getQuickResolveButtonLabel = ( + deprecationResolutionState?: DeprecationResolutionState, + avilableCorrectiveActions: AvailableCorrectiveActions +) => { if (deprecationResolutionState?.resolveDeprecationStatus === 'in_progress') { return i18nTexts.quickResolveInProgressButtonLabel; } @@ -110,7 +124,13 @@ const getQuickResolveButtonLabel = (deprecationResolutionState?: DeprecationReso return i18nTexts.retryQuickResolveButtonLabel; } - return i18nTexts.quickResolveButtonLabel; + if (avilableCorrectiveActions.api) { + return i18nTexts.quickResolveButtonLabel; + } + + if (avilableCorrectiveActions.markAsResolved) { + return i18nTexts.markAsResolvedButtonLabel; + } }; export const DeprecationDetailsFlyout = ({ @@ -120,9 +140,18 @@ export const DeprecationDetailsFlyout = ({ deprecationResolutionState, }: DeprecationDetailsFlyoutProps) => { const { documentationUrl, message, correctiveActions, title } = deprecation; + const isCurrent = deprecationResolutionState?.id === deprecation.id; + const avilableCorrectiveActions: AvailableCorrectiveActions = { + api: !!correctiveActions.api, + manual: correctiveActions.manualSteps && correctiveActions.manualSteps.length > 0, + markAsResolved: !!correctiveActions.mark_as_resolved_api, + }; const isResolved = isCurrent && deprecationResolutionState?.resolveDeprecationStatus === 'ok'; + const hasResolveButton = + avilableCorrectiveActions.api || avilableCorrectiveActions.markAsResolved; + const onResolveDeprecation = useCallback(() => { uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_KIBANA_QUICK_RESOLVE_CLICK); resolveDeprecation(deprecation); @@ -221,7 +250,7 @@ export const DeprecationDetailsFlyout = ({ {/* Only show the "Quick resolve" button if deprecation supports it and deprecation is not yet resolved */} - {correctiveActions.api && !isResolved && ( + {hasResolveButton && !isResolved && ( - {getQuickResolveButtonLabel(deprecationResolutionState)} + {getQuickResolveButtonLabel(deprecationResolutionState, avilableCorrectiveActions)} )} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx index 6a757d0cb2b0b..ec0a2ebbb333d 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx @@ -56,6 +56,12 @@ const i18nTexts = { defaultMessage: 'Feature', } ), + apiDeprecationTypeCellLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.apiDeprecationTypeCellLabel', + { + defaultMessage: 'API', + } + ), unknownDeprecationTypeCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.unknownDeprecationTypeCellLabel', { @@ -135,6 +141,8 @@ export const KibanaDeprecationsTable: React.FunctionComponent = ({ return i18nTexts.configDeprecationTypeCellLabel; case 'feature': return i18nTexts.featureDeprecationTypeCellLabel; + case 'api': + return i18nTexts.apiDeprecationTypeCellLabel; case 'uncategorized': default: return i18nTexts.unknownDeprecationTypeCellLabel; @@ -155,6 +163,7 @@ export const KibanaDeprecationsTable: React.FunctionComponent = ({ ); @@ -191,6 +200,10 @@ export const KibanaDeprecationsTable: React.FunctionComponent = ({ value: 'feature', name: i18nTexts.featureDeprecationTypeCellLabel, }, + { + value: 'api', + name: i18nTexts.apiDeprecationTypeCellLabel, + }, { value: 'uncategorized', name: i18nTexts.unknownDeprecationTypeCellLabel, diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx index 373c9e7b43f52..20c6077a68eb3 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; import type { DeprecationResolutionState } from './kibana_deprecations'; -const i18nTexts = { +const manualI18nTexts = { manualCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.manualCellLabel', { @@ -32,31 +32,34 @@ const i18nTexts = { defaultMessage: 'This issue needs to be resolved manually.', } ), - automatedCellLabel: i18n.translate( +}; + +const automatedI18nTexts = { + resolutionTypeCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.automatedCellLabel', { defaultMessage: 'Automated', } ), - automationInProgressCellLabel: i18n.translate( + resolutionProgressCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.automationInProgressCellLabel', { defaultMessage: 'Resolution in progress…', } ), - automationCompleteCellLabel: i18n.translate( + resolutionCompleteCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.automationCompleteCellLabel', { defaultMessage: 'Resolved', } ), - automationFailedCellLabel: i18n.translate( + resolutionFailedCellLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.automationFailedCellLabel', { defaultMessage: 'Resolution failed', } ), - automatedCellTooltipLabel: i18n.translate( + resolutionCellTooltipLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.automatedCellTooltipLabel', { defaultMessage: 'This issue can be resolved automatically.', @@ -64,18 +67,56 @@ const i18nTexts = { ), }; +const markAsResolvedI18nTexts = { + resolutionTypeCellLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedCellLabel', + { + defaultMessage: 'Mark as resolved', + } + ), + resolutionProgressCellLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedInProgressCellLabel', + { + defaultMessage: 'Marking as resolved…', + } + ), + resolutionCompleteCellLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedCompleteCellLabel', + { + defaultMessage: 'Marked as resolved', + } + ), + resolutionFailedCellLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedFailedCellLabel', + { + defaultMessage: 'Failed to mark as resolved', + } + ), + resolutionCellTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedCellTooltipLabel', + { + defaultMessage: 'This issue can be resolved marked as resolved.', + } + ), +}; + interface Props { deprecationId: string; isAutomated: boolean; + canBeMarkedAsResolved: boolean; deprecationResolutionState?: DeprecationResolutionState; } export const ResolutionTableCell: React.FunctionComponent = ({ deprecationId, isAutomated, + canBeMarkedAsResolved, deprecationResolutionState, }) => { - if (isAutomated) { + if (isAutomated || canBeMarkedAsResolved) { + const resolutionI18nTexts = isAutomated ? automatedI18nTexts : markAsResolvedI18nTexts; + const euiIconType = isAutomated ? 'indexSettings' : 'clickLeft'; + if (deprecationResolutionState?.id === deprecationId) { const { resolveDeprecationStatus } = deprecationResolutionState; @@ -87,7 +128,7 @@ export const ResolutionTableCell: React.FunctionComponent = ({ - {i18nTexts.automationInProgressCellLabel} + {resolutionI18nTexts.resolutionProgressCellLabel} ); @@ -98,7 +139,7 @@ export const ResolutionTableCell: React.FunctionComponent = ({ - {i18nTexts.automationFailedCellLabel} + {resolutionI18nTexts.resolutionFailedCellLabel} ); @@ -110,7 +151,7 @@ export const ResolutionTableCell: React.FunctionComponent = ({ - {i18nTexts.automationCompleteCellLabel} + {resolutionI18nTexts.resolutionCompleteCellLabel} ); @@ -118,13 +159,13 @@ export const ResolutionTableCell: React.FunctionComponent = ({ } return ( - + - + - {i18nTexts.automatedCellLabel} + {resolutionI18nTexts.resolutionTypeCellLabel} @@ -134,11 +175,11 @@ export const ResolutionTableCell: React.FunctionComponent = ({ return ( - {i18nTexts.manualCellLabel} + {manualI18nTexts.manualCellLabel} ); From 0ba759584132dc278366d7be06823e201d41038f Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:28:55 +0000 Subject: [PATCH 02/27] [CI] Auto-commit changed files from 'node scripts/notice' --- .../core-deprecations-server-internal/tsconfig.json | 4 ++++ packages/core/http/core-http-server/tsconfig.json | 3 ++- packages/core/usage-data/core-usage-data-server/tsconfig.json | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json b/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json index ba06a3e9ec2f7..2f9c33f5aae5b 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json +++ b/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json @@ -33,6 +33,10 @@ "@kbn/core-elasticsearch-server-mocks", "@kbn/core-http-server", "@kbn/core-elasticsearch-client-server-mocks", + "@kbn/core-usage-data-base-server-internal", + "@kbn/core-usage-data-server", + "@kbn/core-usage-data-server-internal", + "@kbn/core-http-router-server-internal", ], "exclude": [ "target/**/*", diff --git a/packages/core/http/core-http-server/tsconfig.json b/packages/core/http/core-http-server/tsconfig.json index 64b2dacf2f292..37549e94dbff8 100644 --- a/packages/core/http/core-http-server/tsconfig.json +++ b/packages/core/http/core-http-server/tsconfig.json @@ -15,7 +15,8 @@ "@kbn/utility-types", "@kbn/core-base-common", "@kbn/core-http-common", - "@kbn/zod" + "@kbn/zod", + "@kbn/core-http-router-server-internal" ], "exclude": [ "target/**/*", diff --git a/packages/core/usage-data/core-usage-data-server/tsconfig.json b/packages/core/usage-data/core-usage-data-server/tsconfig.json index 77d0aa6ade3b1..83abb04d150ac 100644 --- a/packages/core/usage-data/core-usage-data-server/tsconfig.json +++ b/packages/core/usage-data/core-usage-data-server/tsconfig.json @@ -12,5 +12,8 @@ ], "exclude": [ "target/**/*", + ], + "kbn_references": [ + "@kbn/core-saved-objects-api-server", ] } From fe1edbffad890f8dd8ec91c00ef3bcdedbeced86 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 13:39:43 +0300 Subject: [PATCH 03/27] revert testing example --- .../src/routes/get.ts | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts index a2ec443e55594..ed3cd061b633b 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/get.ts @@ -11,34 +11,19 @@ import type { DeprecationsGetResponse } from '@kbn/core-deprecations-common'; import type { InternalDeprecationRouter } from '../internal_types'; export const registerGetRoute = (router: InternalDeprecationRouter) => { - router.versioned - .get({ + router.get( + { path: '/', - access: 'public', - enableQueryVersion: true, - }) - .addVersion( - { - validate: false, - version: '2023-10-31', - options: { - deprecated: { - documentationUrl: 'https://google2.com', - severity: 'warning', - reason: { - type: 'bump', - newApiVersion: '2024-10-13', - }, - }, - }, - }, - async (context, req, res) => { - const deprecationsClient = (await context.core).deprecations.client; - const body: DeprecationsGetResponse = { - deprecations: await deprecationsClient.getAllDeprecations(), - }; + validate: false, + }, + async (context, req, res) => { + const deprecationsClient = (await context.core).deprecations.client; - return res.ok({ body }); - } - ); + const body: DeprecationsGetResponse = { + deprecations: await deprecationsClient.getAllDeprecations(), + }; + + return res.ok({ body }); + } + ); }; From 464223624a78172364b18f23130f1e44c2cab229 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 13:42:48 +0300 Subject: [PATCH 04/27] update i18n messages --- .../src/deprecations/i18n_texts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts index 3737c230c588c..cdf54dabb319c 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts @@ -52,7 +52,7 @@ export const getApiDeprecationMessage = ( const messages = [ i18n.translate('core.deprecations.deprecations.apiDeprecationApiCallsDetailsMessage', { defaultMessage: - 'The API {routeWithMethod} has been called {apiTotalCalls} times. The last time the API was called was on {apiLastCalledAt}.', + 'The API {routeWithMethod} has been called {apiTotalCalls} times. The API was last called on {apiLastCalledAt}.', values: { routeWithMethod, apiTotalCalls, @@ -67,7 +67,7 @@ export const getApiDeprecationMessage = ( 'core.deprecations.deprecations.apiDeprecationPreviouslyMarkedAsResolvedMessage', { defaultMessage: - 'The api has been called {timeSinceLastResolved} times since the last time it was marked as resolved on {markedAsResolvedLastCalledAt}', + 'This API has been marked as resolved before. It has been called {timeSinceLastResolved} times since it was marked as resolved on {markedAsResolvedLastCalledAt}.', values: { timeSinceLastResolved: diff, markedAsResolvedLastCalledAt: moment(markedAsResolvedLastCalledAt).format('LLLL Z'), @@ -98,7 +98,7 @@ export const getApiDeprecationsManualSteps = (details: RouterDeprecatedRouteDeta manualSteps.push( i18n.translate('core.deprecations.deprecations.manualSteps.bumpTypeExplainationStep', { defaultMessage: - 'A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version', + 'A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version.', }), i18n.translate('core.deprecations.deprecations.manualSteps.bumpDetailsStep', { defaultMessage: 'This API {routePath} has a new version "{newApiVersion}".', From f6552c761b66e9c37c1ef2e84dd29d7df9769f8d Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 13:47:00 +0300 Subject: [PATCH 05/27] remove version example --- .../src/deprecations_client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts index 38a1078621edc..bdce2e616c5a9 100644 --- a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts +++ b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts @@ -28,7 +28,6 @@ export class DeprecationsClient { private fetchDeprecations = async (): Promise => { const { deprecations } = await this.http.fetch('/api/deprecations/', { - query: { apiVersion: '2023-10-31' }, asSystemRequest: true, }); From e4a4b211fe69528015fd4a8a2572a51a4e73cf12 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 14:50:16 +0300 Subject: [PATCH 06/27] i18n_check --- .../src/deprecations/i18n_texts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts index cdf54dabb319c..716c86abf5022 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts @@ -125,7 +125,7 @@ export const getApiDeprecationsManualSteps = (details: RouterDeprecatedRouteDeta }), i18n.translate('core.deprecations.deprecations.manualSteps.migrateDetailsStep', { defaultMessage: 'This API {routePath} has been migrated to {newApiMethod} {newApiPath}', - values: { newApiMethod: newApiMethod.toUpperCase(), newApiPath }, + values: { newApiMethod: newApiMethod.toUpperCase(), newApiPath, routePath }, }) ); break; From e14ff566eba979557547a0fb30f96675ef3029cf Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 14 Oct 2024 16:24:38 +0300 Subject: [PATCH 07/27] fix types --- .../src/routes/post_validation_handler.ts | 2 +- .../src/core_usage_data_service.ts | 4 ++-- .../usage-data/core-usage-data-server/src/setup_contract.ts | 2 +- .../server/collectors/common/counters.ts | 2 +- src/plugins/kibana_usage_collection/server/plugin.ts | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts index 52e261e3da983..41a5135502c4b 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts @@ -45,7 +45,7 @@ export function createRouteDeprecationsHandler({ const client = coreUsageData.getClient(); // no await we just fire it off. - client.incrementDeprecatedApi(counterName, { resolved: false }); + void client.incrementDeprecatedApi(counterName, { resolved: false }); } }; } diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts index 1c1e4feae4809..b1117934348e7 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts @@ -520,8 +520,8 @@ export class CoreUsageDataService this.deprecatedApiUsageFetcher = fetchFn; }; - const fetchDeprecatedUsageStats = ({ soClient }: { soClient: ISavedObjectsRepository }) => { - return this.deprecatedApiUsageFetcher({ soClient }); + const fetchDeprecatedUsageStats = (params: { soClient: ISavedObjectsRepository }) => { + return this.deprecatedApiUsageFetcher(params); }; this.coreUsageStatsClient = new CoreUsageStatsClient({ diff --git a/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts index 4964f04aea077..30ed7edb6ce1d 100644 --- a/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts +++ b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts @@ -21,7 +21,7 @@ export interface CoreUsageDataSetup { * when tracking events. */ registerUsageCounter: (usageCounter: CoreUsageCounter) => void; - registerDeprecatedUsageFetch: DeprecatedApiUsageFetcher; + registerDeprecatedUsageFetch: (fetchFn: DeprecatedApiUsageFetcher) => void; } /** diff --git a/src/plugins/kibana_usage_collection/server/collectors/common/counters.ts b/src/plugins/kibana_usage_collection/server/collectors/common/counters.ts index 9300ddcb959aa..df0ca67a85198 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/common/counters.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/common/counters.ts @@ -30,7 +30,7 @@ export function createCounterFetcher( filter: string, transform: (counters: CounterEvent[]) => T ) { - return async ({ soClient }: CollectorFetchContext) => { + return async ({ soClient }: Pick) => { const finder = soClient.createPointInTimeFinder({ type: USAGE_COUNTERS_SAVED_OBJECT_TYPE, namespaces: ['*'], diff --git a/src/plugins/kibana_usage_collection/server/plugin.ts b/src/plugins/kibana_usage_collection/server/plugin.ts index 8a01b047c2744..48fb1c6ff7b9b 100644 --- a/src/plugins/kibana_usage_collection/server/plugin.ts +++ b/src/plugins/kibana_usage_collection/server/plugin.ts @@ -75,9 +75,10 @@ export class KibanaUsageCollectionPlugin implements Plugin { registerEbtCounters(coreSetup.analytics, usageCollection); this.eventLoopUsageCounter = usageCollection.createUsageCounter('eventLoop'); coreSetup.coreUsageData.registerUsageCounter(usageCollection.createUsageCounter('core')); - coreSetup.coreUsageData.registerDeprecatedUsageFetch( - fetchDeprecatedApiCounterStats(this.logger.get('deprecated-api-usage')) + const deprecatedUsageFetch = fetchDeprecatedApiCounterStats( + this.logger.get('deprecated-api-usage') ); + coreSetup.coreUsageData.registerDeprecatedUsageFetch(deprecatedUsageFetch); this.registerUsageCollectors( usageCollection, coreSetup, From 96d88efcdddbd91167d7f1fb2e67708e20fcc073 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Tue, 15 Oct 2024 13:33:23 +0300 Subject: [PATCH 08/27] code review changes --- .../src/routes/post_validation_handler.ts | 4 ++-- .../src/routes/resolve_deprecated_api.ts | 2 +- .../core-http-router-server-internal/index.ts | 1 - .../src/request.ts | 10 +++++++++- .../src/router.ts | 4 ++++ .../versioned_router/core_versioned_route.ts | 4 +++- .../versioned_router/core_versioned_router.ts | 13 +++++++------ .../src/versioned_router/index.ts | 2 +- .../src/versioned_router/types.ts | 17 +---------------- .../src/http_server.ts | 5 +++-- .../core-http-server-internal/tsconfig.json | 1 + packages/core/http/core-http-server/index.ts | 1 + .../http/core-http-server/src/router/request.ts | 1 + .../core-http-server/src/versioning/index.ts | 1 + .../core-http-server/src/versioning/types.ts | 16 ++++++++++++++-- .../core/http/core-http-server/tsconfig.json | 1 - .../src/process_versioned_router.ts | 3 +-- 17 files changed, 50 insertions(+), 36 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts index 41a5135502c4b..b93c17af2f536 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts @@ -36,10 +36,10 @@ export function createRouteDeprecationsHandler({ coreUsageData: InternalCoreUsageDataSetup; }) { return (req: CoreKibanaRequest, { deprecated }: { deprecated?: RouteDeprecationInfo }) => { - if (deprecated && isObject(deprecated)) { + if (deprecated && isObject(deprecated) && req.route.routePath) { const counterName = buildApiDeprecationId({ routeMethod: req.route.method, - routePath: req.route.path, + routePath: req.route.routePath, routeVersion: req.apiVersion, }); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts index b8eda6de94294..c087d94920041 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts @@ -31,7 +31,7 @@ export const registerMarkAsResolvedRoute = ( schema.literal('get'), schema.literal('options'), ]), - routeVersion: schema.string(), + routeVersion: schema.maybe(schema.string()), incrementBy: schema.number(), }), }, diff --git a/packages/core/http/core-http-router-server-internal/index.ts b/packages/core/http/core-http-router-server-internal/index.ts index 256e8fb94306f..6aa6ac117f533 100644 --- a/packages/core/http/core-http-router-server-internal/index.ts +++ b/packages/core/http/core-http-router-server-internal/index.ts @@ -13,7 +13,6 @@ export { CoreVersionedRouter, ALLOWED_PUBLIC_VERSION, unwrapVersionedResponseBodyValidation, - type VersionedRouterRoute, type HandlerResolutionStrategy, } from './src/versioned_router'; export { Router } from './src/router'; diff --git a/packages/core/http/core-http-router-server-internal/src/request.ts b/packages/core/http/core-http-router-server-internal/src/request.ts index 6d4da18d0a33a..9f89f1a70bb47 100644 --- a/packages/core/http/core-http-router-server-internal/src/request.ts +++ b/packages/core/http/core-http-router-server-internal/src/request.ts @@ -256,7 +256,14 @@ export class CoreKibanaRequest< } = request.route?.settings?.payload || {}; // the socket is undefined when using @hapi/shot, or when a "fake request" is used - const socketTimeout = isRealRawRequest(request) ? request.raw.req.socket?.timeout : undefined; + let socketTimeout: undefined | number; + let routePath: undefined | string; + + if (isRealRawRequest(request)) { + socketTimeout = request.raw.req.socket?.timeout; + routePath = request.route.path; + } + const options = { authRequired: this.getAuthRequired(request), // TypeScript note: Casting to `RouterOptions` to fix the following error: @@ -291,6 +298,7 @@ export class CoreKibanaRequest< return { path: request.path ?? '/', + routePath, method, options, }; diff --git a/packages/core/http/core-http-router-server-internal/src/router.ts b/packages/core/http/core-http-router-server-internal/src/router.ts index 7fd0a66bc6e99..66d793179383c 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.ts @@ -334,6 +334,10 @@ export class Router; const version = this.getVersion(req); + req.apiVersion = version; if (!version) { return res.badRequest({ @@ -218,6 +219,8 @@ export class CoreVersionedRoute implements VersionedRoute { req.params = params; req.query = query; } catch (e) { + // Emit onPostValidation even if validation fails. + this.router.emitPostValidate(req, handler.options.options); return res.badRequest({ body: e.message, headers: getVersionHeader(version) }); } } else { @@ -227,7 +230,6 @@ export class CoreVersionedRoute implements VersionedRoute { req.query = {}; } - req.apiVersion = version; this.router.emitPostValidate(req, handler.options.options); const response = await handler.fn(ctx, req, res); diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts index 869c59fa52dae..ef1f8255420ae 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.ts @@ -7,10 +7,15 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { VersionedRouter, VersionedRoute, VersionedRouteConfig } from '@kbn/core-http-server'; +import type { + VersionedRouter, + VersionedRoute, + VersionedRouteConfig, + VersionedRouterRoute, +} from '@kbn/core-http-server'; import { omit } from 'lodash'; import { CoreVersionedRoute } from './core_versioned_route'; -import type { HandlerResolutionStrategy, Method, Options, VersionedRouterRoute } from './types'; +import type { HandlerResolutionStrategy, Method } from './types'; import { getRouteFullPath, type Router } from '../router'; /** @internal */ @@ -101,10 +106,6 @@ export class CoreVersionedRouter implements VersionedRouter { path: getRouteFullPath(this.router.routerPath, route.path), method: route.method, options: omit(route.options, 'path'), - versionsOptions: [...route.handlers.entries()].reduce((acc, [version, { options }]) => { - acc[version] = options; - return acc; - }, {} as Record), handlers: route.getHandlers(), isVersioned: true, }; diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/index.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/index.ts index e283fcc2a590f..14c08076faae0 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/index.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/index.ts @@ -9,6 +9,6 @@ export { resolvers as versionHandlerResolvers } from './handler_resolvers'; export { CoreVersionedRouter } from './core_versioned_router'; -export type { HandlerResolutionStrategy, VersionedRouterRoute } from './types'; +export type { HandlerResolutionStrategy } from './types'; export { ALLOWED_PUBLIC_VERSION } from './route_version_utils'; export { unwrapVersionedResponseBodyValidation } from './util'; diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts index 2ebd8fb062408..bdcaae486cd9c 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/types.ts @@ -7,28 +7,13 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { - AddVersionOpts, - RequestHandler, - RouteMethod, - VersionedRouteConfig, -} from '@kbn/core-http-server'; +import type { AddVersionOpts, RouteMethod } from '@kbn/core-http-server'; export type Method = Exclude; /** @internal */ export type Options = AddVersionOpts; -/** @internal */ -export interface VersionedRouterRoute { - method: string; - path: string; - options: Omit, 'path'>; - handlers: Array<{ fn: RequestHandler; options: Options }>; - versionsOptions: Record; - isVersioned: true; -} - /** * Specifies resolution strategy to use if a request does not provide a version. * diff --git a/packages/core/http/core-http-server-internal/src/http_server.ts b/packages/core/http/core-http-server-internal/src/http_server.ts index 46f93d719414c..17617ea9bdd64 100644 --- a/packages/core/http/core-http-server-internal/src/http_server.ts +++ b/packages/core/http/core-http-server-internal/src/http_server.ts @@ -405,8 +405,9 @@ export class HttpServer { .flat() .map((route) => { if (route.isVersioned === true) { - return Object.entries(route.versionsOptions).map(([version, handlerOptions]) => { - return { route, version, deprecated: handlerOptions.options?.deprecated }; + return [...route.handlers.entries()].map(([version, { options }]) => { + const deprecated = options.options?.deprecated; + return { route, version: `${version}`, deprecated }; }); } return { route, version: undefined, deprecated: route.options.deprecated }; diff --git a/packages/core/http/core-http-server-internal/tsconfig.json b/packages/core/http/core-http-server-internal/tsconfig.json index 8e76d71f341da..3e103c61ee954 100644 --- a/packages/core/http/core-http-server-internal/tsconfig.json +++ b/packages/core/http/core-http-server-internal/tsconfig.json @@ -21,6 +21,7 @@ "@kbn/core-execution-context-server-internal", "@kbn/core-http-common", "@kbn/core-http-server", + "@kbn/core-http-router-server", "@kbn/core-http-context-server-internal", "@kbn/core-http-router-server-internal", "@kbn/core-http-router-server-mocks", diff --git a/packages/core/http/core-http-server/index.ts b/packages/core/http/core-http-server/index.ts index b6ec9da75e78a..7fe125c6aa9a7 100644 --- a/packages/core/http/core-http-server/index.ts +++ b/packages/core/http/core-http-server/index.ts @@ -171,6 +171,7 @@ export type { VersionedRouter, VersionedRouteCustomResponseBodyValidation, VersionedResponseBodyValidation, + VersionedRouterRoute, } from './src/versioning'; export type { IStaticAssets } from './src/static_assets'; diff --git a/packages/core/http/core-http-server/src/router/request.ts b/packages/core/http/core-http-server/src/router/request.ts index 3c03b978e8ca5..066372faca1e4 100644 --- a/packages/core/http/core-http-server/src/router/request.ts +++ b/packages/core/http/core-http-server/src/router/request.ts @@ -60,6 +60,7 @@ export interface KibanaRequestRoute { path: string; method: Method; options: KibanaRequestRouteOptions; + routePath?: string; } /** diff --git a/packages/core/http/core-http-server/src/versioning/index.ts b/packages/core/http/core-http-server/src/versioning/index.ts index 94b60bd105aac..8d8a664c769ac 100644 --- a/packages/core/http/core-http-server/src/versioning/index.ts +++ b/packages/core/http/core-http-server/src/versioning/index.ts @@ -19,4 +19,5 @@ export type { VersionedRouter, VersionedRouteCustomResponseBodyValidation, VersionedResponseBodyValidation, + VersionedRouterRoute, } from './types'; diff --git a/packages/core/http/core-http-server/src/versioning/types.ts b/packages/core/http/core-http-server/src/versioning/types.ts index fcedb8720e8df..05b81a57bf86d 100644 --- a/packages/core/http/core-http-server/src/versioning/types.ts +++ b/packages/core/http/core-http-server/src/versioning/types.ts @@ -9,7 +9,6 @@ import type { ApiVersion } from '@kbn/core-http-common'; import type { MaybePromise } from '@kbn/utility-types'; -import { VersionedRouterRoute } from '@kbn/core-http-router-server-internal'; import type { RouteConfig, RouteMethod, @@ -231,7 +230,7 @@ export interface VersionedRouter { /** * @public */ - getRoutes: () => VersionedRouterRoute[]; + getRoutes: () => Array>; } /** @public */ @@ -365,3 +364,16 @@ export interface VersionedRoute< handler: (...params: Parameters>) => MaybePromise ): VersionedRoute; } + +export interface VersionedRouterRoute< + P = unknown, + Q = unknown, + B = unknown, + Ctx extends RqCtx = RqCtx +> { + method: string; + path: string; + options: Omit, 'path'>; + handlers: Array<{ fn: RequestHandler; options: AddVersionOpts }>; + isVersioned: true; +} diff --git a/packages/core/http/core-http-server/tsconfig.json b/packages/core/http/core-http-server/tsconfig.json index 37549e94dbff8..50a0ce973eb4e 100644 --- a/packages/core/http/core-http-server/tsconfig.json +++ b/packages/core/http/core-http-server/tsconfig.json @@ -16,7 +16,6 @@ "@kbn/core-base-common", "@kbn/core-http-common", "@kbn/zod", - "@kbn/core-http-router-server-internal" ], "exclude": [ "target/**/*", diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts index 97b92f92fde57..85c75eaf55453 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts @@ -10,10 +10,9 @@ import { type CoreVersionedRouter, versionHandlerResolvers, - VersionedRouterRoute, unwrapVersionedResponseBodyValidation, } from '@kbn/core-http-router-server-internal'; -import type { RouteMethod } from '@kbn/core-http-server'; +import type { RouteMethod, VersionedRouterRoute } from '@kbn/core-http-server'; import type { OpenAPIV3 } from 'openapi-types'; import type { GenerateOpenApiDocumentOptionsFilters } from './generate_oas'; import type { OasConverter } from './oas_converter'; From cf26b2bcf6770852e297fff558c845aa0a52c325 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:47:24 +0000 Subject: [PATCH 09/27] [CI] Auto-commit changed files from 'node scripts/notice' --- packages/core/http/core-http-server-internal/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/http/core-http-server-internal/tsconfig.json b/packages/core/http/core-http-server-internal/tsconfig.json index 3e103c61ee954..8e76d71f341da 100644 --- a/packages/core/http/core-http-server-internal/tsconfig.json +++ b/packages/core/http/core-http-server-internal/tsconfig.json @@ -21,7 +21,6 @@ "@kbn/core-execution-context-server-internal", "@kbn/core-http-common", "@kbn/core-http-server", - "@kbn/core-http-router-server", "@kbn/core-http-context-server-internal", "@kbn/core-http-router-server-internal", "@kbn/core-http-router-server-mocks", From 7b003e90174c9fbfb75625c010f48f346ebcb0a6 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Thu, 17 Oct 2024 15:35:34 +0300 Subject: [PATCH 10/27] finish deprecated service unit tests --- .../src/deprecations/api_deprecations.test.ts | 355 ++++++++++++++++++ .../src/deprecations/api_deprecations.ts | 104 ++--- .../deprecations/config_deprecations.test.ts | 115 ++++++ .../src/deprecations_service.test.mocks.ts | 8 + .../src/deprecations_service.test.ts | 106 +----- .../src/deprecations_service.ts | 1 - .../tsconfig.json | 1 + .../src/router.test.ts | 14 +- .../src/router.ts | 6 +- .../versioned_router/core_versioned_route.ts | 3 +- .../core_versioned_router.test.ts | 2 - .../src/versioned_router.mock.ts | 15 +- .../src/http_service.mock.ts | 4 + .../core-http-server/src/versioning/types.ts | 11 +- .../src/core_setup.mock.ts | 2 + .../src/plugin_context.ts | 1 + .../src/mocks/internal_mocks.ts | 1 + .../src/routes/bulk_create.ts | 1 + .../src/routes/bulk_delete.ts | 1 + .../src/routes/bulk_get.ts | 1 + .../src/routes/bulk_resolve.ts | 1 + .../src/routes/bulk_update.ts | 1 + .../src/routes/create.ts | 1 + .../src/routes/delete.ts | 1 + .../src/routes/find.ts | 1 + .../src/routes/get.ts | 1 + .../src/routes/resolve.ts | 1 + .../src/routes/update.ts | 1 + .../src/core_usage_stats_client.test.ts | 1 + .../src/core_usage_data_service.mock.ts | 1 + .../src/core_usage_stats_client.mock.ts | 1 + .../src/generate_oas.test.ts | 1 + .../src/generate_oas.test.util.ts | 2 +- .../src/process_router.ts | 2 +- .../src/process_versioned_router.test.ts | 8 +- .../src/process_versioned_router.ts | 2 +- 36 files changed, 604 insertions(+), 174 deletions(-) create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts create mode 100644 packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.test.ts diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts new file mode 100644 index 0000000000000..711456c5958b0 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts @@ -0,0 +1,355 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { DeepPartial } from '@kbn/utility-types'; +import { mockDeprecationsRegistry, mockDeprecationsFactory } from '../mocks'; +import { + registerApiDeprecationsInfo, + buildApiDeprecationId, + createGetApiDeprecations, +} from './api_deprecations'; +import { RouterDeprecatedRouteDetails } from '@kbn/core-http-server'; +import { httpServiceMock } from '@kbn/core-http-server-mocks'; +import { + coreUsageDataServiceMock, + coreUsageStatsClientMock, +} from '@kbn/core-usage-data-server-mocks'; +import _ from 'lodash'; +import { CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; + +describe('#registerApiDeprecationsInfo', () => { + const deprecationsFactory = mockDeprecationsFactory.create(); + const deprecationsRegistry = mockDeprecationsRegistry.create(); + let usageClientMock: ReturnType; + let http: ReturnType; + let coreUsageData: ReturnType; + + beforeEach(() => { + jest.clearAllMocks(); + usageClientMock = coreUsageStatsClientMock.create(); + http = httpServiceMock.createInternalSetupContract(); + coreUsageData = coreUsageDataServiceMock.createSetupContract(usageClientMock); + }); + + beforeAll(() => { + jest.useFakeTimers().setSystemTime(new Date('2024-10-17T12:06:41.224Z')); + }); + + afterAll(() => { + jest.useRealTimers(); + }); + + it('registers api deprecations', async () => { + deprecationsFactory.getRegistry.mockReturnValue(deprecationsRegistry); + registerApiDeprecationsInfo({ deprecationsFactory, coreUsageData, http }); + + expect(deprecationsFactory.getRegistry).toBeCalledWith('core.api_deprecations'); + expect(deprecationsRegistry.registerDeprecations).toBeCalledTimes(1); + expect(deprecationsRegistry.registerDeprecations).toBeCalledWith({ + getDeprecations: expect.any(Function), + }); + }); + + describe('#createGetApiDeprecations', () => { + const createDeprecatedRouteDetails = ( + overrides?: DeepPartial + ): RouterDeprecatedRouteDetails => + _.merge( + { + routeDeprecationOptions: { + documentationUrl: 'https://fake-url', + severity: 'critical', + reason: { + type: 'remove', + }, + }, + routeMethod: 'get', + routePath: '/api/test/', + routeVersion: '123', + } as RouterDeprecatedRouteDetails, + overrides + ); + + const createApiUsageStat = ( + apiId: string, + overrides?: DeepPartial + ): CoreDeprecatedApiUsageStats => + _.merge( + { + apiId, + totalMarkedAsResolved: 1, + markedAsResolvedLastCalledAt: '2024-10-17T12:06:41.224Z', + apiTotalCalls: 13, + apiLastCalledAt: '2024-09-01T10:06:41.224Z', + }, + overrides + ); + + it('returns removed type deprecated route', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ + routePath: '/api/test_removed/', + routeDeprecationOptions: { reason: { type: 'remove' } }, + }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute)), + ]); + + const deprecations = await getDeprecations(); + expect(deprecations).toMatchInlineSnapshot(` + Array [ + Object { + "apiId": "123|get|/api/test_removed", + "correctiveActions": Object { + "manualSteps": Array [ + "This API will be removed", + "This API will be completely removed. You will no longer be able to use it in the future.", + "Click the learn more documentation link for more details on addressing the deprecated API.", + "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", + "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + ], + "mark_as_resolved_api": Object { + "apiTotalCalls": 13, + "routeMethod": "get", + "routePath": "/api/test_removed/", + "routeVersion": "123", + "timestamp": 2024-10-17T12:06:41.224Z, + "totalMarkedAsResolved": 1, + }, + }, + "deprecationType": "api", + "documentationUrl": "https://fake-url", + "domainId": "core.routes-deprecations", + "level": "critical", + "message": "The API GET /api/test_removed/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. + This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", + "title": "The \\"GET /api/test_removed/\\" route will be removed", + }, + ] + `); + }); + + it('returns migrated type deprecated route', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ + routePath: '/api/test_migrated/', + routeDeprecationOptions: { + reason: { type: 'migrate', newApiMethod: 'post', newApiPath: '/api/new_path' }, + }, + }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute)), + ]); + + const deprecations = await getDeprecations(); + expect(deprecations).toMatchInlineSnapshot(` + Array [ + Object { + "apiId": "123|get|/api/test_migrated", + "correctiveActions": Object { + "manualSteps": Array [ + "This API has been migrated to a different API", + "This API will be migrated to a different API and will be removed in the future in favor of the other API.", + "This API /api/test_migrated/ has been migrated to POST /api/new_path", + "Click the learn more documentation link for more details on addressing the deprecated API.", + "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", + "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + ], + "mark_as_resolved_api": Object { + "apiTotalCalls": 13, + "routeMethod": "get", + "routePath": "/api/test_migrated/", + "routeVersion": "123", + "timestamp": 2024-10-17T12:06:41.224Z, + "totalMarkedAsResolved": 1, + }, + }, + "deprecationType": "api", + "documentationUrl": "https://fake-url", + "domainId": "core.routes-deprecations", + "level": "critical", + "message": "The API GET /api/test_migrated/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. + This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", + "title": "The \\"GET /api/test_migrated/\\" route has been migrated to a different API", + }, + ] + `); + }); + + it('returns bumped type deprecated route', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ + routePath: '/api/test_bumped/', + routeDeprecationOptions: { reason: { type: 'bump', newApiVersion: '444' } }, + }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute)), + ]); + + const deprecations = await getDeprecations(); + expect(deprecations).toMatchInlineSnapshot(` + Array [ + Object { + "apiId": "123|get|/api/test_bumped", + "correctiveActions": Object { + "manualSteps": Array [ + "This API has a new version bump", + "A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version.", + "This API /api/test_bumped/ has a new version \\"444\\".", + "Click the learn more documentation link for more details on addressing the deprecated API.", + "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", + "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + ], + "mark_as_resolved_api": Object { + "apiTotalCalls": 13, + "routeMethod": "get", + "routePath": "/api/test_bumped/", + "routeVersion": "123", + "timestamp": 2024-10-17T12:06:41.224Z, + "totalMarkedAsResolved": 1, + }, + }, + "deprecationType": "api", + "documentationUrl": "https://fake-url", + "domainId": "core.routes-deprecations", + "level": "critical", + "message": "The API GET /api/test_bumped/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. + This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", + "title": "The \\"GET /api/test_bumped/\\" route has a new version bump", + }, + ] + `); + }); + + it('does not return resolved deprecated route', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ routePath: '/api/test_resolved/' }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute), { + apiTotalCalls: 5, + totalMarkedAsResolved: 5, + }), + ]); + + const deprecations = await getDeprecations(); + expect(deprecations).toEqual([]); + }); + + it('returns never resolved deprecated route', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ + routePath: '/api/test_never_resolved/', + }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute), { + totalMarkedAsResolved: 0, + markedAsResolvedLastCalledAt: undefined, + }), + ]); + + const deprecations = await getDeprecations(); + expect(deprecations).toMatchInlineSnapshot(` + Array [ + Object { + "apiId": "123|get|/api/test_never_resolved", + "correctiveActions": Object { + "manualSteps": Array [ + "This API will be removed", + "This API will be completely removed. You will no longer be able to use it in the future.", + "Click the learn more documentation link for more details on addressing the deprecated API.", + "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", + "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + ], + "mark_as_resolved_api": Object { + "apiTotalCalls": 13, + "routeMethod": "get", + "routePath": "/api/test_never_resolved/", + "routeVersion": "123", + "timestamp": 2024-10-17T12:06:41.224Z, + "totalMarkedAsResolved": 0, + }, + }, + "deprecationType": "api", + "documentationUrl": "https://fake-url", + "domainId": "core.routes-deprecations", + "level": "critical", + "message": "The API GET /api/test_never_resolved/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00.", + "title": "The \\"GET /api/test_never_resolved/\\" route will be removed", + }, + ] + `); + }); + + it('does not return deprecated routes that have never been called', async () => { + const getDeprecations = createGetApiDeprecations({ coreUsageData, http }); + const deprecatedRoute = createDeprecatedRouteDetails({ + routePath: '/api/test_never_resolved/', + }); + http.getRegisteredDeprecatedApis.mockReturnValue([deprecatedRoute]); + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([]); + expect(await getDeprecations()).toEqual([]); + + usageClientMock.getDeprecatedApiUsageStats.mockResolvedValue([ + createApiUsageStat(buildApiDeprecationId(deprecatedRoute), { + apiTotalCalls: 0, + apiLastCalledAt: undefined, + totalMarkedAsResolved: 0, + markedAsResolvedLastCalledAt: undefined, + }), + ]); + expect(await getDeprecations()).toEqual([]); + }); + }); +}); + +describe('#buildApiDeprecationId', () => { + it('returns apiDeprecationId string for versioned routes', () => { + const apiDeprecationId = buildApiDeprecationId({ + routeMethod: 'get', + routePath: '/api/test', + routeVersion: '10-10-2023', + }); + expect(apiDeprecationId).toBe('10-10-2023|get|/api/test'); + }); + + it('returns apiDeprecationId string for unversioned routes', () => { + const apiDeprecationId = buildApiDeprecationId({ + routeMethod: 'get', + routePath: '/api/test', + }); + expect(apiDeprecationId).toBe('unversioned|get|/api/test'); + }); + + it('gives the same ID the route method is capitalized or not', () => { + const apiDeprecationId = buildApiDeprecationId({ + // @ts-expect-error + routeMethod: 'GeT', + routePath: '/api/test', + routeVersion: '10-10-2023', + }); + + expect(apiDeprecationId).toBe('10-10-2023|get|/api/test'); + }); + + it('gives the same ID the route path has a trailing slash or not', () => { + const apiDeprecationId = buildApiDeprecationId({ + // @ts-expect-error + routeMethod: 'GeT', + routePath: '/api/test/', + routeVersion: '10-10-2023', + }); + + expect(apiDeprecationId).toBe('10-10-2023|get|/api/test'); + }); +}); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts index 591faf0d799bc..8a64b6305514a 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts @@ -7,18 +7,18 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { Logger } from '@kbn/logging'; import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { RouterDeprecatedRouteDetails } from '@kbn/core-http-server'; +import { DeprecationsDetails } from '@kbn/core-deprecations-common'; import type { DeprecationsFactory } from '../deprecations_factory'; import { getApiDeprecationMessage, getApiDeprecationsManualSteps, getApiDeprecationTitle, } from './i18n_texts'; + interface ApiDeprecationsServiceDeps { - logger: Logger; deprecationsFactory: DeprecationsFactory; http: InternalHttpServiceSetup; coreUsageData: InternalCoreUsageDataSetup; @@ -29,9 +29,61 @@ export const buildApiDeprecationId = ({ routeMethod, routeVersion, }: Pick): string => { - return [routeVersion || 'unversioned', routeMethod, routePath].join('|'); + return [ + routeVersion || 'unversioned', + routeMethod.toLocaleLowerCase(), + routePath.replace(/\/$/, ''), + ].join('|'); }; +export const createGetApiDeprecations = + ({ http, coreUsageData }: Pick) => + async (): Promise => { + const deprecatedRoutes = http.getRegisteredDeprecatedApis(); + const usageClient = coreUsageData.getClient(); + const deprecatedApiUsageStats = await usageClient.getDeprecatedApiUsageStats(); + + return deprecatedApiUsageStats + .filter(({ apiTotalCalls, totalMarkedAsResolved }) => { + return apiTotalCalls > totalMarkedAsResolved; + }) + .filter(({ apiId }) => + deprecatedRoutes.some((routeDetails) => buildApiDeprecationId(routeDetails) === apiId) + ) + .map((apiUsageStats) => { + const { apiId, apiTotalCalls, totalMarkedAsResolved } = apiUsageStats; + const routeDeprecationDetails = deprecatedRoutes.find( + (routeDetails) => buildApiDeprecationId(routeDetails) === apiId + )!; + const { routeVersion, routePath, routeDeprecationOptions, routeMethod } = + routeDeprecationDetails; + const defaultLevel = + routeDeprecationOptions.reason.type === 'remove' ? 'critical' : 'warning'; + const deprecationLevel = routeDeprecationOptions.severity || defaultLevel; + + return { + apiId, + title: getApiDeprecationTitle(routeDeprecationDetails), + level: deprecationLevel, + message: getApiDeprecationMessage(routeDeprecationDetails, apiUsageStats), + documentationUrl: routeDeprecationOptions.documentationUrl, + correctiveActions: { + manualSteps: getApiDeprecationsManualSteps(routeDeprecationDetails), + mark_as_resolved_api: { + routePath, + routeMethod, + routeVersion, + apiTotalCalls, + totalMarkedAsResolved, + timestamp: new Date(), + }, + }, + deprecationType: 'api', + domainId: 'core.routes-deprecations', + }; + }); + }; + export const registerApiDeprecationsInfo = ({ deprecationsFactory, http, @@ -40,50 +92,6 @@ export const registerApiDeprecationsInfo = ({ const deprecationsRegistery = deprecationsFactory.getRegistry('core.api_deprecations'); deprecationsRegistery.registerDeprecations({ - getDeprecations: async () => { - const deprecatedRoutes = http.getRegisteredDeprecatedApis(); - const usageClient = coreUsageData.getClient(); - const deprecatedApiUsageStats = await usageClient.getDeprecatedApiUsageStats(); - - return deprecatedApiUsageStats - .filter(({ apiTotalCalls, totalMarkedAsResolved }) => { - return apiTotalCalls > totalMarkedAsResolved; - }) - .filter(({ apiId }) => - deprecatedRoutes.some((routeDetails) => buildApiDeprecationId(routeDetails) === apiId) - ) - .map((apiUsageStats) => { - const { apiId, apiTotalCalls, totalMarkedAsResolved } = apiUsageStats; - const routeDeprecationDetails = deprecatedRoutes.find( - (routeDetails) => buildApiDeprecationId(routeDetails) === apiId - )!; - const { routeVersion, routePath, routeDeprecationOptions, routeMethod } = - routeDeprecationDetails; - const defaultLevel = - routeDeprecationOptions.reason.type === 'remove' ? 'critical' : 'warning'; - const deprecationLevel = routeDeprecationOptions.severity || defaultLevel; - - return { - apiId, - title: getApiDeprecationTitle(routeDeprecationDetails), - level: deprecationLevel, - message: getApiDeprecationMessage(routeDeprecationDetails, apiUsageStats), - documentationUrl: routeDeprecationOptions.documentationUrl, - correctiveActions: { - manualSteps: getApiDeprecationsManualSteps(routeDeprecationDetails), - mark_as_resolved_api: { - routePath, - routeMethod, - routeVersion, - apiTotalCalls, - totalMarkedAsResolved, - timestamp: new Date(), - }, - }, - deprecationType: 'api', - domainId: 'core.routes-deprecations', - }; - }); - }, + getDeprecations: createGetApiDeprecations({ http, coreUsageData }), }); }; diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.test.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.test.ts new file mode 100644 index 0000000000000..92d0703c8037e --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/config_deprecations.test.ts @@ -0,0 +1,115 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { registerConfigDeprecationsInfo } from './config_deprecations'; +import { mockDeprecationsRegistry, mockDeprecationsFactory } from '../mocks'; +import { mockCoreContext } from '@kbn/core-base-server-mocks'; +import { configServiceMock } from '@kbn/config-mocks'; + +describe('#registerConfigDeprecationsInfo', () => { + let coreContext: ReturnType; + + const deprecationsFactory = mockDeprecationsFactory.create(); + const deprecationsRegistry = mockDeprecationsRegistry.create(); + const getDeprecationsContext = mockDeprecationsRegistry.createGetDeprecationsContext(); + + beforeEach(() => { + const configService = configServiceMock.create({ + atPath: { skip_deprecated_settings: ['hello', 'world'] }, + }); + jest.clearAllMocks(); + coreContext = mockCoreContext.create({ configService }); + }); + + it('registers config deprecations', async () => { + coreContext.configService.getHandledDeprecatedConfigs.mockReturnValue([ + [ + 'testDomain', + [ + { + configPath: 'test', + level: 'critical', + message: 'testMessage', + documentationUrl: 'testDocUrl', + correctiveActions: { + manualSteps: [ + 'Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.', + 'Using Kibana role-mapping management, change all role-mappings which assign the kibana_user role to the kibana_admin role.', + ], + }, + }, + ], + ], + ]); + + deprecationsFactory.getRegistry.mockReturnValue(deprecationsRegistry); + registerConfigDeprecationsInfo({ + deprecationsFactory, + configService: coreContext.configService, + }); + + expect(coreContext.configService.getHandledDeprecatedConfigs).toBeCalledTimes(1); + expect(deprecationsFactory.getRegistry).toBeCalledTimes(1); + expect(deprecationsFactory.getRegistry).toBeCalledWith('testDomain'); + expect(deprecationsRegistry.registerDeprecations).toBeCalledTimes(1); + const configDeprecations = + await deprecationsRegistry.registerDeprecations.mock.calls[0][0].getDeprecations( + getDeprecationsContext + ); + expect(configDeprecations).toMatchInlineSnapshot(` + Array [ + Object { + "configPath": "test", + "correctiveActions": Object { + "manualSteps": Array [ + "Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.", + "Using Kibana role-mapping management, change all role-mappings which assign the kibana_user role to the kibana_admin role.", + ], + }, + "deprecationType": "config", + "documentationUrl": "testDocUrl", + "level": "critical", + "message": "testMessage", + "requireRestart": true, + "title": "testDomain has a deprecated setting", + }, + ] + `); + }); + + it('accepts `level` field overrides', async () => { + coreContext.configService.getHandledDeprecatedConfigs.mockReturnValue([ + [ + 'testDomain', + [ + { + configPath: 'test', + message: 'testMessage', + level: 'warning', + correctiveActions: { + manualSteps: ['step a'], + }, + }, + ], + ], + ]); + + deprecationsFactory.getRegistry.mockReturnValue(deprecationsRegistry); + registerConfigDeprecationsInfo({ + deprecationsFactory, + configService: coreContext.configService, + }); + + const configDeprecations = + await deprecationsRegistry.registerDeprecations.mock.calls[0][0].getDeprecations( + getDeprecationsContext + ); + expect(configDeprecations[0].level).toBe('warning'); + }); +}); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.mocks.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.mocks.ts index 9ce9f52fb7a50..93550539343e3 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.mocks.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.mocks.ts @@ -14,6 +14,14 @@ export const DeprecationsFactoryMock = jest .fn() .mockImplementation(() => mockedDeprecationFactoryInstance); +export const registerConfigDeprecationsInfoMock = jest.fn(); +export const registerApiDeprecationsInfoMock = jest.fn(); + +jest.doMock('./deprecations', () => ({ + registerConfigDeprecationsInfo: registerConfigDeprecationsInfoMock, + registerApiDeprecationsInfo: registerApiDeprecationsInfoMock, +})); + jest.doMock('./deprecations_factory', () => ({ DeprecationsFactory: DeprecationsFactoryMock, })); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.ts index 14a131ca8e563..39c299d980531 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.test.ts @@ -7,22 +7,24 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { DeprecationsFactoryMock } from './deprecations_service.test.mocks'; - +import { + DeprecationsFactoryMock, + registerConfigDeprecationsInfoMock, +} from './deprecations_service.test.mocks'; import { mockCoreContext } from '@kbn/core-base-server-mocks'; import { httpServiceMock } from '@kbn/core-http-server-mocks'; +import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks'; import { configServiceMock } from '@kbn/config-mocks'; import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { DeprecationsService, DeprecationsSetupDeps } from './deprecations_service'; -import { mockDeprecationsRegistry, mockDeprecationsFactory } from './mocks'; -/* eslint-disable dot-notation */ describe('DeprecationsService', () => { let coreContext: ReturnType; let http: ReturnType; let router: ReturnType; let deprecationsCoreSetupDeps: DeprecationsSetupDeps; + let coreUsageData: ReturnType; beforeEach(() => { const configService = configServiceMock.create({ @@ -30,14 +32,16 @@ describe('DeprecationsService', () => { }); coreContext = mockCoreContext.create({ configService }); http = httpServiceMock.createInternalSetupContract(); + coreUsageData = coreUsageDataServiceMock.createSetupContract(); router = httpServiceMock.createRouter(); http.createRouter.mockReturnValue(router); - deprecationsCoreSetupDeps = { http }; + deprecationsCoreSetupDeps = { http, coreUsageData }; }); afterEach(() => { jest.clearAllMocks(); DeprecationsFactoryMock.mockClear(); + registerConfigDeprecationsInfoMock.mockClear(); }); describe('#setup', () => { @@ -53,10 +57,8 @@ describe('DeprecationsService', () => { it('calls registerConfigDeprecationsInfo', async () => { const deprecationsService = new DeprecationsService(coreContext); - const mockRegisterConfigDeprecationsInfo = jest.fn(); - deprecationsService['registerConfigDeprecationsInfo'] = mockRegisterConfigDeprecationsInfo; await deprecationsService.setup(deprecationsCoreSetupDeps); - expect(mockRegisterConfigDeprecationsInfo).toBeCalledTimes(1); + expect(registerConfigDeprecationsInfoMock).toBeCalledTimes(1); }); it('creates DeprecationsFactory with the correct parameters', async () => { @@ -89,92 +91,4 @@ describe('DeprecationsService', () => { }); }); }); - - describe('#registerConfigDeprecationsInfo', () => { - const deprecationsFactory = mockDeprecationsFactory.create(); - const deprecationsRegistry = mockDeprecationsRegistry.create(); - const getDeprecationsContext = mockDeprecationsRegistry.createGetDeprecationsContext(); - - it('registers config deprecations', async () => { - const deprecationsService = new DeprecationsService(coreContext); - coreContext.configService.getHandledDeprecatedConfigs.mockReturnValue([ - [ - 'testDomain', - [ - { - configPath: 'test', - level: 'critical', - message: 'testMessage', - documentationUrl: 'testDocUrl', - correctiveActions: { - manualSteps: [ - 'Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.', - 'Using Kibana role-mapping management, change all role-mappings which assign the kibana_user role to the kibana_admin role.', - ], - }, - }, - ], - ], - ]); - - deprecationsFactory.getRegistry.mockReturnValue(deprecationsRegistry); - deprecationsService['registerConfigDeprecationsInfo'](deprecationsFactory); - - expect(coreContext.configService.getHandledDeprecatedConfigs).toBeCalledTimes(1); - expect(deprecationsFactory.getRegistry).toBeCalledTimes(1); - expect(deprecationsFactory.getRegistry).toBeCalledWith('testDomain'); - expect(deprecationsRegistry.registerDeprecations).toBeCalledTimes(1); - const configDeprecations = - await deprecationsRegistry.registerDeprecations.mock.calls[0][0].getDeprecations( - getDeprecationsContext - ); - expect(configDeprecations).toMatchInlineSnapshot(` - Array [ - Object { - "configPath": "test", - "correctiveActions": Object { - "manualSteps": Array [ - "Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.", - "Using Kibana role-mapping management, change all role-mappings which assign the kibana_user role to the kibana_admin role.", - ], - }, - "deprecationType": "config", - "documentationUrl": "testDocUrl", - "level": "critical", - "message": "testMessage", - "requireRestart": true, - "title": "testDomain has a deprecated setting", - }, - ] - `); - }); - - it('accepts `level` field overrides', async () => { - const deprecationsService = new DeprecationsService(coreContext); - coreContext.configService.getHandledDeprecatedConfigs.mockReturnValue([ - [ - 'testDomain', - [ - { - configPath: 'test', - message: 'testMessage', - level: 'warning', - correctiveActions: { - manualSteps: ['step a'], - }, - }, - ], - ], - ]); - - deprecationsFactory.getRegistry.mockReturnValue(deprecationsRegistry); - deprecationsService['registerConfigDeprecationsInfo'](deprecationsFactory); - - const configDeprecations = - await deprecationsRegistry.registerDeprecations.mock.calls[0][0].getDeprecations( - getDeprecationsContext - ); - expect(configDeprecations[0].level).toBe('warning'); - }); - }); }); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts index 3e35102b4238c..c0a0ef0f88c7b 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations_service.ts @@ -84,7 +84,6 @@ export class DeprecationsService registerApiDeprecationsInfo({ deprecationsFactory: this.deprecationsFactory, - logger: this.logger, http, coreUsageData, }); diff --git a/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json b/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json index 2f9c33f5aae5b..02be6b7cb8198 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json +++ b/packages/core/deprecations/core-deprecations-server-internal/tsconfig.json @@ -36,6 +36,7 @@ "@kbn/core-usage-data-base-server-internal", "@kbn/core-usage-data-server", "@kbn/core-usage-data-server-internal", + "@kbn/core-usage-data-server-mocks", "@kbn/core-http-router-server-internal", ], "exclude": [ diff --git a/packages/core/http/core-http-router-server-internal/src/router.test.ts b/packages/core/http/core-http-router-server-internal/src/router.test.ts index b506933574d4a..b4592e3fc9f8c 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.test.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.test.ts @@ -50,7 +50,11 @@ describe('Router', () => { path: '/', validate: { body: validation, query: validation, params: validation }, options: { - deprecated: true, + deprecated: { + documentationUrl: 'https://fake-url.com', + reason: { type: 'remove' }, + severity: 'warning', + }, discontinued: 'post test discontinued', summary: 'post test summary', description: 'post test description', @@ -68,7 +72,11 @@ describe('Router', () => { validationSchemas: { body: validation, query: validation, params: validation }, isVersioned: false, options: { - deprecated: true, + deprecated: { + documentationUrl: 'https://fake-url.com', + reason: { type: 'remove' }, + severity: 'warning', + }, discontinued: 'post test discontinued', summary: 'post test summary', description: 'post test description', @@ -85,7 +93,7 @@ describe('Router', () => { validate: { body: validation, query: validation, params: validation }, }, (context, req, res) => res.ok(), - { isVersioned: true } + { isVersioned: true, events: false } ); router.get( { diff --git a/packages/core/http/core-http-router-server-internal/src/router.ts b/packages/core/http/core-http-router-server-internal/src/router.ts index 66d793179383c..b53f77e32cebd 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.ts @@ -236,6 +236,8 @@ export class Router, route.options), /** Below is added for introspection */ validationSchemas: route.validate, + // @ts-ignore using isVersioned: false in the type instead of boolean + // for typeguarding between versioned and unversioned RouterRoute types isVersioned: internalOptions.isVersioned, }); }; @@ -247,11 +249,11 @@ export class Router void) { + public static on(event: RouterEvents, cb: (req: CoreKibanaRequest, ...args: any[]) => void) { Router.ee.on(event, cb); } - public static off(event: RouterEvents, cb: (req: CoreKibanaRequest) => void) { + public static off(event: RouterEvents, cb: (req: CoreKibanaRequest, ...args: any[]) => void) { Router.ee.off(event, cb); } diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts index 2315b0d8d8284..45654696ba0cf 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts @@ -25,9 +25,10 @@ import type { RouteSecurityGetter, RouteSecurity, RouteMethod, + VersionedRouterRoute, } from '@kbn/core-http-server'; import type { Mutable } from 'utility-types'; -import type { HandlerResolutionStrategy, Method, Options, VersionedRouterRoute } from './types'; +import type { HandlerResolutionStrategy, Method, Options } from './types'; import { validate } from './validate'; import { diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts index d56de36ba9a29..1a0237216379f 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts @@ -36,7 +36,6 @@ describe('Versioned router', () => { versionedRouter.get({ path: '/test/{id}', access: 'internal', - deprecated: true, discontinued: 'x.y.z', }); versionedRouter.post({ @@ -53,7 +52,6 @@ describe('Versioned router', () => { "method": "get", "options": Object { "access": "internal", - "deprecated": true, "discontinued": "x.y.z", }, "path": "/test/{id}", diff --git a/packages/core/http/core-http-router-server-mocks/src/versioned_router.mock.ts b/packages/core/http/core-http-router-server-mocks/src/versioned_router.mock.ts index 987288cf372bd..fec80b06963a0 100644 --- a/packages/core/http/core-http-router-server-mocks/src/versioned_router.mock.ts +++ b/packages/core/http/core-http-router-server-mocks/src/versioned_router.mock.ts @@ -14,6 +14,7 @@ import type { AddVersionOpts, RequestHandler, KibanaResponseFactory, + VersionedRouterRoute, } from '@kbn/core-http-server'; export type MockedVersionedRoute = jest.Mocked; @@ -24,14 +25,16 @@ const createMockVersionedRoute = (): MockedVersionedRoute => { return api; }; +type VersionedRouterMethods = keyof Omit; + export type MockedVersionedRouter = jest.Mocked> & { - getRoute: (method: keyof VersionedRouter, path: string) => RegisteredVersionedRoute; + getRoute: (method: VersionedRouterMethods, path: string) => RegisteredVersionedRoute; }; const createMethodHandler = () => jest.fn((_) => createMockVersionedRoute()); - +const createMockGetRoutes = () => jest.fn(() => [] as VersionedRouterRoute[]); export const createVersionedRouterMock = (): MockedVersionedRouter => { - const router: Omit = { + const router: Omit = { delete: createMethodHandler(), get: createMethodHandler(), patch: createMethodHandler(), @@ -42,6 +45,7 @@ export const createVersionedRouterMock = (): MockedVersionedRouter => { return { ...router, getRoute: getRoute.bind(null, router), + getRoutes: createMockGetRoutes(), }; }; @@ -54,9 +58,10 @@ export interface RegisteredVersionedRoute { }; }; } + const getRoute = ( - router: Omit, - method: keyof VersionedRouter, + router: Omit, + method: VersionedRouterMethods, path: string ): RegisteredVersionedRoute => { if (!router[method].mock.calls.length) { diff --git a/packages/core/http/core-http-server-mocks/src/http_service.mock.ts b/packages/core/http/core-http-server-mocks/src/http_service.mock.ts index 4e803ee5f86a8..116db3648f120 100644 --- a/packages/core/http/core-http-server-mocks/src/http_service.mock.ts +++ b/packages/core/http/core-http-server-mocks/src/http_service.mock.ts @@ -171,6 +171,9 @@ const createInternalSetupContractMock = () => { createCookieSessionStorageFactory: jest.fn(), registerOnPreRouting: jest.fn(), registerOnPreAuth: jest.fn(), + getDeprecatedRoutes: jest.fn(), + getRegisteredDeprecatedApis: jest.fn(), + registerOnPostValidation: jest.fn(), registerAuth: jest.fn(), registerOnPostAuth: jest.fn(), registerRouteHandlerContext: jest.fn(), @@ -207,6 +210,7 @@ const createSetupContractMock = < createCookieSessionStorageFactory: internalMock.createCookieSessionStorageFactory, registerOnPreRouting: internalMock.registerOnPreRouting, registerOnPreAuth: jest.fn(), + getDeprecatedRoutes: jest.fn(), registerAuth: internalMock.registerAuth, registerOnPostAuth: internalMock.registerOnPostAuth, registerOnPreResponse: internalMock.registerOnPreResponse, diff --git a/packages/core/http/core-http-server/src/versioning/types.ts b/packages/core/http/core-http-server/src/versioning/types.ts index 05b81a57bf86d..73679854471ec 100644 --- a/packages/core/http/core-http-server/src/versioning/types.ts +++ b/packages/core/http/core-http-server/src/versioning/types.ts @@ -230,7 +230,7 @@ export interface VersionedRouter { /** * @public */ - getRoutes: () => Array>; + getRoutes: () => VersionedRouterRoute[]; } /** @public */ @@ -365,15 +365,10 @@ export interface VersionedRoute< ): VersionedRoute; } -export interface VersionedRouterRoute< - P = unknown, - Q = unknown, - B = unknown, - Ctx extends RqCtx = RqCtx -> { +export interface VersionedRouterRoute

{ method: string; path: string; options: Omit, 'path'>; - handlers: Array<{ fn: RequestHandler; options: AddVersionOpts }>; + handlers: Array<{ fn: RequestHandler; options: AddVersionOpts }>; isVersioned: true; } diff --git a/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts index b50e9279d4721..30f5958bd92c5 100644 --- a/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts +++ b/packages/core/lifecycle/core-lifecycle-server-mocks/src/core_setup.mock.ts @@ -76,6 +76,8 @@ export function createCoreSetupMock({ userProfile: userProfileServiceMock.createSetup(), coreUsageData: { registerUsageCounter: coreUsageDataServiceMock.createSetupContract().registerUsageCounter, + registerDeprecatedUsageFetch: + coreUsageDataServiceMock.createSetupContract().registerDeprecatedUsageFetch, }, plugins: { onSetup: jest.fn(), diff --git a/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts index 795047a61fb93..d7d40c9b792f7 100644 --- a/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts +++ b/packages/core/plugins/core-plugins-server-internal/src/plugin_context.ts @@ -225,6 +225,7 @@ export function createPluginSetupContext({ }, http: { createCookieSessionStorageFactory: deps.http.createCookieSessionStorageFactory, + getDeprecatedRoutes: deps.http.getDeprecatedRoutes, registerRouteHandlerContext: < Context extends RequestHandlerContext, ContextName extends keyof Omit diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts index 625c8ed77fb48..ff5fe86df1173 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts @@ -36,6 +36,7 @@ export const createCoreUsageDataSetupMock = () => { getClient: jest.fn(), registerUsageCounter: jest.fn(), incrementUsageCounter: jest.fn(), + registerDeprecatedUsageFetch: jest.fn(), }; return setupContract; }; diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts index b90aa0226d71c..1171e32fa9307 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts @@ -38,6 +38,7 @@ export const registerBulkCreateRoute = ( summary: `Create saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts index 0f33ddc384bed..ae85cae80a1cb 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts @@ -38,6 +38,7 @@ export const registerBulkDeleteRoute = ( summary: `Delete saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts index 95fd9f5eab10a..aa2b6529ae1c2 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts @@ -38,6 +38,7 @@ export const registerBulkGetRoute = ( summary: `Get saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts index d6b74131fb74d..da8cf3b7c9d52 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts @@ -38,6 +38,7 @@ export const registerBulkResolveRoute = ( summary: `Resolve saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, description: `Retrieve multiple Kibana saved objects by ID, using any legacy URL aliases if they exist. Under certain circumstances, when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs to enable new features. When an object's ID is regenerated, a legacy URL alias is created for that object, preserving its old ID. In such a scenario, that object can be retrieved with the bulk resolve API using either its new ID or its old ID.`, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts index 7a7ec340d98ca..af121eeaea2fa 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts @@ -38,6 +38,7 @@ export const registerBulkUpdateRoute = ( summary: `Update saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts index c8bfd4c0feaf9..0b2b25dab2f83 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts @@ -38,6 +38,7 @@ export const registerCreateRoute = ( summary: `Create a saved object`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts index 7ef8aac3fa1b1..058ff99583c9e 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts @@ -38,6 +38,7 @@ export const registerDeleteRoute = ( summary: `Delete a saved object`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts index ac3b0555a7694..c94b11928a25c 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts @@ -42,6 +42,7 @@ export const registerFindRoute = ( summary: `Search for saved objects`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts index 9784ef1c79ff4..dafe939ff09ee 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts @@ -38,6 +38,7 @@ export const registerGetRoute = ( summary: `Get a saved object`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts index 295acacc0ba0e..72d1c24dd8cdc 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts @@ -34,6 +34,7 @@ export const registerResolveRoute = ( summary: `Resolve a saved object`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, description: `Retrieve a single Kibana saved object by ID, using any legacy URL alias if it exists. Under certain circumstances, when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs to enable new features. When an object's ID is regenerated, a legacy URL alias is created for that object, preserving its old ID. In such a scenario, that object can be retrieved with the resolve API using either its new ID or its old ID.`, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts index 9eeea40a29b68..cef8937053a3b 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts @@ -39,6 +39,7 @@ export const registerUpdateRoute = ( summary: `Update a saved object`, tags: ['oas-tag:saved objects'], access, + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.test.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.test.ts index 948332c71f59a..9702e4b512345 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.test.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.test.ts @@ -52,6 +52,7 @@ describe('CoreUsageStatsClient', () => { debugLogger: debugLoggerMock, basePath: basePathMock, repositoryPromise: Promise.resolve(repositoryMock), + fetchDeprecatedUsageStats: jest.fn(), stop$, incrementUsageCounter: incrementUsageCounterMock, }); diff --git a/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_data_service.mock.ts b/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_data_service.mock.ts index c85aee50653d2..57628901c1a60 100644 --- a/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_data_service.mock.ts +++ b/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_data_service.mock.ts @@ -17,6 +17,7 @@ import { coreUsageStatsClientMock } from './core_usage_stats_client.mock'; const createSetupContractMock = (usageStatsClient = coreUsageStatsClientMock.create()) => { const setupContract: jest.Mocked = { registerType: jest.fn(), + registerDeprecatedUsageFetch: jest.fn(), getClient: jest.fn().mockReturnValue(usageStatsClient), registerUsageCounter: jest.fn(), incrementUsageCounter: jest.fn(), diff --git a/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_stats_client.mock.ts b/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_stats_client.mock.ts index f6b11204ca040..8896e9066ef78 100644 --- a/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_stats_client.mock.ts +++ b/packages/core/usage-data/core-usage-data-server-mocks/src/core_usage_stats_client.mock.ts @@ -12,6 +12,7 @@ import type { ICoreUsageStatsClient } from '@kbn/core-usage-data-base-server-int const createUsageStatsClientMock = () => ({ getUsageStats: jest.fn().mockResolvedValue({}), + getDeprecatedApiUsageStats: jest.fn().mockResolvedValue([]), incrementSavedObjectsBulkCreate: jest.fn().mockResolvedValue(null), incrementSavedObjectsBulkGet: jest.fn().mockResolvedValue(null), incrementSavedObjectsBulkResolve: jest.fn().mockResolvedValue(null), diff --git a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts index 6db4237751217..521e0fe23bc66 100644 --- a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts +++ b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts @@ -239,6 +239,7 @@ describe('generateOpenApiDocument', () => { routes: [ { method: 'get', + isVersioned: true, path: '/test', options: { access: 'public' }, handlers: [ diff --git a/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts b/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts index 898f234cdc310..4eef12efd24d7 100644 --- a/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts +++ b/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts @@ -60,10 +60,10 @@ export const getRouterDefaults = (bodySchema?: RuntimeSchema) => ({ export const getVersionedRouterDefaults = (bodySchema?: RuntimeSchema) => ({ method: 'get', path: '/bar', + isVersioned: true, options: { summary: 'versioned route', access: 'public', - deprecated: true, discontinued: 'route discontinued version or date', options: { tags: ['ignore-me', 'oas-tag:versioned'], diff --git a/packages/kbn-router-to-openapispec/src/process_router.ts b/packages/kbn-router-to-openapispec/src/process_router.ts index 4437e35ea1f3e..78d46d721abd4 100644 --- a/packages/kbn-router-to-openapispec/src/process_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_router.ts @@ -65,7 +65,7 @@ export const processRouter = ( summary: route.options.summary ?? '', tags: route.options.tags ? extractTags(route.options.tags) : [], ...(route.options.description ? { description: route.options.description } : {}), - ...(route.options.deprecated ? { deprecated: route.options.deprecated } : {}), + ...(route.options.deprecated ? { deprecated: !!route.options.deprecated } : {}), ...(route.options.discontinued ? { 'x-discontinued': route.options.discontinued } : {}), requestBody: !!validationSchemas?.body ? { diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts index 6452c2cf3c2cc..8688b3a06adb4 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts @@ -8,10 +8,7 @@ */ import { schema } from '@kbn/config-schema'; -import type { - CoreVersionedRouter, - VersionedRouterRoute, -} from '@kbn/core-http-router-server-internal'; +import type { CoreVersionedRouter } from '@kbn/core-http-router-server-internal'; import { get } from 'lodash'; import { OasConverter } from './oas_converter'; import { createOperationIdCounter } from './operation_id_counter'; @@ -20,6 +17,7 @@ import { extractVersionedResponses, extractVersionedRequestBodies, } from './process_versioned_router'; +import { VersionedRouterRoute } from '@kbn/core-http-server'; let oasConverter: OasConverter; beforeEach(() => { @@ -151,9 +149,9 @@ describe('processVersionedRouter', () => { const createTestRoute: () => VersionedRouterRoute = () => ({ path: '/foo', method: 'get', + isVersioned: true, options: { access: 'public', - deprecated: true, discontinued: 'discontinued versioned router', options: { body: { access: ['application/test+json'] } as any }, }, diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts index 85c75eaf55453..f71523e861c6b 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts @@ -96,7 +96,7 @@ export const processVersionedRouter = ( summary: route.options.summary ?? '', tags: route.options.options?.tags ? extractTags(route.options.options.tags) : [], ...(route.options.description ? { description: route.options.description } : {}), - ...(route.options.deprecated ? { deprecated: route.options.deprecated } : {}), + ...{ deprecated: route.handlers.some(({ options }) => options.options?.deprecated) }, ...(route.options.discontinued ? { 'x-discontinued': route.options.discontinued } : {}), requestBody: hasBody ? { From e627a214e6773acfa665dc3edb48bc9c2fd12351 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:27:36 +0000 Subject: [PATCH 11/27] [CI] Auto-commit changed files from 'node scripts/capture_oas_snapshot --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/fleet --update' --- oas_docs/bundle.json | 132 +++++++++++++++++++++++++++++--- oas_docs/bundle.serverless.json | 127 +++++++++++++++++++++++++++--- 2 files changed, 237 insertions(+), 22 deletions(-) diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index 34a5103cba9fb..1aea7c691931a 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -6391,7 +6391,7 @@ }, "/api/fleet/agent-status": { "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fagent-status#0", "parameters": [ { @@ -6449,6 +6449,7 @@ }, "/api/fleet/agent_download_sources": { "get": { + "deprecated": false, "description": "List agent binary download sources", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources#0", "parameters": [ @@ -6558,6 +6559,7 @@ ] }, "post": { + "deprecated": false, "description": "Create agent binary download source", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources#1", "parameters": [ @@ -6699,6 +6701,7 @@ }, "/api/fleet/agent_download_sources/{sourceId}": { "delete": { + "deprecated": false, "description": "Delete agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2", "parameters": [ @@ -6784,6 +6787,7 @@ ] }, "get": { + "deprecated": false, "description": "Get agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0", "parameters": [ @@ -6886,6 +6890,7 @@ ] }, "put": { + "deprecated": false, "description": "Update agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1", "parameters": [ @@ -7035,6 +7040,7 @@ }, "/api/fleet/agent_policies": { "get": { + "deprecated": false, "description": "List agent policies", "operationId": "%2Fapi%2Ffleet%2Fagent_policies#0", "parameters": [ @@ -7861,6 +7867,7 @@ ] }, "post": { + "deprecated": false, "description": "Create an agent policy", "operationId": "%2Fapi%2Ffleet%2Fagent_policies#1", "parameters": [ @@ -8856,6 +8863,7 @@ }, "/api/fleet/agent_policies/_bulk_get": { "post": { + "deprecated": false, "description": "Bulk get agent policies", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0", "parameters": [ @@ -9643,6 +9651,7 @@ }, "/api/fleet/agent_policies/delete": { "post": { + "deprecated": false, "description": "Delete agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0", "parameters": [ @@ -9748,6 +9757,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}": { "get": { + "deprecated": false, "description": "Get an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0", "parameters": [ @@ -10499,6 +10509,7 @@ ] }, "put": { + "deprecated": false, "description": "Update an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1", "parameters": [ @@ -11506,6 +11517,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/copy": { "post": { + "deprecated": false, "description": "Copy an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0", "parameters": [ @@ -12291,6 +12303,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/download": { "get": { + "deprecated": false, "description": "Download an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0", "parameters": [ @@ -12408,6 +12421,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/full": { "get": { + "deprecated": false, "description": "Get a full agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0", "parameters": [ @@ -12910,6 +12924,7 @@ }, "/api/fleet/agent_status": { "get": { + "deprecated": false, "description": "Get agent status summary", "operationId": "%2Fapi%2Ffleet%2Fagent_status#0", "parameters": [ @@ -13064,6 +13079,7 @@ }, "/api/fleet/agent_status/data": { "get": { + "deprecated": false, "description": "Get incoming agent data", "operationId": "%2Fapi%2Ffleet%2Fagent_status%2Fdata#0", "parameters": [ @@ -13180,6 +13196,7 @@ }, "/api/fleet/agents": { "get": { + "deprecated": false, "description": "List agents", "operationId": "%2Fapi%2Ffleet%2Fagents#0", "parameters": [ @@ -14119,6 +14136,7 @@ ] }, "post": { + "deprecated": false, "description": "List agents by action ids", "operationId": "%2Fapi%2Ffleet%2Fagents#1", "parameters": [ @@ -14222,6 +14240,7 @@ }, "/api/fleet/agents/action_status": { "get": { + "deprecated": false, "description": "Get agent action status", "operationId": "%2Fapi%2Ffleet%2Fagents%2Faction_status#0", "parameters": [ @@ -14458,6 +14477,7 @@ }, "/api/fleet/agents/actions/{actionId}/cancel": { "post": { + "deprecated": false, "description": "Cancel agent action", "operationId": "%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0", "parameters": [ @@ -14600,6 +14620,7 @@ }, "/api/fleet/agents/available_versions": { "get": { + "deprecated": false, "description": "Get available agent versions", "operationId": "%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0", "parameters": [ @@ -14672,6 +14693,7 @@ }, "/api/fleet/agents/bulk_reassign": { "post": { + "deprecated": false, "description": "Bulk reassign agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0", "parameters": [ @@ -14790,6 +14812,7 @@ }, "/api/fleet/agents/bulk_request_diagnostics": { "post": { + "deprecated": false, "description": "Bulk request diagnostics from agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0", "parameters": [ @@ -14909,6 +14932,7 @@ }, "/api/fleet/agents/bulk_unenroll": { "post": { + "deprecated": false, "description": "Bulk unenroll agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0", "parameters": [ @@ -15033,6 +15057,7 @@ }, "/api/fleet/agents/bulk_update_agent_tags": { "post": { + "deprecated": false, "description": "Bulk update agent tags", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0", "parameters": [ @@ -15159,6 +15184,7 @@ }, "/api/fleet/agents/bulk_upgrade": { "post": { + "deprecated": false, "description": "Bulk upgrade agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0", "parameters": [ @@ -15293,6 +15319,7 @@ }, "/api/fleet/agents/files/{fileId}": { "delete": { + "deprecated": false, "description": "Delete file uploaded by agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0", "parameters": [ @@ -15384,6 +15411,7 @@ }, "/api/fleet/agents/files/{fileId}/{fileName}": { "get": { + "deprecated": false, "description": "Get file uploaded by agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0", "parameters": [ @@ -15460,6 +15488,7 @@ }, "/api/fleet/agents/setup": { "get": { + "deprecated": false, "description": "Get agent setup info", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fsetup#0", "parameters": [ @@ -15561,6 +15590,7 @@ ] }, "post": { + "deprecated": false, "description": "Initiate agent setup", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fsetup#1", "parameters": [ @@ -15661,6 +15691,7 @@ }, "/api/fleet/agents/tags": { "get": { + "deprecated": false, "description": "List agent tags", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ftags#0", "parameters": [ @@ -15750,6 +15781,7 @@ }, "/api/fleet/agents/{agentId}": { "delete": { + "deprecated": false, "description": "Delete agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2", "parameters": [ @@ -15838,6 +15870,7 @@ ] }, "get": { + "deprecated": false, "description": "Get agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0", "parameters": [ @@ -16303,6 +16336,7 @@ ] }, "put": { + "deprecated": false, "description": "Update agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1", "parameters": [ @@ -16793,6 +16827,7 @@ }, "/api/fleet/agents/{agentId}/actions": { "post": { + "deprecated": false, "description": "Create agent action", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0", "parameters": [ @@ -17010,6 +17045,7 @@ }, "/api/fleet/agents/{agentId}/reassign": { "post": { + "deprecated": false, "description": "Reassign agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1", "parameters": [ @@ -17106,7 +17142,7 @@ ] }, "put": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0", "parameters": [ { @@ -17165,6 +17201,7 @@ }, "/api/fleet/agents/{agentId}/request_diagnostics": { "post": { + "deprecated": false, "description": "Request agent diagnostics", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0", "parameters": [ @@ -17274,6 +17311,7 @@ }, "/api/fleet/agents/{agentId}/unenroll": { "post": { + "deprecated": false, "description": "Unenroll agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0", "parameters": [ @@ -17336,6 +17374,7 @@ }, "/api/fleet/agents/{agentId}/upgrade": { "post": { + "deprecated": false, "description": "Upgrade agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0", "parameters": [ @@ -17443,6 +17482,7 @@ }, "/api/fleet/agents/{agentId}/uploads": { "get": { + "deprecated": false, "description": "List agent uploads", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0", "parameters": [ @@ -17563,6 +17603,7 @@ }, "/api/fleet/check-permissions": { "get": { + "deprecated": false, "description": "Check permissions", "operationId": "%2Fapi%2Ffleet%2Fcheck-permissions#0", "parameters": [ @@ -17648,6 +17689,7 @@ }, "/api/fleet/data_streams": { "get": { + "deprecated": false, "description": "List data streams", "operationId": "%2Fapi%2Ffleet%2Fdata_streams#0", "parameters": [ @@ -17806,7 +17848,7 @@ }, "/api/fleet/enrollment-api-keys": { "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#0", "parameters": [ { @@ -17853,7 +17895,7 @@ "tags": [] }, "post": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#1", "parameters": [ { @@ -17910,7 +17952,7 @@ }, "/api/fleet/enrollment-api-keys/{keyId}": { "delete": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1", "parameters": [ { @@ -17949,7 +17991,7 @@ "tags": [] }, "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0", "parameters": [ { @@ -17980,6 +18022,7 @@ }, "/api/fleet/enrollment_api_keys": { "get": { + "deprecated": false, "description": "List enrollment API keys", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys#0", "parameters": [ @@ -18168,6 +18211,7 @@ ] }, "post": { + "deprecated": false, "description": "Create enrollment API key", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys#1", "parameters": [ @@ -18314,6 +18358,7 @@ }, "/api/fleet/enrollment_api_keys/{keyId}": { "delete": { + "deprecated": false, "description": "Revoke enrollment API key by ID by marking it as inactive", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1", "parameters": [ @@ -18402,6 +18447,7 @@ ] }, "get": { + "deprecated": false, "description": "Get enrollment API key by ID", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0", "parameters": [ @@ -18515,6 +18561,7 @@ }, "/api/fleet/epm/bulk_assets": { "post": { + "deprecated": false, "description": "Bulk get assets", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0", "parameters": [ @@ -18666,6 +18713,7 @@ }, "/api/fleet/epm/categories": { "get": { + "deprecated": false, "description": "List package categories", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fcategories#0", "parameters": [ @@ -18815,6 +18863,7 @@ }, "/api/fleet/epm/custom_integrations": { "post": { + "deprecated": false, "description": "Create custom integration", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0", "parameters": [ @@ -19097,6 +19146,7 @@ }, "/api/fleet/epm/data_streams": { "get": { + "deprecated": false, "description": "List data streams", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0", "parameters": [ @@ -19223,6 +19273,7 @@ }, "/api/fleet/epm/packages": { "get": { + "deprecated": false, "description": "List packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages#0", "parameters": [ @@ -20292,6 +20343,7 @@ ] }, "post": { + "deprecated": false, "description": "Install package by upload", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages#1", "parameters": [ @@ -20554,6 +20606,7 @@ }, "/api/fleet/epm/packages/_bulk": { "post": { + "deprecated": false, "description": "Bulk install packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0", "parameters": [ @@ -20978,6 +21031,7 @@ }, "/api/fleet/epm/packages/installed": { "get": { + "deprecated": false, "description": "Get installed packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0", "parameters": [ @@ -21219,6 +21273,7 @@ }, "/api/fleet/epm/packages/limited": { "get": { + "deprecated": false, "description": "Get limited package list", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0", "parameters": [ @@ -21298,6 +21353,7 @@ }, "/api/fleet/epm/packages/{pkgName}/stats": { "get": { + "deprecated": false, "description": "Get package stats", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0", "parameters": [ @@ -21384,6 +21440,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}": { "delete": { + "deprecated": false, "description": "Delete package", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3", "parameters": [ @@ -21646,6 +21703,7 @@ ] }, "get": { + "deprecated": false, "description": "Get package", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0", "parameters": [ @@ -22910,6 +22968,7 @@ ] }, "post": { + "deprecated": false, "description": "Install package from registry", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2", "parameters": [ @@ -23205,6 +23264,7 @@ ] }, "put": { + "deprecated": false, "description": "Update package settings", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1", "parameters": [ @@ -24454,6 +24514,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize": { "post": { + "deprecated": false, "description": "Authorize transforms", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0", "parameters": [ @@ -24598,6 +24659,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}": { "get": { + "deprecated": false, "description": "Get package file", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0", "parameters": [ @@ -24680,7 +24742,7 @@ }, "/api/fleet/epm/packages/{pkgkey}": { "delete": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3", "parameters": [ { @@ -24738,7 +24800,7 @@ "tags": [] }, "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0", "parameters": [ { @@ -24800,7 +24862,7 @@ "tags": [] }, "post": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2", "parameters": [ { @@ -24884,7 +24946,7 @@ "tags": [] }, "put": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1", "parameters": [ { @@ -24943,6 +25005,7 @@ }, "/api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs": { "get": { + "deprecated": false, "description": "Get inputs template", "operationId": "%2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0", "parameters": [ @@ -25112,6 +25175,7 @@ }, "/api/fleet/epm/verification_key_id": { "get": { + "deprecated": false, "description": "Get a package signature verification key ID", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0", "parameters": [ @@ -25182,6 +25246,7 @@ }, "/api/fleet/fleet_server_hosts": { "get": { + "deprecated": false, "description": "List Fleet Server hosts", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts#0", "parameters": [ @@ -25300,6 +25365,7 @@ ] }, "post": { + "deprecated": false, "description": "Create Fleet Server host", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts#1", "parameters": [ @@ -25459,6 +25525,7 @@ }, "/api/fleet/fleet_server_hosts/{itemId}": { "delete": { + "deprecated": false, "description": "Delete Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1", "parameters": [ @@ -25544,6 +25611,7 @@ ] }, "get": { + "deprecated": false, "description": "Get Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0", "parameters": [ @@ -25655,6 +25723,7 @@ ] }, "put": { + "deprecated": false, "description": "Update Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2", "parameters": [ @@ -25813,6 +25882,7 @@ }, "/api/fleet/health_check": { "post": { + "deprecated": false, "description": "Check Fleet Server health", "operationId": "%2Fapi%2Ffleet%2Fhealth_check#0", "parameters": [ @@ -25949,6 +26019,7 @@ }, "/api/fleet/kubernetes": { "get": { + "deprecated": false, "description": "Get full K8s agent manifest", "operationId": "%2Fapi%2Ffleet%2Fkubernetes#0", "parameters": [ @@ -26042,6 +26113,7 @@ }, "/api/fleet/kubernetes/download": { "get": { + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0", "parameters": [ { @@ -26150,6 +26222,7 @@ }, "/api/fleet/logstash_api_keys": { "post": { + "deprecated": false, "description": "Generate Logstash API key", "operationId": "%2Fapi%2Ffleet%2Flogstash_api_keys#0", "parameters": [ @@ -26229,6 +26302,7 @@ }, "/api/fleet/message_signing_service/rotate_key_pair": { "post": { + "deprecated": false, "description": "Rotate fleet message signing key pair", "operationId": "%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0", "parameters": [ @@ -26342,6 +26416,7 @@ }, "/api/fleet/outputs": { "get": { + "deprecated": false, "description": "List outputs", "operationId": "%2Fapi%2Ffleet%2Foutputs#0", "parameters": [ @@ -27472,6 +27547,7 @@ ] }, "post": { + "deprecated": false, "description": "Create output", "operationId": "%2Fapi%2Ffleet%2Foutputs#1", "parameters": [ @@ -29656,6 +29732,7 @@ }, "/api/fleet/outputs/{outputId}": { "delete": { + "deprecated": false, "description": "Delete output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2", "parameters": [ @@ -29766,6 +29843,7 @@ ] }, "get": { + "deprecated": false, "description": "Get output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0", "parameters": [ @@ -30889,6 +30967,7 @@ ] }, "put": { + "deprecated": false, "description": "Update output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1", "parameters": [ @@ -33057,6 +33136,7 @@ }, "/api/fleet/outputs/{outputId}/health": { "get": { + "deprecated": false, "description": "Get latest output health", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0", "parameters": [ @@ -33145,6 +33225,7 @@ }, "/api/fleet/package_policies": { "get": { + "deprecated": false, "description": "List package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies#0", "parameters": [ @@ -33860,6 +33941,7 @@ ] }, "post": { + "deprecated": false, "description": "Create package policy", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies#1", "parameters": [ @@ -35134,6 +35216,7 @@ }, "/api/fleet/package_policies/_bulk_get": { "post": { + "deprecated": false, "description": "Bulk get package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0", "parameters": [ @@ -35832,6 +35915,7 @@ }, "/api/fleet/package_policies/delete": { "post": { + "deprecated": false, "description": "Bulk delete package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0", "parameters": [ @@ -36036,6 +36120,7 @@ }, "/api/fleet/package_policies/upgrade": { "post": { + "deprecated": false, "description": "Upgrade package policy to a newer package version", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0", "parameters": [ @@ -36161,6 +36246,7 @@ }, "/api/fleet/package_policies/upgrade/dryrun": { "post": { + "deprecated": false, "description": "Dry run package policy upgrade", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0", "parameters": [ @@ -37347,6 +37433,7 @@ }, "/api/fleet/package_policies/{packagePolicyId}": { "delete": { + "deprecated": false, "description": "Delete package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2", "parameters": [ @@ -37440,6 +37527,7 @@ ] }, "get": { + "deprecated": false, "description": "Get package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0", "parameters": [ @@ -38106,6 +38194,7 @@ ] }, "put": { + "deprecated": false, "description": "Update package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1", "parameters": [ @@ -39380,6 +39469,7 @@ }, "/api/fleet/proxies": { "get": { + "deprecated": false, "description": "List proxies", "operationId": "%2Fapi%2Ffleet%2Fproxies#0", "parameters": [ @@ -39512,6 +39602,7 @@ ] }, "post": { + "deprecated": false, "description": "Create proxy", "operationId": "%2Fapi%2Ffleet%2Fproxies#1", "parameters": [ @@ -39699,6 +39790,7 @@ }, "/api/fleet/proxies/{itemId}": { "delete": { + "deprecated": false, "description": "Delete proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2", "parameters": [ @@ -39784,6 +39876,7 @@ ] }, "get": { + "deprecated": false, "description": "Get proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1", "parameters": [ @@ -39909,6 +40002,7 @@ ] }, "put": { + "deprecated": false, "description": "Update proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0", "parameters": [ @@ -40099,7 +40193,7 @@ }, "/api/fleet/service-tokens": { "post": { - "deprecated": true, + "deprecated": false, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice-tokens#0", "parameters": [ @@ -40133,6 +40227,7 @@ }, "/api/fleet/service_tokens": { "post": { + "deprecated": false, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice_tokens#0", "parameters": [ @@ -40233,6 +40328,7 @@ }, "/api/fleet/settings": { "get": { + "deprecated": false, "description": "Get settings", "operationId": "%2Fapi%2Ffleet%2Fsettings#0", "parameters": [ @@ -40384,6 +40480,7 @@ ] }, "put": { + "deprecated": false, "description": "Update settings", "operationId": "%2Fapi%2Ffleet%2Fsettings#1", "parameters": [ @@ -40601,6 +40698,7 @@ }, "/api/fleet/setup": { "post": { + "deprecated": false, "description": "Initiate Fleet setup", "operationId": "%2Fapi%2Ffleet%2Fsetup#0", "parameters": [ @@ -40720,6 +40818,7 @@ }, "/api/fleet/uninstall_tokens": { "get": { + "deprecated": false, "description": "List metadata for latest uninstall tokens per agent policy", "operationId": "%2Fapi%2Ffleet%2Funinstall_tokens#0", "parameters": [ @@ -40869,6 +40968,7 @@ }, "/api/fleet/uninstall_tokens/{uninstallTokenId}": { "get": { + "deprecated": false, "description": "Get one decrypted uninstall token by its ID", "operationId": "%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0", "parameters": [ @@ -40977,6 +41077,7 @@ }, "/api/security/role": { "get": { + "deprecated": false, "operationId": "%2Fapi%2Fsecurity%2Frole#0", "parameters": [ { @@ -41009,6 +41110,7 @@ }, "/api/security/role/{name}": { "delete": { + "deprecated": false, "operationId": "%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#1", "parameters": [ { @@ -41050,6 +41152,7 @@ ] }, "get": { + "deprecated": false, "operationId": "%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#0", "parameters": [ { @@ -41089,6 +41192,7 @@ ] }, "put": { + "deprecated": false, "operationId": "%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#2", "parameters": [ { @@ -41382,6 +41486,7 @@ }, "/api/security/roles": { "post": { + "deprecated": false, "operationId": "%2Fapi%2Fsecurity%2Froles#0", "parameters": [ { @@ -42092,6 +42197,7 @@ }, "/api/spaces/space": { "get": { + "deprecated": false, "description": "Get all spaces", "operationId": "%2Fapi%2Fspaces%2Fspace#0", "parameters": [ @@ -42167,6 +42273,7 @@ ] }, "post": { + "deprecated": false, "description": "Create a space", "operationId": "%2Fapi%2Fspaces%2Fspace#1", "parameters": [ @@ -42257,6 +42364,7 @@ }, "/api/spaces/space/{id}": { "delete": { + "deprecated": false, "description": "Delete a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2", "parameters": [ @@ -42298,6 +42406,7 @@ ] }, "get": { + "deprecated": false, "description": "Get a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0", "parameters": [ @@ -42329,6 +42438,7 @@ ] }, "put": { + "deprecated": false, "description": "Update a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1", "parameters": [ diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index 4719fcb479bb5..b0d6c83757e38 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -6391,7 +6391,7 @@ }, "/api/fleet/agent-status": { "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fagent-status#0", "parameters": [ { @@ -6449,6 +6449,7 @@ }, "/api/fleet/agent_download_sources": { "get": { + "deprecated": false, "description": "List agent binary download sources", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources#0", "parameters": [ @@ -6558,6 +6559,7 @@ ] }, "post": { + "deprecated": false, "description": "Create agent binary download source", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources#1", "parameters": [ @@ -6699,6 +6701,7 @@ }, "/api/fleet/agent_download_sources/{sourceId}": { "delete": { + "deprecated": false, "description": "Delete agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2", "parameters": [ @@ -6784,6 +6787,7 @@ ] }, "get": { + "deprecated": false, "description": "Get agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0", "parameters": [ @@ -6886,6 +6890,7 @@ ] }, "put": { + "deprecated": false, "description": "Update agent binary download source by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1", "parameters": [ @@ -7035,6 +7040,7 @@ }, "/api/fleet/agent_policies": { "get": { + "deprecated": false, "description": "List agent policies", "operationId": "%2Fapi%2Ffleet%2Fagent_policies#0", "parameters": [ @@ -7861,6 +7867,7 @@ ] }, "post": { + "deprecated": false, "description": "Create an agent policy", "operationId": "%2Fapi%2Ffleet%2Fagent_policies#1", "parameters": [ @@ -8856,6 +8863,7 @@ }, "/api/fleet/agent_policies/_bulk_get": { "post": { + "deprecated": false, "description": "Bulk get agent policies", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0", "parameters": [ @@ -9643,6 +9651,7 @@ }, "/api/fleet/agent_policies/delete": { "post": { + "deprecated": false, "description": "Delete agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0", "parameters": [ @@ -9748,6 +9757,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}": { "get": { + "deprecated": false, "description": "Get an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0", "parameters": [ @@ -10499,6 +10509,7 @@ ] }, "put": { + "deprecated": false, "description": "Update an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1", "parameters": [ @@ -11506,6 +11517,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/copy": { "post": { + "deprecated": false, "description": "Copy an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0", "parameters": [ @@ -12291,6 +12303,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/download": { "get": { + "deprecated": false, "description": "Download an agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0", "parameters": [ @@ -12408,6 +12421,7 @@ }, "/api/fleet/agent_policies/{agentPolicyId}/full": { "get": { + "deprecated": false, "description": "Get a full agent policy by ID", "operationId": "%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0", "parameters": [ @@ -12910,6 +12924,7 @@ }, "/api/fleet/agent_status": { "get": { + "deprecated": false, "description": "Get agent status summary", "operationId": "%2Fapi%2Ffleet%2Fagent_status#0", "parameters": [ @@ -13064,6 +13079,7 @@ }, "/api/fleet/agent_status/data": { "get": { + "deprecated": false, "description": "Get incoming agent data", "operationId": "%2Fapi%2Ffleet%2Fagent_status%2Fdata#0", "parameters": [ @@ -13180,6 +13196,7 @@ }, "/api/fleet/agents": { "get": { + "deprecated": false, "description": "List agents", "operationId": "%2Fapi%2Ffleet%2Fagents#0", "parameters": [ @@ -14119,6 +14136,7 @@ ] }, "post": { + "deprecated": false, "description": "List agents by action ids", "operationId": "%2Fapi%2Ffleet%2Fagents#1", "parameters": [ @@ -14222,6 +14240,7 @@ }, "/api/fleet/agents/action_status": { "get": { + "deprecated": false, "description": "Get agent action status", "operationId": "%2Fapi%2Ffleet%2Fagents%2Faction_status#0", "parameters": [ @@ -14458,6 +14477,7 @@ }, "/api/fleet/agents/actions/{actionId}/cancel": { "post": { + "deprecated": false, "description": "Cancel agent action", "operationId": "%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0", "parameters": [ @@ -14600,6 +14620,7 @@ }, "/api/fleet/agents/available_versions": { "get": { + "deprecated": false, "description": "Get available agent versions", "operationId": "%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0", "parameters": [ @@ -14672,6 +14693,7 @@ }, "/api/fleet/agents/bulk_reassign": { "post": { + "deprecated": false, "description": "Bulk reassign agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0", "parameters": [ @@ -14790,6 +14812,7 @@ }, "/api/fleet/agents/bulk_request_diagnostics": { "post": { + "deprecated": false, "description": "Bulk request diagnostics from agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0", "parameters": [ @@ -14909,6 +14932,7 @@ }, "/api/fleet/agents/bulk_unenroll": { "post": { + "deprecated": false, "description": "Bulk unenroll agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0", "parameters": [ @@ -15033,6 +15057,7 @@ }, "/api/fleet/agents/bulk_update_agent_tags": { "post": { + "deprecated": false, "description": "Bulk update agent tags", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0", "parameters": [ @@ -15159,6 +15184,7 @@ }, "/api/fleet/agents/bulk_upgrade": { "post": { + "deprecated": false, "description": "Bulk upgrade agents", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0", "parameters": [ @@ -15293,6 +15319,7 @@ }, "/api/fleet/agents/files/{fileId}": { "delete": { + "deprecated": false, "description": "Delete file uploaded by agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0", "parameters": [ @@ -15384,6 +15411,7 @@ }, "/api/fleet/agents/files/{fileId}/{fileName}": { "get": { + "deprecated": false, "description": "Get file uploaded by agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0", "parameters": [ @@ -15460,6 +15488,7 @@ }, "/api/fleet/agents/setup": { "get": { + "deprecated": false, "description": "Get agent setup info", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fsetup#0", "parameters": [ @@ -15561,6 +15590,7 @@ ] }, "post": { + "deprecated": false, "description": "Initiate agent setup", "operationId": "%2Fapi%2Ffleet%2Fagents%2Fsetup#1", "parameters": [ @@ -15661,6 +15691,7 @@ }, "/api/fleet/agents/tags": { "get": { + "deprecated": false, "description": "List agent tags", "operationId": "%2Fapi%2Ffleet%2Fagents%2Ftags#0", "parameters": [ @@ -15750,6 +15781,7 @@ }, "/api/fleet/agents/{agentId}": { "delete": { + "deprecated": false, "description": "Delete agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2", "parameters": [ @@ -15838,6 +15870,7 @@ ] }, "get": { + "deprecated": false, "description": "Get agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0", "parameters": [ @@ -16303,6 +16336,7 @@ ] }, "put": { + "deprecated": false, "description": "Update agent by ID", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1", "parameters": [ @@ -16793,6 +16827,7 @@ }, "/api/fleet/agents/{agentId}/actions": { "post": { + "deprecated": false, "description": "Create agent action", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0", "parameters": [ @@ -17010,6 +17045,7 @@ }, "/api/fleet/agents/{agentId}/reassign": { "post": { + "deprecated": false, "description": "Reassign agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1", "parameters": [ @@ -17106,7 +17142,7 @@ ] }, "put": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0", "parameters": [ { @@ -17165,6 +17201,7 @@ }, "/api/fleet/agents/{agentId}/request_diagnostics": { "post": { + "deprecated": false, "description": "Request agent diagnostics", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0", "parameters": [ @@ -17274,6 +17311,7 @@ }, "/api/fleet/agents/{agentId}/unenroll": { "post": { + "deprecated": false, "description": "Unenroll agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0", "parameters": [ @@ -17336,6 +17374,7 @@ }, "/api/fleet/agents/{agentId}/upgrade": { "post": { + "deprecated": false, "description": "Upgrade agent", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0", "parameters": [ @@ -17443,6 +17482,7 @@ }, "/api/fleet/agents/{agentId}/uploads": { "get": { + "deprecated": false, "description": "List agent uploads", "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0", "parameters": [ @@ -17563,6 +17603,7 @@ }, "/api/fleet/check-permissions": { "get": { + "deprecated": false, "description": "Check permissions", "operationId": "%2Fapi%2Ffleet%2Fcheck-permissions#0", "parameters": [ @@ -17648,6 +17689,7 @@ }, "/api/fleet/data_streams": { "get": { + "deprecated": false, "description": "List data streams", "operationId": "%2Fapi%2Ffleet%2Fdata_streams#0", "parameters": [ @@ -17806,7 +17848,7 @@ }, "/api/fleet/enrollment-api-keys": { "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#0", "parameters": [ { @@ -17853,7 +17895,7 @@ "tags": [] }, "post": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#1", "parameters": [ { @@ -17910,7 +17952,7 @@ }, "/api/fleet/enrollment-api-keys/{keyId}": { "delete": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1", "parameters": [ { @@ -17949,7 +17991,7 @@ "tags": [] }, "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0", "parameters": [ { @@ -17980,6 +18022,7 @@ }, "/api/fleet/enrollment_api_keys": { "get": { + "deprecated": false, "description": "List enrollment API keys", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys#0", "parameters": [ @@ -18168,6 +18211,7 @@ ] }, "post": { + "deprecated": false, "description": "Create enrollment API key", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys#1", "parameters": [ @@ -18314,6 +18358,7 @@ }, "/api/fleet/enrollment_api_keys/{keyId}": { "delete": { + "deprecated": false, "description": "Revoke enrollment API key by ID by marking it as inactive", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1", "parameters": [ @@ -18402,6 +18447,7 @@ ] }, "get": { + "deprecated": false, "description": "Get enrollment API key by ID", "operationId": "%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0", "parameters": [ @@ -18515,6 +18561,7 @@ }, "/api/fleet/epm/bulk_assets": { "post": { + "deprecated": false, "description": "Bulk get assets", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0", "parameters": [ @@ -18666,6 +18713,7 @@ }, "/api/fleet/epm/categories": { "get": { + "deprecated": false, "description": "List package categories", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fcategories#0", "parameters": [ @@ -18815,6 +18863,7 @@ }, "/api/fleet/epm/custom_integrations": { "post": { + "deprecated": false, "description": "Create custom integration", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0", "parameters": [ @@ -19097,6 +19146,7 @@ }, "/api/fleet/epm/data_streams": { "get": { + "deprecated": false, "description": "List data streams", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0", "parameters": [ @@ -19223,6 +19273,7 @@ }, "/api/fleet/epm/packages": { "get": { + "deprecated": false, "description": "List packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages#0", "parameters": [ @@ -20292,6 +20343,7 @@ ] }, "post": { + "deprecated": false, "description": "Install package by upload", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages#1", "parameters": [ @@ -20554,6 +20606,7 @@ }, "/api/fleet/epm/packages/_bulk": { "post": { + "deprecated": false, "description": "Bulk install packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0", "parameters": [ @@ -20978,6 +21031,7 @@ }, "/api/fleet/epm/packages/installed": { "get": { + "deprecated": false, "description": "Get installed packages", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0", "parameters": [ @@ -21219,6 +21273,7 @@ }, "/api/fleet/epm/packages/limited": { "get": { + "deprecated": false, "description": "Get limited package list", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0", "parameters": [ @@ -21298,6 +21353,7 @@ }, "/api/fleet/epm/packages/{pkgName}/stats": { "get": { + "deprecated": false, "description": "Get package stats", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0", "parameters": [ @@ -21384,6 +21440,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}": { "delete": { + "deprecated": false, "description": "Delete package", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3", "parameters": [ @@ -21646,6 +21703,7 @@ ] }, "get": { + "deprecated": false, "description": "Get package", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0", "parameters": [ @@ -22910,6 +22968,7 @@ ] }, "post": { + "deprecated": false, "description": "Install package from registry", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2", "parameters": [ @@ -23205,6 +23264,7 @@ ] }, "put": { + "deprecated": false, "description": "Update package settings", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1", "parameters": [ @@ -24454,6 +24514,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize": { "post": { + "deprecated": false, "description": "Authorize transforms", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0", "parameters": [ @@ -24598,6 +24659,7 @@ }, "/api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}": { "get": { + "deprecated": false, "description": "Get package file", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0", "parameters": [ @@ -24680,7 +24742,7 @@ }, "/api/fleet/epm/packages/{pkgkey}": { "delete": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3", "parameters": [ { @@ -24738,7 +24800,7 @@ "tags": [] }, "get": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0", "parameters": [ { @@ -24800,7 +24862,7 @@ "tags": [] }, "post": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2", "parameters": [ { @@ -24884,7 +24946,7 @@ "tags": [] }, "put": { - "deprecated": true, + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1", "parameters": [ { @@ -24943,6 +25005,7 @@ }, "/api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs": { "get": { + "deprecated": false, "description": "Get inputs template", "operationId": "%2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0", "parameters": [ @@ -25112,6 +25175,7 @@ }, "/api/fleet/epm/verification_key_id": { "get": { + "deprecated": false, "description": "Get a package signature verification key ID", "operationId": "%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0", "parameters": [ @@ -25182,6 +25246,7 @@ }, "/api/fleet/fleet_server_hosts": { "get": { + "deprecated": false, "description": "List Fleet Server hosts", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts#0", "parameters": [ @@ -25300,6 +25365,7 @@ ] }, "post": { + "deprecated": false, "description": "Create Fleet Server host", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts#1", "parameters": [ @@ -25459,6 +25525,7 @@ }, "/api/fleet/fleet_server_hosts/{itemId}": { "delete": { + "deprecated": false, "description": "Delete Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1", "parameters": [ @@ -25544,6 +25611,7 @@ ] }, "get": { + "deprecated": false, "description": "Get Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0", "parameters": [ @@ -25655,6 +25723,7 @@ ] }, "put": { + "deprecated": false, "description": "Update Fleet Server host by ID", "operationId": "%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2", "parameters": [ @@ -25813,6 +25882,7 @@ }, "/api/fleet/health_check": { "post": { + "deprecated": false, "description": "Check Fleet Server health", "operationId": "%2Fapi%2Ffleet%2Fhealth_check#0", "parameters": [ @@ -25949,6 +26019,7 @@ }, "/api/fleet/kubernetes": { "get": { + "deprecated": false, "description": "Get full K8s agent manifest", "operationId": "%2Fapi%2Ffleet%2Fkubernetes#0", "parameters": [ @@ -26042,6 +26113,7 @@ }, "/api/fleet/kubernetes/download": { "get": { + "deprecated": false, "operationId": "%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0", "parameters": [ { @@ -26150,6 +26222,7 @@ }, "/api/fleet/logstash_api_keys": { "post": { + "deprecated": false, "description": "Generate Logstash API key", "operationId": "%2Fapi%2Ffleet%2Flogstash_api_keys#0", "parameters": [ @@ -26229,6 +26302,7 @@ }, "/api/fleet/message_signing_service/rotate_key_pair": { "post": { + "deprecated": false, "description": "Rotate fleet message signing key pair", "operationId": "%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0", "parameters": [ @@ -26342,6 +26416,7 @@ }, "/api/fleet/outputs": { "get": { + "deprecated": false, "description": "List outputs", "operationId": "%2Fapi%2Ffleet%2Foutputs#0", "parameters": [ @@ -27472,6 +27547,7 @@ ] }, "post": { + "deprecated": false, "description": "Create output", "operationId": "%2Fapi%2Ffleet%2Foutputs#1", "parameters": [ @@ -29656,6 +29732,7 @@ }, "/api/fleet/outputs/{outputId}": { "delete": { + "deprecated": false, "description": "Delete output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2", "parameters": [ @@ -29766,6 +29843,7 @@ ] }, "get": { + "deprecated": false, "description": "Get output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0", "parameters": [ @@ -30889,6 +30967,7 @@ ] }, "put": { + "deprecated": false, "description": "Update output by ID", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1", "parameters": [ @@ -33057,6 +33136,7 @@ }, "/api/fleet/outputs/{outputId}/health": { "get": { + "deprecated": false, "description": "Get latest output health", "operationId": "%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0", "parameters": [ @@ -33145,6 +33225,7 @@ }, "/api/fleet/package_policies": { "get": { + "deprecated": false, "description": "List package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies#0", "parameters": [ @@ -33860,6 +33941,7 @@ ] }, "post": { + "deprecated": false, "description": "Create package policy", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies#1", "parameters": [ @@ -35134,6 +35216,7 @@ }, "/api/fleet/package_policies/_bulk_get": { "post": { + "deprecated": false, "description": "Bulk get package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0", "parameters": [ @@ -35832,6 +35915,7 @@ }, "/api/fleet/package_policies/delete": { "post": { + "deprecated": false, "description": "Bulk delete package policies", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0", "parameters": [ @@ -36036,6 +36120,7 @@ }, "/api/fleet/package_policies/upgrade": { "post": { + "deprecated": false, "description": "Upgrade package policy to a newer package version", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0", "parameters": [ @@ -36161,6 +36246,7 @@ }, "/api/fleet/package_policies/upgrade/dryrun": { "post": { + "deprecated": false, "description": "Dry run package policy upgrade", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0", "parameters": [ @@ -37347,6 +37433,7 @@ }, "/api/fleet/package_policies/{packagePolicyId}": { "delete": { + "deprecated": false, "description": "Delete package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2", "parameters": [ @@ -37440,6 +37527,7 @@ ] }, "get": { + "deprecated": false, "description": "Get package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0", "parameters": [ @@ -38106,6 +38194,7 @@ ] }, "put": { + "deprecated": false, "description": "Update package policy by ID", "operationId": "%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1", "parameters": [ @@ -39380,6 +39469,7 @@ }, "/api/fleet/proxies": { "get": { + "deprecated": false, "description": "List proxies", "operationId": "%2Fapi%2Ffleet%2Fproxies#0", "parameters": [ @@ -39512,6 +39602,7 @@ ] }, "post": { + "deprecated": false, "description": "Create proxy", "operationId": "%2Fapi%2Ffleet%2Fproxies#1", "parameters": [ @@ -39699,6 +39790,7 @@ }, "/api/fleet/proxies/{itemId}": { "delete": { + "deprecated": false, "description": "Delete proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2", "parameters": [ @@ -39784,6 +39876,7 @@ ] }, "get": { + "deprecated": false, "description": "Get proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1", "parameters": [ @@ -39909,6 +40002,7 @@ ] }, "put": { + "deprecated": false, "description": "Update proxy by ID", "operationId": "%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0", "parameters": [ @@ -40099,7 +40193,7 @@ }, "/api/fleet/service-tokens": { "post": { - "deprecated": true, + "deprecated": false, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice-tokens#0", "parameters": [ @@ -40133,6 +40227,7 @@ }, "/api/fleet/service_tokens": { "post": { + "deprecated": false, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice_tokens#0", "parameters": [ @@ -40233,6 +40328,7 @@ }, "/api/fleet/settings": { "get": { + "deprecated": false, "description": "Get settings", "operationId": "%2Fapi%2Ffleet%2Fsettings#0", "parameters": [ @@ -40384,6 +40480,7 @@ ] }, "put": { + "deprecated": false, "description": "Update settings", "operationId": "%2Fapi%2Ffleet%2Fsettings#1", "parameters": [ @@ -40601,6 +40698,7 @@ }, "/api/fleet/setup": { "post": { + "deprecated": false, "description": "Initiate Fleet setup", "operationId": "%2Fapi%2Ffleet%2Fsetup#0", "parameters": [ @@ -40720,6 +40818,7 @@ }, "/api/fleet/uninstall_tokens": { "get": { + "deprecated": false, "description": "List metadata for latest uninstall tokens per agent policy", "operationId": "%2Fapi%2Ffleet%2Funinstall_tokens#0", "parameters": [ @@ -40869,6 +40968,7 @@ }, "/api/fleet/uninstall_tokens/{uninstallTokenId}": { "get": { + "deprecated": false, "description": "Get one decrypted uninstall token by its ID", "operationId": "%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0", "parameters": [ @@ -40977,6 +41077,7 @@ }, "/api/spaces/space": { "get": { + "deprecated": false, "description": "Get all spaces", "operationId": "%2Fapi%2Fspaces%2Fspace#0", "parameters": [ @@ -41052,6 +41153,7 @@ ] }, "post": { + "deprecated": false, "description": "Create a space", "operationId": "%2Fapi%2Fspaces%2Fspace#1", "parameters": [ @@ -41133,6 +41235,7 @@ }, "/api/spaces/space/{id}": { "delete": { + "deprecated": false, "description": "Delete a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2", "parameters": [ @@ -41174,6 +41277,7 @@ ] }, "get": { + "deprecated": false, "description": "Get a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0", "parameters": [ @@ -41205,6 +41309,7 @@ ] }, "put": { + "deprecated": false, "description": "Update a space", "operationId": "%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1", "parameters": [ From 2f47efd054be419a8cd74278f5c9b7ffd41e1aeb Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:23:39 +0000 Subject: [PATCH 12/27] [CI] Auto-commit changed files from 'make api-docs && make api-docs-staging' --- .../output/kibana.serverless.staging.yaml | 127 +++++++++++++++-- oas_docs/output/kibana.serverless.yaml | 127 +++++++++++++++-- oas_docs/output/kibana.staging.yaml | 132 ++++++++++++++++-- oas_docs/output/kibana.yaml | 132 ++++++++++++++++-- 4 files changed, 474 insertions(+), 44 deletions(-) diff --git a/oas_docs/output/kibana.serverless.staging.yaml b/oas_docs/output/kibana.serverless.staging.yaml index 9e63182949f25..448ba1293ae0a 100644 --- a/oas_docs/output/kibana.serverless.staging.yaml +++ b/oas_docs/output/kibana.serverless.staging.yaml @@ -9968,6 +9968,7 @@ paths: - Security Exceptions API /api/fleet/agent_download_sources: get: + deprecated: false description: List agent binary download sources operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#0' parameters: @@ -10044,6 +10045,7 @@ paths: tags: - Elastic Agent binary download sources post: + deprecated: false description: Create agent binary download source operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#1' parameters: @@ -10143,6 +10145,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_download_sources/{sourceId}: delete: + deprecated: false description: Delete agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2' parameters: @@ -10198,6 +10201,7 @@ paths: tags: - Elastic Agent binary download sources get: + deprecated: false description: Get agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0' parameters: @@ -10268,6 +10272,7 @@ paths: tags: - Elastic Agent binary download sources put: + deprecated: false description: Update agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1' parameters: @@ -10372,6 +10377,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_policies: get: + deprecated: false description: List agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies#0' parameters: @@ -10977,6 +10983,7 @@ paths: tags: - Elastic Agent policies post: + deprecated: false description: Create an agent policy operationId: '%2Fapi%2Ffleet%2Fagent_policies#1' parameters: @@ -11712,6 +11719,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/_bulk_get: post: + deprecated: false description: Bulk get agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0' parameters: @@ -12292,6 +12300,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}: get: + deprecated: false description: Get an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0' parameters: @@ -12848,6 +12857,7 @@ paths: tags: - Elastic Agent policies put: + deprecated: false description: Update an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1' parameters: @@ -13591,6 +13601,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/copy: post: + deprecated: false description: Copy an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0' parameters: @@ -14169,6 +14180,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/download: get: + deprecated: false description: Download an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0' parameters: @@ -14243,6 +14255,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/full: get: + deprecated: false description: Get a full agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0' parameters: @@ -14575,6 +14588,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/delete: post: + deprecated: false description: Delete agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0' parameters: @@ -14645,6 +14659,7 @@ paths: - Elastic Agent policies /api/fleet/agent_status: get: + deprecated: false description: Get agent status summary operationId: '%2Fapi%2Ffleet%2Fagent_status#0' parameters: @@ -14746,6 +14761,7 @@ paths: - Elastic Agent status /api/fleet/agent_status/data: get: + deprecated: false description: Get incoming agent data operationId: '%2Fapi%2Ffleet%2Fagent_status%2Fdata#0' parameters: @@ -14819,7 +14835,7 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -14855,6 +14871,7 @@ paths: tags: [] /api/fleet/agents: get: + deprecated: false description: List agents operationId: '%2Fapi%2Ffleet%2Fagents#0' parameters: @@ -15520,6 +15537,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: List agents by action ids operationId: '%2Fapi%2Ffleet%2Fagents#1' parameters: @@ -15586,6 +15604,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}: delete: + deprecated: false description: Delete agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2' parameters: @@ -15643,6 +15662,7 @@ paths: tags: - Elastic Agents get: + deprecated: false description: Get agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0' parameters: @@ -15971,6 +15991,7 @@ paths: tags: - Elastic Agents put: + deprecated: false description: Update agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1' parameters: @@ -16315,6 +16336,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}/actions: post: + deprecated: false description: Create agent action operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0' parameters: @@ -16460,6 +16482,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/reassign: post: + deprecated: false description: Reassign agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1' parameters: @@ -16522,7 +16545,7 @@ paths: tags: - Elastic Agent actions put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -16561,6 +16584,7 @@ paths: tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: + deprecated: false description: Request agent diagnostics operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0' parameters: @@ -16631,6 +16655,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/unenroll: post: + deprecated: false description: Unenroll agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0' parameters: @@ -16672,6 +16697,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/upgrade: post: + deprecated: false description: Upgrade agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0' parameters: @@ -16741,6 +16767,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/uploads: get: + deprecated: false description: List agent uploads operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0' parameters: @@ -16822,6 +16849,7 @@ paths: - Elastic Agents /api/fleet/agents/action_status: get: + deprecated: false description: Get agent action status operationId: '%2Fapi%2Ffleet%2Fagents%2Faction_status#0' parameters: @@ -16990,6 +17018,7 @@ paths: - Elastic Agent actions /api/fleet/agents/actions/{actionId}/cancel: post: + deprecated: false description: Cancel agent action operationId: '%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0' parameters: @@ -17085,6 +17114,7 @@ paths: - Elastic Agent actions /api/fleet/agents/available_versions: get: + deprecated: false description: Get available agent versions operationId: '%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0' parameters: @@ -17131,6 +17161,7 @@ paths: - Elastic Agents /api/fleet/agents/bulk_reassign: post: + deprecated: false description: Bulk reassign agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0' parameters: @@ -17205,6 +17236,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_request_diagnostics: post: + deprecated: false description: Bulk request diagnostics from agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0' parameters: @@ -17279,6 +17311,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_unenroll: post: + deprecated: false description: Bulk unenroll agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0' parameters: @@ -17360,6 +17393,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_update_agent_tags: post: + deprecated: false description: Bulk update agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0' parameters: @@ -17439,6 +17473,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_upgrade: post: + deprecated: false description: Bulk upgrade agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0' parameters: @@ -17524,6 +17559,7 @@ paths: - Elastic Agent actions /api/fleet/agents/files/{fileId}: delete: + deprecated: false description: Delete file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0' parameters: @@ -17583,6 +17619,7 @@ paths: - Elastic Agents /api/fleet/agents/files/{fileId}/{fileName}: get: + deprecated: false description: Get file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0' parameters: @@ -17631,6 +17668,7 @@ paths: - Elastic Agents /api/fleet/agents/setup: get: + deprecated: false description: Get agent setup info operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#0' parameters: @@ -17702,6 +17740,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: Initiate agent setup operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#1' parameters: @@ -17772,6 +17811,7 @@ paths: - Elastic Agents /api/fleet/agents/tags: get: + deprecated: false description: List agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Ftags#0' parameters: @@ -17829,6 +17869,7 @@ paths: - Elastic Agents /api/fleet/check-permissions: get: + deprecated: false description: Check permissions operationId: '%2Fapi%2Ffleet%2Fcheck-permissions#0' parameters: @@ -17884,6 +17925,7 @@ paths: - Fleet internals /api/fleet/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fdata_streams#0' parameters: @@ -17989,6 +18031,7 @@ paths: - Data streams /api/fleet/enrollment_api_keys: get: + deprecated: false description: List enrollment API keys operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#0' parameters: @@ -18132,6 +18175,7 @@ paths: tags: - Fleet enrollment API keys post: + deprecated: false description: Create enrollment API key operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#1' parameters: @@ -18236,6 +18280,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment_api_keys/{keyId}: delete: + deprecated: false description: Revoke enrollment API key by ID by marking it as inactive operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1' parameters: @@ -18293,6 +18338,7 @@ paths: tags: - Fleet enrollment API keys get: + deprecated: false description: Get enrollment API key by ID operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0' parameters: @@ -18375,7 +18421,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -18407,7 +18453,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -18445,7 +18491,7 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -18472,7 +18518,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -18493,6 +18539,7 @@ paths: tags: [] /api/fleet/epm/bulk_assets: post: + deprecated: false description: Bulk get assets operationId: '%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0' parameters: @@ -18592,6 +18639,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/categories: get: + deprecated: false description: List package categories operationId: '%2Fapi%2Ffleet%2Fepm%2Fcategories#0' parameters: @@ -18690,6 +18738,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/custom_integrations: post: + deprecated: false description: Create custom integration operationId: '%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0' parameters: @@ -18886,6 +18935,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0' parameters: @@ -18969,6 +19019,7 @@ paths: - Data streams /api/fleet/epm/packages: get: + deprecated: false description: List packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#0' parameters: @@ -19723,6 +19774,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package by upload operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#1' parameters: @@ -19904,6 +19956,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/_bulk: post: + deprecated: false description: Bulk install packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0' parameters: @@ -20187,7 +20240,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -20226,7 +20279,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -20267,7 +20320,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -20323,7 +20376,7 @@ paths: summary: '' tags: [] put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -20362,6 +20415,7 @@ paths: tags: [] /api/fleet/epm/packages/{pkgName}/{pkgVersion}: delete: + deprecated: false description: Delete package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3' parameters: @@ -20542,6 +20596,7 @@ paths: tags: - Elastic Package Manager (EPM) get: + deprecated: false description: Get package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0' parameters: @@ -21427,6 +21482,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package from registry operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2' parameters: @@ -21630,6 +21686,7 @@ paths: tags: - Elastic Package Manager (EPM) put: + deprecated: false description: Update package settings operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1' parameters: @@ -22505,6 +22562,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}: get: + deprecated: false description: Get package file operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0 @@ -22558,6 +22616,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize: post: + deprecated: false description: Authorize transforms operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0 @@ -22652,6 +22711,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/stats: get: + deprecated: false description: Get package stats operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0' parameters: @@ -22707,6 +22767,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/installed: get: + deprecated: false description: Get installed packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0' parameters: @@ -22861,6 +22922,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/limited: get: + deprecated: false description: Get limited package list operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0' parameters: @@ -22912,6 +22974,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs: get: + deprecated: false description: Get inputs template operationId: >- %2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0 @@ -23021,6 +23084,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/verification_key_id: get: + deprecated: false description: Get a package signature verification key ID operationId: '%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0' parameters: @@ -23066,6 +23130,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/fleet_server_hosts: get: + deprecated: false description: List Fleet Server hosts operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#0' parameters: @@ -23146,6 +23211,7 @@ paths: tags: - Fleet Server hosts post: + deprecated: false description: Create Fleet Server host operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#1' parameters: @@ -23253,6 +23319,7 @@ paths: - Fleet Server hosts /api/fleet/fleet_server_hosts/{itemId}: delete: + deprecated: false description: Delete Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1' parameters: @@ -23308,6 +23375,7 @@ paths: tags: - Fleet Server hosts get: + deprecated: false description: Get Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0' parameters: @@ -23382,6 +23450,7 @@ paths: tags: - Fleet Server hosts put: + deprecated: false description: Update Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2' parameters: @@ -23487,6 +23556,7 @@ paths: - Fleet Server hosts /api/fleet/health_check: post: + deprecated: false description: Check Fleet Server health operationId: '%2Fapi%2Ffleet%2Fhealth_check#0' parameters: @@ -23575,6 +23645,7 @@ paths: - Fleet internals /api/fleet/kubernetes: get: + deprecated: false description: Get full K8s agent manifest operationId: '%2Fapi%2Ffleet%2Fkubernetes#0' parameters: @@ -23634,6 +23705,7 @@ paths: - Elastic Agent policies /api/fleet/kubernetes/download: get: + deprecated: false operationId: '%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0' parameters: - description: The version of the API to use @@ -23702,6 +23774,7 @@ paths: - Elastic Agent policies /api/fleet/logstash_api_keys: post: + deprecated: false description: Generate Logstash API key operationId: '%2Fapi%2Ffleet%2Flogstash_api_keys#0' parameters: @@ -23753,6 +23826,7 @@ paths: - Fleet outputs /api/fleet/message_signing_service/rotate_key_pair: post: + deprecated: false description: Rotate fleet message signing key pair operationId: '%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0' parameters: @@ -23826,6 +23900,7 @@ paths: - Message Signing Service /api/fleet/outputs: get: + deprecated: false description: List outputs operationId: '%2Fapi%2Ffleet%2Foutputs#0' parameters: @@ -24582,6 +24657,7 @@ paths: tags: - Fleet outputs post: + deprecated: false description: Create output operationId: '%2Fapi%2Ffleet%2Foutputs#1' parameters: @@ -26042,6 +26118,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}: delete: + deprecated: false description: Delete output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2' parameters: @@ -26113,6 +26190,7 @@ paths: tags: - Fleet outputs get: + deprecated: false description: Get output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0' parameters: @@ -26863,6 +26941,7 @@ paths: tags: - Fleet outputs put: + deprecated: false description: Update output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1' parameters: @@ -28307,6 +28386,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}/health: get: + deprecated: false description: Get latest output health operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0' parameters: @@ -28365,6 +28445,7 @@ paths: - Fleet outputs /api/fleet/package_policies: get: + deprecated: false description: List package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies#0' parameters: @@ -28870,6 +28951,7 @@ paths: tags: - Fleet package policies post: + deprecated: false description: Create package policy operationId: '%2Fapi%2Ffleet%2Fpackage_policies#1' parameters: @@ -29773,6 +29855,7 @@ paths: - Fleet package policies /api/fleet/package_policies/_bulk_get: post: + deprecated: false description: Bulk get package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0' parameters: @@ -30266,6 +30349,7 @@ paths: - Fleet package policies /api/fleet/package_policies/{packagePolicyId}: delete: + deprecated: false description: Delete package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2' parameters: @@ -30326,6 +30410,7 @@ paths: tags: - Fleet package policies get: + deprecated: false description: Get package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0' parameters: @@ -30795,6 +30880,7 @@ paths: tags: - Fleet package policies put: + deprecated: false description: Update package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1' parameters: @@ -31692,6 +31778,7 @@ paths: - Fleet package policies /api/fleet/package_policies/delete: post: + deprecated: false description: Bulk delete package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0' parameters: @@ -31829,6 +31916,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade: post: + deprecated: false description: Upgrade package policy to a newer package version operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0' parameters: @@ -31910,6 +31998,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade/dryrun: post: + deprecated: false description: Dry run package policy upgrade operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0' parameters: @@ -32760,6 +32849,7 @@ paths: - Fleet package policies /api/fleet/proxies: get: + deprecated: false description: List proxies operationId: '%2Fapi%2Ffleet%2Fproxies#0' parameters: @@ -32846,6 +32936,7 @@ paths: tags: - Fleet proxies post: + deprecated: false description: Create proxy operationId: '%2Fapi%2Ffleet%2Fproxies#1' parameters: @@ -32965,6 +33056,7 @@ paths: - Fleet proxies /api/fleet/proxies/{itemId}: delete: + deprecated: false description: Delete proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2' parameters: @@ -33020,6 +33112,7 @@ paths: tags: - Fleet proxies get: + deprecated: false description: Get proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1' parameters: @@ -33100,6 +33193,7 @@ paths: tags: - Fleet proxies put: + deprecated: false description: Update proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0' parameters: @@ -33221,6 +33315,7 @@ paths: - Fleet proxies /api/fleet/service_tokens: post: + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice_tokens#0' parameters: @@ -33286,7 +33381,7 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: @@ -33310,6 +33405,7 @@ paths: tags: [] /api/fleet/settings: get: + deprecated: false description: Get settings operationId: '%2Fapi%2Ffleet%2Fsettings#0' parameters: @@ -33409,6 +33505,7 @@ paths: tags: - Fleet internals put: + deprecated: false description: Update settings operationId: '%2Fapi%2Ffleet%2Fsettings#1' parameters: @@ -33552,6 +33649,7 @@ paths: - Fleet internals /api/fleet/setup: post: + deprecated: false description: Initiate Fleet setup operationId: '%2Fapi%2Ffleet%2Fsetup#0' parameters: @@ -33634,6 +33732,7 @@ paths: - Fleet internals /api/fleet/uninstall_tokens: get: + deprecated: false description: List metadata for latest uninstall tokens per agent policy operationId: '%2Fapi%2Ffleet%2Funinstall_tokens#0' parameters: @@ -33734,6 +33833,7 @@ paths: - Fleet uninstall tokens /api/fleet/uninstall_tokens/{uninstallTokenId}: get: + deprecated: false description: Get one decrypted uninstall token by its ID operationId: '%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0' parameters: @@ -36537,6 +36637,7 @@ paths: - Prompts API /api/spaces/space: get: + deprecated: false description: Get all spaces operationId: '%2Fapi%2Fspaces%2Fspace#0' parameters: @@ -36581,6 +36682,7 @@ paths: tags: - spaces post: + deprecated: false description: Create a space operationId: '%2Fapi%2Fspaces%2Fspace#1' parameters: @@ -36636,6 +36738,7 @@ paths: - spaces /api/spaces/space/{id}: delete: + deprecated: false description: Delete a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2' parameters: @@ -36664,6 +36767,7 @@ paths: tags: - spaces get: + deprecated: false description: Get a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0' parameters: @@ -36685,6 +36789,7 @@ paths: tags: - spaces put: + deprecated: false description: Update a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1' parameters: diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 9e63182949f25..448ba1293ae0a 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -9968,6 +9968,7 @@ paths: - Security Exceptions API /api/fleet/agent_download_sources: get: + deprecated: false description: List agent binary download sources operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#0' parameters: @@ -10044,6 +10045,7 @@ paths: tags: - Elastic Agent binary download sources post: + deprecated: false description: Create agent binary download source operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#1' parameters: @@ -10143,6 +10145,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_download_sources/{sourceId}: delete: + deprecated: false description: Delete agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2' parameters: @@ -10198,6 +10201,7 @@ paths: tags: - Elastic Agent binary download sources get: + deprecated: false description: Get agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0' parameters: @@ -10268,6 +10272,7 @@ paths: tags: - Elastic Agent binary download sources put: + deprecated: false description: Update agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1' parameters: @@ -10372,6 +10377,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_policies: get: + deprecated: false description: List agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies#0' parameters: @@ -10977,6 +10983,7 @@ paths: tags: - Elastic Agent policies post: + deprecated: false description: Create an agent policy operationId: '%2Fapi%2Ffleet%2Fagent_policies#1' parameters: @@ -11712,6 +11719,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/_bulk_get: post: + deprecated: false description: Bulk get agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0' parameters: @@ -12292,6 +12300,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}: get: + deprecated: false description: Get an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0' parameters: @@ -12848,6 +12857,7 @@ paths: tags: - Elastic Agent policies put: + deprecated: false description: Update an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1' parameters: @@ -13591,6 +13601,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/copy: post: + deprecated: false description: Copy an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0' parameters: @@ -14169,6 +14180,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/download: get: + deprecated: false description: Download an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0' parameters: @@ -14243,6 +14255,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/full: get: + deprecated: false description: Get a full agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0' parameters: @@ -14575,6 +14588,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/delete: post: + deprecated: false description: Delete agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0' parameters: @@ -14645,6 +14659,7 @@ paths: - Elastic Agent policies /api/fleet/agent_status: get: + deprecated: false description: Get agent status summary operationId: '%2Fapi%2Ffleet%2Fagent_status#0' parameters: @@ -14746,6 +14761,7 @@ paths: - Elastic Agent status /api/fleet/agent_status/data: get: + deprecated: false description: Get incoming agent data operationId: '%2Fapi%2Ffleet%2Fagent_status%2Fdata#0' parameters: @@ -14819,7 +14835,7 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -14855,6 +14871,7 @@ paths: tags: [] /api/fleet/agents: get: + deprecated: false description: List agents operationId: '%2Fapi%2Ffleet%2Fagents#0' parameters: @@ -15520,6 +15537,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: List agents by action ids operationId: '%2Fapi%2Ffleet%2Fagents#1' parameters: @@ -15586,6 +15604,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}: delete: + deprecated: false description: Delete agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2' parameters: @@ -15643,6 +15662,7 @@ paths: tags: - Elastic Agents get: + deprecated: false description: Get agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0' parameters: @@ -15971,6 +15991,7 @@ paths: tags: - Elastic Agents put: + deprecated: false description: Update agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1' parameters: @@ -16315,6 +16336,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}/actions: post: + deprecated: false description: Create agent action operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0' parameters: @@ -16460,6 +16482,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/reassign: post: + deprecated: false description: Reassign agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1' parameters: @@ -16522,7 +16545,7 @@ paths: tags: - Elastic Agent actions put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -16561,6 +16584,7 @@ paths: tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: + deprecated: false description: Request agent diagnostics operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0' parameters: @@ -16631,6 +16655,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/unenroll: post: + deprecated: false description: Unenroll agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0' parameters: @@ -16672,6 +16697,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/upgrade: post: + deprecated: false description: Upgrade agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0' parameters: @@ -16741,6 +16767,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/uploads: get: + deprecated: false description: List agent uploads operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0' parameters: @@ -16822,6 +16849,7 @@ paths: - Elastic Agents /api/fleet/agents/action_status: get: + deprecated: false description: Get agent action status operationId: '%2Fapi%2Ffleet%2Fagents%2Faction_status#0' parameters: @@ -16990,6 +17018,7 @@ paths: - Elastic Agent actions /api/fleet/agents/actions/{actionId}/cancel: post: + deprecated: false description: Cancel agent action operationId: '%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0' parameters: @@ -17085,6 +17114,7 @@ paths: - Elastic Agent actions /api/fleet/agents/available_versions: get: + deprecated: false description: Get available agent versions operationId: '%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0' parameters: @@ -17131,6 +17161,7 @@ paths: - Elastic Agents /api/fleet/agents/bulk_reassign: post: + deprecated: false description: Bulk reassign agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0' parameters: @@ -17205,6 +17236,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_request_diagnostics: post: + deprecated: false description: Bulk request diagnostics from agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0' parameters: @@ -17279,6 +17311,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_unenroll: post: + deprecated: false description: Bulk unenroll agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0' parameters: @@ -17360,6 +17393,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_update_agent_tags: post: + deprecated: false description: Bulk update agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0' parameters: @@ -17439,6 +17473,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_upgrade: post: + deprecated: false description: Bulk upgrade agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0' parameters: @@ -17524,6 +17559,7 @@ paths: - Elastic Agent actions /api/fleet/agents/files/{fileId}: delete: + deprecated: false description: Delete file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0' parameters: @@ -17583,6 +17619,7 @@ paths: - Elastic Agents /api/fleet/agents/files/{fileId}/{fileName}: get: + deprecated: false description: Get file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0' parameters: @@ -17631,6 +17668,7 @@ paths: - Elastic Agents /api/fleet/agents/setup: get: + deprecated: false description: Get agent setup info operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#0' parameters: @@ -17702,6 +17740,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: Initiate agent setup operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#1' parameters: @@ -17772,6 +17811,7 @@ paths: - Elastic Agents /api/fleet/agents/tags: get: + deprecated: false description: List agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Ftags#0' parameters: @@ -17829,6 +17869,7 @@ paths: - Elastic Agents /api/fleet/check-permissions: get: + deprecated: false description: Check permissions operationId: '%2Fapi%2Ffleet%2Fcheck-permissions#0' parameters: @@ -17884,6 +17925,7 @@ paths: - Fleet internals /api/fleet/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fdata_streams#0' parameters: @@ -17989,6 +18031,7 @@ paths: - Data streams /api/fleet/enrollment_api_keys: get: + deprecated: false description: List enrollment API keys operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#0' parameters: @@ -18132,6 +18175,7 @@ paths: tags: - Fleet enrollment API keys post: + deprecated: false description: Create enrollment API key operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#1' parameters: @@ -18236,6 +18280,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment_api_keys/{keyId}: delete: + deprecated: false description: Revoke enrollment API key by ID by marking it as inactive operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1' parameters: @@ -18293,6 +18338,7 @@ paths: tags: - Fleet enrollment API keys get: + deprecated: false description: Get enrollment API key by ID operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0' parameters: @@ -18375,7 +18421,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -18407,7 +18453,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -18445,7 +18491,7 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -18472,7 +18518,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -18493,6 +18539,7 @@ paths: tags: [] /api/fleet/epm/bulk_assets: post: + deprecated: false description: Bulk get assets operationId: '%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0' parameters: @@ -18592,6 +18639,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/categories: get: + deprecated: false description: List package categories operationId: '%2Fapi%2Ffleet%2Fepm%2Fcategories#0' parameters: @@ -18690,6 +18738,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/custom_integrations: post: + deprecated: false description: Create custom integration operationId: '%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0' parameters: @@ -18886,6 +18935,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0' parameters: @@ -18969,6 +19019,7 @@ paths: - Data streams /api/fleet/epm/packages: get: + deprecated: false description: List packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#0' parameters: @@ -19723,6 +19774,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package by upload operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#1' parameters: @@ -19904,6 +19956,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/_bulk: post: + deprecated: false description: Bulk install packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0' parameters: @@ -20187,7 +20240,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -20226,7 +20279,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -20267,7 +20320,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -20323,7 +20376,7 @@ paths: summary: '' tags: [] put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -20362,6 +20415,7 @@ paths: tags: [] /api/fleet/epm/packages/{pkgName}/{pkgVersion}: delete: + deprecated: false description: Delete package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3' parameters: @@ -20542,6 +20596,7 @@ paths: tags: - Elastic Package Manager (EPM) get: + deprecated: false description: Get package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0' parameters: @@ -21427,6 +21482,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package from registry operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2' parameters: @@ -21630,6 +21686,7 @@ paths: tags: - Elastic Package Manager (EPM) put: + deprecated: false description: Update package settings operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1' parameters: @@ -22505,6 +22562,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}: get: + deprecated: false description: Get package file operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0 @@ -22558,6 +22616,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize: post: + deprecated: false description: Authorize transforms operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0 @@ -22652,6 +22711,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/stats: get: + deprecated: false description: Get package stats operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0' parameters: @@ -22707,6 +22767,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/installed: get: + deprecated: false description: Get installed packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0' parameters: @@ -22861,6 +22922,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/limited: get: + deprecated: false description: Get limited package list operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0' parameters: @@ -22912,6 +22974,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs: get: + deprecated: false description: Get inputs template operationId: >- %2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0 @@ -23021,6 +23084,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/verification_key_id: get: + deprecated: false description: Get a package signature verification key ID operationId: '%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0' parameters: @@ -23066,6 +23130,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/fleet_server_hosts: get: + deprecated: false description: List Fleet Server hosts operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#0' parameters: @@ -23146,6 +23211,7 @@ paths: tags: - Fleet Server hosts post: + deprecated: false description: Create Fleet Server host operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#1' parameters: @@ -23253,6 +23319,7 @@ paths: - Fleet Server hosts /api/fleet/fleet_server_hosts/{itemId}: delete: + deprecated: false description: Delete Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1' parameters: @@ -23308,6 +23375,7 @@ paths: tags: - Fleet Server hosts get: + deprecated: false description: Get Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0' parameters: @@ -23382,6 +23450,7 @@ paths: tags: - Fleet Server hosts put: + deprecated: false description: Update Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2' parameters: @@ -23487,6 +23556,7 @@ paths: - Fleet Server hosts /api/fleet/health_check: post: + deprecated: false description: Check Fleet Server health operationId: '%2Fapi%2Ffleet%2Fhealth_check#0' parameters: @@ -23575,6 +23645,7 @@ paths: - Fleet internals /api/fleet/kubernetes: get: + deprecated: false description: Get full K8s agent manifest operationId: '%2Fapi%2Ffleet%2Fkubernetes#0' parameters: @@ -23634,6 +23705,7 @@ paths: - Elastic Agent policies /api/fleet/kubernetes/download: get: + deprecated: false operationId: '%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0' parameters: - description: The version of the API to use @@ -23702,6 +23774,7 @@ paths: - Elastic Agent policies /api/fleet/logstash_api_keys: post: + deprecated: false description: Generate Logstash API key operationId: '%2Fapi%2Ffleet%2Flogstash_api_keys#0' parameters: @@ -23753,6 +23826,7 @@ paths: - Fleet outputs /api/fleet/message_signing_service/rotate_key_pair: post: + deprecated: false description: Rotate fleet message signing key pair operationId: '%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0' parameters: @@ -23826,6 +23900,7 @@ paths: - Message Signing Service /api/fleet/outputs: get: + deprecated: false description: List outputs operationId: '%2Fapi%2Ffleet%2Foutputs#0' parameters: @@ -24582,6 +24657,7 @@ paths: tags: - Fleet outputs post: + deprecated: false description: Create output operationId: '%2Fapi%2Ffleet%2Foutputs#1' parameters: @@ -26042,6 +26118,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}: delete: + deprecated: false description: Delete output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2' parameters: @@ -26113,6 +26190,7 @@ paths: tags: - Fleet outputs get: + deprecated: false description: Get output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0' parameters: @@ -26863,6 +26941,7 @@ paths: tags: - Fleet outputs put: + deprecated: false description: Update output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1' parameters: @@ -28307,6 +28386,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}/health: get: + deprecated: false description: Get latest output health operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0' parameters: @@ -28365,6 +28445,7 @@ paths: - Fleet outputs /api/fleet/package_policies: get: + deprecated: false description: List package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies#0' parameters: @@ -28870,6 +28951,7 @@ paths: tags: - Fleet package policies post: + deprecated: false description: Create package policy operationId: '%2Fapi%2Ffleet%2Fpackage_policies#1' parameters: @@ -29773,6 +29855,7 @@ paths: - Fleet package policies /api/fleet/package_policies/_bulk_get: post: + deprecated: false description: Bulk get package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0' parameters: @@ -30266,6 +30349,7 @@ paths: - Fleet package policies /api/fleet/package_policies/{packagePolicyId}: delete: + deprecated: false description: Delete package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2' parameters: @@ -30326,6 +30410,7 @@ paths: tags: - Fleet package policies get: + deprecated: false description: Get package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0' parameters: @@ -30795,6 +30880,7 @@ paths: tags: - Fleet package policies put: + deprecated: false description: Update package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1' parameters: @@ -31692,6 +31778,7 @@ paths: - Fleet package policies /api/fleet/package_policies/delete: post: + deprecated: false description: Bulk delete package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0' parameters: @@ -31829,6 +31916,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade: post: + deprecated: false description: Upgrade package policy to a newer package version operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0' parameters: @@ -31910,6 +31998,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade/dryrun: post: + deprecated: false description: Dry run package policy upgrade operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0' parameters: @@ -32760,6 +32849,7 @@ paths: - Fleet package policies /api/fleet/proxies: get: + deprecated: false description: List proxies operationId: '%2Fapi%2Ffleet%2Fproxies#0' parameters: @@ -32846,6 +32936,7 @@ paths: tags: - Fleet proxies post: + deprecated: false description: Create proxy operationId: '%2Fapi%2Ffleet%2Fproxies#1' parameters: @@ -32965,6 +33056,7 @@ paths: - Fleet proxies /api/fleet/proxies/{itemId}: delete: + deprecated: false description: Delete proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2' parameters: @@ -33020,6 +33112,7 @@ paths: tags: - Fleet proxies get: + deprecated: false description: Get proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1' parameters: @@ -33100,6 +33193,7 @@ paths: tags: - Fleet proxies put: + deprecated: false description: Update proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0' parameters: @@ -33221,6 +33315,7 @@ paths: - Fleet proxies /api/fleet/service_tokens: post: + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice_tokens#0' parameters: @@ -33286,7 +33381,7 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: @@ -33310,6 +33405,7 @@ paths: tags: [] /api/fleet/settings: get: + deprecated: false description: Get settings operationId: '%2Fapi%2Ffleet%2Fsettings#0' parameters: @@ -33409,6 +33505,7 @@ paths: tags: - Fleet internals put: + deprecated: false description: Update settings operationId: '%2Fapi%2Ffleet%2Fsettings#1' parameters: @@ -33552,6 +33649,7 @@ paths: - Fleet internals /api/fleet/setup: post: + deprecated: false description: Initiate Fleet setup operationId: '%2Fapi%2Ffleet%2Fsetup#0' parameters: @@ -33634,6 +33732,7 @@ paths: - Fleet internals /api/fleet/uninstall_tokens: get: + deprecated: false description: List metadata for latest uninstall tokens per agent policy operationId: '%2Fapi%2Ffleet%2Funinstall_tokens#0' parameters: @@ -33734,6 +33833,7 @@ paths: - Fleet uninstall tokens /api/fleet/uninstall_tokens/{uninstallTokenId}: get: + deprecated: false description: Get one decrypted uninstall token by its ID operationId: '%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0' parameters: @@ -36537,6 +36637,7 @@ paths: - Prompts API /api/spaces/space: get: + deprecated: false description: Get all spaces operationId: '%2Fapi%2Fspaces%2Fspace#0' parameters: @@ -36581,6 +36682,7 @@ paths: tags: - spaces post: + deprecated: false description: Create a space operationId: '%2Fapi%2Fspaces%2Fspace#1' parameters: @@ -36636,6 +36738,7 @@ paths: - spaces /api/spaces/space/{id}: delete: + deprecated: false description: Delete a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2' parameters: @@ -36664,6 +36767,7 @@ paths: tags: - spaces get: + deprecated: false description: Get a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0' parameters: @@ -36685,6 +36789,7 @@ paths: tags: - spaces put: + deprecated: false description: Update a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1' parameters: diff --git a/oas_docs/output/kibana.staging.yaml b/oas_docs/output/kibana.staging.yaml index f32de75a62b26..a40f7fd2f5c6c 100644 --- a/oas_docs/output/kibana.staging.yaml +++ b/oas_docs/output/kibana.staging.yaml @@ -13397,6 +13397,7 @@ paths: - Security Exceptions API /api/fleet/agent_download_sources: get: + deprecated: false description: List agent binary download sources operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#0' parameters: @@ -13473,6 +13474,7 @@ paths: tags: - Elastic Agent binary download sources post: + deprecated: false description: Create agent binary download source operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#1' parameters: @@ -13572,6 +13574,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_download_sources/{sourceId}: delete: + deprecated: false description: Delete agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2' parameters: @@ -13627,6 +13630,7 @@ paths: tags: - Elastic Agent binary download sources get: + deprecated: false description: Get agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0' parameters: @@ -13697,6 +13701,7 @@ paths: tags: - Elastic Agent binary download sources put: + deprecated: false description: Update agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1' parameters: @@ -13801,6 +13806,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_policies: get: + deprecated: false description: List agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies#0' parameters: @@ -14406,6 +14412,7 @@ paths: tags: - Elastic Agent policies post: + deprecated: false description: Create an agent policy operationId: '%2Fapi%2Ffleet%2Fagent_policies#1' parameters: @@ -15141,6 +15148,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/_bulk_get: post: + deprecated: false description: Bulk get agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0' parameters: @@ -15721,6 +15729,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}: get: + deprecated: false description: Get an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0' parameters: @@ -16277,6 +16286,7 @@ paths: tags: - Elastic Agent policies put: + deprecated: false description: Update an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1' parameters: @@ -17020,6 +17030,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/copy: post: + deprecated: false description: Copy an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0' parameters: @@ -17598,6 +17609,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/download: get: + deprecated: false description: Download an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0' parameters: @@ -17672,6 +17684,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/full: get: + deprecated: false description: Get a full agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0' parameters: @@ -18004,6 +18017,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/delete: post: + deprecated: false description: Delete agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0' parameters: @@ -18074,6 +18088,7 @@ paths: - Elastic Agent policies /api/fleet/agent_status: get: + deprecated: false description: Get agent status summary operationId: '%2Fapi%2Ffleet%2Fagent_status#0' parameters: @@ -18175,6 +18190,7 @@ paths: - Elastic Agent status /api/fleet/agent_status/data: get: + deprecated: false description: Get incoming agent data operationId: '%2Fapi%2Ffleet%2Fagent_status%2Fdata#0' parameters: @@ -18248,7 +18264,7 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -18284,6 +18300,7 @@ paths: tags: [] /api/fleet/agents: get: + deprecated: false description: List agents operationId: '%2Fapi%2Ffleet%2Fagents#0' parameters: @@ -18949,6 +18966,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: List agents by action ids operationId: '%2Fapi%2Ffleet%2Fagents#1' parameters: @@ -19015,6 +19033,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}: delete: + deprecated: false description: Delete agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2' parameters: @@ -19072,6 +19091,7 @@ paths: tags: - Elastic Agents get: + deprecated: false description: Get agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0' parameters: @@ -19400,6 +19420,7 @@ paths: tags: - Elastic Agents put: + deprecated: false description: Update agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1' parameters: @@ -19744,6 +19765,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}/actions: post: + deprecated: false description: Create agent action operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0' parameters: @@ -19889,6 +19911,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/reassign: post: + deprecated: false description: Reassign agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1' parameters: @@ -19951,7 +19974,7 @@ paths: tags: - Elastic Agent actions put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -19990,6 +20013,7 @@ paths: tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: + deprecated: false description: Request agent diagnostics operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0' parameters: @@ -20060,6 +20084,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/unenroll: post: + deprecated: false description: Unenroll agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0' parameters: @@ -20101,6 +20126,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/upgrade: post: + deprecated: false description: Upgrade agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0' parameters: @@ -20170,6 +20196,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/uploads: get: + deprecated: false description: List agent uploads operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0' parameters: @@ -20251,6 +20278,7 @@ paths: - Elastic Agents /api/fleet/agents/action_status: get: + deprecated: false description: Get agent action status operationId: '%2Fapi%2Ffleet%2Fagents%2Faction_status#0' parameters: @@ -20419,6 +20447,7 @@ paths: - Elastic Agent actions /api/fleet/agents/actions/{actionId}/cancel: post: + deprecated: false description: Cancel agent action operationId: '%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0' parameters: @@ -20514,6 +20543,7 @@ paths: - Elastic Agent actions /api/fleet/agents/available_versions: get: + deprecated: false description: Get available agent versions operationId: '%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0' parameters: @@ -20560,6 +20590,7 @@ paths: - Elastic Agents /api/fleet/agents/bulk_reassign: post: + deprecated: false description: Bulk reassign agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0' parameters: @@ -20634,6 +20665,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_request_diagnostics: post: + deprecated: false description: Bulk request diagnostics from agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0' parameters: @@ -20708,6 +20740,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_unenroll: post: + deprecated: false description: Bulk unenroll agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0' parameters: @@ -20789,6 +20822,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_update_agent_tags: post: + deprecated: false description: Bulk update agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0' parameters: @@ -20868,6 +20902,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_upgrade: post: + deprecated: false description: Bulk upgrade agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0' parameters: @@ -20953,6 +20988,7 @@ paths: - Elastic Agent actions /api/fleet/agents/files/{fileId}: delete: + deprecated: false description: Delete file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0' parameters: @@ -21012,6 +21048,7 @@ paths: - Elastic Agents /api/fleet/agents/files/{fileId}/{fileName}: get: + deprecated: false description: Get file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0' parameters: @@ -21060,6 +21097,7 @@ paths: - Elastic Agents /api/fleet/agents/setup: get: + deprecated: false description: Get agent setup info operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#0' parameters: @@ -21131,6 +21169,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: Initiate agent setup operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#1' parameters: @@ -21201,6 +21240,7 @@ paths: - Elastic Agents /api/fleet/agents/tags: get: + deprecated: false description: List agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Ftags#0' parameters: @@ -21258,6 +21298,7 @@ paths: - Elastic Agents /api/fleet/check-permissions: get: + deprecated: false description: Check permissions operationId: '%2Fapi%2Ffleet%2Fcheck-permissions#0' parameters: @@ -21313,6 +21354,7 @@ paths: - Fleet internals /api/fleet/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fdata_streams#0' parameters: @@ -21418,6 +21460,7 @@ paths: - Data streams /api/fleet/enrollment_api_keys: get: + deprecated: false description: List enrollment API keys operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#0' parameters: @@ -21561,6 +21604,7 @@ paths: tags: - Fleet enrollment API keys post: + deprecated: false description: Create enrollment API key operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#1' parameters: @@ -21665,6 +21709,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment_api_keys/{keyId}: delete: + deprecated: false description: Revoke enrollment API key by ID by marking it as inactive operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1' parameters: @@ -21722,6 +21767,7 @@ paths: tags: - Fleet enrollment API keys get: + deprecated: false description: Get enrollment API key by ID operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0' parameters: @@ -21804,7 +21850,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -21836,7 +21882,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -21874,7 +21920,7 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -21901,7 +21947,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -21922,6 +21968,7 @@ paths: tags: [] /api/fleet/epm/bulk_assets: post: + deprecated: false description: Bulk get assets operationId: '%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0' parameters: @@ -22021,6 +22068,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/categories: get: + deprecated: false description: List package categories operationId: '%2Fapi%2Ffleet%2Fepm%2Fcategories#0' parameters: @@ -22119,6 +22167,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/custom_integrations: post: + deprecated: false description: Create custom integration operationId: '%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0' parameters: @@ -22315,6 +22364,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0' parameters: @@ -22398,6 +22448,7 @@ paths: - Data streams /api/fleet/epm/packages: get: + deprecated: false description: List packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#0' parameters: @@ -23152,6 +23203,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package by upload operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#1' parameters: @@ -23333,6 +23385,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/_bulk: post: + deprecated: false description: Bulk install packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0' parameters: @@ -23616,7 +23669,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -23655,7 +23708,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -23696,7 +23749,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -23752,7 +23805,7 @@ paths: summary: '' tags: [] put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -23791,6 +23844,7 @@ paths: tags: [] /api/fleet/epm/packages/{pkgName}/{pkgVersion}: delete: + deprecated: false description: Delete package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3' parameters: @@ -23971,6 +24025,7 @@ paths: tags: - Elastic Package Manager (EPM) get: + deprecated: false description: Get package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0' parameters: @@ -24856,6 +24911,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package from registry operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2' parameters: @@ -25059,6 +25115,7 @@ paths: tags: - Elastic Package Manager (EPM) put: + deprecated: false description: Update package settings operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1' parameters: @@ -25934,6 +25991,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}: get: + deprecated: false description: Get package file operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0 @@ -25987,6 +26045,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize: post: + deprecated: false description: Authorize transforms operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0 @@ -26081,6 +26140,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/stats: get: + deprecated: false description: Get package stats operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0' parameters: @@ -26136,6 +26196,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/installed: get: + deprecated: false description: Get installed packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0' parameters: @@ -26290,6 +26351,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/limited: get: + deprecated: false description: Get limited package list operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0' parameters: @@ -26341,6 +26403,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs: get: + deprecated: false description: Get inputs template operationId: >- %2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0 @@ -26450,6 +26513,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/verification_key_id: get: + deprecated: false description: Get a package signature verification key ID operationId: '%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0' parameters: @@ -26495,6 +26559,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/fleet_server_hosts: get: + deprecated: false description: List Fleet Server hosts operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#0' parameters: @@ -26575,6 +26640,7 @@ paths: tags: - Fleet Server hosts post: + deprecated: false description: Create Fleet Server host operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#1' parameters: @@ -26682,6 +26748,7 @@ paths: - Fleet Server hosts /api/fleet/fleet_server_hosts/{itemId}: delete: + deprecated: false description: Delete Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1' parameters: @@ -26737,6 +26804,7 @@ paths: tags: - Fleet Server hosts get: + deprecated: false description: Get Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0' parameters: @@ -26811,6 +26879,7 @@ paths: tags: - Fleet Server hosts put: + deprecated: false description: Update Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2' parameters: @@ -26916,6 +26985,7 @@ paths: - Fleet Server hosts /api/fleet/health_check: post: + deprecated: false description: Check Fleet Server health operationId: '%2Fapi%2Ffleet%2Fhealth_check#0' parameters: @@ -27004,6 +27074,7 @@ paths: - Fleet internals /api/fleet/kubernetes: get: + deprecated: false description: Get full K8s agent manifest operationId: '%2Fapi%2Ffleet%2Fkubernetes#0' parameters: @@ -27063,6 +27134,7 @@ paths: - Elastic Agent policies /api/fleet/kubernetes/download: get: + deprecated: false operationId: '%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0' parameters: - description: The version of the API to use @@ -27131,6 +27203,7 @@ paths: - Elastic Agent policies /api/fleet/logstash_api_keys: post: + deprecated: false description: Generate Logstash API key operationId: '%2Fapi%2Ffleet%2Flogstash_api_keys#0' parameters: @@ -27182,6 +27255,7 @@ paths: - Fleet outputs /api/fleet/message_signing_service/rotate_key_pair: post: + deprecated: false description: Rotate fleet message signing key pair operationId: '%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0' parameters: @@ -27255,6 +27329,7 @@ paths: - Message Signing Service /api/fleet/outputs: get: + deprecated: false description: List outputs operationId: '%2Fapi%2Ffleet%2Foutputs#0' parameters: @@ -28011,6 +28086,7 @@ paths: tags: - Fleet outputs post: + deprecated: false description: Create output operationId: '%2Fapi%2Ffleet%2Foutputs#1' parameters: @@ -29471,6 +29547,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}: delete: + deprecated: false description: Delete output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2' parameters: @@ -29542,6 +29619,7 @@ paths: tags: - Fleet outputs get: + deprecated: false description: Get output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0' parameters: @@ -30292,6 +30370,7 @@ paths: tags: - Fleet outputs put: + deprecated: false description: Update output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1' parameters: @@ -31736,6 +31815,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}/health: get: + deprecated: false description: Get latest output health operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0' parameters: @@ -31794,6 +31874,7 @@ paths: - Fleet outputs /api/fleet/package_policies: get: + deprecated: false description: List package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies#0' parameters: @@ -32299,6 +32380,7 @@ paths: tags: - Fleet package policies post: + deprecated: false description: Create package policy operationId: '%2Fapi%2Ffleet%2Fpackage_policies#1' parameters: @@ -33202,6 +33284,7 @@ paths: - Fleet package policies /api/fleet/package_policies/_bulk_get: post: + deprecated: false description: Bulk get package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0' parameters: @@ -33695,6 +33778,7 @@ paths: - Fleet package policies /api/fleet/package_policies/{packagePolicyId}: delete: + deprecated: false description: Delete package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2' parameters: @@ -33755,6 +33839,7 @@ paths: tags: - Fleet package policies get: + deprecated: false description: Get package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0' parameters: @@ -34224,6 +34309,7 @@ paths: tags: - Fleet package policies put: + deprecated: false description: Update package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1' parameters: @@ -35121,6 +35207,7 @@ paths: - Fleet package policies /api/fleet/package_policies/delete: post: + deprecated: false description: Bulk delete package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0' parameters: @@ -35258,6 +35345,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade: post: + deprecated: false description: Upgrade package policy to a newer package version operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0' parameters: @@ -35339,6 +35427,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade/dryrun: post: + deprecated: false description: Dry run package policy upgrade operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0' parameters: @@ -36189,6 +36278,7 @@ paths: - Fleet package policies /api/fleet/proxies: get: + deprecated: false description: List proxies operationId: '%2Fapi%2Ffleet%2Fproxies#0' parameters: @@ -36275,6 +36365,7 @@ paths: tags: - Fleet proxies post: + deprecated: false description: Create proxy operationId: '%2Fapi%2Ffleet%2Fproxies#1' parameters: @@ -36394,6 +36485,7 @@ paths: - Fleet proxies /api/fleet/proxies/{itemId}: delete: + deprecated: false description: Delete proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2' parameters: @@ -36449,6 +36541,7 @@ paths: tags: - Fleet proxies get: + deprecated: false description: Get proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1' parameters: @@ -36529,6 +36622,7 @@ paths: tags: - Fleet proxies put: + deprecated: false description: Update proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0' parameters: @@ -36650,6 +36744,7 @@ paths: - Fleet proxies /api/fleet/service_tokens: post: + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice_tokens#0' parameters: @@ -36715,7 +36810,7 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: @@ -36739,6 +36834,7 @@ paths: tags: [] /api/fleet/settings: get: + deprecated: false description: Get settings operationId: '%2Fapi%2Ffleet%2Fsettings#0' parameters: @@ -36838,6 +36934,7 @@ paths: tags: - Fleet internals put: + deprecated: false description: Update settings operationId: '%2Fapi%2Ffleet%2Fsettings#1' parameters: @@ -36981,6 +37078,7 @@ paths: - Fleet internals /api/fleet/setup: post: + deprecated: false description: Initiate Fleet setup operationId: '%2Fapi%2Ffleet%2Fsetup#0' parameters: @@ -37063,6 +37161,7 @@ paths: - Fleet internals /api/fleet/uninstall_tokens: get: + deprecated: false description: List metadata for latest uninstall tokens per agent policy operationId: '%2Fapi%2Ffleet%2Funinstall_tokens#0' parameters: @@ -37163,6 +37262,7 @@ paths: - Fleet uninstall tokens /api/fleet/uninstall_tokens/{uninstallTokenId}: get: + deprecated: false description: Get one decrypted uninstall token by its ID operationId: '%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0' parameters: @@ -40627,6 +40727,7 @@ paths: - Prompts API /api/security/role: get: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole#0' parameters: - description: The version of the API to use @@ -40648,6 +40749,7 @@ paths: - roles /api/security/role/{name}: delete: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#1' parameters: - description: The version of the API to use @@ -40676,6 +40778,7 @@ paths: tags: - roles get: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#0' parameters: - description: The version of the API to use @@ -40702,6 +40805,7 @@ paths: tags: - roles put: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#2' parameters: - description: The version of the API to use @@ -40892,6 +40996,7 @@ paths: - roles /api/security/roles: post: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Froles#0' parameters: - description: The version of the API to use @@ -41366,6 +41471,7 @@ paths: tags: [] /api/spaces/space: get: + deprecated: false description: Get all spaces operationId: '%2Fapi%2Fspaces%2Fspace#0' parameters: @@ -41410,6 +41516,7 @@ paths: tags: - spaces post: + deprecated: false description: Create a space operationId: '%2Fapi%2Fspaces%2Fspace#1' parameters: @@ -41472,6 +41579,7 @@ paths: - spaces /api/spaces/space/{id}: delete: + deprecated: false description: Delete a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2' parameters: @@ -41500,6 +41608,7 @@ paths: tags: - spaces get: + deprecated: false description: Get a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0' parameters: @@ -41521,6 +41630,7 @@ paths: tags: - spaces put: + deprecated: false description: Update a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1' parameters: diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index f32de75a62b26..a40f7fd2f5c6c 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -13397,6 +13397,7 @@ paths: - Security Exceptions API /api/fleet/agent_download_sources: get: + deprecated: false description: List agent binary download sources operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#0' parameters: @@ -13473,6 +13474,7 @@ paths: tags: - Elastic Agent binary download sources post: + deprecated: false description: Create agent binary download source operationId: '%2Fapi%2Ffleet%2Fagent_download_sources#1' parameters: @@ -13572,6 +13574,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_download_sources/{sourceId}: delete: + deprecated: false description: Delete agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#2' parameters: @@ -13627,6 +13630,7 @@ paths: tags: - Elastic Agent binary download sources get: + deprecated: false description: Get agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#0' parameters: @@ -13697,6 +13701,7 @@ paths: tags: - Elastic Agent binary download sources put: + deprecated: false description: Update agent binary download source by ID operationId: '%2Fapi%2Ffleet%2Fagent_download_sources%2F%7BsourceId%7D#1' parameters: @@ -13801,6 +13806,7 @@ paths: - Elastic Agent binary download sources /api/fleet/agent_policies: get: + deprecated: false description: List agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies#0' parameters: @@ -14406,6 +14412,7 @@ paths: tags: - Elastic Agent policies post: + deprecated: false description: Create an agent policy operationId: '%2Fapi%2Ffleet%2Fagent_policies#1' parameters: @@ -15141,6 +15148,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/_bulk_get: post: + deprecated: false description: Bulk get agent policies operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F_bulk_get#0' parameters: @@ -15721,6 +15729,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}: get: + deprecated: false description: Get an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#0' parameters: @@ -16277,6 +16286,7 @@ paths: tags: - Elastic Agent policies put: + deprecated: false description: Update an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D#1' parameters: @@ -17020,6 +17030,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/copy: post: + deprecated: false description: Copy an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fcopy#0' parameters: @@ -17598,6 +17609,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/download: get: + deprecated: false description: Download an agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Fdownload#0' parameters: @@ -17672,6 +17684,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/{agentPolicyId}/full: get: + deprecated: false description: Get a full agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2F%7BagentPolicyId%7D%2Ffull#0' parameters: @@ -18004,6 +18017,7 @@ paths: - Elastic Agent policies /api/fleet/agent_policies/delete: post: + deprecated: false description: Delete agent policy by ID operationId: '%2Fapi%2Ffleet%2Fagent_policies%2Fdelete#0' parameters: @@ -18074,6 +18088,7 @@ paths: - Elastic Agent policies /api/fleet/agent_status: get: + deprecated: false description: Get agent status summary operationId: '%2Fapi%2Ffleet%2Fagent_status#0' parameters: @@ -18175,6 +18190,7 @@ paths: - Elastic Agent status /api/fleet/agent_status/data: get: + deprecated: false description: Get incoming agent data operationId: '%2Fapi%2Ffleet%2Fagent_status%2Fdata#0' parameters: @@ -18248,7 +18264,7 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -18284,6 +18300,7 @@ paths: tags: [] /api/fleet/agents: get: + deprecated: false description: List agents operationId: '%2Fapi%2Ffleet%2Fagents#0' parameters: @@ -18949,6 +18966,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: List agents by action ids operationId: '%2Fapi%2Ffleet%2Fagents#1' parameters: @@ -19015,6 +19033,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}: delete: + deprecated: false description: Delete agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#2' parameters: @@ -19072,6 +19091,7 @@ paths: tags: - Elastic Agents get: + deprecated: false description: Get agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#0' parameters: @@ -19400,6 +19420,7 @@ paths: tags: - Elastic Agents put: + deprecated: false description: Update agent by ID operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D#1' parameters: @@ -19744,6 +19765,7 @@ paths: - Elastic Agents /api/fleet/agents/{agentId}/actions: post: + deprecated: false description: Create agent action operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Factions#0' parameters: @@ -19889,6 +19911,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/reassign: post: + deprecated: false description: Reassign agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#1' parameters: @@ -19951,7 +19974,7 @@ paths: tags: - Elastic Agent actions put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -19990,6 +20013,7 @@ paths: tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: + deprecated: false description: Request agent diagnostics operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Frequest_diagnostics#0' parameters: @@ -20060,6 +20084,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/unenroll: post: + deprecated: false description: Unenroll agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Funenroll#0' parameters: @@ -20101,6 +20126,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/upgrade: post: + deprecated: false description: Upgrade agent operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fupgrade#0' parameters: @@ -20170,6 +20196,7 @@ paths: - Elastic Agent actions /api/fleet/agents/{agentId}/uploads: get: + deprecated: false description: List agent uploads operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Fuploads#0' parameters: @@ -20251,6 +20278,7 @@ paths: - Elastic Agents /api/fleet/agents/action_status: get: + deprecated: false description: Get agent action status operationId: '%2Fapi%2Ffleet%2Fagents%2Faction_status#0' parameters: @@ -20419,6 +20447,7 @@ paths: - Elastic Agent actions /api/fleet/agents/actions/{actionId}/cancel: post: + deprecated: false description: Cancel agent action operationId: '%2Fapi%2Ffleet%2Fagents%2Factions%2F%7BactionId%7D%2Fcancel#0' parameters: @@ -20514,6 +20543,7 @@ paths: - Elastic Agent actions /api/fleet/agents/available_versions: get: + deprecated: false description: Get available agent versions operationId: '%2Fapi%2Ffleet%2Fagents%2Favailable_versions#0' parameters: @@ -20560,6 +20590,7 @@ paths: - Elastic Agents /api/fleet/agents/bulk_reassign: post: + deprecated: false description: Bulk reassign agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_reassign#0' parameters: @@ -20634,6 +20665,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_request_diagnostics: post: + deprecated: false description: Bulk request diagnostics from agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_request_diagnostics#0' parameters: @@ -20708,6 +20740,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_unenroll: post: + deprecated: false description: Bulk unenroll agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_unenroll#0' parameters: @@ -20789,6 +20822,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_update_agent_tags: post: + deprecated: false description: Bulk update agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_update_agent_tags#0' parameters: @@ -20868,6 +20902,7 @@ paths: - Elastic Agent actions /api/fleet/agents/bulk_upgrade: post: + deprecated: false description: Bulk upgrade agents operationId: '%2Fapi%2Ffleet%2Fagents%2Fbulk_upgrade#0' parameters: @@ -20953,6 +20988,7 @@ paths: - Elastic Agent actions /api/fleet/agents/files/{fileId}: delete: + deprecated: false description: Delete file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D#0' parameters: @@ -21012,6 +21048,7 @@ paths: - Elastic Agents /api/fleet/agents/files/{fileId}/{fileName}: get: + deprecated: false description: Get file uploaded by agent operationId: '%2Fapi%2Ffleet%2Fagents%2Ffiles%2F%7BfileId%7D%2F%7BfileName%7D#0' parameters: @@ -21060,6 +21097,7 @@ paths: - Elastic Agents /api/fleet/agents/setup: get: + deprecated: false description: Get agent setup info operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#0' parameters: @@ -21131,6 +21169,7 @@ paths: tags: - Elastic Agents post: + deprecated: false description: Initiate agent setup operationId: '%2Fapi%2Ffleet%2Fagents%2Fsetup#1' parameters: @@ -21201,6 +21240,7 @@ paths: - Elastic Agents /api/fleet/agents/tags: get: + deprecated: false description: List agent tags operationId: '%2Fapi%2Ffleet%2Fagents%2Ftags#0' parameters: @@ -21258,6 +21298,7 @@ paths: - Elastic Agents /api/fleet/check-permissions: get: + deprecated: false description: Check permissions operationId: '%2Fapi%2Ffleet%2Fcheck-permissions#0' parameters: @@ -21313,6 +21354,7 @@ paths: - Fleet internals /api/fleet/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fdata_streams#0' parameters: @@ -21418,6 +21460,7 @@ paths: - Data streams /api/fleet/enrollment_api_keys: get: + deprecated: false description: List enrollment API keys operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#0' parameters: @@ -21561,6 +21604,7 @@ paths: tags: - Fleet enrollment API keys post: + deprecated: false description: Create enrollment API key operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys#1' parameters: @@ -21665,6 +21709,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment_api_keys/{keyId}: delete: + deprecated: false description: Revoke enrollment API key by ID by marking it as inactive operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#1' parameters: @@ -21722,6 +21767,7 @@ paths: tags: - Fleet enrollment API keys get: + deprecated: false description: Get enrollment API key by ID operationId: '%2Fapi%2Ffleet%2Fenrollment_api_keys%2F%7BkeyId%7D#0' parameters: @@ -21804,7 +21850,7 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -21836,7 +21882,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -21874,7 +21920,7 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -21901,7 +21947,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -21922,6 +21968,7 @@ paths: tags: [] /api/fleet/epm/bulk_assets: post: + deprecated: false description: Bulk get assets operationId: '%2Fapi%2Ffleet%2Fepm%2Fbulk_assets#0' parameters: @@ -22021,6 +22068,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/categories: get: + deprecated: false description: List package categories operationId: '%2Fapi%2Ffleet%2Fepm%2Fcategories#0' parameters: @@ -22119,6 +22167,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/custom_integrations: post: + deprecated: false description: Create custom integration operationId: '%2Fapi%2Ffleet%2Fepm%2Fcustom_integrations#0' parameters: @@ -22315,6 +22364,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/data_streams: get: + deprecated: false description: List data streams operationId: '%2Fapi%2Ffleet%2Fepm%2Fdata_streams#0' parameters: @@ -22398,6 +22448,7 @@ paths: - Data streams /api/fleet/epm/packages: get: + deprecated: false description: List packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#0' parameters: @@ -23152,6 +23203,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package by upload operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages#1' parameters: @@ -23333,6 +23385,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/_bulk: post: + deprecated: false description: Bulk install packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F_bulk#0' parameters: @@ -23616,7 +23669,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -23655,7 +23708,7 @@ paths: summary: '' tags: [] get: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -23696,7 +23749,7 @@ paths: summary: '' tags: [] post: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -23752,7 +23805,7 @@ paths: summary: '' tags: [] put: - deprecated: true + deprecated: false operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -23791,6 +23844,7 @@ paths: tags: [] /api/fleet/epm/packages/{pkgName}/{pkgVersion}: delete: + deprecated: false description: Delete package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#3' parameters: @@ -23971,6 +24025,7 @@ paths: tags: - Elastic Package Manager (EPM) get: + deprecated: false description: Get package operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#0' parameters: @@ -24856,6 +24911,7 @@ paths: tags: - Elastic Package Manager (EPM) post: + deprecated: false description: Install package from registry operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#2' parameters: @@ -25059,6 +25115,7 @@ paths: tags: - Elastic Package Manager (EPM) put: + deprecated: false description: Update package settings operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D#1' parameters: @@ -25934,6 +25991,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/{filePath*}: get: + deprecated: false description: Get package file operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2F%7BfilePath*%7D#0 @@ -25987,6 +26045,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/{pkgVersion}/transforms/authorize: post: + deprecated: false description: Authorize transforms operationId: >- %2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Ftransforms%2Fauthorize#0 @@ -26081,6 +26140,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgName}/stats: get: + deprecated: false description: Get package stats operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7BpkgName%7D%2Fstats#0' parameters: @@ -26136,6 +26196,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/installed: get: + deprecated: false description: Get installed packages operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Finstalled#0' parameters: @@ -26290,6 +26351,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/limited: get: + deprecated: false description: Get limited package list operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2Flimited#0' parameters: @@ -26341,6 +26403,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/templates/{pkgName}/{pkgVersion}/inputs: get: + deprecated: false description: Get inputs template operationId: >- %2Fapi%2Ffleet%2Fepm%2Ftemplates%2F%7BpkgName%7D%2F%7BpkgVersion%7D%2Finputs#0 @@ -26450,6 +26513,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/verification_key_id: get: + deprecated: false description: Get a package signature verification key ID operationId: '%2Fapi%2Ffleet%2Fepm%2Fverification_key_id#0' parameters: @@ -26495,6 +26559,7 @@ paths: - Elastic Package Manager (EPM) /api/fleet/fleet_server_hosts: get: + deprecated: false description: List Fleet Server hosts operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#0' parameters: @@ -26575,6 +26640,7 @@ paths: tags: - Fleet Server hosts post: + deprecated: false description: Create Fleet Server host operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts#1' parameters: @@ -26682,6 +26748,7 @@ paths: - Fleet Server hosts /api/fleet/fleet_server_hosts/{itemId}: delete: + deprecated: false description: Delete Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#1' parameters: @@ -26737,6 +26804,7 @@ paths: tags: - Fleet Server hosts get: + deprecated: false description: Get Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#0' parameters: @@ -26811,6 +26879,7 @@ paths: tags: - Fleet Server hosts put: + deprecated: false description: Update Fleet Server host by ID operationId: '%2Fapi%2Ffleet%2Ffleet_server_hosts%2F%7BitemId%7D#2' parameters: @@ -26916,6 +26985,7 @@ paths: - Fleet Server hosts /api/fleet/health_check: post: + deprecated: false description: Check Fleet Server health operationId: '%2Fapi%2Ffleet%2Fhealth_check#0' parameters: @@ -27004,6 +27074,7 @@ paths: - Fleet internals /api/fleet/kubernetes: get: + deprecated: false description: Get full K8s agent manifest operationId: '%2Fapi%2Ffleet%2Fkubernetes#0' parameters: @@ -27063,6 +27134,7 @@ paths: - Elastic Agent policies /api/fleet/kubernetes/download: get: + deprecated: false operationId: '%2Fapi%2Ffleet%2Fkubernetes%2Fdownload#0' parameters: - description: The version of the API to use @@ -27131,6 +27203,7 @@ paths: - Elastic Agent policies /api/fleet/logstash_api_keys: post: + deprecated: false description: Generate Logstash API key operationId: '%2Fapi%2Ffleet%2Flogstash_api_keys#0' parameters: @@ -27182,6 +27255,7 @@ paths: - Fleet outputs /api/fleet/message_signing_service/rotate_key_pair: post: + deprecated: false description: Rotate fleet message signing key pair operationId: '%2Fapi%2Ffleet%2Fmessage_signing_service%2Frotate_key_pair#0' parameters: @@ -27255,6 +27329,7 @@ paths: - Message Signing Service /api/fleet/outputs: get: + deprecated: false description: List outputs operationId: '%2Fapi%2Ffleet%2Foutputs#0' parameters: @@ -28011,6 +28086,7 @@ paths: tags: - Fleet outputs post: + deprecated: false description: Create output operationId: '%2Fapi%2Ffleet%2Foutputs#1' parameters: @@ -29471,6 +29547,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}: delete: + deprecated: false description: Delete output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#2' parameters: @@ -29542,6 +29619,7 @@ paths: tags: - Fleet outputs get: + deprecated: false description: Get output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#0' parameters: @@ -30292,6 +30370,7 @@ paths: tags: - Fleet outputs put: + deprecated: false description: Update output by ID operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D#1' parameters: @@ -31736,6 +31815,7 @@ paths: - Fleet outputs /api/fleet/outputs/{outputId}/health: get: + deprecated: false description: Get latest output health operationId: '%2Fapi%2Ffleet%2Foutputs%2F%7BoutputId%7D%2Fhealth#0' parameters: @@ -31794,6 +31874,7 @@ paths: - Fleet outputs /api/fleet/package_policies: get: + deprecated: false description: List package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies#0' parameters: @@ -32299,6 +32380,7 @@ paths: tags: - Fleet package policies post: + deprecated: false description: Create package policy operationId: '%2Fapi%2Ffleet%2Fpackage_policies#1' parameters: @@ -33202,6 +33284,7 @@ paths: - Fleet package policies /api/fleet/package_policies/_bulk_get: post: + deprecated: false description: Bulk get package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F_bulk_get#0' parameters: @@ -33695,6 +33778,7 @@ paths: - Fleet package policies /api/fleet/package_policies/{packagePolicyId}: delete: + deprecated: false description: Delete package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#2' parameters: @@ -33755,6 +33839,7 @@ paths: tags: - Fleet package policies get: + deprecated: false description: Get package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#0' parameters: @@ -34224,6 +34309,7 @@ paths: tags: - Fleet package policies put: + deprecated: false description: Update package policy by ID operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2F%7BpackagePolicyId%7D#1' parameters: @@ -35121,6 +35207,7 @@ paths: - Fleet package policies /api/fleet/package_policies/delete: post: + deprecated: false description: Bulk delete package policies operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fdelete#0' parameters: @@ -35258,6 +35345,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade: post: + deprecated: false description: Upgrade package policy to a newer package version operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade#0' parameters: @@ -35339,6 +35427,7 @@ paths: - Fleet package policies /api/fleet/package_policies/upgrade/dryrun: post: + deprecated: false description: Dry run package policy upgrade operationId: '%2Fapi%2Ffleet%2Fpackage_policies%2Fupgrade%2Fdryrun#0' parameters: @@ -36189,6 +36278,7 @@ paths: - Fleet package policies /api/fleet/proxies: get: + deprecated: false description: List proxies operationId: '%2Fapi%2Ffleet%2Fproxies#0' parameters: @@ -36275,6 +36365,7 @@ paths: tags: - Fleet proxies post: + deprecated: false description: Create proxy operationId: '%2Fapi%2Ffleet%2Fproxies#1' parameters: @@ -36394,6 +36485,7 @@ paths: - Fleet proxies /api/fleet/proxies/{itemId}: delete: + deprecated: false description: Delete proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#2' parameters: @@ -36449,6 +36541,7 @@ paths: tags: - Fleet proxies get: + deprecated: false description: Get proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#1' parameters: @@ -36529,6 +36622,7 @@ paths: tags: - Fleet proxies put: + deprecated: false description: Update proxy by ID operationId: '%2Fapi%2Ffleet%2Fproxies%2F%7BitemId%7D#0' parameters: @@ -36650,6 +36744,7 @@ paths: - Fleet proxies /api/fleet/service_tokens: post: + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice_tokens#0' parameters: @@ -36715,7 +36810,7 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true + deprecated: false description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: @@ -36739,6 +36834,7 @@ paths: tags: [] /api/fleet/settings: get: + deprecated: false description: Get settings operationId: '%2Fapi%2Ffleet%2Fsettings#0' parameters: @@ -36838,6 +36934,7 @@ paths: tags: - Fleet internals put: + deprecated: false description: Update settings operationId: '%2Fapi%2Ffleet%2Fsettings#1' parameters: @@ -36981,6 +37078,7 @@ paths: - Fleet internals /api/fleet/setup: post: + deprecated: false description: Initiate Fleet setup operationId: '%2Fapi%2Ffleet%2Fsetup#0' parameters: @@ -37063,6 +37161,7 @@ paths: - Fleet internals /api/fleet/uninstall_tokens: get: + deprecated: false description: List metadata for latest uninstall tokens per agent policy operationId: '%2Fapi%2Ffleet%2Funinstall_tokens#0' parameters: @@ -37163,6 +37262,7 @@ paths: - Fleet uninstall tokens /api/fleet/uninstall_tokens/{uninstallTokenId}: get: + deprecated: false description: Get one decrypted uninstall token by its ID operationId: '%2Fapi%2Ffleet%2Funinstall_tokens%2F%7BuninstallTokenId%7D#0' parameters: @@ -40627,6 +40727,7 @@ paths: - Prompts API /api/security/role: get: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole#0' parameters: - description: The version of the API to use @@ -40648,6 +40749,7 @@ paths: - roles /api/security/role/{name}: delete: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#1' parameters: - description: The version of the API to use @@ -40676,6 +40778,7 @@ paths: tags: - roles get: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#0' parameters: - description: The version of the API to use @@ -40702,6 +40805,7 @@ paths: tags: - roles put: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Frole%2F%7Bname%7D#2' parameters: - description: The version of the API to use @@ -40892,6 +40996,7 @@ paths: - roles /api/security/roles: post: + deprecated: false operationId: '%2Fapi%2Fsecurity%2Froles#0' parameters: - description: The version of the API to use @@ -41366,6 +41471,7 @@ paths: tags: [] /api/spaces/space: get: + deprecated: false description: Get all spaces operationId: '%2Fapi%2Fspaces%2Fspace#0' parameters: @@ -41410,6 +41516,7 @@ paths: tags: - spaces post: + deprecated: false description: Create a space operationId: '%2Fapi%2Fspaces%2Fspace#1' parameters: @@ -41472,6 +41579,7 @@ paths: - spaces /api/spaces/space/{id}: delete: + deprecated: false description: Delete a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#2' parameters: @@ -41500,6 +41608,7 @@ paths: tags: - spaces get: + deprecated: false description: Get a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#0' parameters: @@ -41521,6 +41630,7 @@ paths: tags: - spaces put: + deprecated: false description: Update a space operationId: '%2Fapi%2Fspaces%2Fspace%2F%7Bid%7D#1' parameters: From e34ccc117b87a5c4ed14ae5cb4311654bc8e27ec Mon Sep 17 00:00:00 2001 From: Bamieh Date: Thu, 17 Oct 2024 18:03:35 +0300 Subject: [PATCH 13/27] tina code reviews --- .../src/core_usage_data_service.ts | 2 +- .../src/core_usage_stats_client.ts | 4 ++-- packages/core/usage-data/core-usage-data-server/index.ts | 1 + .../core/usage-data/core-usage-data-server/src/index.ts | 1 + .../server/collectors/core/fetch_deprecated_api_counters.ts | 6 +++--- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts index b1117934348e7..7ac7cbb7fbb57 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.ts @@ -37,6 +37,7 @@ import type { CoreConfigUsageData, CoreIncrementCounterParams, CoreUsageCounter, + DeprecatedApiUsageFetcher, } from '@kbn/core-usage-data-server'; import { CORE_USAGE_STATS_TYPE, @@ -49,7 +50,6 @@ import { } from '@kbn/core-saved-objects-server'; import { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; -import { DeprecatedApiUsageFetcher } from '@kbn/core-usage-data-server/src/setup_contract'; import { isConfigured } from './is_configured'; import { coreUsageStatsType } from './saved_objects'; import { CoreUsageStatsClient } from './core_usage_stats_client'; diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts index c7a4134b35dbf..f69b7597626d0 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts @@ -37,7 +37,7 @@ import { takeUntil, tap, } from 'rxjs'; -import { DeprecatedApiUsageFetcher } from '@kbn/core-usage-data-server/src/setup_contract'; +import type { DeprecatedApiUsageFetcher } from '@kbn/core-usage-data-server'; export const BULK_CREATE_STATS_PREFIX = 'apiCalls.savedObjectsBulkCreate'; export const BULK_GET_STATS_PREFIX = 'apiCalls.savedObjectsBulkGet'; @@ -110,7 +110,7 @@ export interface CoreUsageEvent { } /** - * Interface that models some of the core events (e.g. SO HTTP API calls) + * Interface that models core events triggered by API deprecations. (e.g. SO HTTP API calls) * @internal */ export interface CoreUsageDeprecatedApiEvent { diff --git a/packages/core/usage-data/core-usage-data-server/index.ts b/packages/core/usage-data/core-usage-data-server/index.ts index 77221ec937ab0..45ed369ca8381 100644 --- a/packages/core/usage-data/core-usage-data-server/index.ts +++ b/packages/core/usage-data/core-usage-data-server/index.ts @@ -20,4 +20,5 @@ export type { CoreServicesUsageData, CoreUsageStats, CoreDeprecatedApiUsageStats, + DeprecatedApiUsageFetcher, } from './src'; diff --git a/packages/core/usage-data/core-usage-data-server/src/index.ts b/packages/core/usage-data/core-usage-data-server/src/index.ts index 5d4bbcfc64bbc..05d0f02500053 100644 --- a/packages/core/usage-data/core-usage-data-server/src/index.ts +++ b/packages/core/usage-data/core-usage-data-server/src/index.ts @@ -18,5 +18,6 @@ export type { CoreUsageCounter, CoreIncrementUsageCounter, CoreIncrementCounterParams, + DeprecatedApiUsageFetcher, } from './setup_contract'; export type { CoreUsageData, ConfigUsageData, CoreUsageDataStart } from './start_contract'; diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts index 0057a07d86900..9b930294156f1 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts @@ -7,11 +7,11 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { Logger } from '@kbn/logging'; +import type { Logger } from '@kbn/logging'; +import type { CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; import { USAGE_COUNTERS_SAVED_OBJECT_TYPE } from '@kbn/usage-collection-plugin/server'; -import { CoreDeprecatedApiUsageStats } from '@kbn/core-usage-data-server'; -import { createCounterFetcher, CounterEvent } from '../common/counters'; +import { createCounterFetcher, type CounterEvent } from '../common/counters'; const DEPRECATED_API_COUNTERS_FILTER = `${USAGE_COUNTERS_SAVED_OBJECT_TYPE}.attributes.counterType: deprecated_api_call\\:*`; From 309b35aa00b3b600489b797e72500d6cc28db93a Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 20 Oct 2024 13:58:39 +0300 Subject: [PATCH 14/27] openApi spec fixes --- .../src/routes/resolve_deprecated_api.ts | 2 +- .../core-http-router-server-internal/src/router.ts | 2 +- .../versioned_router/core_versioned_route.test.ts | 2 +- .../versioned_router/core_versioned_router.test.ts | 3 +++ .../src/versioned_router/mocks.ts | 1 + .../core/http/core-http-server/src/router/route.ts | 2 +- .../http/core-http-server/src/versioning/types.ts | 2 +- .../src/__snapshots__/generate_oas.test.ts.snap | 1 + .../src/generate_oas.test.ts | 2 +- .../src/generate_oas.test.util.ts | 14 +++++++++++--- .../src/process_router.ts | 4 +++- .../src/process_versioned_router.test.ts | 8 +++++--- .../src/process_versioned_router.ts | 4 +++- 13 files changed, 33 insertions(+), 14 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts index c087d94920041..840bc5ac22d23 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/routes/resolve_deprecated_api.ts @@ -18,7 +18,7 @@ export const registerMarkAsResolvedRoute = ( ) => { router.post( { - path: '/mark_as_resolved/', + path: '/mark_as_resolved', validate: { body: schema.object({ domainId: schema.string(), diff --git a/packages/core/http/core-http-router-server-internal/src/router.ts b/packages/core/http/core-http-router-server-internal/src/router.ts index 6f0d1c2f2920e..7a0eaa1bc565c 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.ts @@ -175,7 +175,7 @@ export type InternalRegistrar { expect(router.post).toHaveBeenCalledWith( expect.objectContaining(expectedRouteConfig), expect.any(Function), - { isVersioned: true } + { isVersioned: true, events: false } ); }); diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts index 1a0237216379f..a3ffffc0ef219 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_router.test.ts @@ -49,6 +49,7 @@ describe('Versioned router', () => { Array [ Object { "handlers": Array [], + "isVersioned": true, "method": "get", "options": Object { "access": "internal", @@ -58,6 +59,7 @@ describe('Versioned router', () => { }, Object { "handlers": Array [], + "isVersioned": true, "method": "post", "options": Object { "access": "internal", @@ -68,6 +70,7 @@ describe('Versioned router', () => { }, Object { "handlers": Array [], + "isVersioned": true, "method": "delete", "options": Object { "access": "internal", diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/mocks.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/mocks.ts index 5a958fa9251f7..36a672ca6a9f7 100644 --- a/packages/core/http/core-http-router-server-internal/src/versioned_router/mocks.ts +++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/mocks.ts @@ -20,6 +20,7 @@ export function createRouter(opts: CreateMockRouterOptions = {}) { put: jest.fn(), getRoutes: jest.fn(), handleLegacyErrors: jest.fn(), + emitPostValidate: jest.fn(), patch: jest.fn(), routerPath: '', versioned: {} as any, diff --git a/packages/core/http/core-http-server/src/router/route.ts b/packages/core/http/core-http-server/src/router/route.ts index 0838ae684ac92..20929f0413aad 100644 --- a/packages/core/http/core-http-server/src/router/route.ts +++ b/packages/core/http/core-http-server/src/router/route.ts @@ -320,7 +320,7 @@ export interface RouteConfigOptions { * of the Elastic stack (via Upgrade Assistant) and will be surfaced in documentation * created from HTTP API introspection (like OAS). * - * Seting this object marks the route as deprecated. + * Setting this object marks the route as deprecated. * * @remarks This may be surfaced in OAS documentation. * @public diff --git a/packages/core/http/core-http-server/src/versioning/types.ts b/packages/core/http/core-http-server/src/versioning/types.ts index 73679854471ec..47ca2fd064322 100644 --- a/packages/core/http/core-http-server/src/versioning/types.ts +++ b/packages/core/http/core-http-server/src/versioning/types.ts @@ -340,7 +340,7 @@ export interface AddVersionOpts { security?: Exclude['security'], undefined>; options?: { - deprecated: RouteDeprecationInfo; + deprecated?: RouteDeprecationInfo; }; } diff --git a/packages/kbn-router-to-openapispec/src/__snapshots__/generate_oas.test.ts.snap b/packages/kbn-router-to-openapispec/src/__snapshots__/generate_oas.test.ts.snap index 818c0502ad774..fef935624ae64 100644 --- a/packages/kbn-router-to-openapispec/src/__snapshots__/generate_oas.test.ts.snap +++ b/packages/kbn-router-to-openapispec/src/__snapshots__/generate_oas.test.ts.snap @@ -572,6 +572,7 @@ OK response oas-test-version-2", }, "/no-xsrf/{id}/{path*}": Object { "post": Object { + "deprecated": true, "operationId": "%2Fno-xsrf%2F%7Bid%7D%2F%7Bpath*%7D#1", "parameters": Array [ Object { diff --git a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts index 521e0fe23bc66..b09dc80bd73b0 100644 --- a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts +++ b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts @@ -189,6 +189,7 @@ describe('generateOpenApiDocument', () => { versionedRouters: { testVersionedRouter: { routes: [{}] } }, bodySchema: createSharedZodSchema(), }); + expect( generateOpenApiDocument( { @@ -239,7 +240,6 @@ describe('generateOpenApiDocument', () => { routes: [ { method: 'get', - isVersioned: true, path: '/test', options: { access: 'public' }, handlers: [ diff --git a/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts b/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts index 4eef12efd24d7..a39afb6357bfc 100644 --- a/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts +++ b/packages/kbn-router-to-openapispec/src/generate_oas.test.util.ts @@ -10,6 +10,7 @@ import type { ZodType } from '@kbn/zod'; import { schema, Type } from '@kbn/config-schema'; import type { CoreVersionedRouter, Router } from '@kbn/core-http-router-server-internal'; +import type { RouterRoute, VersionedRouterRoute } from '@kbn/core-http-server'; import { createLargeSchema } from './oas_converter/kbn_config_schema/lib.test.util'; type RoutesMeta = ReturnType[number]; @@ -27,7 +28,7 @@ export const createVersionedRouter = (args: { routes: VersionedRoutesMeta[] }) = } as unknown as CoreVersionedRouter; }; -export const getRouterDefaults = (bodySchema?: RuntimeSchema) => ({ +export const getRouterDefaults = (bodySchema?: RuntimeSchema): RouterRoute => ({ isVersioned: false, path: '/foo/{id}/{path*}', method: 'get', @@ -57,10 +58,9 @@ export const getRouterDefaults = (bodySchema?: RuntimeSchema) => ({ handler: jest.fn(), }); -export const getVersionedRouterDefaults = (bodySchema?: RuntimeSchema) => ({ +export const getVersionedRouterDefaults = (bodySchema?: RuntimeSchema): VersionedRouterRoute => ({ method: 'get', path: '/bar', - isVersioned: true, options: { summary: 'versioned route', access: 'public', @@ -69,10 +69,18 @@ export const getVersionedRouterDefaults = (bodySchema?: RuntimeSchema) => ({ tags: ['ignore-me', 'oas-tag:versioned'], }, }, + isVersioned: true, handlers: [ { fn: jest.fn(), options: { + options: { + deprecated: { + documentationUrl: 'https://fake-url', + reason: { type: 'remove' }, + severity: 'critical', + }, + }, validate: { request: { body: diff --git a/packages/kbn-router-to-openapispec/src/process_router.ts b/packages/kbn-router-to-openapispec/src/process_router.ts index 78d46d721abd4..451bdc3ca8cd5 100644 --- a/packages/kbn-router-to-openapispec/src/process_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_router.ts @@ -61,11 +61,13 @@ export const processRouter = ( parameters.push(...pathObjects, ...queryObjects); } + // If any route is deprecated we show deprecated: true in the spec + const hasDeprecations = !!routes.some(({ options }) => options.deprecated); const operation: OpenAPIV3.OperationObject = { summary: route.options.summary ?? '', tags: route.options.tags ? extractTags(route.options.tags) : [], ...(route.options.description ? { description: route.options.description } : {}), - ...(route.options.deprecated ? { deprecated: !!route.options.deprecated } : {}), + ...(hasDeprecations ? { deprecated: true } : {}), ...(route.options.discontinued ? { 'x-discontinued': route.options.discontinued } : {}), requestBody: !!validationSchemas?.body ? { diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts index 8688b3a06adb4..6452c2cf3c2cc 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts @@ -8,7 +8,10 @@ */ import { schema } from '@kbn/config-schema'; -import type { CoreVersionedRouter } from '@kbn/core-http-router-server-internal'; +import type { + CoreVersionedRouter, + VersionedRouterRoute, +} from '@kbn/core-http-router-server-internal'; import { get } from 'lodash'; import { OasConverter } from './oas_converter'; import { createOperationIdCounter } from './operation_id_counter'; @@ -17,7 +20,6 @@ import { extractVersionedResponses, extractVersionedRequestBodies, } from './process_versioned_router'; -import { VersionedRouterRoute } from '@kbn/core-http-server'; let oasConverter: OasConverter; beforeEach(() => { @@ -149,9 +151,9 @@ describe('processVersionedRouter', () => { const createTestRoute: () => VersionedRouterRoute = () => ({ path: '/foo', method: 'get', - isVersioned: true, options: { access: 'public', + deprecated: true, discontinued: 'discontinued versioned router', options: { body: { access: ['application/test+json'] } as any }, }, diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts index f71523e861c6b..79953ae691b4e 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.ts @@ -92,11 +92,13 @@ export const processVersionedRouter = ( const hasBody = Boolean(extractValidationSchemaFromVersionedHandler(handler)?.request?.body); const contentType = extractContentType(route.options.options?.body); const hasVersionFilter = Boolean(filters?.version); + // If any handler is deprecated we show deprecated: true in the spec + const hasDeprecations = route.handlers.some(({ options }) => !!options.options?.deprecated); const operation: OpenAPIV3.OperationObject = { summary: route.options.summary ?? '', tags: route.options.options?.tags ? extractTags(route.options.options.tags) : [], ...(route.options.description ? { description: route.options.description } : {}), - ...{ deprecated: route.handlers.some(({ options }) => options.options?.deprecated) }, + ...(hasDeprecations ? { deprecated: true } : {}), ...(route.options.discontinued ? { 'x-discontinued': route.options.discontinued } : {}), requestBody: hasBody ? { From 098e0a8022b9a373fe480e83c6f08fc056d4b11e Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 20 Oct 2024 14:31:08 +0300 Subject: [PATCH 15/27] finalize open spec --- packages/kbn-router-to-openapispec/src/process_router.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/kbn-router-to-openapispec/src/process_router.ts b/packages/kbn-router-to-openapispec/src/process_router.ts index 451bdc3ca8cd5..bcd80b7a97e0f 100644 --- a/packages/kbn-router-to-openapispec/src/process_router.ts +++ b/packages/kbn-router-to-openapispec/src/process_router.ts @@ -61,8 +61,7 @@ export const processRouter = ( parameters.push(...pathObjects, ...queryObjects); } - // If any route is deprecated we show deprecated: true in the spec - const hasDeprecations = !!routes.some(({ options }) => options.deprecated); + const hasDeprecations = !!route.options.deprecated; const operation: OpenAPIV3.OperationObject = { summary: route.options.summary ?? '', tags: route.options.tags ? extractTags(route.options.tags) : [], From f1dc0bb0e3fbb987e1df20995072a3eb167384b8 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:07:28 +0000 Subject: [PATCH 16/27] [CI] Auto-commit changed files from 'node scripts/capture_oas_snapshot --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/fleet --update' --- oas_docs/bundle.json | 11 ----------- oas_docs/bundle.serverless.json | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index ca864dd0bcc63..99e875a148e97 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -6409,7 +6409,6 @@ }, "/api/fleet/agent-status": { "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fagent-status#0", "parameters": [ { @@ -17124,7 +17123,6 @@ ] }, "put": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0", "parameters": [ { @@ -17824,7 +17822,6 @@ }, "/api/fleet/enrollment-api-keys": { "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#0", "parameters": [ { @@ -17871,7 +17868,6 @@ "tags": [] }, "post": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#1", "parameters": [ { @@ -17928,7 +17924,6 @@ }, "/api/fleet/enrollment-api-keys/{keyId}": { "delete": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1", "parameters": [ { @@ -17967,7 +17962,6 @@ "tags": [] }, "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0", "parameters": [ { @@ -24698,7 +24692,6 @@ }, "/api/fleet/epm/packages/{pkgkey}": { "delete": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3", "parameters": [ { @@ -24756,7 +24749,6 @@ "tags": [] }, "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0", "parameters": [ { @@ -24818,7 +24810,6 @@ "tags": [] }, "post": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2", "parameters": [ { @@ -24902,7 +24893,6 @@ "tags": [] }, "put": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1", "parameters": [ { @@ -40117,7 +40107,6 @@ }, "/api/fleet/service-tokens": { "post": { - "deprecated": true, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice-tokens#0", "parameters": [ diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index fd41029331181..755d7007890cc 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -6409,7 +6409,6 @@ }, "/api/fleet/agent-status": { "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fagent-status#0", "parameters": [ { @@ -17124,7 +17123,6 @@ ] }, "put": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0", "parameters": [ { @@ -17824,7 +17822,6 @@ }, "/api/fleet/enrollment-api-keys": { "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#0", "parameters": [ { @@ -17871,7 +17868,6 @@ "tags": [] }, "post": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys#1", "parameters": [ { @@ -17928,7 +17924,6 @@ }, "/api/fleet/enrollment-api-keys/{keyId}": { "delete": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1", "parameters": [ { @@ -17967,7 +17962,6 @@ "tags": [] }, "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0", "parameters": [ { @@ -24698,7 +24692,6 @@ }, "/api/fleet/epm/packages/{pkgkey}": { "delete": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3", "parameters": [ { @@ -24756,7 +24749,6 @@ "tags": [] }, "get": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0", "parameters": [ { @@ -24818,7 +24810,6 @@ "tags": [] }, "post": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2", "parameters": [ { @@ -24902,7 +24893,6 @@ "tags": [] }, "put": { - "deprecated": true, "operationId": "%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1", "parameters": [ { @@ -40117,7 +40107,6 @@ }, "/api/fleet/service-tokens": { "post": { - "deprecated": true, "description": "Create a service token", "operationId": "%2Fapi%2Ffleet%2Fservice-tokens#0", "parameters": [ From 4626672d9bf07055ef8a474fd61e410f93f5e089 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:49:00 +0000 Subject: [PATCH 17/27] [CI] Auto-commit changed files from 'make api-docs && make api-docs-staging' --- oas_docs/output/kibana.serverless.staging.yaml | 11 ----------- oas_docs/output/kibana.serverless.yaml | 11 ----------- oas_docs/output/kibana.staging.yaml | 11 ----------- oas_docs/output/kibana.yaml | 11 ----------- 4 files changed, 44 deletions(-) diff --git a/oas_docs/output/kibana.serverless.staging.yaml b/oas_docs/output/kibana.serverless.staging.yaml index acbbdd7bfca43..006f5fc838874 100644 --- a/oas_docs/output/kibana.serverless.staging.yaml +++ b/oas_docs/output/kibana.serverless.staging.yaml @@ -14831,7 +14831,6 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -16534,7 +16533,6 @@ paths: tags: - Elastic Agent actions put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -18387,7 +18385,6 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -18419,7 +18416,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -18457,7 +18453,6 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -18484,7 +18479,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -20199,7 +20193,6 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -20238,7 +20231,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -20279,7 +20271,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -20335,7 +20326,6 @@ paths: summary: '' tags: [] put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -33298,7 +33288,6 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index acbbdd7bfca43..006f5fc838874 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -14831,7 +14831,6 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -16534,7 +16533,6 @@ paths: tags: - Elastic Agent actions put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -18387,7 +18385,6 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -18419,7 +18416,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -18457,7 +18453,6 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -18484,7 +18479,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -20199,7 +20193,6 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -20238,7 +20231,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -20279,7 +20271,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -20335,7 +20326,6 @@ paths: summary: '' tags: [] put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -33298,7 +33288,6 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: diff --git a/oas_docs/output/kibana.staging.yaml b/oas_docs/output/kibana.staging.yaml index 827f453683bca..7d4e065ecfbd4 100644 --- a/oas_docs/output/kibana.staging.yaml +++ b/oas_docs/output/kibana.staging.yaml @@ -18260,7 +18260,6 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -19963,7 +19962,6 @@ paths: tags: - Elastic Agent actions put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -21816,7 +21814,6 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -21848,7 +21845,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -21886,7 +21882,6 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -21913,7 +21908,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -23628,7 +23622,6 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -23667,7 +23660,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -23708,7 +23700,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -23764,7 +23755,6 @@ paths: summary: '' tags: [] put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -36727,7 +36717,6 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 827f453683bca..7d4e065ecfbd4 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -18260,7 +18260,6 @@ paths: - Elastic Agents /api/fleet/agent-status: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagent-status#0' parameters: - description: The version of the API to use @@ -19963,7 +19962,6 @@ paths: tags: - Elastic Agent actions put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fagents%2F%7BagentId%7D%2Freassign#0' parameters: - description: The version of the API to use @@ -21816,7 +21814,6 @@ paths: - Fleet enrollment API keys /api/fleet/enrollment-api-keys: get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#0' parameters: - description: The version of the API to use @@ -21848,7 +21845,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys#1' parameters: - description: The version of the API to use @@ -21886,7 +21882,6 @@ paths: tags: [] /api/fleet/enrollment-api-keys/{keyId}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#1' parameters: - description: The version of the API to use @@ -21913,7 +21908,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fenrollment-api-keys%2F%7BkeyId%7D#0' parameters: - description: The version of the API to use @@ -23628,7 +23622,6 @@ paths: - Elastic Package Manager (EPM) /api/fleet/epm/packages/{pkgkey}: delete: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#3' parameters: - description: The version of the API to use @@ -23667,7 +23660,6 @@ paths: summary: '' tags: [] get: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#0' parameters: - description: The version of the API to use @@ -23708,7 +23700,6 @@ paths: summary: '' tags: [] post: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#2' parameters: - description: The version of the API to use @@ -23764,7 +23755,6 @@ paths: summary: '' tags: [] put: - deprecated: true operationId: '%2Fapi%2Ffleet%2Fepm%2Fpackages%2F%7Bpkgkey%7D#1' parameters: - description: The version of the API to use @@ -36727,7 +36717,6 @@ paths: - Fleet service tokens /api/fleet/service-tokens: post: - deprecated: true description: Create a service token operationId: '%2Fapi%2Ffleet%2Fservice-tokens#0' parameters: From 15eaa474413c0257b616ad5aae63c36d3e20d9a3 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 20 Oct 2024 15:50:57 +0300 Subject: [PATCH 18/27] deprecated routes example --- examples/routing_example/common/index.ts | 6 ++ examples/routing_example/server/plugin.ts | 3 +- .../server/routes/deprecated_routes/index.ts | 17 +++++ .../routes/deprecated_routes/unversioned.ts | 62 +++++++++++++++++++ .../routes/deprecated_routes/versioned.ts | 53 ++++++++++++++++ .../routing_example/server/routes/index.ts | 1 + .../src/deprecations_client.ts | 2 +- .../src/router.ts | 2 +- .../src/http_server.ts | 4 +- .../src/core_usage_stats_client.ts | 9 +++ .../src/generate_oas.test.ts | 1 + .../src/process_versioned_router.test.ts | 7 +-- 12 files changed, 158 insertions(+), 9 deletions(-) create mode 100644 examples/routing_example/server/routes/deprecated_routes/index.ts create mode 100644 examples/routing_example/server/routes/deprecated_routes/unversioned.ts create mode 100644 examples/routing_example/server/routes/deprecated_routes/versioned.ts diff --git a/examples/routing_example/common/index.ts b/examples/routing_example/common/index.ts index c86a994f469f1..b83582b66ff08 100644 --- a/examples/routing_example/common/index.ts +++ b/examples/routing_example/common/index.ts @@ -15,3 +15,9 @@ export const POST_MESSAGE_ROUTE_PATH = '/api/post_message'; // Internal APIs should use the `internal` prefix, instead of the `api` prefix. export const INTERNAL_GET_MESSAGE_BY_ID_ROUTE = '/internal/get_message'; + +export const DEPRECATED_ROUTES = { + REMOVED_ROUTE: '/api/routing_example/d/removed_route', + MIGRATED_ROUTE: '/api/routing_example/d/migrated_route', + VERSIONED_ROUTE: '/api/routing_example/d/versioned', +}; diff --git a/examples/routing_example/server/plugin.ts b/examples/routing_example/server/plugin.ts index cb6a00920dd05..d4036afc58b5b 100644 --- a/examples/routing_example/server/plugin.ts +++ b/examples/routing_example/server/plugin.ts @@ -8,13 +8,14 @@ */ import { Plugin, CoreSetup, CoreStart } from '@kbn/core/server'; -import { registerRoutes } from './routes'; +import { registerRoutes, registerDeprecatedRoutes } from './routes'; export class RoutingExamplePlugin implements Plugin<{}, {}> { public setup(core: CoreSetup) { const router = core.http.createRouter(); registerRoutes(router); + registerDeprecatedRoutes(router); return {}; } diff --git a/examples/routing_example/server/routes/deprecated_routes/index.ts b/examples/routing_example/server/routes/deprecated_routes/index.ts new file mode 100644 index 0000000000000..75dc0261ed1b9 --- /dev/null +++ b/examples/routing_example/server/routes/deprecated_routes/index.ts @@ -0,0 +1,17 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { IRouter } from '@kbn/core/server'; +import { registerDeprecatedRoute } from './unversioned'; +import { registerVersionedDeprecatedRoute } from './versioned'; + +export function registerDeprecatedRoutes(router: IRouter) { + registerDeprecatedRoute(router); + registerVersionedDeprecatedRoute(router); +} diff --git a/examples/routing_example/server/routes/deprecated_routes/unversioned.ts b/examples/routing_example/server/routes/deprecated_routes/unversioned.ts new file mode 100644 index 0000000000000..4e1451a91fc38 --- /dev/null +++ b/examples/routing_example/server/routes/deprecated_routes/unversioned.ts @@ -0,0 +1,62 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { IRouter } from '@kbn/core/server'; +import { schema } from '@kbn/config-schema'; +import { DEPRECATED_ROUTES } from '../../../common'; + +export const registerDeprecatedRoute = (router: IRouter) => { + router.get( + { + path: DEPRECATED_ROUTES.REMOVED_ROUTE, + validate: false, + options: { + access: 'public', + deprecated: { + documentationUrl: 'https://elastic.co/', + severity: 'critical', + reason: { type: 'remove' }, + }, + }, + }, + async (ctx, req, res) => { + return res.ok({ + body: { result: 'Called deprecated route. Check UA to see the deprecation.' }, + }); + } + ); + + router.post( + { + path: DEPRECATED_ROUTES.MIGRATED_ROUTE, + validate: { + body: schema.object({ + test: schema.maybe(schema.boolean()), + }), + }, + options: { + access: 'public', + deprecated: { + documentationUrl: 'https://elastic.co/', + severity: 'critical', + reason: { + type: 'migrate', + newApiMethod: 'GET', + newApiPath: `${DEPRECATED_ROUTES.VERSIONED_ROUTE}?apiVersion=2`, + }, + }, + }, + }, + async (ctx, req, res) => { + return res.ok({ + body: { result: 'Called deprecated route. Check UA to see the deprecation.' }, + }); + } + ); +}; diff --git a/examples/routing_example/server/routes/deprecated_routes/versioned.ts b/examples/routing_example/server/routes/deprecated_routes/versioned.ts new file mode 100644 index 0000000000000..54d6f779f77c3 --- /dev/null +++ b/examples/routing_example/server/routes/deprecated_routes/versioned.ts @@ -0,0 +1,53 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { RequestHandler } from '@kbn/core-http-server'; +import type { IRouter } from '@kbn/core/server'; +import { DEPRECATED_ROUTES } from '../../../common'; + +const createDummyHandler = + (version: string): RequestHandler => + (ctx, req, res) => { + return res.ok({ body: { result: `API version ${version}.` } }); + }; + +export const registerVersionedDeprecatedRoute = (router: IRouter) => { + const versionedRoute = router.versioned.get({ + path: DEPRECATED_ROUTES.VERSIONED_ROUTE, + description: 'Routing example plugin deprecated versioned route.', + access: 'internal', + options: { + excludeFromOAS: true, + }, + enableQueryVersion: true, + }); + + versionedRoute.addVersion( + { + options: { + deprecated: { + documentationUrl: 'https://elastic.co/', + severity: 'warning', + reason: { type: 'bump', newApiVersion: '2' }, + }, + }, + validate: false, + version: '1', + }, + createDummyHandler('1') + ); + + versionedRoute.addVersion( + { + version: '2', + validate: false, + }, + createDummyHandler('2') + ); +}; diff --git a/examples/routing_example/server/routes/index.ts b/examples/routing_example/server/routes/index.ts index 2f43c85b0d471..1c1ccb9e191ff 100644 --- a/examples/routing_example/server/routes/index.ts +++ b/examples/routing_example/server/routes/index.ts @@ -8,3 +8,4 @@ */ export { registerRoutes } from './register_routes'; +export { registerDeprecatedRoutes } from './deprecated_routes'; diff --git a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts index bdce2e616c5a9..bdcad406995a9 100644 --- a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts +++ b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.ts @@ -72,7 +72,7 @@ export class DeprecationsClient { const incrementBy = apiTotalCalls - totalMarkedAsResolved; return { - path: '/api/deprecations/mark_as_resolved/', + path: '/api/deprecations/mark_as_resolved', method: 'POST', asSystemRequest: true, body: JSON.stringify({ diff --git a/packages/core/http/core-http-router-server-internal/src/router.ts b/packages/core/http/core-http-router-server-internal/src/router.ts index 7a0eaa1bc565c..e7ad85fcda33a 100644 --- a/packages/core/http/core-http-router-server-internal/src/router.ts +++ b/packages/core/http/core-http-router-server-internal/src/router.ts @@ -205,7 +205,7 @@ export class Router( route: InternalRouteConfig, handler: RequestHandler, - { isVersioned, events }: InternalRegistrarOptions = { isVersioned: false, events: false } + { isVersioned, events }: InternalRegistrarOptions = { isVersioned: false, events: true } ) => { route = prepareRouteConfigValidation(route); const routeSchemas = routeSchemasFromRouteConfig(route, method); diff --git a/packages/core/http/core-http-server-internal/src/http_server.ts b/packages/core/http/core-http-server-internal/src/http_server.ts index 17617ea9bdd64..1dee6a3286788 100644 --- a/packages/core/http/core-http-server-internal/src/http_server.ts +++ b/packages/core/http/core-http-server-internal/src/http_server.ts @@ -405,9 +405,9 @@ export class HttpServer { .flat() .map((route) => { if (route.isVersioned === true) { - return [...route.handlers.entries()].map(([version, { options }]) => { + return [...route.handlers.entries()].map(([_, { options }]) => { const deprecated = options.options?.deprecated; - return { route, version: `${version}`, deprecated }; + return { route, version: `${options.version}`, deprecated }; }); } return { route, version: undefined, deprecated: route.options.deprecated }; diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts index f69b7597626d0..69eba9e1abf23 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_stats_client.ts @@ -205,6 +205,15 @@ export class CoreUsageStatsClient implements ICoreUsageStatsClient { counterType: `deprecated_api_call:${resolved ? 'resolved' : 'total'}`, incrementBy, }); + + if (resolved) { + // increment number of times the marked_as_resolve has been called + incrementUsageCounter({ + counterName: id, + counterType: 'deprecated_api_call:marked_as_resolved', + incrementBy: 1, + }); + } }) ) .subscribe(); diff --git a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts index b09dc80bd73b0..37d299a6f51fe 100644 --- a/packages/kbn-router-to-openapispec/src/generate_oas.test.ts +++ b/packages/kbn-router-to-openapispec/src/generate_oas.test.ts @@ -241,6 +241,7 @@ describe('generateOpenApiDocument', () => { { method: 'get', path: '/test', + isVersioned: true, options: { access: 'public' }, handlers: [ { diff --git a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts index 6452c2cf3c2cc..f9f4f4898c1d0 100644 --- a/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts +++ b/packages/kbn-router-to-openapispec/src/process_versioned_router.test.ts @@ -8,10 +8,7 @@ */ import { schema } from '@kbn/config-schema'; -import type { - CoreVersionedRouter, - VersionedRouterRoute, -} from '@kbn/core-http-router-server-internal'; +import type { CoreVersionedRouter } from '@kbn/core-http-router-server-internal'; import { get } from 'lodash'; import { OasConverter } from './oas_converter'; import { createOperationIdCounter } from './operation_id_counter'; @@ -20,6 +17,7 @@ import { extractVersionedResponses, extractVersionedRequestBodies, } from './process_versioned_router'; +import { VersionedRouterRoute } from '@kbn/core-http-server'; let oasConverter: OasConverter; beforeEach(() => { @@ -151,6 +149,7 @@ describe('processVersionedRouter', () => { const createTestRoute: () => VersionedRouterRoute = () => ({ path: '/foo', method: 'get', + isVersioned: true, options: { access: 'public', deprecated: true, From ae0d20b38f8a3f1fc5b8f23befd2ee4e1295a6ab Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 20 Oct 2024 15:55:17 +0300 Subject: [PATCH 19/27] update readme --- x-pack/plugins/upgrade_assistant/README.md | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/upgrade_assistant/README.md b/x-pack/plugins/upgrade_assistant/README.md index 30b403f6d6230..2acac8e3e734d 100644 --- a/x-pack/plugins/upgrade_assistant/README.md +++ b/x-pack/plugins/upgrade_assistant/README.md @@ -17,7 +17,7 @@ When we want to enable ML model snapshot deprecation warnings again we need to c * Migrating system indices (`featureSet.migrateSystemIndices`): Migrating system indices should only be enabled for major version upgrades. This config hides the second step from the UA UI for migrating system indices. * Reindex corrective actions (`featureSet.reindexCorrectiveActions`): Deprecations with reindexing corrective actions are only enabled for major version upgrades. Currently, the reindex actions include some logic that is specific to the [8.0 upgrade](https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.ts). End users could get into a bad situation if this is enabled before this logic is fixed. -### Deprecations +## Deprecations There are three sources of deprecation information: @@ -275,6 +275,47 @@ PUT .reporting-*/_settings } ``` +#### Kibana API deprecations: +Run kibana locally with the test example plugin that has deprecated routes +``` +yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples +``` + +The following comprehensive deprecated routes examples are registered inside the folder: `examples/routing_example/server/routes/deprecated_routes` + +Run them in the console to trigger the deprecation condition so they show up in the UA: + +``` +# Versioned routes: Version 1 is deprecated +GET kbn:/api/routing_example/d/versioned?apiVersion=1 +GET kbn:/api/routing_example/d/versioned?apiVersion=2 + +# Non-versioned routes +GET kbn:/api/routing_example/d/removed_route +POST kbn:/api/routing_example/d/migrated_route +{} +``` + +1. You can also mark as deprecated in the UA to remove the deprecation from the list. +2. Check the telemetry response to see the reported data about the deprecated route. +3. Calling version 2 of the API does not do anything since it is not deprecated unlike version `1` (`GET kbn:/api/routing_example/d/versioned?apiVersion=2`) +4. Internally you can see the deprecations counters from the dev console by running the following: +``` +GET .kibana_usage_counters/_search +{ + "query": { + "bool": { + "should": [ + {"match": { "usage-counter.counterType": "deprecated_api_call:total"}}, + {"match": { "usage-counter.counterType": "deprecated_api_call:resolved"}}, + {"match": { "usage-counter.counterType": "deprecated_api_call:marked_as_resolved"}} + ] + } + } +} + +``` + For a complete list of Kibana deprecations, refer to the [8.0 Kibana deprecations meta issue](https://github.com/elastic/kibana/issues/109166). ### Errors From 7d66a9f92258e017c7b3fe0782539cdb9f0d6f60 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:11:22 +0000 Subject: [PATCH 20/27] [CI] Auto-commit changed files from 'node scripts/notice' --- examples/routing_example/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/routing_example/tsconfig.json b/examples/routing_example/tsconfig.json index b35e8dbd34f4a..86bfda9d3d529 100644 --- a/examples/routing_example/tsconfig.json +++ b/examples/routing_example/tsconfig.json @@ -20,5 +20,6 @@ "@kbn/core-http-browser", "@kbn/config-schema", "@kbn/react-kibana-context-render", + "@kbn/core-http-server", ] } From 77cb2d45536612e6b09a7e2b93400e51eff710af Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 20 Oct 2024 17:54:37 +0300 Subject: [PATCH 21/27] fix more tests --- .../src/deprecations_client.test.ts | 2 +- .../http/core-http-server-internal/src/http_server.test.ts | 2 ++ .../integration_tests/http/request_representation.test.ts | 6 +++++- test/plugin_functional/test_suites/core/deprecations.ts | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.test.ts b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.test.ts index bfb4f35fa93f1..38777474f136b 100644 --- a/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.test.ts +++ b/packages/core/deprecations/core-deprecations-browser-internal/src/deprecations_client.test.ts @@ -135,7 +135,7 @@ describe('DeprecationsClient', () => { expect(result).toMatchInlineSnapshot(` Object { - "reason": "This deprecation cannot be resolved automatically.", + "reason": "This deprecation cannot be resolved automatically or marked as resolved.", "status": "fail", } `); diff --git a/packages/core/http/core-http-server-internal/src/http_server.test.ts b/packages/core/http/core-http-server-internal/src/http_server.test.ts index c374ff7ca2107..69e69f784e65e 100644 --- a/packages/core/http/core-http-server-internal/src/http_server.test.ts +++ b/packages/core/http/core-http-server-internal/src/http_server.test.ts @@ -906,6 +906,7 @@ test('exposes route details of incoming request to a route handler', async () => .expect(200, { method: 'get', path: '/', + routePath: '/', options: { authRequired: true, xsrfRequired: false, @@ -1088,6 +1089,7 @@ test('exposes route details of incoming request to a route handler (POST + paylo .expect(200, { method: 'post', path: '/', + routePath: '/', options: { authRequired: true, xsrfRequired: true, diff --git a/src/core/server/integration_tests/http/request_representation.test.ts b/src/core/server/integration_tests/http/request_representation.test.ts index f180a3a49ce0f..82300eceec774 100644 --- a/src/core/server/integration_tests/http/request_representation.test.ts +++ b/src/core/server/integration_tests/http/request_representation.test.ts @@ -87,6 +87,7 @@ describe('request logging', () => { route: { method: 'get', path: '/', + routePath: '/', options: expect.any(Object), }, uuid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', @@ -116,10 +117,12 @@ describe('request logging', () => { auth: { isAuthenticated: false }, route: { path: '/', + routePath: '/', method: 'get', options: { authRequired: true, xsrfRequired: false, + deprecated: undefined, access: 'internal', tags: [], security: undefined, @@ -127,7 +130,8 @@ describe('request logging', () => { body: undefined } }, - authzResult: undefined + authzResult: undefined, + apiVersion: undefined }" `); }); diff --git a/test/plugin_functional/test_suites/core/deprecations.ts b/test/plugin_functional/test_suites/core/deprecations.ts index 081209e6c7dce..b41adc7ffefa5 100644 --- a/test/plugin_functional/test_suites/core/deprecations.ts +++ b/test/plugin_functional/test_suites/core/deprecations.ts @@ -151,7 +151,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide }); expect(resolveResult).to.eql({ - reason: 'This deprecation cannot be resolved automatically.', + reason: 'This deprecation cannot be resolved automatically or marked as resolved.', status: 'fail', }); }); From 0a7d698ddb1698d9b27b74f5a5b00821d0832f63 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 21 Oct 2024 13:27:03 +0300 Subject: [PATCH 22/27] add integration test --- .buildkite/ftr_platform_stateful_configs.yml | 2 +- .../core/fetch_deprecated_api_counters.ts | 16 +- .../{config.js => config.ts} | 13 +- .../upgrade_assistant/api_deprecations.ts | 158 ++++++++++++++++++ .../upgrade_assistant/index.js | 1 + 5 files changed, 181 insertions(+), 9 deletions(-) rename x-pack/test/upgrade_assistant_integration/{config.js => config.ts} (70%) create mode 100644 x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts diff --git a/.buildkite/ftr_platform_stateful_configs.yml b/.buildkite/ftr_platform_stateful_configs.yml index 6958ec4530ae8..244f04257ef92 100644 --- a/.buildkite/ftr_platform_stateful_configs.yml +++ b/.buildkite/ftr_platform_stateful_configs.yml @@ -344,7 +344,7 @@ enabled: - x-pack/test/task_manager_claimer_mget/config.ts - x-pack/test/ui_capabilities/security_and_spaces/config.ts - x-pack/test/ui_capabilities/spaces_only/config.ts - - x-pack/test/upgrade_assistant_integration/config.js + - x-pack/test/upgrade_assistant_integration/config.ts - x-pack/test/usage_collection/config.ts - x-pack/performance/journeys_e2e/aiops_log_rate_analysis.ts - x-pack/performance/journeys_e2e/ecommerce_dashboard.ts diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts index 9b930294156f1..1c90b23e40b16 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/fetch_deprecated_api_counters.ts @@ -21,13 +21,10 @@ const mergeCounter = (counter: CounterEvent, acc?: CoreDeprecatedApiUsageStats) `Failed to merge mismatching counterNames: ${acc.apiId} with ${counter.counterName}` ); } - - const isResolvedCounter = counter.counterType.endsWith(':resolved'); - - const totalKey = isResolvedCounter ? 'totalMarkedAsResolved' : 'apiTotalCalls'; - const lastUpdatedKey = isResolvedCounter ? 'markedAsResolvedLastCalledAt' : 'apiLastCalledAt'; + const isMarkedCounter = counter.counterType.endsWith(':marked_as_resolved'); const finalCounter = { + apiId: counter.counterName, apiTotalCalls: 0, apiLastCalledAt: 'unknown', totalMarkedAsResolved: 0, @@ -35,13 +32,20 @@ const mergeCounter = (counter: CounterEvent, acc?: CoreDeprecatedApiUsageStats) ...(acc || {}), }; + if (isMarkedCounter) { + return finalCounter; + } + + const isResolvedCounter = counter.counterType.endsWith(':resolved'); + const totalKey = isResolvedCounter ? 'totalMarkedAsResolved' : 'apiTotalCalls'; + const lastUpdatedKey = isResolvedCounter ? 'markedAsResolvedLastCalledAt' : 'apiLastCalledAt'; + const newPayload = { [totalKey]: (finalCounter[totalKey] || 0) + counter.total, [lastUpdatedKey]: counter.lastUpdatedAt, }; return { - apiId: counter.counterName, ...finalCounter, ...newPayload, }; diff --git a/x-pack/test/upgrade_assistant_integration/config.js b/x-pack/test/upgrade_assistant_integration/config.ts similarity index 70% rename from x-pack/test/upgrade_assistant_integration/config.js rename to x-pack/test/upgrade_assistant_integration/config.ts index 9529e4bc568d3..0794f4d0b9ada 100644 --- a/x-pack/test/upgrade_assistant_integration/config.js +++ b/x-pack/test/upgrade_assistant_integration/config.ts @@ -6,8 +6,10 @@ */ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { FtrConfigProviderContext } from '@kbn/test'; +import path from 'node:path'; -export default async function ({ readConfigFile }) { +export default async function ({ readConfigFile }: FtrConfigProviderContext) { // Read the Kibana API integration tests config file so that we can utilize its services. const kibanaAPITestsConfig = await readConfigFile( require.resolve('@kbn/test-suites-src/api_integration/config') @@ -26,7 +28,14 @@ export default async function ({ readConfigFile }) { junit: { reportName: 'X-Pack Upgrade Assistant Integration Tests', }, - kbnTestServer: xPackFunctionalTestsConfig.get('kbnTestServer'), + kbnTestServer: { + ...xPackFunctionalTestsConfig.get('kbnTestServer'), + serverArgs: [ + ...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'), + `--plugin-path=${path.resolve(__dirname, '../../../examples/routing_example')}`, + `--plugin-path=${path.resolve(__dirname, '../../../examples/developer_examples')}`, + ], + }, esTestCluster: { ...xPackFunctionalTestsConfig.get('esTestCluster'), // this archive can not be loaded into 8.0+ diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts new file mode 100644 index 0000000000000..a4144e51083e4 --- /dev/null +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts @@ -0,0 +1,158 @@ +/* + * 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. + */ + +import expect from '@kbn/expect'; +import { expect as expectExpect } from 'expect'; +import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common'; +import { ApiDeprecationDetails } from '@kbn/core-deprecations-common/src/types'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; +import { UsageCountersSavedObject } from '@kbn/usage-collection-plugin/server'; +import _ from 'lodash'; +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +const getApiDeprecations = (allDeprecations: DomainDeprecationDetails[]) => { + return allDeprecations.filter( + (deprecation) => deprecation.deprecationType === 'api' + ) as unknown as ApiDeprecationDetails[]; +}; + +export function apiDeprecationTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const esArchiver = getService('esArchiver'); + const retry = getService('retry'); + const es = getService('es'); + + describe('Kibana API Deprecations', () => { + before(async () => { + // await kibanaServer.savedObjects.cleanStandardList(); + await esArchiver.emptyKibanaIndex(); + }); + it('returns does not return api deprecations if the routes are not called', async () => { + const { deprecations } = (await supertest.get(`/api/deprecations/`).expect(200)).body; + const apiDeprecations = getApiDeprecations(deprecations); + expect(apiDeprecations.length).to.equal(0); + }); + + it('returns deprecated APIs when the api is called', async () => { + await supertest.get(`/api/routing_example/d/removed_route`).expect(200); + + // sleep a little until the usage counter is synced into ES + await setTimeoutAsync(3000); + await retry.tryForTime( + 15 * 1000, + async () => { + const { deprecations } = (await supertest.get(`/api/deprecations/`).expect(200)).body; + const apiDeprecations = getApiDeprecations(deprecations); + expect(apiDeprecations.length).to.equal(1); + + expectExpect(apiDeprecations[0].correctiveActions.mark_as_resolved_api).toEqual({ + routePath: '/api/routing_example/d/removed_route', + routeMethod: 'get', + apiTotalCalls: 1, + totalMarkedAsResolved: 0, + timestamp: expectExpect.any(String), + }); + + expectExpect(apiDeprecations[0].domainId).toEqual('core.api_deprecations'); + expectExpect(apiDeprecations[0].apiId).toEqual( + 'unversioned|get|/api/routing_example/d/removed_route' + ); + expectExpect(apiDeprecations[0].title).toEqual( + 'The "GET /api/routing_example/d/removed_route" route will be removed' + ); + }, + undefined, + 2000 + ); + }); + + it('no longer returns deprecated API when it is marked as resolved', async () => { + await supertest + .post(`/api/deprecations/mark_as_resolved`) + .set('kbn-xsrf', 'xxx') + .send({ + domainId: 'core.api_deprecations', + routePath: '/api/routing_example/d/removed_route', + routeMethod: 'get', + incrementBy: 1, + }) + .expect(200); + + // sleep a little until the usage counter is synced into ES + await setTimeoutAsync(5000); + await retry.tryForTime(15 * 1000, async () => { + const { deprecations } = (await supertest.get(`/api/deprecations/`).expect(200)).body; + const apiDeprecations = getApiDeprecations(deprecations); + expect(apiDeprecations.length).to.equal(0); + }); + }); + + it('returns deprecated API when it is called again after resolved, but with a different message', async () => { + await supertest.get(`/api/routing_example/d/removed_route`).expect(200); + + // sleep a little until the usage counter is synced into ES + await setTimeoutAsync(3000); + await retry.tryForTime( + 15 * 1000, + async () => { + const { deprecations } = (await supertest.get(`/api/deprecations/`).expect(200)).body; + const apiDeprecations = getApiDeprecations(deprecations); + expect(apiDeprecations.length).to.equal(1); + + expectExpect(apiDeprecations[0].correctiveActions.mark_as_resolved_api).toEqual({ + routePath: '/api/routing_example/d/removed_route', + routeMethod: 'get', + apiTotalCalls: 2, + totalMarkedAsResolved: 1, + timestamp: expectExpect.any(String), + }); + }, + undefined, + 2000 + ); + }); + + it('keeps track of all counters via saved objects and core usage counters', async () => { + const should = ['total', 'resolved', 'marked_as_resolved'].map((type) => ({ + match: { 'usage-counter.counterType': `deprecated_api_call:${type}` }, + })); + + const { hits } = await es.search<{ 'usage-counter': UsageCountersSavedObject }>({ + index: '.kibana_usage_counters', + body: { + query: { bool: { should } }, + }, + }); + + expect(hits.hits.length).to.equal(3); + const counters = hits.hits.map((hit) => hit._source!['usage-counter']).sort(); + expectExpect(_.sortBy(counters, 'counterType')).toEqual([ + { + count: 1, + counterName: 'unversioned|get|/api/routing_example/d/removed_route', + counterType: 'deprecated_api_call:marked_as_resolved', + domainId: 'core', + source: 'server', + }, + { + count: 1, + counterName: 'unversioned|get|/api/routing_example/d/removed_route', + counterType: 'deprecated_api_call:resolved', + domainId: 'core', + source: 'server', + }, + { + count: 2, + counterName: 'unversioned|get|/api/routing_example/d/removed_route', + counterType: 'deprecated_api_call:total', + domainId: 'core', + source: 'server', + }, + ]); + }); + }); +} diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js index eb09d24b79b6a..0019f2ab1f936 100644 --- a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js @@ -8,5 +8,6 @@ export default function ({ loadTestFile }) { describe('upgrade assistant', function () { loadTestFile(require.resolve('./reindexing')); + loadTestFile(require.resolve('./api_deprecations').apiDeprecationTests); }); } From ecf62adfcd04c399085a8c1afc8a6217a94b7ade Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:38:22 +0000 Subject: [PATCH 23/27] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/test/tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 03fbddf161f00..2ba14ceb1218c 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -185,6 +185,8 @@ "@kbn/cloud-security-posture-common", "@kbn/saved-objects-management-plugin", "@kbn/alerting-types", - "@kbn/ai-assistant-common" + "@kbn/ai-assistant-common", + "@kbn/core-deprecations-common", + "@kbn/usage-collection-plugin" ] } From 43f9a1e19365f5841b01465e527186cce2a890d6 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 21 Oct 2024 14:49:22 +0300 Subject: [PATCH 24/27] add integration test --- .eslintrc.js | 1 + .../upgrade_assistant/api_deprecations.ts | 8 ++++++-- .../upgrade_assistant/{index.js => index.ts} | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) rename x-pack/test/upgrade_assistant_integration/upgrade_assistant/{index.js => index.ts} (64%) diff --git a/.eslintrc.js b/.eslintrc.js index 006f39ce1026c..3c67594513c0e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -643,6 +643,7 @@ module.exports = { 'x-pack/test/*/*config.*ts', 'x-pack/test/saved_object_api_integration/*/apis/**/*', 'x-pack/test/ui_capabilities/*/tests/**/*', + 'x-pack/test/upgrade_assistant_integration/**/*', 'x-pack/test/performance/**/*.ts', '**/cypress.config.{js,ts}', 'x-pack/test_serverless/**/config*.ts', diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts index a4144e51083e4..b07d271403212 100644 --- a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts @@ -14,13 +14,17 @@ import { UsageCountersSavedObject } from '@kbn/usage-collection-plugin/server'; import _ from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +interface DomainApiDeprecationDetails extends ApiDeprecationDetails { + domainId: string; +} + const getApiDeprecations = (allDeprecations: DomainDeprecationDetails[]) => { return allDeprecations.filter( (deprecation) => deprecation.deprecationType === 'api' - ) as unknown as ApiDeprecationDetails[]; + ) as unknown as DomainApiDeprecationDetails[]; }; -export function apiDeprecationTests({ getService }: FtrProviderContext) { +export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); const retry = getService('retry'); diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.ts similarity index 64% rename from x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js rename to x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.ts index 0019f2ab1f936..2aaddc7d6f669 100644 --- a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.js +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/index.ts @@ -5,9 +5,11 @@ * 2.0. */ -export default function ({ loadTestFile }) { +import { FtrProviderContext } from '../../common/ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { describe('upgrade assistant', function () { loadTestFile(require.resolve('./reindexing')); - loadTestFile(require.resolve('./api_deprecations').apiDeprecationTests); + loadTestFile(require.resolve('./api_deprecations')); }); } From a6a0608fced9171adbe05a7105cdad06a21c6694 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Tue, 22 Oct 2024 13:49:06 +0300 Subject: [PATCH 25/27] update integration test --- .../core-deprecations-common/src/types.ts | 2 +- .../src/deprecations/api_deprecations.test.ts | 64 ++++++++--------- .../src/deprecations/api_deprecations.ts | 5 +- .../src/deprecations/i18n_texts.ts | 72 +++++++------------ .../deprecation_details_flyout.tsx | 9 ++- .../kibana_deprecations.tsx | 37 +++++----- .../kibana_deprecations_table.tsx | 6 +- .../upgrade_assistant/api_deprecations.ts | 2 +- 8 files changed, 90 insertions(+), 107 deletions(-) diff --git a/packages/core/deprecations/core-deprecations-common/src/types.ts b/packages/core/deprecations/core-deprecations-common/src/types.ts index f00c74523cdcf..85da30b2c1287 100644 --- a/packages/core/deprecations/core-deprecations-common/src/types.ts +++ b/packages/core/deprecations/core-deprecations-common/src/types.ts @@ -22,7 +22,7 @@ export interface BaseDeprecationDetails { * The description message to be displayed for the deprecation. * Check the README for writing deprecations in `src/core/server/deprecations/README.mdx` */ - message: string; + message: string | string[]; /** * levels: * - warning: will not break deployment upon upgrade diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts index 711456c5958b0..b431088152f3e 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.test.ts @@ -109,11 +109,9 @@ describe('#registerApiDeprecationsInfo', () => { "apiId": "123|get|/api/test_removed", "correctiveActions": Object { "manualSteps": Array [ - "This API will be removed", - "This API will be completely removed. You will no longer be able to use it in the future.", - "Click the learn more documentation link for more details on addressing the deprecated API.", - "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", - "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + "Identify the origin of these API calls.", + "This API no longer exists and no replacement is available. Delete any requests you have that use this API.", + "Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected.", ], "mark_as_resolved_api": Object { "apiTotalCalls": 13, @@ -128,9 +126,11 @@ describe('#registerApiDeprecationsInfo', () => { "documentationUrl": "https://fake-url", "domainId": "core.routes-deprecations", "level": "critical", - "message": "The API GET /api/test_removed/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. - This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", - "title": "The \\"GET /api/test_removed/\\" route will be removed", + "message": Array [ + "The API \\"GET /api/test_removed/\\" has been called 13 times. The last call was on Sunday, September 1, 2024 6:06 AM -04:00.", + "This issue has been marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00 but the API has been called 12 times since.", + ], + "title": "The \\"GET /api/test_removed/\\" route is removed", }, ] `); @@ -156,12 +156,9 @@ describe('#registerApiDeprecationsInfo', () => { "apiId": "123|get|/api/test_migrated", "correctiveActions": Object { "manualSteps": Array [ - "This API has been migrated to a different API", - "This API will be migrated to a different API and will be removed in the future in favor of the other API.", - "This API /api/test_migrated/ has been migrated to POST /api/new_path", - "Click the learn more documentation link for more details on addressing the deprecated API.", - "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", - "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + "Identify the origin of these API calls.", + "Update the requests to use the following new API instead: \\"POST /api/new_path\\".", + "Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected.", ], "mark_as_resolved_api": Object { "apiTotalCalls": 13, @@ -176,9 +173,11 @@ describe('#registerApiDeprecationsInfo', () => { "documentationUrl": "https://fake-url", "domainId": "core.routes-deprecations", "level": "critical", - "message": "The API GET /api/test_migrated/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. - This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", - "title": "The \\"GET /api/test_migrated/\\" route has been migrated to a different API", + "message": Array [ + "The API \\"GET /api/test_migrated/\\" has been called 13 times. The last call was on Sunday, September 1, 2024 6:06 AM -04:00.", + "This issue has been marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00 but the API has been called 12 times since.", + ], + "title": "The \\"GET /api/test_migrated/\\" route is migrated to a different API", }, ] `); @@ -202,12 +201,9 @@ describe('#registerApiDeprecationsInfo', () => { "apiId": "123|get|/api/test_bumped", "correctiveActions": Object { "manualSteps": Array [ - "This API has a new version bump", - "A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version.", - "This API /api/test_bumped/ has a new version \\"444\\".", - "Click the learn more documentation link for more details on addressing the deprecated API.", - "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", - "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + "Identify the origin of these API calls.", + "Update the requests to use the following new version of the API instead: \\"444\\".", + "Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected.", ], "mark_as_resolved_api": Object { "apiTotalCalls": 13, @@ -222,9 +218,11 @@ describe('#registerApiDeprecationsInfo', () => { "documentationUrl": "https://fake-url", "domainId": "core.routes-deprecations", "level": "critical", - "message": "The API GET /api/test_bumped/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00. - This API has been marked as resolved before. It has been called 12 times since it was marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00.", - "title": "The \\"GET /api/test_bumped/\\" route has a new version bump", + "message": Array [ + "The API \\"GET /api/test_bumped/\\" has been called 13 times. The last call was on Sunday, September 1, 2024 6:06 AM -04:00.", + "This issue has been marked as resolved on Thursday, October 17, 2024 8:06 AM -04:00 but the API has been called 12 times since.", + ], + "title": "The \\"GET /api/test_bumped/\\" route has a newer version available", }, ] `); @@ -265,11 +263,9 @@ describe('#registerApiDeprecationsInfo', () => { "apiId": "123|get|/api/test_never_resolved", "correctiveActions": Object { "manualSteps": Array [ - "This API will be removed", - "This API will be completely removed. You will no longer be able to use it in the future.", - "Click the learn more documentation link for more details on addressing the deprecated API.", - "Once you are no longer using the deprecated API. You can click on the \\"Mark as Resolved\\" button to track if the API is still getting called.", - "The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.", + "Identify the origin of these API calls.", + "This API no longer exists and no replacement is available. Delete any requests you have that use this API.", + "Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected.", ], "mark_as_resolved_api": Object { "apiTotalCalls": 13, @@ -284,8 +280,10 @@ describe('#registerApiDeprecationsInfo', () => { "documentationUrl": "https://fake-url", "domainId": "core.routes-deprecations", "level": "critical", - "message": "The API GET /api/test_never_resolved/ has been called 13 times. The API was last called on Sunday, September 1, 2024 6:06 AM -04:00.", - "title": "The \\"GET /api/test_never_resolved/\\" route will be removed", + "message": Array [ + "The API \\"GET /api/test_never_resolved/\\" has been called 13 times. The last call was on Sunday, September 1, 2024 6:06 AM -04:00.", + ], + "title": "The \\"GET /api/test_never_resolved/\\" route is removed", }, ] `); diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts index 8a64b6305514a..45893987ddf92 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/api_deprecations.ts @@ -57,9 +57,8 @@ export const createGetApiDeprecations = )!; const { routeVersion, routePath, routeDeprecationOptions, routeMethod } = routeDeprecationDetails; - const defaultLevel = - routeDeprecationOptions.reason.type === 'remove' ? 'critical' : 'warning'; - const deprecationLevel = routeDeprecationOptions.severity || defaultLevel; + + const deprecationLevel = routeDeprecationOptions.severity || 'warning'; return { apiId, diff --git a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts index 716c86abf5022..cb1dacc97bd91 100644 --- a/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts +++ b/packages/core/deprecations/core-deprecations-server-internal/src/deprecations/i18n_texts.ts @@ -13,9 +13,14 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; export const getApiDeprecationTitle = (details: RouterDeprecatedRouteDetails) => { - const { routePath, routeMethod } = details; + const { routePath, routeMethod, routeDeprecationOptions } = details; + const deprecationType = routeDeprecationOptions.reason.type; const routeWithMethod = `${routeMethod.toUpperCase()} ${routePath}`; - const deprecationTypeText = getApiDeprecationTypeText(details); + const deprecationTypeText = i18n.translate('core.deprecations.deprecations.apiDeprecationType', { + defaultMessage: + '{deprecationType, select, remove {is removed} bump {has a newer version available} migrate {is migrated to a different API} other {is deprecated}}', + values: { deprecationType }, + }); return i18n.translate('core.deprecations.deprecations.apiDeprecationInfoTitle', { defaultMessage: 'The "{routeWithMethod}" route {deprecationTypeText}', @@ -26,21 +31,10 @@ export const getApiDeprecationTitle = (details: RouterDeprecatedRouteDetails) => }); }; -export const getApiDeprecationTypeText = (details: RouterDeprecatedRouteDetails) => { - const { routeDeprecationOptions } = details; - const deprecationType = routeDeprecationOptions.reason.type; - - return i18n.translate('core.deprecations.deprecations.apiDeprecationType', { - defaultMessage: - '{deprecationType, select, remove {will be removed} bump {has a new version bump} migrate {has been migrated to a different API} other {has been marked as deprecated}}', - values: { deprecationType }, - }); -}; - export const getApiDeprecationMessage = ( details: RouterDeprecatedRouteDetails, apiUsageStats: CoreDeprecatedApiUsageStats -) => { +): string[] => { const { routePath, routeMethod } = details; const { apiLastCalledAt, apiTotalCalls, markedAsResolvedLastCalledAt, totalMarkedAsResolved } = apiUsageStats; @@ -52,7 +46,7 @@ export const getApiDeprecationMessage = ( const messages = [ i18n.translate('core.deprecations.deprecations.apiDeprecationApiCallsDetailsMessage', { defaultMessage: - 'The API {routeWithMethod} has been called {apiTotalCalls} times. The API was last called on {apiLastCalledAt}.', + 'The API "{routeWithMethod}" has been called {apiTotalCalls} times. The last call was on {apiLastCalledAt}.', values: { routeWithMethod, apiTotalCalls, @@ -67,7 +61,7 @@ export const getApiDeprecationMessage = ( 'core.deprecations.deprecations.apiDeprecationPreviouslyMarkedAsResolvedMessage', { defaultMessage: - 'This API has been marked as resolved before. It has been called {timeSinceLastResolved} times since it was marked as resolved on {markedAsResolvedLastCalledAt}.', + 'This issue has been marked as resolved on {markedAsResolvedLastCalledAt} but the API has been called {timeSinceLastResolved, plural, one {# time} other {# times}} since.', values: { timeSinceLastResolved: diff, markedAsResolvedLastCalledAt: moment(markedAsResolvedLastCalledAt).format('LLLL Z'), @@ -77,18 +71,16 @@ export const getApiDeprecationMessage = ( ); } - return messages.join('\n'); + return messages; }; export const getApiDeprecationsManualSteps = (details: RouterDeprecatedRouteDetails): string[] => { - const { routeDeprecationOptions, routePath } = details; - const { documentationUrl } = routeDeprecationOptions; + const { routeDeprecationOptions } = details; const deprecationType = routeDeprecationOptions.reason.type; const manualSteps = [ i18n.translate('core.deprecations.deprecations.manualSteps.apiIseprecatedStep', { - defaultMessage: 'This API {deprecationTypeText}', - values: { deprecationTypeText: getApiDeprecationTypeText(details) }, + defaultMessage: 'Identify the origin of these API calls.', }), ]; @@ -96,59 +88,43 @@ export const getApiDeprecationsManualSteps = (details: RouterDeprecatedRouteDeta case 'bump': { const { newApiVersion } = routeDeprecationOptions.reason; manualSteps.push( - i18n.translate('core.deprecations.deprecations.manualSteps.bumpTypeExplainationStep', { - defaultMessage: - 'A version bump deprecation means the API has a new version and the current version will be removed in the future in favor of the newer version.', - }), i18n.translate('core.deprecations.deprecations.manualSteps.bumpDetailsStep', { - defaultMessage: 'This API {routePath} has a new version "{newApiVersion}".', - values: { routePath, newApiVersion }, + defaultMessage: + 'Update the requests to use the following new version of the API instead: "{newApiVersion}".', + values: { newApiVersion }, }) ); break; } + case 'remove': { manualSteps.push( i18n.translate('core.deprecations.deprecations.manualSteps.removeTypeExplainationStep', { defaultMessage: - 'This API will be completely removed. You will no longer be able to use it in the future.', + 'This API no longer exists and no replacement is available. Delete any requests you have that use this API.', }) ); break; } case 'migrate': { const { newApiPath, newApiMethod } = routeDeprecationOptions.reason; + const newRouteWithMethod = `${newApiMethod.toUpperCase()} ${newApiPath}`; + manualSteps.push( - i18n.translate('core.deprecations.deprecations.manualSteps.migrateTypeExplainationStep', { - defaultMessage: - 'This API will be migrated to a different API and will be removed in the future in favor of the other API.', - }), i18n.translate('core.deprecations.deprecations.manualSteps.migrateDetailsStep', { - defaultMessage: 'This API {routePath} has been migrated to {newApiMethod} {newApiPath}', - values: { newApiMethod: newApiMethod.toUpperCase(), newApiPath, routePath }, + defaultMessage: + 'Update the requests to use the following new API instead: "{newRouteWithMethod}".', + values: { newRouteWithMethod }, }) ); break; } } - if (documentationUrl) { - manualSteps.push( - i18n.translate('core.deprecations.deprecations.manualSteps.documentationStep', { - defaultMessage: - 'Click the learn more documentation link for more details on addressing the deprecated API.', - }) - ); - } - manualSteps.push( i18n.translate('core.deprecations.deprecations.manualSteps.markAsResolvedStep', { defaultMessage: - 'Once you are no longer using the deprecated API. You can click on the "Mark as Resolved" button to track if the API is still getting called.', - }), - i18n.translate('core.deprecations.deprecations.manualSteps.deprecationWillBeHiddenStep', { - defaultMessage: - 'The deprecation will be hidden from the Upgrade Assistant unless the deprecated API has been called again.', + 'Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected.', }) ); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx index 0bd1375b131c9..beb4c7c0c678c 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx @@ -53,7 +53,7 @@ const i18nTexts = { markAsResolvedButtonLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.flyout.quickResolveButtonLabel', { - defaultMessage: 'Mark As Resolved', + defaultMessage: 'Mark as Resolved', } ), retryQuickResolveButtonLabel: i18n.translate( @@ -140,6 +140,7 @@ export const DeprecationDetailsFlyout = ({ deprecationResolutionState, }: DeprecationDetailsFlyoutProps) => { const { documentationUrl, message, correctiveActions, title } = deprecation; + const messages = Array.isArray(message) ? message : [message]; const isCurrent = deprecationResolutionState?.id === deprecation.id; const avilableCorrectiveActions: AvailableCorrectiveActions = { @@ -184,7 +185,11 @@ export const DeprecationDetailsFlyout = ({ )} -

{message}

+ {messages.map((m, i) => ( +

+ {m} +

+ ))} {documentationUrl && (

diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx index d76f1afa9e612..0d433a59ee2d9 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx @@ -126,9 +126,9 @@ export const KibanaDeprecationsList = ({ const [flyoutContent, setFlyoutContent] = useState( undefined ); - const [deprecationResolutionState, setDeprecationResolutionState] = useState< - DeprecationResolutionState | undefined - >(undefined); + const [deprecationResolutionStates, setDeprecationResolutionStates] = useState< + Record + >({}); const { services: { @@ -194,17 +194,25 @@ export const KibanaDeprecationsList = ({ const resolveDeprecation = useCallback( async (deprecationDetails: KibanaDeprecationDetails) => { - setDeprecationResolutionState({ - id: deprecationDetails.id, - resolveDeprecationStatus: 'in_progress', + setDeprecationResolutionStates((states) => { + states[deprecationDetails.id] = { + id: deprecationDetails.id, + resolveDeprecationStatus: 'in_progress', + }; + + return states; }); const response = await deprecations.resolveDeprecation(deprecationDetails); - setDeprecationResolutionState({ - id: deprecationDetails.id, - resolveDeprecationStatus: response.status, - resolveDeprecationError: response.status === 'fail' ? response.reason : undefined, + setDeprecationResolutionStates((states) => { + states[deprecationDetails.id] = { + id: deprecationDetails.id, + resolveDeprecationStatus: response.status, + resolveDeprecationError: response.status === 'fail' ? response.reason : undefined, + }; + + return states; }); closeFlyout(); @@ -221,10 +229,7 @@ export const KibanaDeprecationsList = ({ deprecation: flyoutContent, closeFlyout, resolveDeprecation, - deprecationResolutionState: - deprecationResolutionState && flyoutContent.id === deprecationResolutionState.id - ? deprecationResolutionState - : undefined, + deprecationResolutionState: deprecationResolutionStates[flyoutContent.id], }, flyoutProps: { onClose: closeFlyout, @@ -236,7 +241,7 @@ export const KibanaDeprecationsList = ({ }, [ addContentToGlobalFlyout, closeFlyout, - deprecationResolutionState, + deprecationResolutionStates, flyoutContent, resolveDeprecation, ]); @@ -310,7 +315,7 @@ export const KibanaDeprecationsList = ({ deprecations={kibanaDeprecations} reload={getAllDeprecations} toggleFlyout={toggleFlyout} - deprecationResolutionState={deprecationResolutionState} + deprecationResolutionStates={deprecationResolutionStates} /> ); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx index ec0a2ebbb333d..8d223dedca490 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations_table.tsx @@ -92,14 +92,14 @@ interface Props { deprecations?: KibanaDeprecationDetails[]; reload: () => void; toggleFlyout: (newFlyoutContent?: KibanaDeprecationDetails) => void; - deprecationResolutionState?: DeprecationResolutionState; + deprecationResolutionStates: Record; } export const KibanaDeprecationsTable: React.FunctionComponent = ({ deprecations, reload, toggleFlyout, - deprecationResolutionState, + deprecationResolutionStates, }) => { const columns: Array> = [ { @@ -164,7 +164,7 @@ export const KibanaDeprecationsTable: React.FunctionComponent = ({ deprecationId={deprecation.id} isAutomated={Boolean(correctiveActions?.api)} canBeMarkedAsResolved={Boolean(correctiveActions?.mark_as_resolved_api)} - deprecationResolutionState={deprecationResolutionState} + deprecationResolutionState={deprecationResolutionStates[deprecation.id]} /> ); }, diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts index b07d271403212..f146bf38f5f26 100644 --- a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/api_deprecations.ts @@ -66,7 +66,7 @@ export default function ({ getService }: FtrProviderContext) { 'unversioned|get|/api/routing_example/d/removed_route' ); expectExpect(apiDeprecations[0].title).toEqual( - 'The "GET /api/routing_example/d/removed_route" route will be removed' + 'The "GET /api/routing_example/d/removed_route" route is removed' ); }, undefined, From a1405a7935427dd532d825b90a7be940f98d0754 Mon Sep 17 00:00:00 2001 From: Ahmad Bamieh Date: Tue, 22 Oct 2024 13:59:44 +0300 Subject: [PATCH 26/27] Update x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx Co-authored-by: florent-leborgne --- .../components/kibana_deprecations/resolution_table_cell.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx index 20c6077a68eb3..502c31ae90744 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/resolution_table_cell.tsx @@ -95,7 +95,7 @@ const markAsResolvedI18nTexts = { resolutionCellTooltipLabel: i18n.translate( 'xpack.upgradeAssistant.kibanaDeprecations.table.markAsResolvedCellTooltipLabel', { - defaultMessage: 'This issue can be resolved marked as resolved.', + defaultMessage: 'This issue can be marked as resolved.', } ), }; From 23c51266f76755eecfd9868243328ca1d366be3e Mon Sep 17 00:00:00 2001 From: Bamieh Date: Tue, 22 Oct 2024 14:04:48 +0300 Subject: [PATCH 27/27] fix type -> replace --- .../src/routes/bulk_create.ts | 2 +- .../src/routes/bulk_delete.ts | 2 +- .../src/routes/bulk_get.ts | 2 +- .../src/routes/bulk_resolve.ts | 2 +- .../src/routes/bulk_update.ts | 2 +- .../src/routes/create.ts | 2 +- .../src/routes/delete.ts | 2 +- .../core-saved-objects-server-internal/src/routes/find.ts | 2 +- .../core-saved-objects-server-internal/src/routes/get.ts | 2 +- .../src/routes/resolve.ts | 2 +- .../src/routes/update.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/create.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/delete.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/execute.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/get.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/get_all.ts | 2 +- .../actions/server/routes/legacy/list_action_types.ts | 2 +- x-pack/plugins/actions/server/routes/legacy/update.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/create.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/delete.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/disable.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/enable.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/find.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/get.ts | 2 +- .../server/routes/legacy/get_alert_instance_summary.ts | 2 +- .../alerting/server/routes/legacy/get_alert_state.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/health.ts | 2 +- .../alerting/server/routes/legacy/list_alert_types.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/mute_all.ts | 2 +- .../alerting/server/routes/legacy/mute_instance.ts | 2 +- .../plugins/alerting/server/routes/legacy/unmute_all.ts | 2 +- .../alerting/server/routes/legacy/unmute_instance.ts | 2 +- x-pack/plugins/alerting/server/routes/legacy/update.ts | 2 +- .../alerting/server/routes/legacy/update_api_key.ts | 2 +- .../cases/server/routes/api/comments/get_all_comment.ts | 2 +- .../plugins/cases/server/routes/api/stats/get_status.ts | 2 +- .../routes/api/user_actions/get_all_user_actions.ts | 2 +- x-pack/plugins/fleet/server/routes/agent/index.ts | 4 ++-- x-pack/plugins/fleet/server/routes/app/index.ts | 2 +- .../fleet/server/routes/enrollment_api_key/index.ts | 8 ++++---- x-pack/plugins/fleet/server/routes/epm/index.ts | 8 ++++---- x-pack/plugins/ml/server/routes/system.ts | 2 +- .../server/endpoint/routes/metadata/index.ts | 2 +- .../server/endpoint/routes/suggestions/index.ts | 2 +- 44 files changed, 51 insertions(+), 51 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts index 1171e32fa9307..c9a8656b3f753 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts @@ -38,7 +38,7 @@ export const registerBulkCreateRoute = ( summary: `Create saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts index ae85cae80a1cb..65209a6072748 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts @@ -38,7 +38,7 @@ export const registerBulkDeleteRoute = ( summary: `Delete saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts index aa2b6529ae1c2..3f87ca12248ae 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts @@ -38,7 +38,7 @@ export const registerBulkGetRoute = ( summary: `Get saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts index da8cf3b7c9d52..8e19114e798e0 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts @@ -38,7 +38,7 @@ export const registerBulkResolveRoute = ( summary: `Resolve saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, description: `Retrieve multiple Kibana saved objects by ID, using any legacy URL aliases if they exist. Under certain circumstances, when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs to enable new features. When an object's ID is regenerated, a legacy URL alias is created for that object, preserving its old ID. In such a scenario, that object can be retrieved with the bulk resolve API using either its new ID or its old ID.`, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts index af121eeaea2fa..825a5f95482c0 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts @@ -38,7 +38,7 @@ export const registerBulkUpdateRoute = ( summary: `Update saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts index 0b2b25dab2f83..57f4a10ed9377 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts @@ -38,7 +38,7 @@ export const registerCreateRoute = ( summary: `Create a saved object`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts index 058ff99583c9e..69287821d8049 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts @@ -38,7 +38,7 @@ export const registerDeleteRoute = ( summary: `Delete a saved object`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts index c94b11928a25c..884ba1ed5c423 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts @@ -42,7 +42,7 @@ export const registerFindRoute = ( summary: `Search for saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts index dafe939ff09ee..9fe3aa8ff20c7 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts @@ -38,7 +38,7 @@ export const registerGetRoute = ( summary: `Get a saved object`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts index 72d1c24dd8cdc..28a6c82e9ffdf 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts @@ -34,7 +34,7 @@ export const registerResolveRoute = ( summary: `Resolve a saved object`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, description: `Retrieve a single Kibana saved object by ID, using any legacy URL alias if it exists. Under certain circumstances, when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs to enable new features. When an object's ID is regenerated, a legacy URL alias is created for that object, preserving its old ID. In such a scenario, that object can be retrieved with the resolve API using either its new ID or its old ID.`, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts index cef8937053a3b..cfedc3ce03d2a 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts @@ -39,7 +39,7 @@ export const registerUpdateRoute = ( summary: `Update a saved object`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/x-pack/plugins/actions/server/routes/legacy/create.ts b/x-pack/plugins/actions/server/routes/legacy/create.ts index 6437e7e76ae78..f667a9e003a77 100644 --- a/x-pack/plugins/actions/server/routes/legacy/create.ts +++ b/x-pack/plugins/actions/server/routes/legacy/create.ts @@ -38,7 +38,7 @@ export const createActionRoute = ( access: 'public', summary: `Create a connector`, tags: ['oas-tag:connectors'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/x-pack/plugins/actions/server/routes/legacy/delete.ts b/x-pack/plugins/actions/server/routes/legacy/delete.ts index ce7dced5b5011..c7e1e985cc6f0 100644 --- a/x-pack/plugins/actions/server/routes/legacy/delete.ts +++ b/x-pack/plugins/actions/server/routes/legacy/delete.ts @@ -32,7 +32,7 @@ export const deleteActionRoute = ( summary: `Delete a connector`, description: 'WARNING: When you delete a connector, it cannot be recovered.', tags: ['oas-tag:connectors'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, validate: { diff --git a/x-pack/plugins/actions/server/routes/legacy/execute.ts b/x-pack/plugins/actions/server/routes/legacy/execute.ts index ba86aff8d950a..71b04262075d4 100644 --- a/x-pack/plugins/actions/server/routes/legacy/execute.ts +++ b/x-pack/plugins/actions/server/routes/legacy/execute.ts @@ -37,7 +37,7 @@ export const executeActionRoute = ( options: { access: 'public', summary: `Run a connector`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, tags: ['oas-tag:connectors'], }, diff --git a/x-pack/plugins/actions/server/routes/legacy/get.ts b/x-pack/plugins/actions/server/routes/legacy/get.ts index f00204554ff8d..571849ccaf478 100644 --- a/x-pack/plugins/actions/server/routes/legacy/get.ts +++ b/x-pack/plugins/actions/server/routes/legacy/get.ts @@ -31,7 +31,7 @@ export const getActionRoute = ( options: { access: 'public', summary: `Get connector information`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, tags: ['oas-tag:connectors'], }, diff --git a/x-pack/plugins/actions/server/routes/legacy/get_all.ts b/x-pack/plugins/actions/server/routes/legacy/get_all.ts index 4c57a999c1ccb..f0a17acb96691 100644 --- a/x-pack/plugins/actions/server/routes/legacy/get_all.ts +++ b/x-pack/plugins/actions/server/routes/legacy/get_all.ts @@ -23,7 +23,7 @@ export const getAllActionRoute = ( options: { access: 'public', summary: `Get all connectors`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, tags: ['oas-tag:connectors'], }, diff --git a/x-pack/plugins/actions/server/routes/legacy/list_action_types.ts b/x-pack/plugins/actions/server/routes/legacy/list_action_types.ts index 11531f1d56cc1..cc3e9c23f240d 100644 --- a/x-pack/plugins/actions/server/routes/legacy/list_action_types.ts +++ b/x-pack/plugins/actions/server/routes/legacy/list_action_types.ts @@ -27,7 +27,7 @@ export const listActionTypesRoute = ( options: { access: 'public', summary: `Get connector types`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, tags: ['oas-tag:connectors'], }, diff --git a/x-pack/plugins/actions/server/routes/legacy/update.ts b/x-pack/plugins/actions/server/routes/legacy/update.ts index 14172c12fd40f..0bf1ec7ece55d 100644 --- a/x-pack/plugins/actions/server/routes/legacy/update.ts +++ b/x-pack/plugins/actions/server/routes/legacy/update.ts @@ -37,7 +37,7 @@ export const updateActionRoute = ( options: { access: 'public', summary: `Update a connector`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, tags: ['oas-tag:connectors'], }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/create.ts b/x-pack/plugins/alerting/server/routes/legacy/create.ts index 674be27594ddb..333877b7df49e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/create.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/create.ts @@ -65,7 +65,7 @@ export const createAlertRoute = ({ access: isServerless ? 'internal' : 'public', summary: 'Create an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/delete.ts b/x-pack/plugins/alerting/server/routes/legacy/delete.ts index 3e99bae02b10f..2b63de9e4ee73 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/delete.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/delete.ts @@ -33,7 +33,7 @@ export const deleteAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Delete an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/disable.ts b/x-pack/plugins/alerting/server/routes/legacy/disable.ts index 485a915868f11..0c6f3cf062a0c 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/disable.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/disable.ts @@ -34,7 +34,7 @@ export const disableAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Disable an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/enable.ts b/x-pack/plugins/alerting/server/routes/legacy/enable.ts index 21bab104b5cb4..d52eaa784f670 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/enable.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/enable.ts @@ -35,7 +35,7 @@ export const enableAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Enable an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/find.ts b/x-pack/plugins/alerting/server/routes/legacy/find.ts index 05fd90fa87191..fa309ae51f2e4 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/find.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/find.ts @@ -79,7 +79,7 @@ export const findAlertRoute = ( tags: ['oas-tag:alerting'], description: 'Gets a paginated set of alerts. Alert `params` are stored as a flattened field type and analyzed as keywords. As alerts change in Kibana, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data.', - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/get.ts b/x-pack/plugins/alerting/server/routes/legacy/get.ts index c9afbe62f051a..e5eff52bf02d6 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get.ts @@ -33,7 +33,7 @@ export const getAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Get an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts index 8c22d8ed1f0b2..58a75dd68dce7 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts @@ -44,7 +44,7 @@ export const getAlertInstanceSummaryRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Get an alert summary', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts index a43836b3ebf2b..e952ef8719667 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts @@ -33,7 +33,7 @@ export const getAlertStateRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Get the state of an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.ts b/x-pack/plugins/alerting/server/routes/legacy/health.ts index aef760a6af361..8f67767941fd2 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/health.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/health.ts @@ -29,7 +29,7 @@ export function healthRoute( access: isServerless ? 'internal' : 'public', summary: 'Get the alerting framework health', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts index aea596b6eee17..35d6a7efeeee3 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts @@ -25,7 +25,7 @@ export const listAlertTypesRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Get the alert types', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts index 9987d7aaf2ebf..5c4fc1542ef5b 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts @@ -34,7 +34,7 @@ export const muteAllAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Mute all alert instances', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts index 62cd1c2bcad95..ab0b52d41de29 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts @@ -37,7 +37,7 @@ export const muteAlertInstanceRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Mute an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts index 328f2f6c866ea..0681e7d2cf01e 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts @@ -34,7 +34,7 @@ export const unmuteAllAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Unmute all alert instances', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts index 9a469c6eba77d..1101a2b5092e7 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts @@ -35,7 +35,7 @@ export const unmuteAlertInstanceRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Unmute an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/update.ts b/x-pack/plugins/alerting/server/routes/legacy/update.ts index c4dd270a00c00..01adeb5c634dc 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/update.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/update.ts @@ -61,7 +61,7 @@ export const updateAlertRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Update an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts index 8dec2e2b9417a..30c51d3cdcf5c 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts @@ -35,7 +35,7 @@ export const updateApiKeyRoute = ( access: isServerless ? 'internal' : 'public', summary: 'Update the API key for an alert', tags: ['oas-tag:alerting'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, }, diff --git a/x-pack/plugins/cases/server/routes/api/comments/get_all_comment.ts b/x-pack/plugins/cases/server/routes/api/comments/get_all_comment.ts index 5e6aebb17fc74..6e8ac79bffec9 100644 --- a/x-pack/plugins/cases/server/routes/api/comments/get_all_comment.ts +++ b/x-pack/plugins/cases/server/routes/api/comments/get_all_comment.ts @@ -31,7 +31,7 @@ export const getAllCommentsRoute = createCasesRoute({ summary: `Gets all case comments`, tags: ['oas-tag:cases'], // description: 'You must have `read` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the cases with the comments you\'re seeking.', - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, handler: async ({ context, request, response }) => { diff --git a/x-pack/plugins/cases/server/routes/api/stats/get_status.ts b/x-pack/plugins/cases/server/routes/api/stats/get_status.ts index 19f41a3880955..dce369e4a0f45 100644 --- a/x-pack/plugins/cases/server/routes/api/stats/get_status.ts +++ b/x-pack/plugins/cases/server/routes/api/stats/get_status.ts @@ -26,7 +26,7 @@ export const getStatusRoute: CaseRoute = createCasesRoute({ description: 'Returns the number of cases that are open, closed, and in progress in the default space.', // You must have `read` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the cases you're seeking. - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, handler: async ({ context, request, response }) => { diff --git a/x-pack/plugins/cases/server/routes/api/user_actions/get_all_user_actions.ts b/x-pack/plugins/cases/server/routes/api/user_actions/get_all_user_actions.ts index d3443cce7074d..17fe0dcdb9012 100644 --- a/x-pack/plugins/cases/server/routes/api/user_actions/get_all_user_actions.ts +++ b/x-pack/plugins/cases/server/routes/api/user_actions/get_all_user_actions.ts @@ -30,7 +30,7 @@ export const getUserActionsRoute = createCasesRoute({ description: `Returns all user activity for a case.`, // You must have `read` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the case you're seeking. tags: ['oas-tag:cases'], - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }, handler: async ({ context, request, response }) => { diff --git a/x-pack/plugins/fleet/server/routes/agent/index.ts b/x-pack/plugins/fleet/server/routes/agent/index.ts index 08e31dd389f06..fc45869dc1219 100644 --- a/x-pack/plugins/fleet/server/routes/agent/index.ts +++ b/x-pack/plugins/fleet/server/routes/agent/index.ts @@ -397,7 +397,7 @@ export const registerAPIRoutes = (router: FleetAuthzRouter, config: FleetConfigT fleetAuthz: { fleet: { allAgents: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -619,7 +619,7 @@ export const registerAPIRoutes = (router: FleetAuthzRouter, config: FleetConfigT fleetAuthz: { fleet: { readAgents: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( diff --git a/x-pack/plugins/fleet/server/routes/app/index.ts b/x-pack/plugins/fleet/server/routes/app/index.ts index 996d27717bed6..c0b7dbcfa1743 100644 --- a/x-pack/plugins/fleet/server/routes/app/index.ts +++ b/x-pack/plugins/fleet/server/routes/app/index.ts @@ -293,7 +293,7 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType fleet: { allAgents: true }, }, description: `Create a service token`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( 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 b536f41f0e8dd..bcf4448420919 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 @@ -161,7 +161,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { fleetAuthz: { fleet: { readEnrollmentTokens: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -178,7 +178,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { fleetAuthz: { fleet: { allAgents: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -195,7 +195,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { fleetAuthz: { fleet: { readEnrollmentTokens: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -212,7 +212,7 @@ export const registerRoutes = (router: FleetAuthzRouter) => { fleetAuthz: { fleet: { allAgents: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( diff --git a/x-pack/plugins/fleet/server/routes/epm/index.ts b/x-pack/plugins/fleet/server/routes/epm/index.ts index 1025dfc881857..0e3c5e76eb825 100644 --- a/x-pack/plugins/fleet/server/routes/epm/index.ts +++ b/x-pack/plugins/fleet/server/routes/epm/index.ts @@ -659,7 +659,7 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType fleetAuthz, getRouteRequiredAuthz('get', EPM_API_ROUTES.INFO_PATTERN_DEPRECATED) ).granted, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -688,7 +688,7 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType fleetAuthz: { integrations: { writePackageSettings: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -715,7 +715,7 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType .post({ path: EPM_API_ROUTES.INSTALL_FROM_REGISTRY_PATTERN_DEPRECATED, fleetAuthz: INSTALL_PACKAGES_AUTHZ, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( @@ -744,7 +744,7 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType fleetAuthz: { integrations: { removePackages: true }, }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( diff --git a/x-pack/plugins/ml/server/routes/system.ts b/x-pack/plugins/ml/server/routes/system.ts index 6ae4b025814cc..bf4fa3161f5b9 100644 --- a/x-pack/plugins/ml/server/routes/system.ts +++ b/x-pack/plugins/ml/server/routes/system.ts @@ -203,7 +203,7 @@ export function systemRoutes( tags: ['access:ml:canGetJobs'], }, summary: 'ES Search wrapper', - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/index.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/index.ts index 23edb0de54b13..2f6e46d1d7727 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/index.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/index.ts @@ -95,7 +95,7 @@ export function registerEndpointRoutes( access: 'public', path: METADATA_TRANSFORMS_STATUS_ROUTE, options: { authRequired: true, tags: ['access:securitySolution'] }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion( diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts index aa44ac503bd0f..677fb004ee862 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/suggestions/index.ts @@ -43,7 +43,7 @@ export function registerEndpointSuggestionsRoutes( access: 'public', path: SUGGESTIONS_ROUTE, options: { authRequired: true, tags: ['access:securitySolution'] }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Repalce {RouteDeprecationInfo} + // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} deprecated: true, }) .addVersion(