mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[OAS] Refactor description
-> summary
(#184651)
## Summary Per [the OAS docs](https://swagger.io/specification/), they have an info object with a `summary` and `description` field. This PR refactors the existing router `description` field to to OAS `summary` (that is how it has been used) and introduces a "new" `description` field that will be used for the longer form descriptions. ## Resources * https://swagger.io/specification/ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: lcawl <lcawley@elastic.co>
This commit is contained in:
parent
1c255c611a
commit
dd1864b876
82 changed files with 142 additions and 99 deletions
|
@ -499,8 +499,7 @@
|
|||
"description": "Kibana's operational status. A minimal response is sent for unauthorized users."
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Get Kibana's current status."
|
||||
}
|
||||
},
|
||||
"503": {
|
||||
"content": {
|
||||
|
@ -517,11 +516,10 @@
|
|||
"description": "Kibana's operational status. A minimal response is sent for unauthorized users."
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Get Kibana's current status."
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Get Kibana's current status.",
|
||||
"summary": "Get Kibana's current status",
|
||||
"tags": []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,33 @@ export interface RouteConfigOptions<Method extends RouteMethod> {
|
|||
idleSocket?: number;
|
||||
};
|
||||
|
||||
/** A short, human-friendly description of this endpoint */
|
||||
/**
|
||||
* Short summary of this route. Required for all routes used in OAS documentation.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* router.get({
|
||||
* path: '/api/foo/{id}',
|
||||
* access: 'public',
|
||||
* summary: `Get foo resources for an ID`,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
summary?: string;
|
||||
|
||||
/**
|
||||
* Optional API description, which supports [CommonMark](https://spec.commonmark.org) markdown formatting
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* router.get({
|
||||
* path: '/api/foo/{id}',
|
||||
* access: 'public',
|
||||
* summary: `Get foo resources for an ID`,
|
||||
* description: `Foo resources require **X** and **Y** `read` permissions to access.`,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
description?: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,14 +55,29 @@ export type VersionedRouteConfig<Method extends RouteMethod> = Omit<
|
|||
enableQueryVersion?: boolean;
|
||||
|
||||
/**
|
||||
* Human-friendly description of this route, should be usable for documentation
|
||||
* Short summary of this route. Required for all routes used in OAS documentation.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* router.get({
|
||||
* path: '/api/foo/{id}',
|
||||
* access: 'public',
|
||||
* description: `Retrieve foo resources given an ID. To retrieve a list of IDs use the GET /api/foo API.`,
|
||||
* summary: `Get foo resources for an ID`,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
summary?: string;
|
||||
|
||||
/**
|
||||
* Optional API description, which supports [CommonMark](https://spec.commonmark.org) markdown formatting
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* router.get({
|
||||
* path: '/api/foo/{id}',
|
||||
* access: 'public',
|
||||
* summary: `Get foo resources for an ID`,
|
||||
* description: `Foo resources require **X** and **Y** `read` permissions to access.`,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
|
|
|
@ -88,7 +88,7 @@ export const registerStatusRoute = ({
|
|||
// ROUTE_TAG_ACCEPT_JWT from '@kbn/security-plugin/server' that cannot be imported here directly.
|
||||
tags: ['api', 'security:acceptJWT'],
|
||||
access: 'public', // needs to be public to allow access from "system" users like k8s readiness probes.
|
||||
description: `Get Kibana's current status.`,
|
||||
summary: `Get Kibana's current status`,
|
||||
},
|
||||
validate: {
|
||||
request: {
|
||||
|
|
|
@ -26,6 +26,7 @@ Object {
|
|||
"paths": Object {
|
||||
"/foo/{id}": Object {
|
||||
"get": Object {
|
||||
"description": undefined,
|
||||
"operationId": "/foo/{id}#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -85,7 +86,6 @@ Object {
|
|||
},
|
||||
},
|
||||
},
|
||||
"description": "No description",
|
||||
},
|
||||
},
|
||||
"summary": "",
|
||||
|
@ -133,6 +133,7 @@ Object {
|
|||
"paths": Object {
|
||||
"/bar": Object {
|
||||
"get": Object {
|
||||
"description": undefined,
|
||||
"operationId": "/bar#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -221,6 +222,7 @@ Object {
|
|||
},
|
||||
"/foo/{id}/{path*}": Object {
|
||||
"get": Object {
|
||||
"description": "route description",
|
||||
"operationId": "/foo/{id}/{path*}#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -357,15 +359,15 @@ Object {
|
|||
},
|
||||
},
|
||||
},
|
||||
"description": "route",
|
||||
},
|
||||
},
|
||||
"summary": "route",
|
||||
"summary": "route summary",
|
||||
"tags": Array [
|
||||
"bar",
|
||||
],
|
||||
},
|
||||
"post": Object {
|
||||
"description": "route description",
|
||||
"operationId": "/foo/{id}/{path*}#1",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -502,10 +504,9 @@ Object {
|
|||
},
|
||||
},
|
||||
},
|
||||
"description": "route",
|
||||
},
|
||||
},
|
||||
"summary": "route",
|
||||
"summary": "route summary",
|
||||
"tags": Array [
|
||||
"bar",
|
||||
],
|
||||
|
@ -576,6 +577,7 @@ Object {
|
|||
"paths": Object {
|
||||
"/recursive": Object {
|
||||
"get": Object {
|
||||
"description": undefined,
|
||||
"operationId": "/recursive#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -611,7 +613,6 @@ Object {
|
|||
},
|
||||
},
|
||||
},
|
||||
"description": "No description",
|
||||
},
|
||||
},
|
||||
"summary": "",
|
||||
|
@ -659,6 +660,7 @@ Object {
|
|||
"paths": Object {
|
||||
"/foo/{id}": Object {
|
||||
"get": Object {
|
||||
"description": undefined,
|
||||
"operationId": "/foo/{id}#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
@ -688,7 +690,6 @@ Object {
|
|||
"schema": Object {},
|
||||
},
|
||||
},
|
||||
"description": "No description",
|
||||
},
|
||||
},
|
||||
"summary": "",
|
||||
|
@ -697,6 +698,7 @@ Object {
|
|||
},
|
||||
"/test": Object {
|
||||
"get": Object {
|
||||
"description": undefined,
|
||||
"operationId": "/test#0",
|
||||
"parameters": Array [
|
||||
Object {
|
||||
|
|
|
@ -55,7 +55,8 @@ export const getRouterDefaults = () => ({
|
|||
method: 'get',
|
||||
options: {
|
||||
tags: ['foo', 'oas-tag:bar'],
|
||||
description: 'route',
|
||||
summary: 'route summary',
|
||||
description: 'route description',
|
||||
},
|
||||
validationSchemas: {
|
||||
request: {
|
||||
|
@ -82,7 +83,7 @@ export const getVersionedRouterDefaults = () => ({
|
|||
method: 'get',
|
||||
path: '/bar',
|
||||
options: {
|
||||
description: 'versioned route',
|
||||
summary: 'versioned route',
|
||||
access: 'public',
|
||||
options: {
|
||||
tags: ['ignore-me', 'oas-tag:versioned'],
|
||||
|
|
|
@ -45,7 +45,6 @@ describe('extractResponses', () => {
|
|||
};
|
||||
expect(extractResponses(route, oasConverter)).toEqual({
|
||||
200: {
|
||||
description: 'No description',
|
||||
content: {
|
||||
'application/test+json; Elastic-Api-Version=2023-10-31': {
|
||||
schema: {
|
||||
|
@ -60,7 +59,6 @@ describe('extractResponses', () => {
|
|||
},
|
||||
},
|
||||
404: {
|
||||
description: 'No description',
|
||||
content: {
|
||||
'application/test2+json; Elastic-Api-Version=2023-10-31': {
|
||||
schema: {
|
||||
|
|
|
@ -60,7 +60,8 @@ export const processRouter = (
|
|||
}
|
||||
|
||||
const operation: OpenAPIV3.OperationObject = {
|
||||
summary: route.options.description ?? '',
|
||||
summary: route.options.summary ?? '',
|
||||
description: route.options.description,
|
||||
tags: route.options.tags ? extractTags(route.options.tags) : [],
|
||||
requestBody: !!validationSchemas?.body
|
||||
? {
|
||||
|
@ -103,7 +104,6 @@ export const extractResponses = (route: InternalRouterRoute, converter: OasConve
|
|||
const oasSchema = converter.convert(schema.body());
|
||||
acc[statusCode] = {
|
||||
...acc[statusCode],
|
||||
description: route.options.description ?? 'No description',
|
||||
content: {
|
||||
...((acc[statusCode] ?? {}) as OpenAPIV3.ResponseObject).content,
|
||||
[getVersionedContentTypeString(
|
||||
|
|
|
@ -84,7 +84,8 @@ export const processVersionedRouter = (
|
|||
const contentType = extractContentType(route.options.options?.body);
|
||||
const hasVersionFilter = Boolean(filters?.version);
|
||||
const operation: OpenAPIV3.OperationObject = {
|
||||
summary: route.options.description ?? '',
|
||||
summary: route.options.summary ?? '',
|
||||
description: route.options.description,
|
||||
tags: route.options.options?.tags ? extractTags(route.options.options.tags) : [],
|
||||
requestBody: hasBody
|
||||
? {
|
||||
|
|
|
@ -17,7 +17,7 @@ export const registerCreateRoute = (router: IRouter, url: ServerUrlService) => {
|
|||
path: '/api/short_url',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Create a short URL`,
|
||||
summary: `Create a short URL`,
|
||||
},
|
||||
validate: {
|
||||
body: schema.object({
|
||||
|
|
|
@ -16,7 +16,7 @@ export const registerDeleteRoute = (router: IRouter, url: ServerUrlService) => {
|
|||
path: '/api/short_url/{id}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a short URL`,
|
||||
summary: `Delete a short URL`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -16,7 +16,7 @@ export const registerGetRoute = (router: IRouter, url: ServerUrlService) => {
|
|||
path: '/api/short_url/{id}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get a short URL`,
|
||||
summary: `Get a short URL`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -17,7 +17,7 @@ export const registerResolveRoute = (router: IRouter, url: ServerUrlService) =>
|
|||
path: '/api/short_url/_slug/{slug}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Resolve a short URL`,
|
||||
summary: `Resolve a short URL`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -25,7 +25,7 @@ export const getConnectorRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get connector information`,
|
||||
summary: `Get connector information`,
|
||||
},
|
||||
validate: {
|
||||
params: getConnectorParamsSchemaV1,
|
||||
|
|
|
@ -22,7 +22,7 @@ export const getAllConnectorsRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connectors`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get all connectors`,
|
||||
summary: `Get all connectors`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
|
|
|
@ -26,7 +26,7 @@ export const listTypesRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector_types`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get connector types`,
|
||||
summary: `Get connector types`,
|
||||
},
|
||||
validate: {
|
||||
query: connectorTypesQuerySchemaV1,
|
||||
|
|
|
@ -55,7 +55,7 @@ export const createActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector/{id?}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: 'Create a connector',
|
||||
summary: 'Create a connector',
|
||||
},
|
||||
validate: {
|
||||
params: schema.maybe(
|
||||
|
|
|
@ -25,7 +25,7 @@ export const deleteActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a connector`,
|
||||
summary: `Delete a connector`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -41,7 +41,9 @@ export const executeActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector/{id}/_execute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Run a connector`,
|
||||
summary: `Run a connector`,
|
||||
description:
|
||||
'You can use this API to test an action that involves interaction with Kibana services or integrations with third-party systems. You must have `read` privileges for the **Actions and Connectors** feature in the **Management** section of the Kibana feature privileges. If you use an index connector, you must also have `all`, `create`, `index`, or `write` indices privileges.',
|
||||
},
|
||||
validate: {
|
||||
body: bodySchema,
|
||||
|
|
|
@ -31,7 +31,7 @@ export const createActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/action`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Create a connector`,
|
||||
summary: `Create a connector`,
|
||||
},
|
||||
validate: {
|
||||
body: bodySchema,
|
||||
|
|
|
@ -27,7 +27,7 @@ export const deleteActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/action/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a connector`,
|
||||
summary: `Delete a connector`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -33,7 +33,7 @@ export const executeActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/action/{id}/_execute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Run a connector`,
|
||||
summary: `Run a connector`,
|
||||
},
|
||||
validate: {
|
||||
body: bodySchema,
|
||||
|
|
|
@ -27,7 +27,7 @@ export const getActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/action/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get connector information`,
|
||||
summary: `Get connector information`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -22,7 +22,7 @@ export const getAllActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get all connectors`,
|
||||
summary: `Get all connectors`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
|
|
|
@ -26,7 +26,7 @@ export const listActionTypesRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/list_action_types`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get connector types`,
|
||||
summary: `Get connector types`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ export const updateActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/action/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update a connector`,
|
||||
summary: `Update a connector`,
|
||||
},
|
||||
validate: {
|
||||
body: bodySchema,
|
||||
|
|
|
@ -51,7 +51,7 @@ export const updateActionRoute = (
|
|||
path: `${BASE_ACTION_API_PATH}/connector/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update a connector`,
|
||||
summary: `Update a connector`,
|
||||
},
|
||||
validate: {
|
||||
body: bodySchema,
|
||||
|
|
|
@ -32,7 +32,7 @@ export const disableRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_disable`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Disable a rule`,
|
||||
summary: `Disable a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -24,7 +24,7 @@ export const enableRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_enable`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Enable a rule`,
|
||||
summary: `Enable a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -42,7 +42,7 @@ export const healthRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/_health`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get the health of the alerting framework`,
|
||||
summary: `Get the health of the alerting framework`,
|
||||
},
|
||||
validate: false,
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const muteAllRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_mute_all`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Mute all alerts`,
|
||||
summary: `Mute all alerts`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -34,7 +34,7 @@ export const createRuleRoute = ({ router, licenseState, usageCounter }: RouteOpt
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id?}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Create a rule`,
|
||||
summary: `Create a rule`,
|
||||
},
|
||||
validate: {
|
||||
body: createBodySchemaV1,
|
||||
|
|
|
@ -23,7 +23,7 @@ export const deleteRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a rule`,
|
||||
summary: `Delete a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: deleteRuleRequestParamsSchemaV1,
|
||||
|
|
|
@ -43,7 +43,7 @@ const buildFindRulesRoute = ({
|
|||
path,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rules`,
|
||||
summary: `Get rules`,
|
||||
},
|
||||
validate: {
|
||||
query: findRulesRequestQuerySchemaV1,
|
||||
|
|
|
@ -78,7 +78,7 @@ export const getRuleRoute = (
|
|||
router,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rule details`,
|
||||
summary: `Get rule details`,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export const muteAlertRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{rule_id}/alert/{alert_id}/_mute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Mute an alert`,
|
||||
summary: `Mute an alert`,
|
||||
},
|
||||
validate: {
|
||||
params: muteAlertParamsSchemaV1,
|
||||
|
|
|
@ -33,7 +33,7 @@ export const updateRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update a rule`,
|
||||
summary: `Update a rule`,
|
||||
},
|
||||
validate: {
|
||||
body: updateBodySchemaV1,
|
||||
|
|
|
@ -57,7 +57,7 @@ export const ruleTypesRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule_types`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rule types`,
|
||||
summary: `Get rule types`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ export const unmuteAlertRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{rule_id}/alert/{alert_id}/_unmute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Unmute an alert`,
|
||||
summary: `Unmute an alert`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -24,7 +24,7 @@ export const unmuteAllRuleRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_unmute_all`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Unmute all alerts`,
|
||||
summary: `Unmute all alerts`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -24,7 +24,7 @@ export const updateRuleApiKeyRoute = (
|
|||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_update_api_key`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update the API key for a rule`,
|
||||
summary: `Update the API key for a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
|
|
|
@ -21,7 +21,7 @@ export const getCasesByAlertIdRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get cases for an alert`,
|
||||
summary: `Get cases for an alert`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -16,7 +16,7 @@ export const deleteCaseRoute = createCasesRoute({
|
|||
path: CASES_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Delete cases`,
|
||||
summary: `Delete cases`,
|
||||
},
|
||||
params: {
|
||||
query: schema.object({
|
||||
|
|
|
@ -15,7 +15,7 @@ export const findCaseRoute = createCasesRoute({
|
|||
path: `${CASES_URL}/_find`,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Search cases`,
|
||||
summary: `Search cases`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -32,7 +32,7 @@ export const getCaseRoute = createCasesRoute({
|
|||
params,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get a case`,
|
||||
summary: `Get a case`,
|
||||
},
|
||||
handler: async ({ context, request, response, logger, kibanaVersion }) => {
|
||||
try {
|
||||
|
|
|
@ -16,7 +16,7 @@ export const patchCaseRoute = createCasesRoute({
|
|||
path: CASES_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Update cases`,
|
||||
summary: `Update cases`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -16,7 +16,7 @@ export const postCaseRoute = createCasesRoute({
|
|||
path: CASES_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Create a case`,
|
||||
summary: `Create a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const pushCaseRoute: CaseRoute = createCasesRoute({
|
|||
path: CASE_PUSH_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Push a case to an external service`,
|
||||
summary: `Push a case to an external service`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const getReportersRoute = createCasesRoute({
|
|||
path: CASE_REPORTERS_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get all case creators`,
|
||||
summary: `Get all case creators`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const getTagsRoute = createCasesRoute({
|
|||
path: CASE_TAGS_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get case tags`,
|
||||
summary: `Get case tags`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const deleteAllCommentsRoute = createCasesRoute({
|
|||
path: CASE_COMMENTS_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Delete all alerts and comments from a case`,
|
||||
summary: `Delete all alerts and comments from a case`,
|
||||
},
|
||||
params: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -22,7 +22,7 @@ export const deleteCommentRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Delete an alert or comment from a case`,
|
||||
summary: `Delete an alert or comment from a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@ export const findCommentsRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get all alerts and comments for a case`,
|
||||
summary: `Get all alerts and comments for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@ export const getAllAlertsAttachedToCaseRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get all alerts for a case`,
|
||||
summary: `Get all alerts for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -28,7 +28,7 @@ export const getAllCommentsRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Gets all comments for a case`,
|
||||
summary: `Gets all comments for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -23,7 +23,7 @@ export const getCommentRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get an alert or comment for a case`,
|
||||
summary: `Get an alert or comment for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -23,7 +23,7 @@ export const patchCommentRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Update an alert or comment in a case`,
|
||||
summary: `Update an alert or comment in a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@ export const postCommentRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Add an alert or comment to a case`,
|
||||
summary: `Add an alert or comment to a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const getCaseConfigureRoute = createCasesRoute({
|
|||
path: CASE_CONFIGURE_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get case settings`,
|
||||
summary: `Get case settings`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const getConnectorsRoute = createCasesRoute({
|
|||
routerOptions: {
|
||||
tags: ['access:casesGetConnectorsConfigure'],
|
||||
access: 'public',
|
||||
description: `Get case connectors`,
|
||||
summary: `Get case connectors`,
|
||||
},
|
||||
handler: async ({ context, response }) => {
|
||||
try {
|
||||
|
|
|
@ -17,7 +17,7 @@ export const patchCaseConfigureRoute = createCasesRoute({
|
|||
path: CASE_CONFIGURE_DETAILS_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Update case settings`,
|
||||
summary: `Update case settings`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -17,7 +17,7 @@ export const postCaseConfigureRoute = createCasesRoute({
|
|||
path: CASE_CONFIGURE_URL,
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Add case settings`,
|
||||
summary: `Add case settings`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -21,7 +21,7 @@ export const getStatusRoute: CaseRoute = createCasesRoute({
|
|||
options: { deprecated: true },
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get case status summary`,
|
||||
summary: `Get case status summary`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@ export const findUserActionsRoute = createCasesRoute({
|
|||
},
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get user activity for a case`,
|
||||
summary: `Get user activity for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -26,7 +26,7 @@ export const getUserActionsRoute = createCasesRoute({
|
|||
options: { deprecated: true },
|
||||
routerOptions: {
|
||||
access: 'public',
|
||||
description: `Get all user activity for a case`,
|
||||
summary: `Get all user activity for a case`,
|
||||
},
|
||||
handler: async ({ context, request, response }) => {
|
||||
try {
|
||||
|
|
|
@ -24,7 +24,7 @@ export function defineRoutes({ router, featureRegistry }: RouteDefinitionParams)
|
|||
options: {
|
||||
tags: ['access:features'],
|
||||
access: 'public',
|
||||
description: `Get features`,
|
||||
summary: `Get features`,
|
||||
},
|
||||
validate: {
|
||||
query: schema.object({ ignoreValidLicenses: schema.boolean({ defaultValue: false }) }),
|
||||
|
|
|
@ -16,7 +16,7 @@ export function registerPipelineDeleteRoute(router: LogstashPluginRouter) {
|
|||
path: '/api/logstash/pipeline/{id}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a managed Logstash pipeline`,
|
||||
summary: `Delete a managed Logstash pipeline`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -18,7 +18,7 @@ export function registerPipelineLoadRoute(router: LogstashPluginRouter) {
|
|||
path: '/api/logstash/pipeline/{id}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get a managed Logstash pipeline`,
|
||||
summary: `Get a managed Logstash pipeline`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -23,7 +23,7 @@ export function registerPipelineSaveRoute(
|
|||
path: '/api/logstash/pipeline/{id}',
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Create a managed Logstash pipeline`,
|
||||
summary: `Create a managed Logstash pipeline`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -37,7 +37,7 @@ export function registerPipelinesDeleteRoute(router: LogstashPluginRouter) {
|
|||
{
|
||||
path: '/api/logstash/pipelines/delete',
|
||||
options: {
|
||||
description: `Delete managed Logstash pipelines`,
|
||||
summary: `Delete managed Logstash pipelines`,
|
||||
},
|
||||
validate: {
|
||||
body: schema.object({
|
||||
|
|
|
@ -28,7 +28,7 @@ export function registerPipelinesListRoute(router: LogstashPluginRouter) {
|
|||
{
|
||||
path: '/api/logstash/pipelines',
|
||||
options: {
|
||||
description: `Get all managed Logstash pipelines`,
|
||||
summary: `Get all managed Logstash pipelines`,
|
||||
},
|
||||
validate: false,
|
||||
},
|
||||
|
|
|
@ -78,7 +78,7 @@ export function savedObjectsRoutes(
|
|||
.get({
|
||||
path: `${ML_EXTERNAL_BASE_PATH}/saved_objects/sync`,
|
||||
access: 'public',
|
||||
description: 'Synchronize machine learning saved objects',
|
||||
summary: 'Synchronize machine learning saved objects',
|
||||
options: {
|
||||
tags: [
|
||||
'access:ml:canCreateJob',
|
||||
|
|
|
@ -16,7 +16,7 @@ export function defineDeleteRolesRoutes({ router }: RouteDefinitionParams) {
|
|||
{
|
||||
path: '/api/security/role/{name}',
|
||||
options: {
|
||||
description: `Delete a role`,
|
||||
summary: `Delete a role`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({ name: schema.string({ minLength: 1 }) }),
|
||||
|
|
|
@ -22,7 +22,7 @@ export function defineGetRolesRoutes({
|
|||
{
|
||||
path: '/api/security/role/{name}',
|
||||
options: {
|
||||
description: `Get a role`,
|
||||
summary: `Get a role`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({ name: schema.string({ minLength: 1 }) }),
|
||||
|
|
|
@ -22,7 +22,7 @@ export function defineGetAllRolesRoutes({
|
|||
{
|
||||
path: '/api/security/role',
|
||||
options: {
|
||||
description: `Get all roles`,
|
||||
summary: `Get all roles`,
|
||||
},
|
||||
validate: false,
|
||||
},
|
||||
|
|
|
@ -46,7 +46,7 @@ export function definePutRolesRoutes({
|
|||
{
|
||||
path: '/api/security/role/{name}',
|
||||
options: {
|
||||
description: `Create or update a role`,
|
||||
summary: `Create or update a role`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({ name: schema.string({ minLength: 1, maxLength: 1024 }) }),
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('Invalidate sessions routes', () => {
|
|||
|
||||
it('correctly defines route.', () => {
|
||||
expect(routeConfig.options).toEqual({
|
||||
description: 'Invalidate user sessions',
|
||||
summary: 'Invalidate user sessions',
|
||||
tags: ['access:sessionManagement'],
|
||||
});
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ export function defineInvalidateSessionsRoutes({ router, getSession }: RouteDefi
|
|||
},
|
||||
options: {
|
||||
tags: ['access:sessionManagement'],
|
||||
description: `Invalidate user sessions`,
|
||||
summary: `Invalidate user sessions`,
|
||||
},
|
||||
},
|
||||
async (_context, request, response) => {
|
||||
|
|
|
@ -131,7 +131,7 @@ export function healthRoute(params: HealthRouteParams): {
|
|||
validate: false,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get task manager health`,
|
||||
summary: `Get task manager health`,
|
||||
},
|
||||
},
|
||||
async function (
|
||||
|
|
|
@ -38,7 +38,7 @@ export function registerBatchReindexIndicesRoutes(
|
|||
path: `${BASE_PATH}/batch/queue`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get the batch reindex queue`,
|
||||
summary: `Get the batch reindex queue`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
|
@ -77,7 +77,7 @@ export function registerBatchReindexIndicesRoutes(
|
|||
path: `${BASE_PATH}/batch`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Batch start or resume reindex`,
|
||||
summary: `Batch start or resume reindex`,
|
||||
},
|
||||
validate: {
|
||||
body: schema.object({
|
||||
|
|
|
@ -36,7 +36,7 @@ export function registerReindexIndicesRoutes(
|
|||
path: `${BASE_PATH}/{indexName}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Start or resume reindex`,
|
||||
summary: `Start or resume reindex`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
@ -83,7 +83,7 @@ export function registerReindexIndicesRoutes(
|
|||
path: `${BASE_PATH}/{indexName}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get reindex status`,
|
||||
summary: `Get reindex status`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
@ -144,7 +144,7 @@ export function registerReindexIndicesRoutes(
|
|||
path: `${BASE_PATH}/{indexName}/cancel`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Cancel reindex`,
|
||||
summary: `Cancel reindex`,
|
||||
},
|
||||
validate: {
|
||||
params: schema.object({
|
||||
|
|
|
@ -26,7 +26,7 @@ export function registerUpgradeStatusRoute({
|
|||
path: `${API_BASE_PATH}/status`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get upgrade readiness status`,
|
||||
summary: `Get upgrade readiness status`,
|
||||
},
|
||||
validate: false,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue