From 1016ef06d7a78d46c19dc38ee6e642d3f65da89c Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 29 Aug 2024 10:35:42 -0700 Subject: [PATCH] [ResponseOps][Connectors] Add descriptions for OpenAPI responses (#191678) --- .../server/routes/connector/get/get.ts | 11 +++++++--- .../plugins/actions/server/routes/create.ts | 21 ++++++++++++------- .../plugins/actions/server/routes/delete.ts | 10 +++++++-- .../plugins/actions/server/routes/execute.ts | 12 ++++++++--- .../actions/server/routes/legacy/create.ts | 9 +++++++- .../actions/server/routes/legacy/delete.ts | 9 +++++++- .../actions/server/routes/legacy/execute.ts | 11 ++++++++-- .../actions/server/routes/legacy/get.ts | 9 +++++++- .../actions/server/routes/legacy/update.ts | 11 ++++++++-- .../plugins/actions/server/routes/update.ts | 13 ++++++++---- 10 files changed, 89 insertions(+), 27 deletions(-) diff --git a/x-pack/plugins/actions/server/routes/connector/get/get.ts b/x-pack/plugins/actions/server/routes/connector/get/get.ts index 29d917702af4f..4519673a400fe 100644 --- a/x-pack/plugins/actions/server/routes/connector/get/get.ts +++ b/x-pack/plugins/actions/server/routes/connector/get/get.ts @@ -27,11 +27,16 @@ export const getConnectorRoute = ( access: 'public', summary: `Get connector information`, tags: ['oas-tag:connectors'], - // description: - // 'You must have `read` privileges for the **Actions and Connectors** feature in the **Management** section of the Kibana feature privileges.', }, validate: { - params: getConnectorParamsSchemaV1, + request: { + params: getConnectorParamsSchemaV1, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors( diff --git a/x-pack/plugins/actions/server/routes/create.ts b/x-pack/plugins/actions/server/routes/create.ts index 2803c5d31d603..f7e8b61707d70 100644 --- a/x-pack/plugins/actions/server/routes/create.ts +++ b/x-pack/plugins/actions/server/routes/create.ts @@ -63,16 +63,21 @@ export const createActionRoute = ( access: 'public', summary: 'Create a connector', tags: ['oas-tag:connectors'], - // description: - // 'You must have `all` privileges for the **Actions and Connectors** feature in the **Management** section of the Kibana feature privileges.', }, validate: { - params: schema.maybe( - schema.object({ - id: schema.maybe(schema.string()), - }) - ), - body: bodySchema, + request: { + params: schema.maybe( + schema.object({ + id: schema.maybe(schema.string()), + }) + ), + body: bodySchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors( diff --git a/x-pack/plugins/actions/server/routes/delete.ts b/x-pack/plugins/actions/server/routes/delete.ts index 8e2dd21952ab6..8b25fe66c9eb2 100644 --- a/x-pack/plugins/actions/server/routes/delete.ts +++ b/x-pack/plugins/actions/server/routes/delete.ts @@ -29,11 +29,17 @@ export const deleteActionRoute = ( access: 'public', summary: `Delete a connector`, description: 'WARNING: When you delete a connector, it cannot be recovered.', - // You must have `all` privileges for the **Actions and Connectors** feature in the **Management** section of the Kibana feature privileges. tags: ['oas-tag:connectors'], }, validate: { - params: paramSchema, + request: { + params: paramSchema, + }, + response: { + 204: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors( diff --git a/x-pack/plugins/actions/server/routes/execute.ts b/x-pack/plugins/actions/server/routes/execute.ts index 83b6e72652b06..6f2ad11e20588 100644 --- a/x-pack/plugins/actions/server/routes/execute.ts +++ b/x-pack/plugins/actions/server/routes/execute.ts @@ -46,12 +46,18 @@ export const executeActionRoute = ( 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. tags: ['oas-tag:connectors'], }, validate: { - body: bodySchema, - params: paramSchema, + request: { + body: bodySchema, + params: paramSchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors( diff --git a/x-pack/plugins/actions/server/routes/legacy/create.ts b/x-pack/plugins/actions/server/routes/legacy/create.ts index 3fd8c77759122..d668b1fbc19d2 100644 --- a/x-pack/plugins/actions/server/routes/legacy/create.ts +++ b/x-pack/plugins/actions/server/routes/legacy/create.ts @@ -40,7 +40,14 @@ export const createActionRoute = ( deprecated: true, }, validate: { - body: bodySchema, + request: { + body: bodySchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors( diff --git a/x-pack/plugins/actions/server/routes/legacy/delete.ts b/x-pack/plugins/actions/server/routes/legacy/delete.ts index e2df62e5ec4bd..2204095e03801 100644 --- a/x-pack/plugins/actions/server/routes/legacy/delete.ts +++ b/x-pack/plugins/actions/server/routes/legacy/delete.ts @@ -35,7 +35,14 @@ export const deleteActionRoute = ( deprecated: true, }, validate: { - params: paramSchema, + request: { + params: paramSchema, + }, + response: { + 204: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors(async function (context, req, res) { diff --git a/x-pack/plugins/actions/server/routes/legacy/execute.ts b/x-pack/plugins/actions/server/routes/legacy/execute.ts index abe8971baf1cf..88e75aadb627c 100644 --- a/x-pack/plugins/actions/server/routes/legacy/execute.ts +++ b/x-pack/plugins/actions/server/routes/legacy/execute.ts @@ -40,8 +40,15 @@ export const executeActionRoute = ( tags: ['oas-tag:connectors'], }, validate: { - body: bodySchema, - params: paramSchema, + request: { + body: bodySchema, + params: paramSchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors(async function (context, req, res) { diff --git a/x-pack/plugins/actions/server/routes/legacy/get.ts b/x-pack/plugins/actions/server/routes/legacy/get.ts index e95c88fca7c45..524b3522ed541 100644 --- a/x-pack/plugins/actions/server/routes/legacy/get.ts +++ b/x-pack/plugins/actions/server/routes/legacy/get.ts @@ -34,7 +34,14 @@ export const getActionRoute = ( tags: ['oas-tag:connectors'], }, validate: { - params: paramSchema, + request: { + params: paramSchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors(async function (context, req, res) { diff --git a/x-pack/plugins/actions/server/routes/legacy/update.ts b/x-pack/plugins/actions/server/routes/legacy/update.ts index f07682706fc19..5f234c8bf55a9 100644 --- a/x-pack/plugins/actions/server/routes/legacy/update.ts +++ b/x-pack/plugins/actions/server/routes/legacy/update.ts @@ -40,8 +40,15 @@ export const updateActionRoute = ( tags: ['oas-tag:connectors'], }, validate: { - body: bodySchema, - params: paramSchema, + request: { + body: bodySchema, + params: paramSchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors(async function (context, req, res) { diff --git a/x-pack/plugins/actions/server/routes/update.ts b/x-pack/plugins/actions/server/routes/update.ts index 0077c1632877b..efb4d036b1e48 100644 --- a/x-pack/plugins/actions/server/routes/update.ts +++ b/x-pack/plugins/actions/server/routes/update.ts @@ -58,12 +58,17 @@ export const updateActionRoute = ( access: 'public', summary: `Update a connector`, tags: ['oas-tag:connectors'], - // description: - // 'You must have `all` privileges for the **Actions and Connectors** feature in the **Management** section of the Kibana feature privileges.', }, validate: { - body: bodySchema, - params: paramSchema, + request: { + body: bodySchema, + params: paramSchema, + }, + response: { + 200: { + description: 'Indicates a successful call.', + }, + }, }, }, router.handleLegacyErrors(