Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Jira API', () => {
const res = await getIssueTypes({ http, signal: abortCtrl.signal, connectorId: 'test' });

expect(res).toEqual(issueTypesResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"issueTypes","subActionParams":{}}}',
signal: abortCtrl.signal,
});
Expand All @@ -121,7 +121,7 @@ describe('Jira API', () => {
});

expect(res).toEqual(fieldsResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"fieldsByIssueType","subActionParams":{"id":"10006"}}}',
signal: abortCtrl.signal,
});
Expand All @@ -140,7 +140,7 @@ describe('Jira API', () => {
});

expect(res).toEqual(issuesResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"issues","subActionParams":{"title":"test issue"}}}',
signal: abortCtrl.signal,
});
Expand All @@ -159,7 +159,7 @@ describe('Jira API', () => {
});

expect(res).toEqual(issuesResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"issue","subActionParams":{"id":"RJ-107"}}}',
signal: abortCtrl.signal,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function getIssueTypes({
signal: AbortSignal;
connectorId: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'issueTypes', subActionParams: {} },
}),
Expand All @@ -36,7 +36,7 @@ export async function getFieldsByIssueType({
connectorId: string;
id: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'fieldsByIssueType', subActionParams: { id } },
}),
Expand All @@ -55,7 +55,7 @@ export async function getIssues({
connectorId: string;
title: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'issues', subActionParams: { title } },
}),
Expand All @@ -74,7 +74,7 @@ export async function getIssue({
connectorId: string;
id: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'issue', subActionParams: { id } },
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Resilient API', () => {
});

expect(res).toEqual(incidentTypesResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"incidentTypes","subActionParams":{}}}',
signal: abortCtrl.signal,
});
Expand All @@ -79,7 +79,7 @@ describe('Resilient API', () => {
});

expect(res).toEqual(severityResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"severity","subActionParams":{}}}',
signal: abortCtrl.signal,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function getIncidentTypes({
signal: AbortSignal;
connectorId: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'incidentTypes', subActionParams: {} },
}),
Expand All @@ -34,7 +34,7 @@ export async function getSeverity({
signal: AbortSignal;
connectorId: string;
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'severity', subActionParams: {} },
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('ServiceNow API', () => {
});

expect(res).toEqual(choicesResponse);
expect(http.post).toHaveBeenCalledWith('/api/actions/action/test/_execute', {
expect(http.post).toHaveBeenCalledWith('/api/actions/connector/test/_execute', {
body: '{"params":{"subAction":"getChoices","subActionParams":{"fields":["priority"]}}}',
signal: abortCtrl.signal,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function getChoices({
connectorId: string;
fields: string[];
}): Promise<Record<string, any>> {
return await http.post(`${BASE_ACTION_API_PATH}/action/${connectorId}/_execute`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector/${connectorId}/_execute`, {
body: JSON.stringify({
params: { subAction: 'getChoices', subActionParams: { fields } },
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('loadActionTypes', () => {
expect(result).toEqual(resolvedValue);
expect(http.get.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/actions/list_action_types",
"/api/actions/list_connector_types",
]
`);
});
Expand Down Expand Up @@ -74,7 +74,7 @@ describe('createActionConnector', () => {
expect(result).toEqual(resolvedValue);
expect(http.post.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/actions/action",
"/api/actions/connector",
Object {
"body": "{\\"actionTypeId\\":\\"test\\",\\"isPreconfigured\\":false,\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}",
},
Expand All @@ -100,7 +100,7 @@ describe('updateActionConnector', () => {
expect(result).toEqual(resolvedValue);
expect(http.put.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/actions/action/123",
"/api/actions/connector/123",
Object {
"body": "{\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}",
},
Expand All @@ -118,13 +118,13 @@ describe('deleteActions', () => {
expect(http.delete.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
"/api/actions/action/1",
"/api/actions/connector/1",
],
Array [
"/api/actions/action/2",
"/api/actions/connector/2",
],
Array [
"/api/actions/action/3",
"/api/actions/connector/3",
],
]
`);
Expand All @@ -151,7 +151,7 @@ describe('executeAction', () => {
});
expect(http.post.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/actions/action/123/_execute",
"/api/actions/connector/123/_execute",
Object {
"body": "{\\"params\\":{\\"stringParams\\":\\"someString\\",\\"numericParams\\":123}}",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { ActionConnector, ActionConnectorWithoutId, ActionType } from '../.
import { ActionTypeExecutorResult } from '../../../../../plugins/actions/common';

export async function loadActionTypes({ http }: { http: HttpSetup }): Promise<ActionType[]> {
return await http.get(`${BASE_ACTION_API_PATH}/list_action_types`);
return await http.get(`${BASE_ACTION_API_PATH}/list_connector_types`);
}

export async function loadAllActions({ http }: { http: HttpSetup }): Promise<ActionConnector[]> {
Expand All @@ -25,7 +25,7 @@ export async function createActionConnector({
http: HttpSetup;
connector: Omit<ActionConnectorWithoutId, 'referencedByCount'>;
}): Promise<ActionConnector> {
return await http.post(`${BASE_ACTION_API_PATH}/action`, {
return await http.post(`${BASE_ACTION_API_PATH}/connector`, {
body: JSON.stringify(connector),
});
}
Expand All @@ -39,7 +39,7 @@ export async function updateActionConnector({
connector: Pick<ActionConnectorWithoutId, 'name' | 'config' | 'secrets'>;
id: string;
}): Promise<ActionConnector> {
return await http.put(`${BASE_ACTION_API_PATH}/action/${id}`, {
return await http.put(`${BASE_ACTION_API_PATH}/connector/${id}`, {
body: JSON.stringify({
name: connector.name,
config: connector.config,
Expand All @@ -57,7 +57,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}/action/${id}`))).then(
await Promise.all(ids.map((id) => http.delete(`${BASE_ACTION_API_PATH}/connector/${id}`))).then(
function (fulfilled) {
successes.push(...fulfilled);
},
Expand All @@ -77,7 +77,7 @@ export async function executeAction({
http: HttpSetup;
params: Record<string, unknown>;
}): Promise<ActionTypeExecutorResult<unknown>> {
return http.post(`${BASE_ACTION_API_PATH}/action/${id}/_execute`, {
return http.post(`${BASE_ACTION_API_PATH}/connector/${id}/_execute`, {
body: JSON.stringify({ params }),
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

before(async () => {
const { body: createdAction } = await supertest
.post(`/api/actions/action`)
.post(`/api/actions/connector`)
.set('kbn-xsrf', 'foo')
.send(getTestActionData())
.expect(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

async function createActionManualCleanup(overwrites: Record<string, any> = {}) {
const { body: createdAction } = await supertest
.post(`/api/actions/action`)
.post(`/api/actions/connector`)
.set('kbn-xsrf', 'foo')
.send(getTestActionData(overwrites))
.expect(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

it('navigates to an alert details page', async () => {
const { body: createdAction } = await supertest
.post(`/api/actions/action`)
.post(`/api/actions/connector`)
.set('kbn-xsrf', 'foo')
.send(getTestActionData())
.expect(200);
Expand Down