From dddcf2ef434bb1c8a1df7bea3d4bbd3566fe4923 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 8 Jul 2024 06:54:52 -0700 Subject: [PATCH] [HTTP/OAS] Add tags and summaries for saved object APIs (#184184) Co-authored-by: Jean-Louis Leysens --- .../src/routes/bulk_create.ts | 3 ++- .../src/routes/bulk_delete.ts | 3 ++- .../src/routes/bulk_get.ts | 3 ++- .../src/routes/bulk_resolve.ts | 3 ++- .../src/routes/bulk_update.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/create.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/delete.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/export.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/find.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/get.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/import.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/resolve.ts | 3 ++- .../src/routes/resolve_import_errors.ts | 3 ++- .../core-saved-objects-server-internal/src/routes/update.ts | 3 ++- .../server/routes/key_rotation.test.ts | 5 ++++- .../encrypted_saved_objects/server/routes/key_rotation.ts | 3 ++- 16 files changed, 34 insertions(+), 16 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 62b253e64f2e3..35c8fc305d062 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 @@ -34,8 +34,9 @@ export const registerBulkCreateRoute = ( { path: '/_bulk_create', options: { + summary: `Create saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Create saved objects`, }, validate: { query: schema.object({ 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 ad8a087f5cfdd..0f7219386a07b 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 @@ -34,8 +34,9 @@ export const registerBulkDeleteRoute = ( { path: '/_bulk_delete', options: { + summary: `Delete saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Remove saved objects`, }, validate: { body: schema.arrayOf( 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 2e9798d56f3b1..c54069c0aae5c 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 @@ -34,8 +34,9 @@ export const registerBulkGetRoute = ( { path: '/_bulk_get', options: { + summary: `Get saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Get saved objects`, }, validate: { body: schema.arrayOf( 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 786af996dc628..d59c5e096aa2e 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 @@ -34,8 +34,9 @@ export const registerBulkResolveRoute = ( { path: '/_bulk_resolve', options: { + summary: `Resolve saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Resolve saved objects`, }, validate: { body: schema.arrayOf( 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 ef6609358a782..cd401ba4f2061 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 @@ -34,8 +34,9 @@ export const registerBulkUpdateRoute = ( { path: '/_bulk_update', options: { + summary: `Update saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Update saved objects`, }, validate: { body: schema.arrayOf( 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 54db933dea814..5fb3a2964c701 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 @@ -34,8 +34,9 @@ export const registerCreateRoute = ( { path: '/{type}/{id?}', options: { + summary: `Create a saved object`, + tags: ['oas-tag:saved objects'], access, - description: `Create a saved object`, }, validate: { params: schema.object({ 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 5d18aa5763663..eb01f092ba585 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 @@ -34,8 +34,9 @@ export const registerDeleteRoute = ( { path: '/{type}/{id}', options: { + summary: `Delete a saved object`, + tags: ['oas-tag:saved objects'], access, - description: `Delete a saved object`, }, validate: { params: schema.object({ diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts index e6ec6f7caa5be..ea2adb976d07f 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts @@ -144,8 +144,9 @@ export const registerExportRoute = ( { path: '/_export', options: { + summary: `Export saved objects`, + tags: ['oas-tag:saved objects'], access: 'public', - description: `Export saved objects`, }, validate: { body: schema.object({ 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 8efc647573d69..525e80e7637b6 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 @@ -38,8 +38,9 @@ export const registerFindRoute = ( { path: '/_find', options: { + summary: `Search for saved objects`, + tags: ['oas-tag:saved objects'], access, - description: `Search for saved objects`, }, validate: { query: schema.object({ 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 caaae77da9568..5d0ffb9a11964 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 @@ -34,8 +34,9 @@ export const registerGetRoute = ( { path: '/{type}/{id}', options: { + summary: `Get a saved object`, + tags: ['oas-tag:saved objects'], access, - description: `Get a saved object`, }, validate: { params: schema.object({ diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts index 7b4181a76507e..69042c7ce6a31 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts @@ -36,8 +36,9 @@ export const registerImportRoute = ( { path: '/_import', options: { + summary: `Import saved objects`, + tags: ['oas-tag:saved objects'], access: 'public', - description: `Import saved objects`, body: { maxBytes: maxImportPayloadBytes, output: 'stream', 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 866e6d47e8390..2139deda867dc 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 @@ -30,8 +30,9 @@ export const registerResolveRoute = ( { path: '/resolve/{type}/{id}', options: { + summary: `Resolve a saved object`, + tags: ['oas-tag:saved objects'], access, - description: `Resolve a saved object`, }, validate: { params: schema.object({ diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts index 770b3af978f1e..e9020b200b048 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts @@ -37,8 +37,9 @@ export const registerResolveImportErrorsRoute = ( { path: '/_resolve_import_errors', options: { + summary: `Resolve import errors`, + tags: ['oas-tag:saved objects'], access: 'public', - description: `Resolve import errors`, body: { maxBytes: maxImportPayloadBytes, output: 'stream', 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 cda03f99c4ad1..c0b5b9ae26d3b 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 @@ -35,8 +35,9 @@ export const registerUpdateRoute = ( { path: '/{type}/{id}', options: { + summary: `Update a saved object`, + tags: ['oas-tag:saved objects'], access, - description: `Update a saved object`, }, validate: { params: schema.object({ diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts index edcf522987115..83d56a133ea16 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.test.ts @@ -43,7 +43,10 @@ describe('Key rotation routes', () => { }); it('correctly defines route.', () => { - expect(routeConfig.options).toEqual({ tags: ['access:rotateEncryptionKey'] }); + expect(routeConfig.options).toEqual({ + tags: ['access:rotateEncryptionKey', 'oas-tag:saved objects'], + description: `Rotate a key for encrypted saved objects`, + }); expect(routeConfig.validate).toEqual({ body: undefined, query: expect.any(Type), diff --git a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts index 9305446767e9d..c9c452cf9a031 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/routes/key_rotation.ts @@ -39,7 +39,8 @@ export function defineKeyRotationRoutes({ }), }, options: { - tags: ['access:rotateEncryptionKey'], + tags: ['access:rotateEncryptionKey', 'oas-tag:saved objects'], + description: `Rotate a key for encrypted saved objects`, }, }, async (context, request, response) => {