Skip to content

Commit

Permalink
added public and internal access for rules and alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
js-jankisalvi committed Sep 19, 2024
1 parent d8aaab7 commit a2c96ff
Show file tree
Hide file tree
Showing 31 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const findBackfillRoute = (
validate: {
query: findQuerySchemaV1,
},
options: {
access: 'internal',
},
},
router.handleLegacyErrors(
verifyAccessAndContext(licenseState, async function (context, req, res) {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const createAlertRoute = ({ router, licenseState, usageCounter }: RouteOp
body: bodySchema,
},
options: {
access: 'public',
summary: 'Create an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const deleteAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Delete an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const disableAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Disable an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const enableAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Enable an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const findAlertRoute = (
query: querySchema,
},
options: {
access: 'public',
summary: 'Find alerts',
tags: ['oas-tag:alerting'],
description:
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const getAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Get an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const getAlertInstanceSummaryRoute = (
query: querySchema,
},
options: {
access: 'public',
summary: 'Get an alert summary',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const getAlertStateRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Get the state of an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function healthRoute(
path: '/api/alerts/_health',
validate: false,
options: {
access: 'public',
summary: 'Get the alerting framework health',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const listAlertTypesRoute = (
path: `${LEGACY_BASE_ALERT_API_PATH}/list_alert_types`,
validate: {},
options: {
access: 'public',
summary: 'Get the alert types',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/mute_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const muteAllAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Mute all alert instances',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const muteAlertInstanceRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Mute an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const unmuteAllAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Unmute all alert instances',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const unmuteAlertInstanceRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Unmute an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/routes/legacy/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const updateAlertRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Update an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const updateApiKeyRoute = (
params: paramSchema,
},
options: {
access: 'public',
summary: 'Update the API key for an alert',
tags: ['oas-tag:alerting'],
deprecated: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const archiveMaintenanceWindowRoute = (
body: archiveBodySchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.WRITE_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const bulkGetMaintenanceWindowRoute = (
body: bulkGetBodySchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.READ_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const createMaintenanceWindowRoute = (
body: createBodySchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.WRITE_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const deleteMaintenanceWindowRoute = (
params: deleteParamsSchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.WRITE_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const findMaintenanceWindowsRoute = (
path: `${INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH}/_find`,
validate: {},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.READ_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const finishMaintenanceWindowRoute = (
params: finishParamsSchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.WRITE_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getMaintenanceWindowRoute = (
params: getParamsSchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.READ_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const getActiveMaintenanceWindowsRoute = (
path: INTERNAL_ALERTING_API_GET_ACTIVE_MAINTENANCE_WINDOWS_PATH,
validate: {},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.READ_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const updateMaintenanceWindowRoute = (
params: updateParamsSchemaV1,
},
options: {
access: 'internal',
tags: [`access:${MAINTENANCE_WINDOW_API_PRIVILEGES.WRITE_MAINTENANCE_WINDOW}`],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const buildFindRulesRoute = ({
router.post(
{
path,
options: { access: 'internal' },
validate: {
body: findRulesRequestQuerySchemaV1,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const snoozeRuleRoute = (
router.post(
{
path: INTERNAL_ALERTING_SNOOZE_RULE,
options: { access: 'internal' },
validate: {
params: snoozeParamsSchema,
body: snoozeBodySchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function registerFieldsRoute(
router.post(
{
path: '/internal/rules/saved_objects/fields',
options: { access: 'internal' },
validate: {
body: schema.nullable(
schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function registerAlertsValueSuggestionsRoute(
router.post(
{
path: '/internal/alerts/suggestions/values',
options: { access: 'internal' },
validate: AlertsSuggestionsSchema,
},
router.handleLegacyErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function registerRulesValueSuggestionsRoute(
router.post(
{
path: '/internal/rules/suggestions/values',
options: { access: 'internal' },
validate: RulesSuggestionsSchema,
},
router.handleLegacyErrors(
Expand Down

0 comments on commit a2c96ff

Please sign in to comment.