[Dashboards as Code] Change access to dashboard route endpoints to internal (#223262)

Changes the dashboard endpoint routes from public to internal as they
are still unreleased.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nick Peihl 2025-06-14 09:47:01 -04:00 committed by GitHub
parent f099dd7346
commit 4d3dec0b90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 12734 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,3 +10,4 @@
export const PUBLIC_API_VERSION = '2023-10-31';
export const PUBLIC_API_CONTENT_MANAGEMENT_VERSION = 3;
export const PUBLIC_API_PATH = '/api/dashboards/dashboard';
export const INTERNAL_API_VERSION = '1';

View file

@ -15,8 +15,8 @@ import type { Logger } from '@kbn/logging';
import { CONTENT_ID } from '../../common/content_management';
import {
INTERNAL_API_VERSION,
PUBLIC_API_PATH,
PUBLIC_API_VERSION,
PUBLIC_API_CONTENT_MANAGEMENT_VERSION,
} from './constants';
import {
@ -34,8 +34,31 @@ interface RegisterAPIRoutesArgs {
logger: Logger;
}
const TECHNICAL_PREVIEW_WARNING =
'This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.';
const commonRouteConfig = {
// This route is in development and not yet intended for public use.
access: 'internal',
/**
* `enableQueryVersion` is a temporary solution for testing internal endpoints.
* Requests to these internal endpoints from Kibana Dev Tools or external clients
* should include the ?apiVersion=1 query parameter.
* This will be removed when the API is finalized and moved to a stable version.
*/
enableQueryVersion: true,
description:
'This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.',
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
} as const;
export function registerAPIRoutes({
http,
@ -48,26 +71,13 @@ export function registerAPIRoutes({
// Create API route
const createRoute = versionedRouter.post({
path: `${PUBLIC_API_PATH}/{id?}`,
access: 'public',
summary: 'Create a dashboard',
description: TECHNICAL_PREVIEW_WARNING,
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
...commonRouteConfig,
});
createRoute.addVersion(
{
version: PUBLIC_API_VERSION,
version: INTERNAL_API_VERSION,
validate: {
request: {
params: schema.object({
@ -127,26 +137,13 @@ export function registerAPIRoutes({
const updateRoute = versionedRouter.put({
path: `${PUBLIC_API_PATH}/{id}`,
access: 'public',
summary: `Update an existing dashboard`,
description: TECHNICAL_PREVIEW_WARNING,
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
...commonRouteConfig,
});
updateRoute.addVersion(
{
version: PUBLIC_API_VERSION,
version: INTERNAL_API_VERSION,
validate: {
request: {
params: schema.object({
@ -194,26 +191,13 @@ export function registerAPIRoutes({
// List API route
const listRoute = versionedRouter.get({
path: `${PUBLIC_API_PATH}`,
access: 'public',
summary: `Get a list of dashboards`,
description: TECHNICAL_PREVIEW_WARNING,
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
...commonRouteConfig,
});
listRoute.addVersion(
{
version: PUBLIC_API_VERSION,
version: INTERNAL_API_VERSION,
validate: {
request: {
query: schema.object({
@ -282,26 +266,13 @@ export function registerAPIRoutes({
// Get API route
const getRoute = versionedRouter.get({
path: `${PUBLIC_API_PATH}/{id}`,
access: 'public',
summary: `Get a dashboard`,
description: TECHNICAL_PREVIEW_WARNING,
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
...commonRouteConfig,
});
getRoute.addVersion(
{
version: PUBLIC_API_VERSION,
version: INTERNAL_API_VERSION,
validate: {
request: {
params: schema.object({
@ -349,26 +320,13 @@ export function registerAPIRoutes({
// Delete API route
const deleteRoute = versionedRouter.delete({
path: `${PUBLIC_API_PATH}/{id}`,
access: 'public',
summary: `Delete a dashboard`,
description: TECHNICAL_PREVIEW_WARNING,
options: {
tags: ['oas-tag:Dashboards'],
availability: {
stability: 'experimental',
},
},
security: {
authz: {
enabled: false,
reason: 'Relies on Content Client for authorization',
},
},
...commonRouteConfig,
});
deleteRoute.addVersion(
{
version: PUBLIC_API_VERSION,
version: INTERNAL_API_VERSION,
validate: {
request: {
params: schema.object({