diff --git a/x-pack/plugins/actions/README.md b/x-pack/plugins/actions/README.md index 54624b94e0de35..847172ae972fd0 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 84eb64f6370ac8..b3cacc76b77fde 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 1fa85c86e06514..940b8ecc61f4ec 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 e9d7c2d8d00eb9..81355671575837 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 e63989e27a57cd..8d759f1a7565e5 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 d1f9693e1c8d48..9d4fa4019744ca 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 1cd6343a39dcff..4467ddf372b21d 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 4093ed45119397..820bc191993d1e 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 f701be579d99d3..ee2586851366c4 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 09c47c94029e7f..224de241c7374e 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 e00054fd3746f1..6550921278aa5c 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 6d02872ea64e14..03a4a97855b6b0 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 205752d5a49d15..f231efe1a07f35 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 bc91d4854e638b..bfb5fabe127f3e 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 6459a34bf0737d..323a52f2fc6e2d 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 efad39c1cd4537..1e107a4d6edb42 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 855a5c3d63507a..819d4110e168d1 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 61f86b0f9b609c..f248e20493a243 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 69dedd71284afa..1be66ce4ccfefb 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 27e46ef82a1b4a..b3e6c079378ef2 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 5f13115f28484d..fb3e0323d425b1 100644 --- a/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts +++ b/x-pack/plugins/siem/cypress/integration/cases_connectors.spec.ts @@ -20,7 +20,7 @@ import { CASES } from '../urls/navigation'; describe('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/containers/case/api.test.tsx b/x-pack/plugins/siem/public/containers/case/api.test.tsx index 174738098fa107..3d78f5b3272815 100644 --- a/x-pack/plugins/siem/public/containers/case/api.test.tsx +++ b/x-pack/plugins/siem/public/containers/case/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/${connectorId}/_execute`, { method: 'POST', body: JSON.stringify({ params: { subAction: 'pushToService', subActionParams: casePushParams }, 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 2028216e6770f2..724ed2f340aec1 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 c587e9a2041822..448c5bc46c4f49 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 e9cf2a270d180d..43b22361aea36f 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 20ce1d21050c1c..46a676ac06539e 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 f22fe0e3bc1e7c..3de628b6f44bfe 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 ec07f6ff44df64..d92af5afc103bb 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 e261cf15d05ae6..d962a0e72027d3 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 686f4a0086fa09..ea5f523b396b48 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 1244657ed99889..6eb1f278585af9 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 4151deab45213d..22ffdfb762bdf8 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 bae6dada48fb7e..f674d2db227c44 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 901a39069c6ece..8a98e78feab314 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 8d01b3444b4881..780c239149d53c 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 6001dd531cfae8..ffbb29b431d8d8 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 612eba858ea0b0..c1dc155c172384 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 b04bc13ffc5e47..93daa16e71bcfb 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 ed63d25d86aca6..eba1f99547971f 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 4c76ebfb93b0bd..c696d32b30f3ce 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 e9d3e6c542442b..a915987ce5feb3 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 04cd06999f4321..cc6b00f3abb289 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 386254e49c19c8..905125f13cbec0 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 9b66326fa6157a..627d56a63be298 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 922315eba5a5c6..69dcb7c813815c 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 011e47cf11b394..d96ffc5bb3be39 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 4458353f4fdc88..70a3663c1c798c 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 e43f9dba4b2dc1..c610ac670f690c 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 95b564e63d715b..785285f6d455c5 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 f70e8f561b23e8..22c89a1a8148f6 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 dc5152a7f24977..ae5e6adc7a8d9f 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 6cafbeb8c6ea8b..cb0e0efda0b1a8 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 59cf22b52920cc..02cd661cbaf04d 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 7dae7e4ab7941d..ad9fd117c36042 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 3da9552df976c9..7dc46cecc56cce 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}`) @@ -141,7 +141,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 5007cfa6cf0440..e6a0e8f1157a64 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(`${getUrlPrefix(space.id)}/api/saved_objects/alert/${createdAlert.id}`) @@ -146,7 +146,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 d89172515757b3..d22dea11abac09 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(`${getUrlPrefix(space.id)}/api/saved_objects/alert/${createdAlert.id}`) @@ -156,7 +156,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 f91c06c5299b8d..1c4d684eb78de7 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 20eed4013d7dd3..5800273dce75d3 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 d95f9ea8ac0ea1..42a6b36df0f97f 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 ce11fb8052b458..0196615629e231 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 f91b54514ae05a..0c05dbdf558429 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 f2598ff7c5493b..ebe9f1f645ed7d 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 ca58b58e5e822a..7142fd7d91adf0 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 f7ccc6c97bcf0a..e55a04a46f64fb 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(`${getUrlPrefix(space.id)}/api/saved_objects/alert/${createdAlert.id}`) @@ -195,7 +195,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}`) @@ -242,7 +242,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}`) @@ -330,7 +330,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}`) @@ -419,7 +419,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 cd821a739a9eba..2849df32d3e785 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(`${getUrlPrefix(space.id)}/api/saved_objects/alert/${createdAlert.id}`) @@ -134,7 +134,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 874d42ac04736a..0822e614464cba 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 112149a32649a2..1a263b18b15aa3 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 c70c289194abbd..f3542c728845d7 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 26a811d2cc512e..6e7f8d6f2a4b17 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 db1c6c68a237df..7bbeab7cc87260 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 4eb8c16f4fb3a8..2f965d422bfd9b 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 62abdddc6a1bfb..60766ff4bc926d 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 dca3769d38e12a..9f9a66dde39d89 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 e2d832bafdd173..912b0dc339a213 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 05d26aaaed2ec3..81db8177b2c114 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 95ccfb897cf546..d3c914942bd90a 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 c98e3abe75ab17..353f7d02f6b0b5 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 319834452a2120..b10c356cf40d5f 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 9d5017530e075c..7152a76fa167fb 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 4459dd744fe4b2..3d556d09360221 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 5f50c0d64f3539..f57b136b9637a9 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 66cd8a72440810..6b216d2ba265f2 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 6f1aec901760e4..06f5f5542780c7 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 4781aed640f511..b2ba38ac984700 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 0ee4d076d7b3c8..d9f52d3321e323 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 a7bf065d5795de..7c5f1e0a621305 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 868bbf66b1c32b..86464c3d6bb64c 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 5a35d4bf838659..fc0aeb71d9066b 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 4c4e641f902775..9c7b4dcc8b1a39 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/functional_with_es_ssl/services/alerting/actions.ts b/x-pack/test/functional_with_es_ssl/services/alerting/actions.ts index 9454a32757068b..cff5b3c3ce9c3c 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) {