From d09bd6378632e8640120b2d9f6157d51a7a85527 Mon Sep 17 00:00:00 2001 From: Yuliia Naumenko Date: Sun, 24 May 2020 20:27:42 -0700 Subject: [PATCH] Changed actions API endpoints urls to follow Kibana STYLEGUIDE (#65936) * Changed actions API endpoints urls to follow Kibana STYLEGUIDE * Fixed tests * fixed test * fixed test * resolved conflicts * Fixed siem tests * Fixed failing test * fixed readme and test * Changed actions api urls to follow the template 'api/{plugin}/{type}/{id} * Fixed type checks * Fixed tests and API * fixed tests * Fixed type checks * fixed type check --- x-pack/plugins/actions/README.md | 24 +++++------ x-pack/plugins/actions/common/index.ts | 2 +- .../actions/server/routes/create.test.ts | 2 +- .../plugins/actions/server/routes/create.ts | 2 +- .../actions/server/routes/delete.test.ts | 2 +- .../plugins/actions/server/routes/delete.ts | 2 +- .../actions/server/routes/execute.test.ts | 2 +- .../plugins/actions/server/routes/execute.ts | 2 +- .../plugins/actions/server/routes/get.test.ts | 2 +- x-pack/plugins/actions/server/routes/get.ts | 2 +- .../actions/server/routes/get_all.test.ts | 6 +-- .../plugins/actions/server/routes/get_all.ts | 2 +- .../server/routes/list_action_types.test.ts | 6 +-- .../server/routes/list_action_types.ts | 2 +- .../actions/server/routes/update.test.ts | 2 +- .../plugins/actions/server/routes/update.ts | 2 +- x-pack/plugins/case/common/constants.ts | 4 +- .../alerts/configuration/configuration.tsx | 2 +- .../alerts/configuration/step1.test.tsx | 12 +++--- .../components/alerts/configuration/step1.tsx | 8 ++-- .../integration/cases_connectors.spec.ts | 2 +- .../siem/public/cases/containers/api.test.tsx | 4 +- .../siem/public/cases/containers/api.ts | 2 +- .../scripts/get_action_instances.sh | 2 +- .../scripts/get_action_types.sh | 2 +- .../lib/action_connector_api.test.ts | 14 +++---- .../application/lib/action_connector_api.ts | 10 ++--- .../actions/builtin_action_types/email.ts | 2 +- .../actions/builtin_action_types/es_index.ts | 2 +- .../actions/builtin_action_types/pagerduty.ts | 2 +- .../builtin_action_types/server_log.ts | 2 +- .../builtin_action_types/servicenow.ts | 2 +- .../actions/builtin_action_types/slack.ts | 2 +- .../actions/builtin_action_types/webhook.ts | 2 +- .../common/lib/alert_utils.ts | 4 +- .../common/lib/object_remover.ts | 15 +++++-- .../actions/builtin_action_types/email.ts | 20 +++++----- .../actions/builtin_action_types/es_index.ts | 26 ++++++------ .../es_index_preconfigured.ts | 2 +- .../actions/builtin_action_types/jira.ts | 40 +++++++++---------- .../actions/builtin_action_types/pagerduty.ts | 18 ++++----- .../builtin_action_types/server_log.ts | 6 +-- .../builtin_action_types/servicenow.ts | 38 +++++++++--------- .../actions/builtin_action_types/slack.ts | 22 +++++----- .../actions/builtin_action_types/webhook.ts | 18 ++++----- .../tests/actions/create.ts | 12 +++--- .../tests/actions/delete.ts | 16 ++++---- .../tests/actions/execute.ts | 38 +++++++++--------- .../security_and_spaces/tests/actions/get.ts | 14 +++---- .../tests/actions/get_all.ts | 20 +++++----- .../tests/actions/list_action_types.ts | 2 +- .../tests/actions/manual/pr_40694.js | 10 ++--- .../tests/actions/update.ts | 26 ++++++------ .../tests/alerting/alerts.ts | 22 +++++----- .../tests/alerting/create.ts | 6 +-- .../tests/alerting/delete.ts | 6 +-- .../tests/alerting/disable.ts | 6 +-- .../tests/alerting/enable.ts | 6 +-- .../tests/alerting/find.ts | 8 ++-- .../security_and_spaces/tests/alerting/get.ts | 4 +- .../tests/alerting/get_alert_state.ts | 4 +- .../tests/alerting/mute_all.ts | 2 +- .../tests/alerting/mute_instance.ts | 4 +- .../tests/alerting/unmute_all.ts | 2 +- .../tests/alerting/unmute_instance.ts | 2 +- .../tests/alerting/update.ts | 12 +++--- .../tests/alerting/update_api_key.ts | 6 +-- .../actions/builtin_action_types/es_index.ts | 12 +++--- .../actions/builtin_action_types/webhook.ts | 4 +- .../spaces_only/tests/actions/create.ts | 4 +- .../spaces_only/tests/actions/delete.ts | 14 +++---- .../spaces_only/tests/actions/execute.ts | 24 +++++------ .../spaces_only/tests/actions/get.ts | 26 ++++++------ .../spaces_only/tests/actions/get_all.ts | 12 +++--- .../tests/actions/list_action_types.ts | 4 +- .../tests/actions/type_not_enabled.ts | 14 +++---- .../spaces_only/tests/actions/update.ts | 14 +++---- .../spaces_only/tests/alerting/alerts_base.ts | 18 ++++----- .../index_threshold/alert.ts | 6 +-- .../spaces_only/tests/alerting/create.ts | 6 +-- .../spaces_only/tests/alerting/disable.ts | 4 +- .../spaces_only/tests/alerting/enable.ts | 4 +- .../spaces_only/tests/alerting/find.ts | 4 +- .../spaces_only/tests/alerting/get.ts | 4 +- .../tests/alerting/get_alert_state.ts | 4 +- .../spaces_only/tests/alerting/mute_all.ts | 2 +- .../tests/alerting/mute_instance.ts | 2 +- .../spaces_only/tests/alerting/unmute_all.ts | 2 +- .../tests/alerting/unmute_instance.ts | 2 +- .../spaces_only/tests/alerting/update.ts | 4 +- .../tests/alerting/update_api_key.ts | 4 +- .../basic/tests/cases/push_case.ts | 8 ++-- .../services/alerting/actions.ts | 2 +- 93 files changed, 395 insertions(+), 384 deletions(-) diff --git a/x-pack/plugins/actions/README.md b/x-pack/plugins/actions/README.md index 54624b94e0de3..847172ae972fd 100644 --- a/x-pack/plugins/actions/README.md +++ b/x-pack/plugins/actions/README.md @@ -27,12 +27,12 @@ Table of Contents - [Example](#example) - [RESTful API](#restful-api) - [`POST /api/action`: Create action](#post-apiaction-create-action) - - [`DELETE /api/action/{id}`: Delete action](#delete-apiactionid-delete-action) - - [`GET /api/action/_getAll`: Get all actions](#get-apiactiongetall-get-all-actions) - - [`GET /api/action/{id}`: Get action](#get-apiactionid-get-action) - - [`GET /api/action/types`: List action types](#get-apiactiontypes-list-action-types) - - [`PUT /api/action/{id}`: Update action](#put-apiactionid-update-action) - - [`POST /api/action/{id}/_execute`: Execute action](#post-apiactionidexecute-execute-action) + - [`DELETE /api/actions/action/{id}`: Delete action](#delete-apiactionid-delete-action) + - [`GET /api/actions`: Get all actions](#get-apiactiongetall-get-all-actions) + - [`GET /api/actions/action/{id}`: Get action](#get-apiactionid-get-action) + - [`GET /api/actions/list_action_types`: List action types](#get-apiactiontypes-list-action-types) + - [`PUT /api/actions/action/{id}`: Update action](#put-apiactionid-update-action) + - [`POST /api/actions/action/{id}/_execute`: Execute action](#post-apiactionidexecute-execute-action) - [Firing actions](#firing-actions) - [Example](#example-1) - [Built-in Action Types](#built-in-action-types) @@ -174,7 +174,7 @@ Payload: | config | The configuration the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if config validation is defined. | object | | secrets | The secrets the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if secrets validation is defined. | object | -### `DELETE /api/action/{id}`: Delete action +### `DELETE /api/actions/action/{id}`: Delete action Params: @@ -182,7 +182,7 @@ Params: | -------- | --------------------------------------------- | ------ | | id | The id of the action you're trying to delete. | string | -### `GET /api/action/_getAll`: Get all actions +### `GET /api/actions`: Get all actions No parameters. @@ -190,7 +190,7 @@ Return all actions from saved objects merged with predefined list. Use the [saved objects API for find](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html) with the proprties: `type: 'action'` and `perPage: 10000`. List of predefined actions should be set up in Kibana.yaml. -### `GET /api/action/{id}`: Get action +### `GET /api/actions/action/{id}`: Get action Params: @@ -198,11 +198,11 @@ Params: | -------- | ------------------------------------------ | ------ | | id | The id of the action you're trying to get. | string | -### `GET /api/action/types`: List action types +### `GET /api/actions/list_action_types`: List action types No parameters. -### `PUT /api/action/{id}`: Update action +### `PUT /api/actions/action/{id}`: Update action Params: @@ -218,7 +218,7 @@ Payload: | config | The configuration the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if config validation is defined. | object | | secrets | The secrets the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if secrets validation is defined. | object | -### `POST /api/action/{id}/_execute`: Execute action +### `POST /api/actions/action/{id}/_execute`: Execute action Params: diff --git a/x-pack/plugins/actions/common/index.ts b/x-pack/plugins/actions/common/index.ts index 84eb64f6370ac..b3cacc76b77fd 100644 --- a/x-pack/plugins/actions/common/index.ts +++ b/x-pack/plugins/actions/common/index.ts @@ -6,4 +6,4 @@ export * from './types'; -export const BASE_ACTION_API_PATH = '/api/action'; +export const BASE_ACTION_API_PATH = '/api/actions'; diff --git a/x-pack/plugins/actions/server/routes/create.test.ts b/x-pack/plugins/actions/server/routes/create.test.ts index 1fa85c86e0651..940b8ecc61f4e 100644 --- a/x-pack/plugins/actions/server/routes/create.test.ts +++ b/x-pack/plugins/actions/server/routes/create.test.ts @@ -27,7 +27,7 @@ describe('createActionRoute', () => { const [config, handler] = router.post.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/action"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/create.ts b/x-pack/plugins/actions/server/routes/create.ts index e9d7c2d8d00eb..8135567157583 100644 --- a/x-pack/plugins/actions/server/routes/create.ts +++ b/x-pack/plugins/actions/server/routes/create.ts @@ -26,7 +26,7 @@ export const bodySchema = schema.object({ export const createActionRoute = (router: IRouter, licenseState: ILicenseState) => { router.post( { - path: BASE_ACTION_API_PATH, + path: `${BASE_ACTION_API_PATH}/action`, validate: { body: bodySchema, }, diff --git a/x-pack/plugins/actions/server/routes/delete.test.ts b/x-pack/plugins/actions/server/routes/delete.test.ts index e63989e27a57c..8d759f1a7565e 100644 --- a/x-pack/plugins/actions/server/routes/delete.test.ts +++ b/x-pack/plugins/actions/server/routes/delete.test.ts @@ -27,7 +27,7 @@ describe('deleteActionRoute', () => { const [config, handler] = router.delete.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/delete.ts b/x-pack/plugins/actions/server/routes/delete.ts index d1f9693e1c8d4..9d4fa4019744c 100644 --- a/x-pack/plugins/actions/server/routes/delete.ts +++ b/x-pack/plugins/actions/server/routes/delete.ts @@ -27,7 +27,7 @@ const paramSchema = schema.object({ export const deleteActionRoute = (router: IRouter, licenseState: ILicenseState) => { router.delete( { - path: `${BASE_ACTION_API_PATH}/{id}`, + path: `${BASE_ACTION_API_PATH}/action/{id}`, validate: { params: paramSchema, }, diff --git a/x-pack/plugins/actions/server/routes/execute.test.ts b/x-pack/plugins/actions/server/routes/execute.test.ts index 1cd6343a39dcf..4467ddf372b21 100644 --- a/x-pack/plugins/actions/server/routes/execute.test.ts +++ b/x-pack/plugins/actions/server/routes/execute.test.ts @@ -53,7 +53,7 @@ describe('executeActionRoute', () => { const [config, handler] = router.post.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}/_execute"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}/_execute"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/execute.ts b/x-pack/plugins/actions/server/routes/execute.ts index 4093ed4511939..820bc191993d1 100644 --- a/x-pack/plugins/actions/server/routes/execute.ts +++ b/x-pack/plugins/actions/server/routes/execute.ts @@ -32,7 +32,7 @@ export const executeActionRoute = ( ) => { router.post( { - path: `${BASE_ACTION_API_PATH}/{id}/_execute`, + path: `${BASE_ACTION_API_PATH}/action/{id}/_execute`, validate: { body: bodySchema, params: paramSchema, diff --git a/x-pack/plugins/actions/server/routes/get.test.ts b/x-pack/plugins/actions/server/routes/get.test.ts index f701be579d99d..ee2586851366c 100644 --- a/x-pack/plugins/actions/server/routes/get.test.ts +++ b/x-pack/plugins/actions/server/routes/get.test.ts @@ -28,7 +28,7 @@ describe('getActionRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/get.ts b/x-pack/plugins/actions/server/routes/get.ts index 09c47c94029e7..224de241c7374 100644 --- a/x-pack/plugins/actions/server/routes/get.ts +++ b/x-pack/plugins/actions/server/routes/get.ts @@ -22,7 +22,7 @@ const paramSchema = schema.object({ export const getActionRoute = (router: IRouter, licenseState: ILicenseState) => { router.get( { - path: `${BASE_ACTION_API_PATH}/{id}`, + path: `${BASE_ACTION_API_PATH}/action/{id}`, validate: { params: paramSchema, }, diff --git a/x-pack/plugins/actions/server/routes/get_all.test.ts b/x-pack/plugins/actions/server/routes/get_all.test.ts index e00054fd3746f..6550921278aa5 100644 --- a/x-pack/plugins/actions/server/routes/get_all.test.ts +++ b/x-pack/plugins/actions/server/routes/get_all.test.ts @@ -28,7 +28,7 @@ describe('getAllActionRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ @@ -63,7 +63,7 @@ describe('getAllActionRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ @@ -94,7 +94,7 @@ describe('getAllActionRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/get_all.ts b/x-pack/plugins/actions/server/routes/get_all.ts index 6d02872ea64e1..03a4a97855b6b 100644 --- a/x-pack/plugins/actions/server/routes/get_all.ts +++ b/x-pack/plugins/actions/server/routes/get_all.ts @@ -17,7 +17,7 @@ import { BASE_ACTION_API_PATH } from '../../common'; export const getAllActionRoute = (router: IRouter, licenseState: ILicenseState) => { router.get( { - path: `${BASE_ACTION_API_PATH}/_getAll`, + path: `${BASE_ACTION_API_PATH}`, validate: {}, options: { tags: ['access:actions-read'], diff --git a/x-pack/plugins/actions/server/routes/list_action_types.test.ts b/x-pack/plugins/actions/server/routes/list_action_types.test.ts index 205752d5a49d1..f231efe1a07f3 100644 --- a/x-pack/plugins/actions/server/routes/list_action_types.test.ts +++ b/x-pack/plugins/actions/server/routes/list_action_types.test.ts @@ -28,7 +28,7 @@ describe('listActionTypesRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ @@ -80,7 +80,7 @@ describe('listActionTypesRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ @@ -125,7 +125,7 @@ describe('listActionTypesRoute', () => { const [config, handler] = router.get.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/list_action_types.ts b/x-pack/plugins/actions/server/routes/list_action_types.ts index bc91d4854e638..bfb5fabe127f3 100644 --- a/x-pack/plugins/actions/server/routes/list_action_types.ts +++ b/x-pack/plugins/actions/server/routes/list_action_types.ts @@ -17,7 +17,7 @@ import { BASE_ACTION_API_PATH } from '../../common'; export const listActionTypesRoute = (router: IRouter, licenseState: ILicenseState) => { router.get( { - path: `${BASE_ACTION_API_PATH}/types`, + path: `${BASE_ACTION_API_PATH}/list_action_types`, validate: {}, options: { tags: ['access:actions-read'], diff --git a/x-pack/plugins/actions/server/routes/update.test.ts b/x-pack/plugins/actions/server/routes/update.test.ts index 6459a34bf0737..323a52f2fc6e2 100644 --- a/x-pack/plugins/actions/server/routes/update.test.ts +++ b/x-pack/plugins/actions/server/routes/update.test.ts @@ -27,7 +27,7 @@ describe('updateActionRoute', () => { const [config, handler] = router.put.mock.calls[0]; - expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`); + expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`); expect(config.options).toMatchInlineSnapshot(` Object { "tags": Array [ diff --git a/x-pack/plugins/actions/server/routes/update.ts b/x-pack/plugins/actions/server/routes/update.ts index efad39c1cd453..1e107a4d6edb4 100644 --- a/x-pack/plugins/actions/server/routes/update.ts +++ b/x-pack/plugins/actions/server/routes/update.ts @@ -28,7 +28,7 @@ const bodySchema = schema.object({ export const updateActionRoute = (router: IRouter, licenseState: ILicenseState) => { router.put( { - path: `${BASE_ACTION_API_PATH}/{id}`, + path: `${BASE_ACTION_API_PATH}/action/{id}`, validate: { body: bodySchema, params: paramSchema, diff --git a/x-pack/plugins/case/common/constants.ts b/x-pack/plugins/case/common/constants.ts index 855a5c3d63507..819d4110e168d 100644 --- a/x-pack/plugins/case/common/constants.ts +++ b/x-pack/plugins/case/common/constants.ts @@ -25,7 +25,7 @@ export const CASE_USER_ACTIONS_URL = `${CASE_DETAILS_URL}/user_actions`; * Action routes */ -export const ACTION_URL = '/api/action'; -export const ACTION_TYPES_URL = '/api/action/types'; +export const ACTION_URL = '/api/actions'; +export const ACTION_TYPES_URL = '/api/actions/list_action_types'; export const SUPPORTED_CONNECTORS = ['.servicenow', '.jira']; diff --git a/x-pack/plugins/monitoring/public/components/alerts/configuration/configuration.tsx b/x-pack/plugins/monitoring/public/components/alerts/configuration/configuration.tsx index 61f86b0f9b609..f248e20493a24 100644 --- a/x-pack/plugins/monitoring/public/components/alerts/configuration/configuration.tsx +++ b/x-pack/plugins/monitoring/public/components/alerts/configuration/configuration.tsx @@ -61,7 +61,7 @@ export const AlertsConfiguration: React.FC = ( async function fetchEmailActions() { const kibanaActions = await Legacy.shims.kfetch({ method: 'GET', - pathname: `/api/action/_getAll`, + pathname: `/api/actions`, }); const actions = kibanaActions.data.filter( diff --git a/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.test.tsx b/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.test.tsx index 69dedd71284af..1be66ce4ccfef 100644 --- a/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.test.tsx +++ b/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.test.tsx @@ -135,7 +135,7 @@ describe('Step1', () => { expect(kfetch).toHaveBeenCalledWith({ method: 'POST', - pathname: `/api/action`, + pathname: `/api/actions/action`, body: JSON.stringify({ name: 'Email action for Stack Monitoring alerts', actionTypeId: ALERT_ACTION_TYPE_EMAIL, @@ -193,7 +193,7 @@ describe('Step1', () => { expect(kfetch).toHaveBeenCalledWith({ method: 'PUT', - pathname: `/api/action/${emailActions[0].id}`, + pathname: `/api/actions/action/${emailActions[0].id}`, body: JSON.stringify({ name: emailActions[0].name, config: omit(data, ['user', 'password']), @@ -210,7 +210,7 @@ describe('Step1', () => { Legacy: { shims: { kfetch: jest.fn().mockImplementation((arg) => { - if (arg.pathname === '/api/action/1/_execute') { + if (arg.pathname === '/api/actions/action/1/_execute') { return { status: 'ok' }; } return {}; @@ -236,7 +236,7 @@ describe('Step1', () => { Legacy: { shims: { kfetch: (arg: any) => { - if (arg.pathname === '/api/action/1/_execute') { + if (arg.pathname === '/api/actions/action/1/_execute') { return { status: 'ok' }; } return {}; @@ -260,7 +260,7 @@ describe('Step1', () => { Legacy: { shims: { kfetch: (arg: any) => { - if (arg.pathname === '/api/action/1/_execute') { + if (arg.pathname === '/api/actions/action/1/_execute') { return { message: 'Very detailed error message' }; } return {}; @@ -320,7 +320,7 @@ describe('Step1', () => { expect(kfetch).toHaveBeenCalledWith({ method: 'DELETE', - pathname: `/api/action/${emailActions[0].id}`, + pathname: `/api/actions/action/${emailActions[0].id}`, }); expect(customProps.setSelectedEmailActionId).toHaveBeenCalledWith(''); diff --git a/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.tsx b/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.tsx index 27e46ef82a1b4..b3e6c079378ef 100644 --- a/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.tsx +++ b/x-pack/plugins/monitoring/public/components/alerts/configuration/step1.tsx @@ -44,7 +44,7 @@ export const Step1: React.FC = (props: GetStep1Props) => { if (props.editAction) { await Legacy.shims.kfetch({ method: 'PUT', - pathname: `${BASE_ACTION_API_PATH}/${props.editAction.id}`, + pathname: `${BASE_ACTION_API_PATH}/action/${props.editAction.id}`, body: JSON.stringify({ name: props.editAction.name, config: omit(data, ['user', 'password']), @@ -55,7 +55,7 @@ export const Step1: React.FC = (props: GetStep1Props) => { } else { await Legacy.shims.kfetch({ method: 'POST', - pathname: BASE_ACTION_API_PATH, + pathname: `${BASE_ACTION_API_PATH}/action`, body: JSON.stringify({ name: i18n.translate('xpack.monitoring.alerts.configuration.emailAction.name', { defaultMessage: 'Email action for Stack Monitoring alerts', @@ -75,7 +75,7 @@ export const Step1: React.FC = (props: GetStep1Props) => { await Legacy.shims.kfetch({ method: 'DELETE', - pathname: `${BASE_ACTION_API_PATH}/${id}`, + pathname: `${BASE_ACTION_API_PATH}/action/${id}`, }); if (props.editAction && props.editAction.id === id) { @@ -101,7 +101,7 @@ export const Step1: React.FC = (props: GetStep1Props) => { const result = await Legacy.shims.kfetch({ method: 'POST', - pathname: `${BASE_ACTION_API_PATH}/${props.selectedEmailActionId}/_execute`, + pathname: `${BASE_ACTION_API_PATH}/action/${props.selectedEmailActionId}/_execute`, body: JSON.stringify({ params }), }); if (result.status === 'ok') { diff --git a/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts b/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts index 339dee6bb9666..ae4bb82ebfee6 100644 --- a/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts +++ b/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts @@ -21,7 +21,7 @@ import { CASES } from '../urls/navigation'; describe.skip('Cases connectors', () => { before(() => { cy.server(); - cy.route('POST', '**/api/action').as('createConnector'); + cy.route('POST', '**/api/actions/action').as('createConnector'); cy.route('POST', '**/api/cases/configure').as('saveConnector'); }); diff --git a/x-pack/plugins/siem/public/cases/containers/api.test.tsx b/x-pack/plugins/siem/public/cases/containers/api.test.tsx index b4f0c2198b458..321d330758e53 100644 --- a/x-pack/plugins/siem/public/cases/containers/api.test.tsx +++ b/x-pack/plugins/siem/public/cases/containers/api.test.tsx @@ -88,7 +88,7 @@ describe('Case Configuration API', () => { }); test('check url, method, signal', async () => { await getActionLicense(abortCtrl.signal); - expect(fetchMock).toHaveBeenCalledWith(`/api/action/types`, { + expect(fetchMock).toHaveBeenCalledWith(`/api/actions/list_action_types`, { method: 'GET', signal: abortCtrl.signal, }); @@ -416,7 +416,7 @@ describe('Case Configuration API', () => { const connectorId = 'connectorId'; test('check url, method, signal', async () => { await pushToService(connectorId, casePushParams, abortCtrl.signal); - expect(fetchMock).toHaveBeenCalledWith(`/api/action/${connectorId}/_execute`, { + expect(fetchMock).toHaveBeenCalledWith(`/api/actions/action/${connectorId}/_execute`, { method: 'POST', body: JSON.stringify({ params: { subAction: 'pushToService', subActionParams: casePushParams }, diff --git a/x-pack/plugins/siem/public/cases/containers/api.ts b/x-pack/plugins/siem/public/cases/containers/api.ts index e07081a60fbfe..4f7ef290370cc 100644 --- a/x-pack/plugins/siem/public/cases/containers/api.ts +++ b/x-pack/plugins/siem/public/cases/containers/api.ts @@ -242,7 +242,7 @@ export const pushToService = async ( signal: AbortSignal ): Promise => { const response = await KibanaServices.get().http.fetch( - `${ACTION_URL}/${connectorId}/_execute`, + `${ACTION_URL}/action/${connectorId}/_execute`, { method: 'POST', body: JSON.stringify({ diff --git a/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh b/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh index 2028216e6770f..724ed2f340aec 100755 --- a/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh +++ b/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/plugins/actions/README.md#get-apiaction_find-find-actions curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}${SPACE_URL}/api/action/_getAll \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/actions \ | jq . diff --git a/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh b/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh index c587e9a204182..448c5bc46c4f4 100755 --- a/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh +++ b/x-pack/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/plugins/actions/README.md curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}${SPACE_URL}/api/action/types \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/actions/list_action_types \ | jq . diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.test.ts index e9cf2a270d180..43b22361aea36 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.test.ts @@ -36,7 +36,7 @@ describe('loadActionTypes', () => { expect(result).toEqual(resolvedValue); expect(http.get.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "/api/action/types", + "/api/actions/list_action_types", ] `); }); @@ -50,7 +50,7 @@ describe('loadAllActions', () => { expect(result).toEqual([]); expect(http.get.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "/api/action/_getAll", + "/api/actions", ] `); }); @@ -72,7 +72,7 @@ describe('createActionConnector', () => { expect(result).toEqual(resolvedValue); expect(http.post.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "/api/action", + "/api/actions/action", Object { "body": "{\\"actionTypeId\\":\\"test\\",\\"isPreconfigured\\":false,\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}", }, @@ -98,7 +98,7 @@ describe('updateActionConnector', () => { expect(result).toEqual(resolvedValue); expect(http.put.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "/api/action/123", + "/api/actions/action/123", Object { "body": "{\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}", }, @@ -116,13 +116,13 @@ describe('deleteActions', () => { expect(http.delete.mock.calls).toMatchInlineSnapshot(` Array [ Array [ - "/api/action/1", + "/api/actions/action/1", ], Array [ - "/api/action/2", + "/api/actions/action/2", ], Array [ - "/api/action/3", + "/api/actions/action/3", ], ] `); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.ts index 20ce1d21050c1..46a676ac06539 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/action_connector_api.ts @@ -9,11 +9,11 @@ import { BASE_ACTION_API_PATH } from '../constants'; import { ActionConnector, ActionConnectorWithoutId, ActionType } from '../../types'; export async function loadActionTypes({ http }: { http: HttpSetup }): Promise { - return await http.get(`${BASE_ACTION_API_PATH}/types`); + return await http.get(`${BASE_ACTION_API_PATH}/list_action_types`); } export async function loadAllActions({ http }: { http: HttpSetup }): Promise { - return await http.get(`${BASE_ACTION_API_PATH}/_getAll`); + return await http.get(`${BASE_ACTION_API_PATH}`); } export async function createActionConnector({ @@ -23,7 +23,7 @@ export async function createActionConnector({ http: HttpSetup; connector: Omit; }): Promise { - return await http.post(`${BASE_ACTION_API_PATH}`, { + return await http.post(`${BASE_ACTION_API_PATH}/action`, { body: JSON.stringify(connector), }); } @@ -37,7 +37,7 @@ export async function updateActionConnector({ connector: Pick; id: string; }): Promise { - return await http.put(`${BASE_ACTION_API_PATH}/${id}`, { + return await http.put(`${BASE_ACTION_API_PATH}/action/${id}`, { body: JSON.stringify({ name: connector.name, config: connector.config, @@ -55,7 +55,7 @@ export async function deleteActions({ }): Promise<{ successes: string[]; errors: string[] }> { const successes: string[] = []; const errors: string[] = []; - await Promise.all(ids.map((id) => http.delete(`${BASE_ACTION_API_PATH}/${id}`))).then( + await Promise.all(ids.map((id) => http.delete(`${BASE_ACTION_API_PATH}/action/${id}`))).then( function (fulfilled) { successes.push(...fulfilled); }, diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/email.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/email.ts index f22fe0e3bc1e7..3de628b6f44bf 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/email.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/email.ts @@ -13,7 +13,7 @@ export default function emailTest({ getService }: FtrProviderContext) { describe('create email action', () => { it('should return 403 when creating an email action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/es_index.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/es_index.ts index ec07f6ff44df6..d92af5afc103b 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/es_index.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/es_index.ts @@ -14,7 +14,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should return 200 when creating an index action', async () => { // create action with no config await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/pagerduty.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/pagerduty.ts index e261cf15d05ae..d962a0e72027d 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/pagerduty.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/pagerduty.ts @@ -13,7 +13,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { describe('pagerduty action', () => { it('should return 403 when creating a pagerduty action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A pagerduty action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/server_log.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/server_log.ts index 686f4a0086fa0..ea5f523b396b4 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/server_log.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/server_log.ts @@ -16,7 +16,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) { it('should return 200 when creating a server-log action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A server.log action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/servicenow.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/servicenow.ts index 0bb98a540c4e8..3356b3e3d5828 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/servicenow.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/servicenow.ts @@ -61,7 +61,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should return 403 when creating a servicenow action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/slack.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/slack.ts index 15b7f4f8b3386..90660cc99507d 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/slack.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/slack.ts @@ -28,7 +28,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should return 403 when creating a slack action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack action', diff --git a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/webhook.ts b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/webhook.ts index e3ba075d27de2..af1d413ff3c46 100644 --- a/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/webhook.ts +++ b/x-pack/test/alerting_api_integration/basic/tests/actions/builtin_action_types/webhook.ts @@ -27,7 +27,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should return 403 when creating a webhook action', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'test') .send({ name: 'A generic Webhook action', diff --git a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts index 901a39069c6ec..8a98e78feab31 100644 --- a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts +++ b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts @@ -187,7 +187,7 @@ export class AlertUtils { const alertBody = getDefaultAlwaysFiringAlertData(reference, actionId); const response = await request.send({ ...alertBody, ...overwrites }); if (response.statusCode === 200) { - objRemover.add(this.space.id, response.body.id, 'alert'); + objRemover.add(this.space.id, response.body.id, 'alert', undefined); } return response; } @@ -257,7 +257,7 @@ export class AlertUtils { ...overwrites, }); if (response.statusCode === 200) { - objRemover.add(this.space.id, response.body.id, 'alert'); + objRemover.add(this.space.id, response.body.id, 'alert', undefined); } return response; } diff --git a/x-pack/test/alerting_api_integration/common/lib/object_remover.ts b/x-pack/test/alerting_api_integration/common/lib/object_remover.ts index 8d01b3444b488..780c239149d53 100644 --- a/x-pack/test/alerting_api_integration/common/lib/object_remover.ts +++ b/x-pack/test/alerting_api_integration/common/lib/object_remover.ts @@ -10,6 +10,7 @@ interface ObjectToRemove { spaceId: string; id: string; type: string; + plugin?: string; } export class ObjectRemover { @@ -20,15 +21,21 @@ export class ObjectRemover { this.supertest = supertest; } - add(spaceId: ObjectToRemove['spaceId'], id: ObjectToRemove['id'], type: ObjectToRemove['type']) { - this.objectsToRemove.push({ spaceId, id, type }); + add( + spaceId: ObjectToRemove['spaceId'], + id: ObjectToRemove['id'], + type: ObjectToRemove['type'], + plugin: ObjectToRemove['plugin'] + ) { + this.objectsToRemove.push({ spaceId, id, type, plugin }); } async removeAll() { await Promise.all( - this.objectsToRemove.map(({ spaceId, id, type }) => { + this.objectsToRemove.map(({ spaceId, id, type, plugin }) => { + const pluginPath = plugin ? `/${plugin}` : ''; return this.supertest - .delete(`${getUrlPrefix(spaceId)}/api/${type}/${id}`) + .delete(`${getUrlPrefix(spaceId)}/api${pluginPath}/${type}/${id}`) .set('kbn-xsrf', 'foo') .expect(204); }) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts index 6001dd531cfae..ffbb29b431d8d 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/email.ts @@ -20,7 +20,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should return 200 when creating an email action successfully', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', @@ -54,7 +54,7 @@ export default function emailTest({ getService }: FtrProviderContext) { expect(typeof createdActionId).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdActionId}`) + .get(`/api/actions/action/${createdActionId}`) .expect(200); expect(fetchedAction).to.eql({ @@ -74,7 +74,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should return the message data when firing the __json service', async () => { await supertest - .post(`/api/action/${createdActionId}/_execute`) + .post(`/api/actions/action/${createdActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -117,7 +117,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should render html from markdown', async () => { await supertest - .post(`/api/action/${createdActionId}/_execute`) + .post(`/api/actions/action/${createdActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -138,7 +138,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating an email action with an invalid config', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', @@ -158,7 +158,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating an email action with non-whitelisted server', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', @@ -183,7 +183,7 @@ export default function emailTest({ getService }: FtrProviderContext) { }); await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', @@ -211,7 +211,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should handle creating an email action with a whitelisted server', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action', @@ -232,7 +232,7 @@ export default function emailTest({ getService }: FtrProviderContext) { it('should handle an email action with no auth', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An email action with no auth', @@ -245,7 +245,7 @@ export default function emailTest({ getService }: FtrProviderContext) { .expect(200); await supertest - .post(`/api/action/${createdAction.id}/_execute`) + .post(`/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index.ts index 612eba858ea0b..c1dc155c17238 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index.ts @@ -26,7 +26,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should be created successfully', async () => { // create action with no config const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -53,7 +53,7 @@ export default function indexTest({ getService }: FtrProviderContext) { expect(typeof createdActionID).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdActionID}`) + .get(`/api/actions/action/${createdActionID}`) .expect(200); expect(fetchedAction).to.eql({ @@ -66,7 +66,7 @@ export default function indexTest({ getService }: FtrProviderContext) { // create action with all config props const { body: createdActionWithIndex } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action with index config', @@ -94,7 +94,7 @@ export default function indexTest({ getService }: FtrProviderContext) { expect(typeof createdActionIDWithIndex).to.be('string'); const { body: fetchedActionWithIndex } = await supertest - .get(`/api/action/${createdActionIDWithIndex}`) + .get(`/api/actions/action/${createdActionIDWithIndex}`) .expect(200); expect(fetchedActionWithIndex).to.eql({ @@ -112,7 +112,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should respond with error when creation unsuccessful', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -132,7 +132,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should execute successly when expected for a single body', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -145,7 +145,7 @@ export default function indexTest({ getService }: FtrProviderContext) { }) .expect(200); const { body: result } = await supertest - .post(`/api/action/${createdAction.id}/_execute`) + .post(`/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -162,7 +162,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should execute successly when expected for with multiple bodies', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -175,7 +175,7 @@ export default function indexTest({ getService }: FtrProviderContext) { }) .expect(200); const { body: result } = await supertest - .post(`/api/action/${createdAction.id}/_execute`) + .post(`/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -206,7 +206,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should execute successly with refresh false', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -220,7 +220,7 @@ export default function indexTest({ getService }: FtrProviderContext) { }) .expect(200); const { body: result } = await supertest - .post(`/api/action/${createdAction.id}/_execute`) + .post(`/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -235,7 +235,7 @@ export default function indexTest({ getService }: FtrProviderContext) { expect(items.length).to.be.lessThan(2); const { body: createdActionWithRefresh } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -248,7 +248,7 @@ export default function indexTest({ getService }: FtrProviderContext) { }) .expect(200); const { body: result2 } = await supertest - .post(`/api/action/${createdActionWithRefresh.id}/_execute`) + .post(`/api/actions/action/${createdActionWithRefresh.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index_preconfigured.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index_preconfigured.ts index b04bc13ffc5e4..93daa16e71bcf 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index_preconfigured.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/es_index_preconfigured.ts @@ -24,7 +24,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should execute successfully when expected for a single body', async () => { const { body: result } = await supertest - .post(`/api/action/${ACTION_ID}/_execute`) + .post(`/api/actions/action/${ACTION_ID}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts index c67f7868f7ff0..093f09c24bad3 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts @@ -87,7 +87,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { describe('Jira - Action Creation', () => { it('should return 200 when creating a jira action successfully', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -113,7 +113,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { }); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -131,7 +131,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action with no apiUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -151,7 +151,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action with no projectKey', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -171,7 +171,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action with a non whitelisted apiUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -196,7 +196,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action without secrets', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -220,7 +220,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action without casesConfiguration', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -244,7 +244,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action with empty mapping', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -269,7 +269,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a jira action with wrong actionType', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira action', @@ -297,7 +297,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { let simulatedActionId: string; before(async () => { const { body } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A jira simulator', @@ -315,7 +315,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { describe('Validation', () => { it('should handle failing with a simulated success without action', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: {}, @@ -332,7 +332,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without unsupported action', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'non-supported' }, @@ -350,7 +350,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without subActionParams', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'pushToService' }, @@ -368,7 +368,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without caseId', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'pushToService', subActionParams: {} }, @@ -386,7 +386,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without title', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -409,7 +409,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without createdAt', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -433,7 +433,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without commentId', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -461,7 +461,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without comment message', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -489,7 +489,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without comment.createdAt', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -519,7 +519,7 @@ export default function jiraTest({ getService }: FtrProviderContext) { describe('Execution', () => { it('should handle creating an incident without comments', async () => { const { body } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/pagerduty.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/pagerduty.ts index 443d3acb7ba1c..71ceb731da9f0 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/pagerduty.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/pagerduty.ts @@ -34,7 +34,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should return successfully when passed valid create parameters', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A pagerduty action', @@ -61,7 +61,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { expect(typeof createdAction.id).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -77,7 +77,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should return unsuccessfully when passed invalid create parameters', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A pagerduty action', @@ -100,7 +100,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should return unsuccessfully when default pagerduty url is not whitelisted', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A pagerduty action', @@ -120,7 +120,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should create pagerduty simulator action successfully', async () => { const { body: createdSimulatedAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A pagerduty simulator', @@ -139,7 +139,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should handle executing with a simulated success', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -160,7 +160,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should handle a 40x pagerduty error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -174,7 +174,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should handle a 429 pagerduty error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -192,7 +192,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) { it('should handle a 500 pagerduty error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/server_log.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/server_log.ts index e9d3e6c542442..a915987ce5feb 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/server_log.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/server_log.ts @@ -20,7 +20,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) { it('should return 200 when creating a builtin server-log action', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A server.log action', @@ -40,7 +40,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) { expect(typeof createdAction.id).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -54,7 +54,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) { it('should handle firing the action', async () => { const { body: result } = await supertest - .post(`/api/action/${serverLogActionId}/_execute`) + .post(`/api/actions/action/${serverLogActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow.ts index c69eead75e278..531a362fa2bab 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow.ts @@ -86,7 +86,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { describe('ServiceNow - Action Creation', () => { it('should return 200 when creating a servicenow action successfully', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -111,7 +111,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { }); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -128,7 +128,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action with no apiUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -148,7 +148,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action with a non whitelisted apiUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -172,7 +172,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action without secrets', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -195,7 +195,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action without casesConfiguration', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -218,7 +218,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action with empty mapping', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -242,7 +242,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a servicenow action with wrong actionType', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow action', @@ -269,7 +269,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { let simulatedActionId: string; before(async () => { const { body } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A servicenow simulator', @@ -286,7 +286,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { describe('Validation', () => { it('should handle failing with a simulated success without action', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: {}, @@ -303,7 +303,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without unsupported action', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'non-supported' }, @@ -321,7 +321,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without subActionParams', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'pushToService' }, @@ -339,7 +339,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without caseId', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { subAction: 'pushToService', subActionParams: {} }, @@ -357,7 +357,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without title', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -380,7 +380,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without createdAt', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -404,7 +404,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without commentId', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -432,7 +432,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without comment message', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -460,7 +460,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { it('should handle failing with a simulated success without comment.createdAt', async () => { await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -490,7 +490,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) { describe('Execution', () => { it('should handle creating an incident without comments', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/slack.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/slack.ts index e522b8c7b898d..537205360f4aa 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/slack.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/slack.ts @@ -34,7 +34,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should return 200 when creating a slack action successfully', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack action', @@ -56,7 +56,7 @@ export default function slackTest({ getService }: FtrProviderContext) { expect(typeof createdAction.id).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -70,7 +70,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a slack action with no webhookUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack action', @@ -90,7 +90,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a slack action with a non whitelisted webhookUrl', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack action', @@ -112,7 +112,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should respond with a 400 Bad Request when creating a slack action with a webhookUrl with no hostname', async () => { await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack action', @@ -134,7 +134,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should create our slack simulator action successfully', async () => { const { body: createdSimulatedAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'A slack simulator', @@ -150,7 +150,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should handle firing with a simulated success', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -163,7 +163,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should handle an empty message error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -177,7 +177,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should handle a 40x slack error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -192,7 +192,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should handle a 429 slack error', async () => { const dateStart = new Date().getTime(); const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -210,7 +210,7 @@ export default function slackTest({ getService }: FtrProviderContext) { it('should handle a 500 slack error', async () => { const { body: result } = await supertest - .post(`/api/action/${simulatedActionId}/_execute`) + .post(`/api/actions/action/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/webhook.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/webhook.ts index 9c769897d35ee..10adf12baf652 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/webhook.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/webhook.ts @@ -45,7 +45,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { }; const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'test') .send({ name: 'A generic Webhook action', @@ -75,7 +75,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should return 200 when creating a webhook action successfully', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'test') .send({ name: 'A generic Webhook action', @@ -104,7 +104,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { expect(typeof createdAction.id).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdAction.id}`) + .get(`/api/actions/action/${createdAction.id}`) .expect(200); expect(fetchedAction).to.eql({ @@ -122,7 +122,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should send authentication to the webhook target', async () => { const webhookActionId = await createWebhookAction(webhookSimulatorURL); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { @@ -137,7 +137,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should support the POST method against webhook target', async () => { const webhookActionId = await createWebhookAction(webhookSimulatorURL, { method: 'post' }); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { @@ -152,7 +152,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should support the PUT method against webhook target', async () => { const webhookActionId = await createWebhookAction(webhookSimulatorURL, { method: 'put' }); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { @@ -166,7 +166,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should handle target webhooks that are not whitelisted', async () => { const { body: result } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'test') .send({ name: 'A generic Webhook action', @@ -188,7 +188,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should handle unreachable webhook targets', async () => { const webhookActionId = await createWebhookAction('http://some.non.existent.com/endpoint'); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { @@ -204,7 +204,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('should handle failing webhook targets', async () => { const webhookActionId = await createWebhookAction(webhookSimulatorURL); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/create.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/create.ts index 922315eba5a5c..69dcb7c813815 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/create.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/create.ts @@ -24,7 +24,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle create action request appropriately', async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -52,7 +52,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { case 'superuser at space1': case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'action'); + objectRemover.add(space.id, response.body.id, 'action', 'actions'); expect(response.body).to.eql({ id: response.body.id, isPreconfigured: false, @@ -78,7 +78,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { it(`should handle create action request appropriately when action type isn't registered`, async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ @@ -114,7 +114,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { it('should handle create action request appropriately when payload is empty and invalid', async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({}); @@ -146,7 +146,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { it(`should handle create action request appropriately when config isn't valid`, async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ @@ -185,7 +185,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { it(`should handle create action requests for action types that are not enabled`, async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/delete.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/delete.ts index 011e47cf11b39..d96ffc5bb3be3 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/delete.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/delete.ts @@ -25,7 +25,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle delete action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -40,7 +40,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { .expect(200); const response = await supertestWithoutAuth - .delete(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .delete(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo'); @@ -54,7 +54,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { error: 'Not Found', message: 'Not Found', }); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); break; case 'superuser at space1': case 'space_1_all at space1': @@ -68,7 +68,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it(`shouldn't delete action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -81,10 +81,10 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .delete(`${getUrlPrefix('other')}/api/action/${createdAction.id}`) + .delete(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo'); @@ -114,7 +114,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it(`should handle delete request appropriately when action doesn't exist`, async () => { const response = await supertestWithoutAuth - .delete(`${getUrlPrefix(space.id)}/api/action/2`) + .delete(`${getUrlPrefix(space.id)}/api/actions/action/2`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password); @@ -140,7 +140,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it(`shouldn't delete action from preconfigured list`, async () => { const response = await supertestWithoutAuth - .delete(`${getUrlPrefix(space.id)}/api/action/my-slack1`) + .delete(`${getUrlPrefix(space.id)}/api/actions/action/my-slack1`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/execute.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/execute.ts index 4458353f4fdc8..70a3663c1c798 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/execute.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/execute.ts @@ -43,7 +43,7 @@ export default function ({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle execute request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -56,11 +56,11 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const reference = `actions-execute-1:${user.username}`; const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -115,7 +115,7 @@ export default function ({ getService }: FtrProviderContext) { it(`shouldn't execute an action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -128,11 +128,11 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const reference = `actions-execute-4:${user.username}`; const response = await supertestWithoutAuth - .post(`${getUrlPrefix('other')}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -169,7 +169,7 @@ export default function ({ getService }: FtrProviderContext) { it('should handle execute request appropriately after action is updated', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -182,10 +182,10 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); await supertest - .put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .send({ name: 'My action updated', @@ -200,7 +200,7 @@ export default function ({ getService }: FtrProviderContext) { const reference = `actions-execute-2:${user.username}`; const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -255,7 +255,7 @@ export default function ({ getService }: FtrProviderContext) { it(`should handle execute request appropriately when action doesn't exist`, async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/1/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/1/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -289,7 +289,7 @@ export default function ({ getService }: FtrProviderContext) { it('should handle execute request appropriately when payload is empty and invalid', async () => { const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/1/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/1/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({}); @@ -322,7 +322,7 @@ export default function ({ getService }: FtrProviderContext) { it('should handle execute request appropriately after changing config properties', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'test email action', @@ -340,10 +340,10 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); await supertest - .put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .send({ name: 'a test email action 2', @@ -359,7 +359,7 @@ export default function ({ getService }: FtrProviderContext) { .expect(200); const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -395,17 +395,17 @@ export default function ({ getService }: FtrProviderContext) { let searchResult: any; const reference = `actions-execute-3:${user.username}`; const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', actionTypeId: 'test.authorization', }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get.ts index e43f9dba4b2dc..c610ac670f690 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get.ts @@ -24,7 +24,7 @@ export default function getActionTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle get action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -37,10 +37,10 @@ export default function getActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .get(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .get(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password); switch (scenario.id) { @@ -74,7 +74,7 @@ export default function getActionTests({ getService }: FtrProviderContext) { it(`action shouldn't be acessible from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -87,10 +87,10 @@ export default function getActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .get(`${getUrlPrefix('other')}/api/action/${createdAction.id}`) + .get(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password); expect(response.statusCode).to.eql(404); @@ -119,7 +119,7 @@ export default function getActionTests({ getService }: FtrProviderContext) { it('should handle get preconfigured action request appropriately', async () => { const response = await supertestWithoutAuth - .get(`${getUrlPrefix(space.id)}/api/action/my-slack1`) + .get(`${getUrlPrefix(space.id)}/api/actions/action/my-slack1`) .auth(user.username, user.password); switch (scenario.id) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get_all.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get_all.ts index 95b564e63d715..785285f6d455c 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get_all.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/get_all.ts @@ -24,7 +24,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle get all action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -37,10 +37,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .get(`${getUrlPrefix(space.id)}/api/action/_getAll`) + .get(`${getUrlPrefix(space.id)}/api/actions`) .auth(user.username, user.password); switch (scenario.id) { @@ -105,7 +105,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { it('should handle get all request appropriately with proper referencedByCount', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -118,7 +118,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const { body: createdAlert } = await supertest .post(`${getUrlPrefix(space.id)}/api/alert`) @@ -142,10 +142,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth - .get(`${getUrlPrefix(space.id)}/api/action/_getAll`) + .get(`${getUrlPrefix(space.id)}/api/actions`) .auth(user.username, user.password); switch (scenario.id) { @@ -210,7 +210,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { it(`shouldn't get actions from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -223,10 +223,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .get(`${getUrlPrefix('other')}/api/action/_getAll`) + .get(`${getUrlPrefix('other')}/api/actions`) .auth(user.username, user.password); switch (scenario.id) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/list_action_types.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/list_action_types.ts index f70e8f561b23e..22c89a1a8148f 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/list_action_types.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/list_action_types.ts @@ -19,7 +19,7 @@ export default function listActionTypesTests({ getService }: FtrProviderContext) describe(scenario.id, () => { it('should return 200 with list of action types containing defaults', async () => { const response = await supertestWithoutAuth - .get(`${getUrlPrefix(space.id)}/api/action/types`) + .get(`${getUrlPrefix(space.id)}/api/actions/list_action_types`) .auth(user.username, user.password); function createActionTypeMatcher(id: string, name: string) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/manual/pr_40694.js b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/manual/pr_40694.js index dc5152a7f2497..ae5e6adc7a8d9 100755 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/manual/pr_40694.js +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/manual/pr_40694.js @@ -15,7 +15,7 @@ if (require.main === module) main(); async function main() { let response; - response = await httpPost('api/action', { + response = await httpPost('api/actions/action', { actionTypeId: '.email', name: 'an email action', config: { @@ -33,10 +33,10 @@ async function main() { const actionId = response.id; - response = await httpGet(`api/action/${actionId}`); + response = await httpGet(`api/actions/${actionId}`); console.log(`action after create: ${JSON.stringify(response, null, 4)}`); - response = await httpPut(`api/action/${actionId}`, { + response = await httpPut(`api/actions/action/${actionId}`, { name: 'an email action', config: { from: 'patrick.mueller@elastic.co', @@ -50,10 +50,10 @@ async function main() { console.log(`response from update: ${JSON.stringify(response, null, 4)}`); - response = await httpGet(`api/action/${actionId}`); + response = await httpGet(`api/actions/${actionId}`); console.log(`action after update: ${JSON.stringify(response, null, 4)}`); - response = await httpPost(`api/action/${actionId}/_execute`, { + response = await httpPost(`api/actions/action/${actionId}/_execute`, { params: { to: ['patrick.mueller@elastic.co'], subject: 'the email subject', diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/update.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/update.ts index 6cafbeb8c6ea8..cb0e0efda0b1a 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/update.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/update.ts @@ -24,7 +24,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle update action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -37,10 +37,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -91,7 +91,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it(`shouldn't update action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -104,10 +104,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .put(`${getUrlPrefix('other')}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ @@ -146,7 +146,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it('should handle update action request appropriately when passing a null config', async () => { const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/1`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/1`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ @@ -181,7 +181,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it(`should handle update action request appropriately when action doesn't exist`, async () => { const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/1`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/1`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ @@ -221,7 +221,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it('should handle update action request appropriately when payload is empty and invalid', async () => { const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/1`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/1`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({}); @@ -254,7 +254,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it('should handle update action request appropriately when secrets are not valid', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -267,10 +267,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .auth(user.username, user.password) .send({ @@ -311,7 +311,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it(`shouldn't update action from preconfigured list`, async () => { const response = await supertestWithoutAuth - .put(`${getUrlPrefix(space.id)}/api/action/custom-system-abc-connector`) + .put(`${getUrlPrefix(space.id)}/api/actions/action/custom-system-abc-connector`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo') .send({ diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts index 59cf22b52920c..02cd661cbaf04 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts @@ -50,7 +50,7 @@ export default function alertTests({ getService }: FtrProviderContext) { before(async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -72,7 +72,7 @@ export default function alertTests({ getService }: FtrProviderContext) { objectRemover, }); }); - after(() => objectRemover.add(space.id, indexRecordActionId, 'action')); + after(() => objectRemover.add(space.id, indexRecordActionId, 'action', 'actions')); it('should schedule task, run alert and schedule actions when appropriate', async () => { const testStart = new Date(); @@ -324,7 +324,7 @@ instanceStateValue: true const retryDate = new Date(Date.now() + 60000); const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'Test rate limit', @@ -332,7 +332,7 @@ instanceStateValue: true config: {}, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const reference = alertUtils.generateReference(); const response = await supertestWithoutAuth @@ -374,7 +374,7 @@ instanceStateValue: true case 'superuser at space1': case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); // Wait for the task to be attempted once and idle const scheduledActionTask = await retry.try(async () => { @@ -457,7 +457,7 @@ instanceStateValue: true break; case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); // Wait for test.authorization to index a document before disabling the alert and waiting for tasks to finish await esTestIndexTool.waitForDocs('alert:test.authorization', reference); @@ -490,7 +490,7 @@ instanceStateValue: true break; case 'superuser at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); // Wait for test.authorization to index a document before disabling the alert and waiting for tasks to finish await esTestIndexTool.waitForDocs('alert:test.authorization', reference); @@ -523,14 +523,14 @@ instanceStateValue: true const testStart = new Date(); const reference = alertUtils.generateReference(); const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', actionTypeId: 'test.authorization', }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth .post(`${getUrlPrefix(space.id)}/api/alert`) .set('kbn-xsrf', 'foo') @@ -571,7 +571,7 @@ instanceStateValue: true break; case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); // Ensure test.authorization indexed 1 document before disabling the alert and waiting for tasks to finish await esTestIndexTool.waitForDocs('action:test.authorization', reference); @@ -604,7 +604,7 @@ instanceStateValue: true break; case 'superuser at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); // Ensure test.authorization indexed 1 document before disabling the alert and waiting for tasks to finish await esTestIndexTool.waitForDocs('action:test.authorization', reference); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts index 7dae7e4ab7941..ad9fd117c3604 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts @@ -32,7 +32,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { describe(scenario.id, () => { it('should handle create alert request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'MY action', @@ -72,7 +72,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { case 'superuser at space1': case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); expect(response.body).to.eql({ id: response.body.id, name: 'abc', @@ -145,7 +145,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { case 'superuser at space1': case 'space_1_all at space1': expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); expect(response.body.scheduledTaskId).to.eql(undefined); break; default: diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts index af7e0334b2d35..593ae574e6f34 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/delete.ts @@ -52,7 +52,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) { error: 'Not Found', message: 'Not Found', }); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); // Ensure task still exists await getScheduledTask(createdAlert.scheduledTaskId); break; @@ -78,7 +78,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .delete(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`) @@ -143,7 +143,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) { error: 'Not Found', message: 'Not Found', }); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); // Ensure task still exists await getScheduledTask(createdAlert.scheduledTaskId); break; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts index 52bdd7e90b5b1..dbbccba70a715 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/disable.ts @@ -44,7 +44,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: true })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await alertUtils.getDisableRequest(createdAlert.id); @@ -90,7 +90,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: true })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .put( @@ -148,7 +148,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: true })) .expect(200); - objectRemover.add('other', createdAlert.id, 'alert'); + objectRemover.add('other', createdAlert.id, 'alert', undefined); const response = await alertUtils.getDisableRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts index f87d985ffc6bc..611556aaf1fef 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/enable.ts @@ -44,7 +44,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await alertUtils.getEnableRequest(createdAlert.id); @@ -95,7 +95,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .put( @@ -158,7 +158,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add('other', createdAlert.id, 'alert'); + objectRemover.add('other', createdAlert.id, 'alert', undefined); const response = await alertUtils.getEnableRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts index f91c06c5299b8..1c4d684eb78de 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts @@ -28,7 +28,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get( @@ -84,7 +84,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { it('should handle find alert request with filter appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -110,7 +110,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get( @@ -178,7 +178,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get( diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts index 20eed4013d7dd..5800273dce75d 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts @@ -28,7 +28,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`) @@ -82,7 +82,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_state.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_state.ts index d95f9ea8ac0ea..42a6b36df0f97 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_state.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_state.ts @@ -28,7 +28,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/state`) @@ -61,7 +61,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .get(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}/state`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_all.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_all.ts index ce11fb8052b45..0196615629e23 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_all.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_all.ts @@ -36,7 +36,7 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext) .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await alertUtils.getMuteAllRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_instance.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_instance.ts index f91b54514ae05..0c05dbdf55842 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_instance.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/mute_instance.ts @@ -36,7 +36,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await alertUtils.getMuteInstanceRequest(createdAlert.id, '1'); @@ -80,7 +80,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/alert_instance/1/_mute`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_all.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_all.ts index f2598ff7c5493..ebe9f1f645ed7 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_all.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_all.ts @@ -36,7 +36,7 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/_mute_all`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_instance.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_instance.ts index ca58b58e5e822..7142fd7d91adf 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_instance.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/unmute_instance.ts @@ -36,7 +36,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/alert_instance/1/_mute`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts index 2abaa5548e318..0af1e22584643 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts @@ -43,7 +43,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const updatedData = { name: 'bcd', @@ -114,7 +114,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .put( @@ -197,7 +197,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .put(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`) @@ -244,7 +244,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .put(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`) @@ -332,7 +332,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await supertestWithoutAuth .put(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`) @@ -421,7 +421,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await retry.try(async () => { const alertTask = (await getAlertingTaskById(createdAlert.scheduledTaskId)).docs[0]; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts index 67925edb4f8f8..6349919c15cd2 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update_api_key.ts @@ -36,7 +36,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); const response = await alertUtils.getUpdateApiKeyRequest(createdAlert.id); @@ -80,7 +80,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(space.id, createdAlert.id, 'alert'); + objectRemover.add(space.id, createdAlert.id, 'alert', undefined); await supertest .put( @@ -136,7 +136,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add('other', createdAlert.id, 'alert'); + objectRemover.add('other', createdAlert.id, 'alert', undefined); const response = await alertUtils.getUpdateApiKeyRequest(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/es_index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/es_index.ts index 874d42ac04736..0822e614464cb 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/es_index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/es_index.ts @@ -26,7 +26,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should be created successfully', async () => { // create action with no config const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -51,7 +51,7 @@ export default function indexTest({ getService }: FtrProviderContext) { expect(typeof createdActionID).to.be('string'); const { body: fetchedAction } = await supertest - .get(`/api/action/${createdActionID}`) + .get(`/api/actions/action/${createdActionID}`) .expect(200); expect(fetchedAction).to.eql({ @@ -64,7 +64,7 @@ export default function indexTest({ getService }: FtrProviderContext) { // create action with all config props const { body: createdActionWithIndex } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action with index config', @@ -92,7 +92,7 @@ export default function indexTest({ getService }: FtrProviderContext) { expect(typeof createdActionIDWithIndex).to.be('string'); const { body: fetchedActionWithIndex } = await supertest - .get(`/api/action/${createdActionIDWithIndex}`) + .get(`/api/actions/action/${createdActionIDWithIndex}`) .expect(200); expect(fetchedActionWithIndex).to.eql({ @@ -110,7 +110,7 @@ export default function indexTest({ getService }: FtrProviderContext) { it('should execute successly when expected for a single body', async () => { const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'foo') .send({ name: 'An index action', @@ -123,7 +123,7 @@ export default function indexTest({ getService }: FtrProviderContext) { }) .expect(200); const { body: result } = await supertest - .post(`/api/action/${createdAction.id}/_execute`) + .post(`/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/webhook.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/webhook.ts index 22e1284f55aa8..fb8460068cbcf 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/webhook.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/builtin_action_types/webhook.ts @@ -32,7 +32,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { }; const { body: createdAction } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'test') .send({ name: 'A generic Webhook action', @@ -60,7 +60,7 @@ export default function webhookTest({ getService }: FtrProviderContext) { it('webhook can be executed without username and password', async () => { const webhookActionId = await createWebhookAction(webhookSimulatorURL); const { body: result } = await supertest - .post(`/api/action/${webhookActionId}/_execute`) + .post(`/api/actions/action/${webhookActionId}/_execute`) .set('kbn-xsrf', 'test') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/create.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/create.ts index c70c289194abb..f3542c728845d 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/create.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/create.ts @@ -20,7 +20,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { it('should handle create action request appropriately', async () => { const response = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -34,7 +34,7 @@ export default function createActionTests({ getService }: FtrProviderContext) { }); expect(response.status).to.eql(200); - objectRemover.add(Spaces.space1.id, response.body.id, 'action'); + objectRemover.add(Spaces.space1.id, response.body.id, 'action', 'actions'); expect(response.body).to.eql({ id: response.body.id, isPreconfigured: false, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/delete.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/delete.ts index 26a811d2cc512..6e7f8d6f2a4b1 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/delete.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/delete.ts @@ -19,7 +19,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it('should handle delete action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -34,14 +34,14 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { .expect(200); await supertest - .delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`) + .delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .expect(204, ''); }); it(`shouldn't delete action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -54,10 +54,10 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); await supertest - .delete(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`) + .delete(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .expect(404, { statusCode: 404, @@ -68,7 +68,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it(`should handle delete request appropriately when action doesn't exist`, async () => { await supertest - .delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/2`) + .delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/2`) .set('kbn-xsrf', 'foo') .expect(404, { statusCode: 404, @@ -79,7 +79,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) { it(`shouldn't delete action from preconfigured list`, async () => { await supertest - .delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/my-slack1`) + .delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/my-slack1`) .set('kbn-xsrf', 'foo') .expect(400, { statusCode: 400, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts index db1c6c68a237d..7bbeab7cc8726 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts @@ -39,7 +39,7 @@ export default function ({ getService }: FtrProviderContext) { it('should handle execute request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -52,11 +52,11 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); const reference = `actions-execute-1:${Spaces.space1.id}`; const response = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -90,18 +90,18 @@ export default function ({ getService }: FtrProviderContext) { it('should handle failed executions', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'failing action', actionTypeId: 'test.failing', }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); const reference = `actions-failure-1:${Spaces.space1.id}`; const response = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -122,7 +122,7 @@ export default function ({ getService }: FtrProviderContext) { it(`shouldn't execute an action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -135,11 +135,11 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); const reference = `actions-execute-2:${Spaces.space1.id}`; await supertest - .post(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { @@ -158,17 +158,17 @@ export default function ({ getService }: FtrProviderContext) { it('should handle execute request appropriately and have proper callCluster and savedObjectsClient authorization', async () => { const reference = `actions-execute-3:${Spaces.space1.id}`; const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', actionTypeId: 'test.authorization', }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); const response = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get.ts index 4eb8c16f4fb3a..2f965d422bfd9 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get.ts @@ -19,7 +19,7 @@ export default function getActionTests({ getService }: FtrProviderContext) { it('should handle get action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -32,10 +32,10 @@ export default function getActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); await supertest - .get(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`) + .get(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`) .expect(200, { id: createdAction.id, isPreconfigured: false, @@ -49,7 +49,7 @@ export default function getActionTests({ getService }: FtrProviderContext) { it(`action should't be acessible from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -62,10 +62,10 @@ export default function getActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); await supertest - .get(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`) + .get(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`) .expect(404, { statusCode: 404, error: 'Not Found', @@ -74,12 +74,14 @@ export default function getActionTests({ getService }: FtrProviderContext) { }); it('should handle get action request from preconfigured list', async () => { - await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/my-slack1`).expect(200, { - id: 'my-slack1', - isPreconfigured: true, - actionTypeId: '.slack', - name: 'Slack#xyz', - }); + await supertest + .get(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/my-slack1`) + .expect(200, { + id: 'my-slack1', + isPreconfigured: true, + actionTypeId: '.slack', + name: 'Slack#xyz', + }); }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get_all.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get_all.ts index 62abdddc6a1bf..60766ff4bc926 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get_all.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/get_all.ts @@ -19,7 +19,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { it('should handle get all action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -32,9 +32,9 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); - await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/_getAll`).expect(200, [ + await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/actions`).expect(200, [ { id: createdAction.id, isPreconfigured: false, @@ -78,7 +78,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { it(`shouldn't get all action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -91,9 +91,9 @@ export default function getAllActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); - await supertest.get(`${getUrlPrefix(Spaces.other.id)}/api/action/_getAll`).expect(200, [ + await supertest.get(`${getUrlPrefix(Spaces.other.id)}/api/actions`).expect(200, [ { id: 'preconfigured-es-index-action', isPreconfigured: true, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/list_action_types.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/list_action_types.ts index dca3769d38e12..9f9a66dde39d8 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/list_action_types.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/list_action_types.ts @@ -15,7 +15,9 @@ export default function listActionTypesTests({ getService }: FtrProviderContext) describe('list_action_types', () => { it('should return 200 with list of action types containing defaults', async () => { - const response = await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/types`); + const response = await supertest.get( + `${getUrlPrefix(Spaces.space1.id)}/api/actions/list_action_types` + ); function createActionTypeMatcher(id: string, name: string) { return (actionType: { id: string; name: string }) => { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/type_not_enabled.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/type_not_enabled.ts index e2d832bafdd17..912b0dc339a21 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/type_not_enabled.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/type_not_enabled.ts @@ -21,7 +21,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) after(() => esArchiver.unload('alerting')); it('should handle create action with disabled actionType request appropriately', async () => { - const response = await supertest.post(`/api/action`).set('kbn-xsrf', 'foo').send({ + const response = await supertest.post(`/api/actions/action`).set('kbn-xsrf', 'foo').send({ name: 'My action', actionTypeId: DISABLED_ACTION_TYPE, }); @@ -37,7 +37,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) it(`should handle execute request with disabled actionType appropriately`, async () => { const response = await supertest - .post(`/api/action/${PREWRITTEN_ACTION_ID}/_execute`) + .post(`/api/actions/action/${PREWRITTEN_ACTION_ID}/_execute`) .set('kbn-xsrf', 'foo') .send({ params: {}, @@ -53,7 +53,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) }); it('should handle get action request with disabled actionType appropriately', async () => { - const response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`); + const response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`); expect(response.status).to.eql(200); expect(response.body).to.eql({ @@ -67,7 +67,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) it('should handle update action request with disabled actionType appropriately', async () => { const responseUpdate = await supertest - .put(`/api/action/${PREWRITTEN_ACTION_ID}`) + .put(`/api/actions/action/${PREWRITTEN_ACTION_ID}`) .set('kbn-xsrf', 'foo') .send({ name: 'an action created before test.not-enabled was disabled (updated)', @@ -81,7 +81,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) 'action type "test.not-enabled" is not enabled in the Kibana config xpack.actions.enabledActionTypes', }); - const response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`); + const response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`); expect(response.status).to.eql(200); expect(response.body).to.eql({ actionTypeId: 'test.not-enabled', @@ -96,11 +96,11 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext) let response; response = await supertest - .delete(`/api/action/${PREWRITTEN_ACTION_ID}`) + .delete(`/api/actions/action/${PREWRITTEN_ACTION_ID}`) .set('kbn-xsrf', 'foo'); expect(response.status).to.eql(204); - response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`); + response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`); expect(response.status).to.eql(404); }); }); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/update.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/update.ts index 05d26aaaed2ec..81db8177b2c11 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/update.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/update.ts @@ -19,7 +19,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it('should handle update action request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -32,10 +32,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); await supertest - .put(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .send({ name: 'My action updated', @@ -67,7 +67,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it(`shouldn't update action from another space`, async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -80,10 +80,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) { }, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAction.id, 'action'); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); await supertest - .put(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`) + .put(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`) .set('kbn-xsrf', 'foo') .send({ name: 'My action updated', @@ -103,7 +103,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) { it(`shouldn't update action from preconfigured list`, async () => { await supertest - .put(`${getUrlPrefix(Spaces.space1.id)}/api/action/custom-system-abc-connector`) + .put(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/custom-system-abc-connector`) .set('kbn-xsrf', 'foo') .send({ name: 'My action updated', diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts index 95ccfb897cf54..d3c914942bd90 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts @@ -45,7 +45,7 @@ export function alertTests({ getService }: FtrProviderContext, space: Space) { await esTestIndexTool.setup(); await es.indices.create({ index: authorizationIndex }); const { body: createdAction } = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', @@ -70,7 +70,7 @@ export function alertTests({ getService }: FtrProviderContext, space: Space) { after(async () => { await esTestIndexTool.destroy(); await es.indices.delete({ index: authorizationIndex }); - objectRemover.add(space.id, indexRecordActionId, 'action'); + objectRemover.add(space.id, indexRecordActionId, 'action', 'actions'); await objectRemover.removeAll(); }); @@ -174,7 +174,7 @@ instanceStateValue: true const retryDate = new Date(Date.now() + 60000); const { body: createdAction } = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'Test rate limit', @@ -182,7 +182,7 @@ instanceStateValue: true config: {}, }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const reference = alertUtils.generateReference(); const response = await supertestWithoutAuth @@ -211,7 +211,7 @@ instanceStateValue: true ); expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); const scheduledActionTask = await retry.try(async () => { const searchResult = await es.search({ index: '.kibana_task_manager', @@ -271,7 +271,7 @@ instanceStateValue: true ); expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); const alertTestRecord = ( await esTestIndexTool.waitForDocs('alert:test.authorization', reference) )[0]; @@ -292,14 +292,14 @@ instanceStateValue: true it('should have proper callCluster and savedObjectsClient authorization for action type executor', async () => { const reference = alertUtils.generateReference(); const { body: createdAction } = await supertestWithoutAuth - .post(`${getUrlPrefix(space.id)}/api/action`) + .post(`${getUrlPrefix(space.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'My action', actionTypeId: 'test.authorization', }) .expect(200); - objectRemover.add(space.id, createdAction.id, 'action'); + objectRemover.add(space.id, createdAction.id, 'action', 'actions'); const response = await supertestWithoutAuth .post(`${getUrlPrefix(space.id)}/api/alert`) .set('kbn-xsrf', 'foo') @@ -327,7 +327,7 @@ instanceStateValue: true ); expect(response.statusCode).to.eql(200); - objectRemover.add(space.id, response.body.id, 'alert'); + objectRemover.add(space.id, response.body.id, 'alert', undefined); const actionTestRecord = ( await esTestIndexTool.waitForDocs('action:test.authorization', reference) )[0]; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts index c98e3abe75ab1..353f7d02f6b0b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts @@ -372,7 +372,7 @@ export default function alertTests({ getService }: FtrProviderContext) { expect(status).to.be(200); const alertId = createdAlert.id; - objectRemover.add(Spaces.space1.id, alertId, 'alert'); + objectRemover.add(Spaces.space1.id, alertId, 'alert', undefined); return alertId; } @@ -381,7 +381,7 @@ export default function alertTests({ getService }: FtrProviderContext) { async function createAction(supertest: any, objectRemover: ObjectRemover): Promise { const { statusCode, body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'index action for index threshold FT', @@ -398,7 +398,7 @@ async function createAction(supertest: any, objectRemover: ObjectRemover): Promi expect(statusCode).to.be(200); const actionId = createdAction.id; - objectRemover.add(Spaces.space1.id, actionId, 'action'); + objectRemover.add(Spaces.space1.id, actionId, 'action', 'actions'); return actionId; } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts index 319834452a212..b10c356cf40d5 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts @@ -28,7 +28,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { it('should handle create alert request appropriately', async () => { const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/action`) + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`) .set('kbn-xsrf', 'foo') .send({ name: 'MY action', @@ -54,7 +54,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { ); expect(response.status).to.eql(200); - objectRemover.add(Spaces.space1.id, response.body.id, 'alert'); + objectRemover.add(Spaces.space1.id, response.body.id, 'alert', undefined); expect(response.body).to.eql({ id: response.body.id, name: 'abc', @@ -109,7 +109,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { .send(getTestAlertData({ enabled: false })); expect(response.status).to.eql(200); - objectRemover.add(Spaces.space1.id, response.body.id, 'alert'); + objectRemover.add(Spaces.space1.id, response.body.id, 'alert', undefined); expect(response.body.scheduledTaskId).to.eql(undefined); }); }); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts index 9d5017530e075..7152a76fa167f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts @@ -39,7 +39,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: true })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.disable(createdAlert.id); @@ -65,7 +65,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: true })) .expect(200); - objectRemover.add(Spaces.other.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined); await alertUtils.getDisableRequest(createdAlert.id).expect(404, { statusCode: 404, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/enable.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/enable.ts index 4459dd744fe4b..3d556d0936022 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/enable.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/enable.ts @@ -39,7 +39,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.enable(createdAlert.id); @@ -71,7 +71,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.other.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined); await alertUtils.getEnableRequest(createdAlert.id).expect(404, { statusCode: 404, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts index 5f50c0d64f353..f57b136b9637a 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts @@ -24,7 +24,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); const response = await supertest.get( `${getUrlPrefix( @@ -67,7 +67,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await supertest .get( diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts index 66cd8a7244081..6b216d2ba265f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts @@ -24,7 +24,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); const response = await supertest.get( `${getUrlPrefix(Spaces.space1.id)}/api/alert/${createdAlert.id}` @@ -61,7 +61,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await supertest .get(`${getUrlPrefix(Spaces.other.id)}/api/alert/${createdAlert.id}`) diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_state.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_state.ts index 6f1aec901760e..06f5f5542780c 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_state.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_state.ts @@ -25,7 +25,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); const response = await supertest.get( `${getUrlPrefix(Spaces.space1.id)}/api/alert/${createdAlert.id}/state` @@ -51,7 +51,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont params: {}, }) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); // wait for alert to actually execute await retry.try(async () => { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_all.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_all.ts index 4781aed640f51..b2ba38ac98470 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_all.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_all.ts @@ -31,7 +31,7 @@ export default function createMuteTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.muteAll(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_instance.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_instance.ts index 0ee4d076d7b3c..d9f52d3321e32 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_instance.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/mute_instance.ts @@ -31,7 +31,7 @@ export default function createMuteInstanceTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.muteInstance(createdAlert.id, '1'); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_all.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_all.ts index a7bf065d5795d..7c5f1e0a62130 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_all.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_all.ts @@ -31,7 +31,7 @@ export default function createUnmuteTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.muteAll(createdAlert.id); await alertUtils.unmuteAll(createdAlert.id); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_instance.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_instance.ts index 868bbf66b1c32..86464c3d6bb64 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_instance.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/unmute_instance.ts @@ -31,7 +31,7 @@ export default function createUnmuteInstanceTests({ getService }: FtrProviderCon .set('kbn-xsrf', 'foo') .send(getTestAlertData({ enabled: false })) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.muteInstance(createdAlert.id, '1'); await alertUtils.unmuteInstance(createdAlert.id, '1'); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts index 5a35d4bf83865..fc0aeb71d9066 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts @@ -24,7 +24,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); const updatedData = { name: 'bcd', @@ -79,7 +79,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await supertest .put(`${getUrlPrefix(Spaces.other.id)}/api/alert/${createdAlert.id}`) diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update_api_key.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update_api_key.ts index 4c4e641f90277..9c7b4dcc8b1a3 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update_api_key.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update_api_key.ts @@ -35,7 +35,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined); await alertUtils.updateApiKey(createdAlert.id); @@ -60,7 +60,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte .set('kbn-xsrf', 'foo') .send(getTestAlertData()) .expect(200); - objectRemover.add(Spaces.other.id, createdAlert.id, 'alert'); + objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined); await alertUtils.getUpdateApiKeyRequest(createdAlert.id).expect(404, { statusCode: 404, diff --git a/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts b/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts index 2c1c4369e3ccd..a0f5e51175e05 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/push_case.ts @@ -37,12 +37,12 @@ export default ({ getService }: FtrProviderContext): void => { it('should push a case', async () => { const { body: connector } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'true') .send(getConnector()) .expect(200); - actionsRemover.add('default', connector.id, 'action'); + actionsRemover.add('default', connector.id, 'action', 'actions'); const { body: configure } = await supertest .post(CASE_CONFIGURE_URL) @@ -73,12 +73,12 @@ export default ({ getService }: FtrProviderContext): void => { it('pushes a comment appropriately', async () => { const { body: connector } = await supertest - .post('/api/action') + .post('/api/actions/action') .set('kbn-xsrf', 'true') .send(getConnector()) .expect(200); - actionsRemover.add('default', connector.id, 'action'); + actionsRemover.add('default', connector.id, 'action', 'actions'); const { body: configure } = await supertest .post(CASE_CONFIGURE_URL) diff --git a/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts b/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts index 9454a32757068..cff5b3c3ce9c3 100644 --- a/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts +++ b/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts @@ -31,7 +31,7 @@ export class Actions { this.log.debug(`creating action ${actionParams.name}`); const { data: action, status: actionStatus, actionStatusText } = await this.axios.post( - `/api/action`, + `/api/actions/action`, actionParams ); if (actionStatus !== 200) {