Skip to content

Commit

Permalink
[8.x] Changes deprecated SO HTTP APIs deprecation field to object (#1…
Browse files Browse the repository at this point in the history
…97936) (#201154)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Changes deprecated SO HTTP APIs deprecation field to object
(#197936)](#197936)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christiane (Tina)
Heiligers","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-07T20:49:05Z","message":"Changes
deprecated SO HTTP APIs deprecation field to object (#197936)\n\nfix
https://github.com/elastic/kibana/issues/197721.\r\n\r\nThe route
deprecation field changed from a boolean to an object, where\r\nthe
object contains information that is used in deprecation issues
that\r\nthe Upgrade Assistant shows.\r\n\r\nThis PR makes the necessary
changes in the deprecated Saved Objects HTTP\r\nAPIs.\r\n\r\nThis PR
also includes a release notes entry for the API deprecations\r\nthat was
missing.\r\n![Screenshot 2024-10-29 at 12
01\r\n29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### How
to test this:\r\n\r\n- Pull PR, run es against a trial license and start
kibana as usual.\r\n- Make a curl request to Kibana to get the config
saved object: \r\n\r\n```\r\ncurl --location
'localhost:5601/abc/api/saved_objects/config/9.0.0' \\\r\n--header
'Content-Type: application/json' \\\r\n--header 'Accept-Encoding: gzip,
deflate, br' \\\r\n--header 'kbn-xsrf: kibana' \\\r\n--header
'Kbn-Version: 9.0.0' \\\r\n--header 'Authorization: Basic
ZWxhc3RpYzpjaGFuZ2VtZQ=='\r\n```\r\n\r\n- Navigate to Upgrade Assistant
and observe Kibana has at least 1\r\ndeprecation warning.\r\n- View
Kibana's warnings, you should see a warning entry for `The
\"GET\r\n/api/saved_objects/{type}/{id}\" route is
deprecated`\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)\r\n\r\n-
click on the deprecation and you should see more detail about
the\r\ndeprecated API that's been used in the
flyout:\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)\r\n\r\n-
resolve the deprecation warning\r\n- Kibana should continue to issue
requests to the deprecated SO HTTP\r\nAPIs because these APIs have not
been removed yet.\r\n\r\n\r\n### Risk Matrix\r\n\r\n| Risk | Probability
| Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
End user concern from the deprecation warning that says the
routes\r\nhave been deprecated | Low | Low | The APIs have been
deprecated since\r\n8.7 and recommends using public APIs instead.
|\r\n\r\n### For maintainers\r\n\r\n- [x] This will appear in the
**Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"0df2e9838119d202eba0c6b2bcb7068b160f6005","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:deprecation","Team:Core","Feature:Saved
Objects","backport
missing","v9.0.0","docs","backport:prev-minor","Epic:Deprecations","Feature:OAS","v8.17.0"],"number":197936,"url":"https://github.com/elastic/kibana/pull/197936","mergeCommit":{"message":"Changes
deprecated SO HTTP APIs deprecation field to object (#197936)\n\nfix
https://github.com/elastic/kibana/issues/197721.\r\n\r\nThe route
deprecation field changed from a boolean to an object, where\r\nthe
object contains information that is used in deprecation issues
that\r\nthe Upgrade Assistant shows.\r\n\r\nThis PR makes the necessary
changes in the deprecated Saved Objects HTTP\r\nAPIs.\r\n\r\nThis PR
also includes a release notes entry for the API deprecations\r\nthat was
missing.\r\n![Screenshot 2024-10-29 at 12
01\r\n29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### How
to test this:\r\n\r\n- Pull PR, run es against a trial license and start
kibana as usual.\r\n- Make a curl request to Kibana to get the config
saved object: \r\n\r\n```\r\ncurl --location
'localhost:5601/abc/api/saved_objects/config/9.0.0' \\\r\n--header
'Content-Type: application/json' \\\r\n--header 'Accept-Encoding: gzip,
deflate, br' \\\r\n--header 'kbn-xsrf: kibana' \\\r\n--header
'Kbn-Version: 9.0.0' \\\r\n--header 'Authorization: Basic
ZWxhc3RpYzpjaGFuZ2VtZQ=='\r\n```\r\n\r\n- Navigate to Upgrade Assistant
and observe Kibana has at least 1\r\ndeprecation warning.\r\n- View
Kibana's warnings, you should see a warning entry for `The
\"GET\r\n/api/saved_objects/{type}/{id}\" route is
deprecated`\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)\r\n\r\n-
click on the deprecation and you should see more detail about
the\r\ndeprecated API that's been used in the
flyout:\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)\r\n\r\n-
resolve the deprecation warning\r\n- Kibana should continue to issue
requests to the deprecated SO HTTP\r\nAPIs because these APIs have not
been removed yet.\r\n\r\n\r\n### Risk Matrix\r\n\r\n| Risk | Probability
| Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
End user concern from the deprecation warning that says the
routes\r\nhave been deprecated | Low | Low | The APIs have been
deprecated since\r\n8.7 and recommends using public APIs instead.
|\r\n\r\n### For maintainers\r\n\r\n- [x] This will appear in the
**Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"0df2e9838119d202eba0c6b2bcb7068b160f6005"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197936","number":197936,"mergeCommit":{"message":"Changes
deprecated SO HTTP APIs deprecation field to object (#197936)\n\nfix
https://github.com/elastic/kibana/issues/197721.\r\n\r\nThe route
deprecation field changed from a boolean to an object, where\r\nthe
object contains information that is used in deprecation issues
that\r\nthe Upgrade Assistant shows.\r\n\r\nThis PR makes the necessary
changes in the deprecated Saved Objects HTTP\r\nAPIs.\r\n\r\nThis PR
also includes a release notes entry for the API deprecations\r\nthat was
missing.\r\n![Screenshot 2024-10-29 at 12
01\r\n29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### How
to test this:\r\n\r\n- Pull PR, run es against a trial license and start
kibana as usual.\r\n- Make a curl request to Kibana to get the config
saved object: \r\n\r\n```\r\ncurl --location
'localhost:5601/abc/api/saved_objects/config/9.0.0' \\\r\n--header
'Content-Type: application/json' \\\r\n--header 'Accept-Encoding: gzip,
deflate, br' \\\r\n--header 'kbn-xsrf: kibana' \\\r\n--header
'Kbn-Version: 9.0.0' \\\r\n--header 'Authorization: Basic
ZWxhc3RpYzpjaGFuZ2VtZQ=='\r\n```\r\n\r\n- Navigate to Upgrade Assistant
and observe Kibana has at least 1\r\ndeprecation warning.\r\n- View
Kibana's warnings, you should see a warning entry for `The
\"GET\r\n/api/saved_objects/{type}/{id}\" route is
deprecated`\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)\r\n\r\n-
click on the deprecation and you should see more detail about
the\r\ndeprecated API that's been used in the
flyout:\r\n\r\n![Screenshot 2024-11-06 at 16
26\r\n44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)\r\n\r\n-
resolve the deprecation warning\r\n- Kibana should continue to issue
requests to the deprecated SO HTTP\r\nAPIs because these APIs have not
been removed yet.\r\n\r\n\r\n### Risk Matrix\r\n\r\n| Risk | Probability
| Severity | Mitigation/Notes
|\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n|
End user concern from the deprecation warning that says the
routes\r\nhave been deprecated | Low | Low | The APIs have been
deprecated since\r\n8.7 and recommends using public APIs instead.
|\r\n\r\n### For maintainers\r\n\r\n- [x] This will appear in the
**Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"0df2e9838119d202eba0c6b2bcb7068b160f6005"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 29a31f4 commit 7fd0115
Show file tree
Hide file tree
Showing 52 changed files with 606 additions and 118 deletions.
29 changes: 29 additions & 0 deletions docs/upgrade-notes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,35 @@ The `/agent_status` Fleet API now returns the following statuses:
* `active` &mdash; All active
====

[discrete]
[[kibana-150267]]
.Deprecated Saved objects APIs. (8.7)
[%collapsible]
====
*Details* +
The following saved objects APIs have been deprecated.
[source,text]
--
/api/saved_objects/{type}/{id}
/api/saved_objects/resolve/{type}/{id}
/api/saved_objects/{type}/{id?}
/api/saved_objects/{type}/{id}
/api/saved_objects/_find
/api/saved_objects/{type}/{id}
/api/saved_objects/_bulk_get
/api/saved_objects/_bulk_create
/api/saved_objects/_bulk_resolve
/api/saved_objects/_bulk_update
/api/saved_objects/_bulk_delete
--
For more information, refer to ({kibana-pull}150267[#150267]).
*Impact* +
Use dedicated public APIs instead, for example use <<data-views-api>> to manage Data Views.
====

[discrete]
[[deprecation-119494]]
.Updates Fleet API to improve consistency. (8.0)
Expand Down
6 changes: 3 additions & 3 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ tags:
description: Kibana role management
url: https://www.elastic.co/guide/en/kibana/8.x/kibana-role-management.html
- description: |
Export sets of saved objects that you want to import into {kib}, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.
Export sets of saved objects that you want to import into Kibana, resolve import errors, and rotate an encryption key for encrypted saved objects with the saved objects APIs.

To manage a specific type of saved object, use the corresponding APIs.
For example, use:
Expand Down Expand Up @@ -18040,7 +18040,7 @@ paths:
schema:
type: object
description: |
Indicates a successful call. NOTE: This HTTP response code indicates that the bulk operation succeeded. Errors pertaining to individual objects will be returned in the response body.
Indicates a successful call. NOTE: This HTTP response code indicates that the bulk operation succeeded. Errors pertaining to individual objects will be returned in the response body.
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:
Expand Down Expand Up @@ -18072,7 +18072,7 @@ paths:
schema:
type: object
description: |
Indicates a successful call. NOTE: This HTTP response code indicates that the bulk operation succeeded. Errors pertaining to individual objects will be returned in the response body.
Indicates a successful call. NOTE: This HTTP response code indicates that the bulk operation succeeded. Errors pertaining to individual objects will be returned in the response body.
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:
Expand Down
1 change: 1 addition & 0 deletions packages/core/root/core-root-server-internal/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export class Server {
elasticsearch: elasticsearchServiceSetup,
deprecations: deprecationsSetup,
coreUsageData: coreUsageDataSetup,
docLinks: docLinksSetup,
});

const uiSettingsSetup = await this.uiSettings.setup({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerBulkCreateRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.post(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
query: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerBulkDeleteRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.post(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerBulkGetRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.post(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerBulkResolveRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.post(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
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.`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerBulkUpdateRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.put(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerCreateRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.post(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerDeleteRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.delete(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -21,11 +21,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerFindRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const referenceSchema = schema.object({
type: schema.string(),
Expand All @@ -42,8 +43,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
query: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { schema } from '@kbn/config-schema';
import type { RouteAccess } from '@kbn/core-http-server';
import type { RouteAccess, RouteDeprecationInfo } from '@kbn/core-http-server';
import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { Logger } from '@kbn/logging';
Expand All @@ -24,11 +24,12 @@ interface RouteDependencies {
coreUsageData: InternalCoreUsageDataSetup;
logger: Logger;
access: RouteAccess;
deprecationInfo: RouteDeprecationInfo;
}

export const registerGetRoute = (
router: InternalSavedObjectRouter,
{ config, coreUsageData, logger, access }: RouteDependencies
{ config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies
) => {
const { allowHttpApiAccess } = config;
router.get(
Expand All @@ -38,8 +39,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): Replace {RouteDeprecationInfo}
deprecated: true,
deprecated: deprecationInfo,
},
validate: {
params: schema.object({
Expand Down
Loading

0 comments on commit 7fd0115

Please sign in to comment.