mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[HTTP] Make alerting
APIs public (#183945)
This commit is contained in:
parent
295b4dbc15
commit
f0aef3d3ae
14 changed files with 60 additions and 1 deletions
|
@ -30,6 +30,10 @@ export const disableRuleRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_disable`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Disable a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
body: bodySchema,
|
||||
|
|
|
@ -22,6 +22,10 @@ export const enableRuleRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_enable`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Enable a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
},
|
||||
|
|
|
@ -40,6 +40,10 @@ export const healthRoute = (
|
|||
router.get(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/_health`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get the health of the alerting framework`,
|
||||
},
|
||||
validate: false,
|
||||
},
|
||||
router.handleLegacyErrors(
|
||||
|
|
|
@ -25,6 +25,10 @@ export const muteAllRuleRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_mute_all`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Mute all alerts`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
},
|
||||
|
|
|
@ -32,6 +32,10 @@ export const createRuleRoute = ({ router, licenseState, usageCounter }: RouteOpt
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id?}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Create a rule`,
|
||||
},
|
||||
validate: {
|
||||
body: createBodySchemaV1,
|
||||
params: createParamsSchemaV1,
|
||||
|
|
|
@ -21,6 +21,10 @@ export const deleteRuleRoute = (
|
|||
router.delete(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Delete a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: deleteRuleRequestParamsSchemaV1,
|
||||
},
|
||||
|
|
|
@ -41,6 +41,10 @@ const buildFindRulesRoute = ({
|
|||
router.get(
|
||||
{
|
||||
path,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rules`,
|
||||
},
|
||||
validate: {
|
||||
query: findRulesRequestQuerySchemaV1,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from '@kbn/core/server';
|
||||
import { IRouter, RouteConfigOptions, RouteMethod } from '@kbn/core/server';
|
||||
import { ILicenseState } from '../../../../lib';
|
||||
import { verifyAccessAndContext } from '../../../lib';
|
||||
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
|
||||
|
@ -28,16 +28,19 @@ interface BuildGetRulesRouteParams {
|
|||
path: string;
|
||||
router: IRouter<AlertingRequestHandlerContext>;
|
||||
excludeFromPublicApi?: boolean;
|
||||
options?: RouteConfigOptions<RouteMethod>;
|
||||
}
|
||||
const buildGetRuleRoute = ({
|
||||
licenseState,
|
||||
path,
|
||||
router,
|
||||
excludeFromPublicApi = false,
|
||||
options,
|
||||
}: BuildGetRulesRouteParams) => {
|
||||
router.get(
|
||||
{
|
||||
path,
|
||||
options,
|
||||
validate: {
|
||||
params: getRuleRequestParamsSchemaV1,
|
||||
},
|
||||
|
@ -73,6 +76,10 @@ export const getRuleRoute = (
|
|||
licenseState,
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}`,
|
||||
router,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rule details`,
|
||||
},
|
||||
});
|
||||
|
||||
export const getInternalRuleRoute = (
|
||||
|
|
|
@ -21,6 +21,10 @@ export const muteAlertRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{rule_id}/alert/{alert_id}/_mute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Mute an alert`,
|
||||
},
|
||||
validate: {
|
||||
params: muteAlertParamsSchemaV1,
|
||||
},
|
||||
|
|
|
@ -31,6 +31,10 @@ export const updateRuleRoute = (
|
|||
router.put(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update a rule`,
|
||||
},
|
||||
validate: {
|
||||
body: updateBodySchemaV1,
|
||||
params: updateParamsSchemaV1,
|
||||
|
|
|
@ -55,6 +55,10 @@ export const ruleTypesRoute = (
|
|||
router.get(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule_types`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Get rule types`,
|
||||
},
|
||||
validate: {},
|
||||
},
|
||||
router.handleLegacyErrors(
|
||||
|
|
|
@ -32,6 +32,10 @@ export const unmuteAlertRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{rule_id}/alert/{alert_id}/_unmute`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Unmute an alert`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
},
|
||||
|
|
|
@ -22,6 +22,10 @@ export const unmuteAllRuleRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_unmute_all`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Unmute all alerts`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
},
|
||||
|
|
|
@ -22,6 +22,10 @@ export const updateRuleApiKeyRoute = (
|
|||
router.post(
|
||||
{
|
||||
path: `${BASE_ALERTING_API_PATH}/rule/{id}/_update_api_key`,
|
||||
options: {
|
||||
access: 'public',
|
||||
description: `Update the API key for a rule`,
|
||||
},
|
||||
validate: {
|
||||
params: paramSchema,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue