Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Move @kbn/config-schema to server] alerting #191851

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';
import type { MaintenanceWindow } from '../../../common';
import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindow } from '../../../common';
import type { CreateMaintenanceWindowRequestBody } from '../../../common/routes/maintenance_window/apis/create';
import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { CreateMaintenanceWindowRequestBody } from '../../../server/routes/schemas/maintenance_window/apis/create';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';

import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindow } from '../../../common';
import type { FindMaintenanceWindowsResponse } from '../../../common/routes/maintenance_window/apis/find';
import type { FindMaintenanceWindowsResponse } from '../../../server/routes/schemas/maintenance_window/apis/find';

import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindow } from '../../../common';
import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';

import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindow } from '../../../common';
import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';

import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';
import type { MaintenanceWindow } from '../../../common';

export const transformMaintenanceWindowResponse = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
import type { HttpSetup } from '@kbn/core/public';
import type { MaintenanceWindow } from '../../../common';
import type { UpdateMaintenanceWindowRequestBody } from '../../../common/routes/maintenance_window/apis/update';
import type { MaintenanceWindowResponse } from '../../../common/routes/maintenance_window/response';
import type { UpdateMaintenanceWindowRequestBody } from '../../../server/routes/schemas/maintenance_window/apis/update';
import type { MaintenanceWindowResponse } from '../../../server/routes/schemas/maintenance_window/response';

import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../common';
import { transformMaintenanceWindowResponse } from './transform_maintenance_window_response';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../../common/routes/rule/request';
import { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../routes/schemas/rule/request';

export const snoozeRuleBodySchema = schema.object({
snoozeSchedule: ruleSnoozeScheduleRequestSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/
import { TypeOf } from '@kbn/config-schema';
import { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../../common/routes/rule/request';
import { ruleSnoozeScheduleSchema as ruleSnoozeScheduleRequestSchema } from '../../../../../routes/schemas/rule/request';

export interface SnoozeRuleOptions {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Boom from '@hapi/boom';
import { KueryNode, nodeBuilder, nodeTypes } from '@kbn/es-query';
import { findRulesSo } from '../../../../data/rule/methods/find_rules_so';
import { ruleTagsParamsSchema, RuleTagsParams, RuleTagsAggregationResult } from '.';
import type { RuleTagsFormattedResponse } from '../../../../../common/routes/rule/apis/tags';
import { DEFAULT_TAGS_PER_PAGE } from '../../../../../common/routes/rule/apis/tags/constants/latest';
import type { RuleTagsFormattedResponse } from '../../../../routes/schemas/rule/apis/tags';
import { DEFAULT_TAGS_PER_PAGE } from '../../../../routes/schemas/rule/apis/tags/constants/latest';
import { RulesClientContext } from '../../../../rules_client/types';
import { AlertingAuthorizationEntity } from '../../../../authorization';
import { alertingAuthorizationFilterOpts } from '../../../../rules_client/common/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { DEFAULT_TAGS_PER_PAGE } from '../../../../../../common/routes/rule/apis/tags/constants/latest';
import { DEFAULT_TAGS_PER_PAGE } from '../../../../../routes/schemas/rule/apis/tags/constants/latest';

export const ruleTagsParamsSchema = schema.object({
page: schema.number({ defaultValue: 1, min: 1 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IRouter } from '@kbn/core/server';
import {
deleteParamsSchemaV1,
DeleteBackfillRequestParamsV1,
} from '../../../../../common/routes/backfill/apis/delete';
} from '../../../schemas/backfill/apis/delete';
import { ILicenseState } from '../../../../lib';
import { verifyAccessAndContext } from '../../../lib';
import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
findQuerySchemaV1,
FindBackfillRequestQueryV1,
FindBackfillResponseV1,
} from '../../../../../common/routes/backfill/apis/find';
} from '../../../schemas/backfill/apis/find';
import { ILicenseState } from '../../../../lib';
import { verifyAccessAndContext } from '../../../lib';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
/* eslint-disable @typescript-eslint/naming-convention */

import { FindBackfillRequestQueryV1 } from '../../../../../../../common/routes/backfill/apis/find';
import { FindBackfillRequestQueryV1 } from '../../../../../schemas/backfill/apis/find';
import { FindBackfillParams } from '../../../../../../application/backfill/methods/find/types';

export const transformRequest = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { FindBackfillResult } from '../../../../../../application/backfill/methods/find/types';
import { FindBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/find';
import { FindBackfillResponseBodyV1 } from '../../../../../schemas/backfill/apis/find';
import { transformBackfillToBackfillResponseV1 } from '../../../../transforms';

export const transformResponse = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getParamsSchemaV1,
GetBackfillRequestParamsV1,
GetBackfillResponseV1,
} from '../../../../../common/routes/backfill/apis/get';
} from '../../../schemas/backfill/apis/get';
import { ILicenseState } from '../../../../lib';
import { verifyAccessAndContext } from '../../../lib';
import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
scheduleBodySchemaV1,
ScheduleBackfillRequestBodyV1,
ScheduleBackfillResponseV1,
} from '../../../../../common/routes/backfill/apis/schedule';
} from '../../../schemas/backfill/apis/schedule';
import { ILicenseState } from '../../../../lib';
import { verifyAccessAndContext } from '../../../lib';
import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
/* eslint-disable @typescript-eslint/naming-convention */

import { ScheduleBackfillRequestBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule';
import { ScheduleBackfillRequestBodyV1 } from '../../../../../schemas/backfill/apis/schedule';
import { ScheduleBackfillParams } from '../../../../../../application/backfill/methods/schedule/types';

export const transformRequest = (request: ScheduleBackfillRequestBodyV1): ScheduleBackfillParams =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
ScheduleBackfillResult,
ScheduleBackfillResults,
} from '../../../../../../application/backfill/methods/schedule/types';
import { ScheduleBackfillResponseBodyV1 } from '../../../../../../../common/routes/backfill/apis/schedule';
import { ScheduleBackfillResponseBodyV1 } from '../../../../../schemas/backfill/apis/schedule';
import { transformBackfillToBackfillResponseV1 } from '../../../../transforms';

export const transformResponse = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ArchiveMaintenanceWindowRequestBodyV1,
ArchiveMaintenanceWindowRequestParamsV1,
ArchiveMaintenanceWindowResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/archive';
} from '../../../schemas/maintenance_window/apis/archive';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

export const archiveMaintenanceWindowRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
bulkGetBodySchemaV1,
BulkGetMaintenanceWindowsRequestBodyV1,
BulkGetMaintenanceWindowsResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/bulk_get';
} from '../../../schemas/maintenance_window/apis/bulk_get';
import { transformBulkGetResultToResponseV1 } from './transforms';

export const bulkGetMaintenanceWindowRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { BulkGetMaintenanceWindowsResponseBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/bulk_get';
import { BulkGetMaintenanceWindowsResponseBodyV1 } from '../../../../../schemas/maintenance_window/apis/bulk_get';
import { BulkGetMaintenanceWindowsResult } from '../../../../../../application/maintenance_window/methods/bulk_get/types';
import { transformMaintenanceWindowToResponseV1 } from '../../../../transforms';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/te
import { MaintenanceWindowStatus } from '../../../../../common';

import { MaintenanceWindow } from '../../../../application/maintenance_window/types';
import { CreateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/create';
import { CreateMaintenanceWindowRequestBody } from '../../../schemas/maintenance_window/apis/create';
import { transformCreateBody } from './transforms';
import { transformMaintenanceWindowToResponse } from '../../transforms';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
createBodySchemaV1,
CreateMaintenanceWindowRequestBodyV1,
CreateMaintenanceWindowResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/create';
} from '../../../schemas/maintenance_window/apis/create';
import { transformCreateBodyV1 } from './transforms';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { CreateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/create';
import { CreateMaintenanceWindowRequestBodyV1 } from '../../../../../schemas/maintenance_window/apis/create';
import { CreateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/create/types';

export const transformCreateBody = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common';
import {
deleteParamsSchemaV1,
DeleteMaintenanceWindowRequestParamsV1,
} from '../../../../../common/routes/maintenance_window/apis/delete';
} from '../../../schemas/maintenance_window/apis/delete';

export const deleteMaintenanceWindowRoute = (
router: IRouter<AlertingRequestHandlerContext>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '../../../../types';
import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common';
import type { FindMaintenanceWindowsResult } from '../../../../application/maintenance_window/methods/find/types';
import type { FindMaintenanceWindowsResponseV1 } from '../../../../../common/routes/maintenance_window/apis/find';
import type { FindMaintenanceWindowsResponseV1 } from '../../../schemas/maintenance_window/apis/find';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

export const findMaintenanceWindowsRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
finishParamsSchemaV1,
FinishMaintenanceWindowRequestParamsV1,
FinishMaintenanceWindowResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/finish';
} from '../../../schemas/maintenance_window/apis/finish';
import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
getParamsSchemaV1,
GetMaintenanceWindowRequestParamsV1,
GetMaintenanceWindowResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/get';
} from '../../../schemas/maintenance_window/apis/get';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

export const getMaintenanceWindowRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { MAINTENANCE_WINDOW_API_PRIVILEGES } from '../../../../../common';

import { MaintenanceWindow } from '../../../../application/maintenance_window/types';
import { GetActiveMaintenanceWindowsResponseV1 } from '../../../../../common/routes/maintenance_window/apis/get_active';
import { GetActiveMaintenanceWindowsResponseV1 } from '../../../schemas/maintenance_window/apis/get_active';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

export const getActiveMaintenanceWindowsRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { UpdateMaintenanceWindowRequestBodyV1 } from '../../../../../../../common/routes/maintenance_window/apis/update';
import { UpdateMaintenanceWindowRequestBodyV1 } from '../../../../../schemas/maintenance_window/apis/update';
import { UpdateMaintenanceWindowParams } from '../../../../../../application/maintenance_window/methods/update/types';

export const transformUpdateBody = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getMockMaintenanceWindow } from '../../../../data/maintenance_window/te
import { MaintenanceWindowStatus } from '../../../../../common';
import { transformUpdateBody } from './transforms';
import { rewritePartialMaintenanceBodyRes } from '../../../lib';
import { UpdateMaintenanceWindowRequestBody } from '../../../../../common/routes/maintenance_window/apis/update';
import { UpdateMaintenanceWindowRequestBody } from '../../../schemas/maintenance_window/apis/update';

const maintenanceWindowClient = maintenanceWindowClientMock.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
UpdateMaintenanceWindowRequestBodyV1,
UpdateMaintenanceWindowRequestParamsV1,
UpdateMaintenanceWindowResponseV1,
} from '../../../../../common/routes/maintenance_window/apis/update';
} from '../../../schemas/maintenance_window/apis/update';
import { transformUpdateBodyV1 } from './transforms';
import { transformMaintenanceWindowToResponseV1 } from '../../transforms';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { MaintenanceWindowResponseV1 } from '../../../../../common/routes/maintenance_window/response';
import { MaintenanceWindowResponseV1 } from '../../../schemas/maintenance_window/response';
import { MaintenanceWindow } from '../../../../application/maintenance_window/types';

export const transformMaintenanceWindowToResponse = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
aggregateRulesRequestBodySchemaV1,
AggregateRulesRequestBodyV1,
AggregateRulesResponseV1,
} from '../../../../../common/routes/rule/apis/aggregate';
} from '../../../schemas/rule/apis/aggregate';
import { formatDefaultAggregationResult } from './transforms';
import { transformAggregateQueryRequestV1, transformAggregateBodyResponseV1 } from './transforms';
import { DefaultRuleAggregationResult } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { RuleAggregationFormattedResult } from '../../../../../../application/rule/methods/aggregate/types';
import { AggregateRulesResponseBodyV1 } from '../../../../../../../common/routes/rule/apis/aggregate';
import { AggregateRulesResponseBodyV1 } from '../../../../../schemas/rule/apis/aggregate';

export const transformAggregateBodyResponse = ({
ruleExecutionStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
bulkDeleteRulesRequestBodySchemaV1,
BulkDeleteRulesRequestBodyV1,
BulkDeleteRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_delete';
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
} from '../../../schemas/rule/apis/bulk_delete';
import type { RuleParamsV1 } from '../../../schemas/rule/response';
import { transformRuleToRuleResponseV1 } from '../../transforms';
import { Rule } from '../../../../application/rule/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
bulkDisableRulesRequestBodySchemaV1,
BulkDisableRulesRequestBodyV1,
BulkDisableRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_disable';
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
} from '../../../schemas/rule/apis/bulk_disable';
import type { RuleParamsV1 } from '../../../schemas/rule/response';
import { transformRuleToRuleResponseV1 } from '../../transforms';
import { Rule } from '../../../../application/rule/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
bulkEditRulesRequestBodySchemaV1,
BulkEditRulesRequestBodyV1,
BulkEditRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_edit';
} from '../../../schemas/rule/apis/bulk_edit';
import { Rule } from '../../../../application/rule/types';
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
import type { RuleParamsV1 } from '../../../schemas/rule/response';

import { transformRuleToRuleResponseV1 } from '../../transforms';
import { transformOperationsV1 } from './transforms';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { BulkEditOperation } from '../../../../../../application/rule/methods/bulk_edit';
import { BulkEditRulesRequestBodyV1 } from '../../../../../../../common/routes/rule/apis/bulk_edit';
import { BulkEditRulesRequestBodyV1 } from '../../../../../schemas/rule/apis/bulk_edit';

export const transformOperations = ({
operations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
bulkEnableBodySchemaV1,
BulkEnableRulesRequestBodyV1,
BulkEnableRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_enable';
import { RuleParamsV1 } from '../../../../../common/routes/rule/response';
} from '../../../schemas/rule/apis/bulk_enable';
import { RuleParamsV1 } from '../../../schemas/rule/response';
import { transformBulkEnableResponseV1 } from './transforms';

export const bulkEnableRulesRoute = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import { BulkEnableRulesResponseV1 } from '../../../../../../../common/routes/rule/apis/bulk_enable';
import { RuleParamsV1 } from '../../../../../../../common/routes/rule/response';
import { BulkEnableRulesResponseV1 } from '../../../../../schemas/rule/apis/bulk_enable';
import { RuleParamsV1 } from '../../../../../schemas/rule/response';
import { BulkEnableRulesResult } from '../../../../../../application/rule/methods/bulk_enable/types';
import { transformRuleToRuleResponseV1 } from '../../../../transforms';
import { Rule, RuleParams } from '../../../../../../application/rule/types';
Expand Down
Loading