mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Changing triggers actions ui routes to internal (#141149)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
2f00d39586
commit
81e973bc35
11 changed files with 20 additions and 19 deletions
|
@ -9,7 +9,7 @@ import { HttpSetup } from '@kbn/core/public';
|
|||
import { TimeSeriesResult } from '@kbn/triggers-actions-ui-plugin/common';
|
||||
import { IndexThresholdAlertParams } from './types';
|
||||
|
||||
const INDEX_THRESHOLD_DATA_API_ROOT = '/api/triggers_actions_ui/data';
|
||||
const INDEX_THRESHOLD_DATA_API_ROOT = '/internal/triggers_actions_ui/data';
|
||||
|
||||
export interface GetThresholdAlertVisualizationDataParams {
|
||||
model: IndexThresholdAlertParams;
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
/* eslint-disable @kbn/eslint/no_export_all */
|
||||
|
||||
export * from './data';
|
||||
export const BASE_TRIGGERS_ACTIONS_UI_API_PATH = '/api/triggers_actions_ui';
|
||||
export const BASE_TRIGGERS_ACTIONS_UI_API_PATH = '/internal/triggers_actions_ui';
|
||||
export * from './parse_interval';
|
||||
export * from './experimental_features';
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('triggersActionsUiConfig', () => {
|
|||
expect(http.get.mock.calls).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
"/api/triggers_actions_ui/_config",
|
||||
"/internal/triggers_actions_ui/_config",
|
||||
],
|
||||
]
|
||||
`);
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('Data API', () => {
|
|||
http.post.mockResolvedValueOnce(mockFields);
|
||||
const fields = await getESIndexFields({ indexes, http });
|
||||
|
||||
expect(http.post).toHaveBeenCalledWith('/api/triggers_actions_ui/data/_fields', {
|
||||
expect(http.post).toHaveBeenCalledWith('/internal/triggers_actions_ui/data/_fields', {
|
||||
body: `{"indexPatterns":${JSON.stringify(indexes)}}`,
|
||||
});
|
||||
expect(fields).toEqual(mockFields.fields);
|
||||
|
@ -50,7 +50,7 @@ describe('Data API', () => {
|
|||
http.post.mockResolvedValueOnce(mockIndices);
|
||||
const indices = await getMatchingIndices({ pattern, http });
|
||||
|
||||
expect(http.post).toHaveBeenCalledWith('/api/triggers_actions_ui/data/_indices', {
|
||||
expect(http.post).toHaveBeenCalledWith('/internal/triggers_actions_ui/data/_indices', {
|
||||
body: `{"pattern":"*${mockPattern}*"}`,
|
||||
});
|
||||
expect(indices).toEqual(mockIndices.indices);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { HttpSetup } from '@kbn/core/public';
|
||||
import { DataViewsContract, DataView } from '@kbn/data-views-plugin/public';
|
||||
|
||||
const DATA_API_ROOT = '/api/triggers_actions_ui/data';
|
||||
const DATA_API_ROOT = '/internal/triggers_actions_ui/data';
|
||||
|
||||
const formatPattern = (pattern: string) => {
|
||||
let formattedPattern = pattern;
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('triggersActionsUiHealth', () => {
|
|||
expect(http.get.mock.calls).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
"/api/triggers_actions_ui/_health",
|
||||
"/internal/triggers_actions_ui/_health",
|
||||
],
|
||||
]
|
||||
`);
|
||||
|
|
|
@ -6,9 +6,9 @@ The TriggersActionsUi plugin's Data Apis back the functionality needed by the In
|
|||
|
||||
The following endpoints are provided for this alert type:
|
||||
|
||||
- `POST /api/triggers_actions_ui/data/_indices`
|
||||
- `POST /api/triggers_actions_ui/data/_fields`
|
||||
- `POST /api/triggers_actions_ui/data/_time_series_query`
|
||||
- `POST /internal/triggers_actions_ui/data/_indices`
|
||||
- `POST /internal/triggers_actions_ui/data/_fields`
|
||||
- `POST /internal/triggers_actions_ui/data/_time_series_query`
|
||||
|
||||
### `POST .../_indices`
|
||||
|
||||
|
@ -79,7 +79,7 @@ provide a "preview" of the alert during creation/editing based on recent data,
|
|||
and could be used to show a "simulation" of the the alert over an arbitrary
|
||||
range of time.
|
||||
|
||||
The endpoint is `POST /api/triggers_actions_ui/data/_time_series_query`.
|
||||
The endpoint is `POST /internal/triggers_actions_ui/data/_time_series_query`.
|
||||
The request and response bodies are specifed in
|
||||
[`lib/core_query_types.ts`][it-core-query]
|
||||
and
|
||||
|
@ -93,7 +93,7 @@ for the last 10 seconds.
|
|||
This example uses [now-iso][] to generate iso date strings.
|
||||
|
||||
```console
|
||||
curl -k "https://elastic:changeme@localhost:5601/api/triggers_actions_ui/data/_time_series_query" \
|
||||
curl -k "https://elastic:changeme@localhost:5601/internal/triggers_actions_ui/data/_time_series_query" \
|
||||
-H "kbn-xsrf: foo" -H "content-type: application/json" -d "{
|
||||
\"index\": \"es-hb-sim\",
|
||||
\"timeField\": \"@timestamp\",
|
||||
|
@ -136,7 +136,7 @@ curl -k "https://elastic:changeme@localhost:5601/api/triggers_actions_ui/data/_
|
|||
To get the current value of the calculated metric, you can leave off the date:
|
||||
|
||||
```
|
||||
curl -k "https://elastic:changeme@localhost:5601/api/triggers_actions_ui/data/_time_series_query" \
|
||||
curl -k "https://elastic:changeme@localhost:5601/internal/triggers_actions_ui/data/_time_series_query" \
|
||||
-H "kbn-xsrf: foo" -H "content-type: application/json" -d '{
|
||||
"index": "es-hb-sim",
|
||||
"timeField": "@timestamp",
|
||||
|
@ -169,7 +169,7 @@ curl -k "https://elastic:changeme@localhost:5601/api/triggers_actions_ui/data/_
|
|||
## service functions
|
||||
|
||||
A single service function is available that provides the functionality
|
||||
of the http endpoint `POST /api/triggers_actions_ui/data/_time_series_query`,
|
||||
of the http endpoint `POST /internal/triggers_actions_ui/data/_time_series_query`,
|
||||
but as an API for Kibana plugins. The function is available as
|
||||
`triggersActionsUi.data.timeSeriesQuery()` on the plugin's _Start_ contract
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ describe('createConfigRoute', () => {
|
|||
it('registers the route', async () => {
|
||||
const router = httpServiceMock.createRouter();
|
||||
const logger = loggingSystemMock.create().get();
|
||||
createConfigRoute(logger, router, `/api/triggers_actions_ui`, () => ({
|
||||
createConfigRoute(logger, router, `/internal/triggers_actions_ui`, () => ({
|
||||
isUsingSecurity: true,
|
||||
minimumScheduleInterval: { value: '1m', enforce: false },
|
||||
}));
|
||||
|
||||
const [config, handler] = router.get.mock.calls[0];
|
||||
expect(config.path).toMatchInlineSnapshot(`"/api/triggers_actions_ui/_config"`);
|
||||
expect(config.path).toMatchInlineSnapshot(`"/internal/triggers_actions_ui/_config"`);
|
||||
|
||||
const mockResponse = httpServerMock.createResponseFactory();
|
||||
await handler({}, httpServerMock.createKibanaRequest(), mockResponse);
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Spaces } from '../../../../scenarios';
|
|||
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
|
||||
import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../../common/lib';
|
||||
|
||||
const API_URI = 'api/triggers_actions_ui/data/_fields';
|
||||
const API_URI = 'internal/triggers_actions_ui/data/_fields';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function fieldsEndpointTests({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../.
|
|||
import { createEsDocumentsWithGroups } from '../lib/create_test_data';
|
||||
import { createDataStream, deleteDataStream } from '../lib/create_test_data';
|
||||
|
||||
const API_URI = 'api/triggers_actions_ui/data/_indices';
|
||||
const API_URI = 'internal/triggers_actions_ui/data/_indices';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function indicesEndpointTests({ getService }: FtrProviderContext) {
|
||||
|
|
|
@ -14,7 +14,8 @@ import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../.
|
|||
|
||||
import { createEsDocumentsWithGroups } from '../lib/create_test_data';
|
||||
|
||||
const INDEX_THRESHOLD_TIME_SERIES_QUERY_URL = 'api/triggers_actions_ui/data/_time_series_query';
|
||||
const INDEX_THRESHOLD_TIME_SERIES_QUERY_URL =
|
||||
'internal/triggers_actions_ui/data/_time_series_query';
|
||||
|
||||
const START_DATE_MM_DD_HH_MM_SS_MS = '01-01T00:00:00.000Z';
|
||||
const START_DATE = `2020-${START_DATE_MM_DD_HH_MM_SS_MS}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue