From a3052ebfed4479f99eb13505c48505ec9f18f1bc Mon Sep 17 00:00:00 2001 From: adcoelho Date: Mon, 30 Dec 2024 10:41:07 +0100 Subject: [PATCH 01/10] Move uptime rule params to package --- .../uptime_duration_anomaly/latest.ts | 10 ++++ .../rule_params/uptime_duration_anomaly/v1.ts | 18 +++++++ .../uptime_monitor_status/latest.ts | 10 ++++ .../rule_params/uptime_monitor_status/v1.ts | 52 +++++++++++++++++++ .../rule_params/uptime_tls/latest.ts | 10 ++++ .../response-ops/rule_params/uptime_tls/v1.ts | 19 +++++++ .../lib/alerts/duration_anomaly.ts | 8 +-- .../legacy_uptime/lib/alerts/status_check.ts | 42 +-------------- .../server/legacy_uptime/lib/alerts/tls.ts | 10 ++-- 9 files changed, 126 insertions(+), 53 deletions(-) create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts create mode 100644 src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts b/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts new file mode 100644 index 0000000000000..f278309c22b03 --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export * from './v1'; diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts b/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts new file mode 100644 index 0000000000000..2df767e76fdba --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { TypeOf, schema } from '@kbn/config-schema'; + +export const UptimeDurationAnomalyRuleParamsSchema = schema.object({ + stackVersion: schema.maybe(schema.string()), + monitorId: schema.string(), + severity: schema.number(), +}); + +export type UptimeDurationAnomalyRuleParams = TypeOf; diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts b/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts new file mode 100644 index 0000000000000..f278309c22b03 --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export * from './v1'; diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts b/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts new file mode 100644 index 0000000000000..47c82b387a8dc --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { TypeOf, schema } from '@kbn/config-schema'; + +export const UptimeMonitorStatusRuleParamsSchema = schema.object({ + stackVersion: schema.maybe(schema.string()), + availability: schema.maybe( + schema.object({ + range: schema.number(), + rangeUnit: schema.string(), + threshold: schema.string(), + }) + ), + // deprecated + filters: schema.maybe( + schema.oneOf([ + // deprecated + schema.object({ + 'monitor.type': schema.maybe(schema.arrayOf(schema.string())), + 'observer.geo.name': schema.maybe(schema.arrayOf(schema.string())), + tags: schema.maybe(schema.arrayOf(schema.string())), + 'url.port': schema.maybe(schema.arrayOf(schema.string())), + }), + schema.string(), + ]) + ), + locations: schema.maybe(schema.arrayOf(schema.string())), + numTimes: schema.number(), + search: schema.maybe(schema.string()), + shouldCheckStatus: schema.boolean(), + shouldCheckAvailability: schema.boolean(), + timerangeCount: schema.maybe(schema.number()), + timerangeUnit: schema.maybe(schema.string()), + // deprecated + timerange: schema.maybe( + schema.object({ + from: schema.string(), + to: schema.string(), + }) + ), + version: schema.maybe(schema.number()), + isAutoGenerated: schema.maybe(schema.boolean()), +}); + +export type UptimeMonitorStatusParams = TypeOf; diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts b/src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts new file mode 100644 index 0000000000000..f278309c22b03 --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export * from './v1'; diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts b/src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts new file mode 100644 index 0000000000000..666d98cee79e1 --- /dev/null +++ b/src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { TypeOf, schema } from '@kbn/config-schema'; + +export const UptimeTLSRuleParamsSchema = schema.object({ + stackVersion: schema.maybe(schema.string()), + search: schema.maybe(schema.string()), + certExpirationThreshold: schema.maybe(schema.number()), + certAgeThreshold: schema.maybe(schema.number()), +}); + +export type UptimeTLSRuleParams = TypeOf; diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts index 4bb64fe694446..10058aa80e8b9 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts @@ -12,7 +12,6 @@ import { SavedObjectsClientContract, DEFAULT_APP_CATEGORIES, } from '@kbn/core/server'; -import { schema } from '@kbn/config-schema'; import { ALERT_EVALUATION_VALUE, ALERT_EVALUATION_THRESHOLD, @@ -21,6 +20,7 @@ import { import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common'; import type { MlAnomaliesTableRecord } from '@kbn/ml-anomaly-utils'; import { getSeverityType } from '@kbn/ml-anomaly-utils'; +import { UptimeDurationAnomalyRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_duration_anomaly/latest'; import { alertsLocatorID, AlertsLocatorParams, @@ -109,11 +109,7 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory producer: 'uptime', name: durationAnomalyTranslations.alertFactoryName, validate: { - params: schema.object({ - stackVersion: schema.maybe(schema.string()), - monitorId: schema.string(), - severity: schema.number(), - }), + params: UptimeDurationAnomalyRuleParamsSchema, }, defaultActionGroupId: DURATION_ANOMALY.id, actionGroups: [ diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts index 0ce64bc803821..27e61af48a079 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts @@ -10,12 +10,12 @@ import { min } from 'lodash'; import moment from 'moment'; import datemath from '@kbn/datemath'; -import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; import { JsonObject } from '@kbn/utility-types'; import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; import { ALERT_REASON } from '@kbn/rule-data-utils'; import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common'; +import { UptimeMonitorStatusRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_monitor_status/latest'; import { alertsLocatorID, AlertsLocatorParams, @@ -294,45 +294,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = ( defaultMessage: 'Uptime monitor status', }), validate: { - params: schema.object({ - stackVersion: schema.maybe(schema.string()), - availability: schema.maybe( - schema.object({ - range: schema.number(), - rangeUnit: schema.string(), - threshold: schema.string(), - }) - ), - // deprecated - filters: schema.maybe( - schema.oneOf([ - // deprecated - schema.object({ - 'monitor.type': schema.maybe(schema.arrayOf(schema.string())), - 'observer.geo.name': schema.maybe(schema.arrayOf(schema.string())), - tags: schema.maybe(schema.arrayOf(schema.string())), - 'url.port': schema.maybe(schema.arrayOf(schema.string())), - }), - schema.string(), - ]) - ), - locations: schema.maybe(schema.arrayOf(schema.string())), - numTimes: schema.number(), - search: schema.maybe(schema.string()), - shouldCheckStatus: schema.boolean(), - shouldCheckAvailability: schema.boolean(), - timerangeCount: schema.maybe(schema.number()), - timerangeUnit: schema.maybe(schema.string()), - // deprecated - timerange: schema.maybe( - schema.object({ - from: schema.string(), - to: schema.string(), - }) - ), - version: schema.maybe(schema.number()), - isAutoGenerated: schema.maybe(schema.boolean()), - }), + params: UptimeMonitorStatusRuleParamsSchema, }, defaultActionGroupId: MONITOR_STATUS.id, actionGroups: [ diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts index bf0ba8596332f..8ba11faf02b23 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts @@ -9,7 +9,6 @@ import { DEFAULT_APP_CATEGORIES } from '@kbn/core/server'; import { AlertsClientError, GetViewInAppRelativeUrlFnOpts } from '@kbn/alerting-plugin/server'; import moment from 'moment'; import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common'; -import { schema } from '@kbn/config-schema'; import { alertsLocatorID, AlertsLocatorParams, @@ -20,6 +19,8 @@ import { LocatorPublic } from '@kbn/share-plugin/common'; import { ALERT_REASON, ALERT_UUID } from '@kbn/rule-data-utils'; import { asyncForEach } from '@kbn/std'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; +import { UptimeTLSRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_tls/latest'; + import { uptimeRuleFieldMap } from '../../../../common/rules/uptime_rule_field_map'; import { formatFilterString } from './status_check'; import { UptimeAlertTypeFactory } from './types'; @@ -123,12 +124,7 @@ export const tlsAlertFactory: UptimeAlertTypeFactory = ( producer: 'uptime', name: tlsTranslations.alertFactoryName, validate: { - params: schema.object({ - stackVersion: schema.maybe(schema.string()), - search: schema.maybe(schema.string()), - certExpirationThreshold: schema.maybe(schema.number()), - certAgeThreshold: schema.maybe(schema.number()), - }), + params: UptimeTLSRuleParamsSchema, }, defaultActionGroupId: TLS.id, actionGroups: [ From b69a13e0e95147b0136c966da73698809a63a6f4 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 30 Dec 2024 09:55:40 +0000 Subject: [PATCH 02/10] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/solutions/observability/plugins/uptime/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/solutions/observability/plugins/uptime/tsconfig.json b/x-pack/solutions/observability/plugins/uptime/tsconfig.json index 496ae1f398f2c..56b4e84c1795c 100644 --- a/x-pack/solutions/observability/plugins/uptime/tsconfig.json +++ b/x-pack/solutions/observability/plugins/uptime/tsconfig.json @@ -79,6 +79,7 @@ "@kbn/core-rendering-browser", "@kbn/charts-theme", "@kbn/charts-plugin", + "@kbn/response-ops-rule-params", ], "exclude": ["target/**/*"] } From 5de214ccefd8e11fbcb42626609df12d4a9a30c9 Mon Sep 17 00:00:00 2001 From: adcoelho Date: Mon, 30 Dec 2024 11:24:01 +0100 Subject: [PATCH 03/10] make params package public --- .../packages/private/response-ops/rule_params/kibana.jsonc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/platform/packages/private/response-ops/rule_params/kibana.jsonc b/src/platform/packages/private/response-ops/rule_params/kibana.jsonc index 1315303258949..a8c69653fffed 100644 --- a/src/platform/packages/private/response-ops/rule_params/kibana.jsonc +++ b/src/platform/packages/private/response-ops/rule_params/kibana.jsonc @@ -1,9 +1,7 @@ { "type": "shared-common", "id": "@kbn/response-ops-rule-params", - "owner": [ - "@elastic/response-ops" - ], + "owner": ["@elastic/response-ops"], "group": "platform", - "visibility": "private" + "visibility": "shared" } \ No newline at end of file From 9902a63f0bdb1da36af739a880cde59c4e5df4f8 Mon Sep 17 00:00:00 2001 From: adcoelho Date: Thu, 2 Jan 2025 10:49:27 +0100 Subject: [PATCH 04/10] move response-ops package to shared --- .../response-ops/rule_params/README.md | 0 .../{private => shared}/response-ops/rule_params/index.ts | 0 .../response-ops/rule_params/jest.config.js | 0 .../response-ops/rule_params/kibana.jsonc | 0 .../response-ops/rule_params/latest.ts | 0 .../response-ops/rule_params/package.json | 0 .../response-ops/rule_params/tsconfig.json | 0 .../rule_params/uptime_duration_anomaly/latest.ts | 0 .../rule_params/uptime_duration_anomaly/v1.ts | 0 .../rule_params/uptime_monitor_status/latest.ts | 0 .../response-ops/rule_params/uptime_monitor_status/v1.ts | 0 .../response-ops/rule_params/uptime_tls/latest.ts | 0 .../response-ops/rule_params/uptime_tls/v1.ts | 0 .../{private => shared}/response-ops/rule_params/v1.ts | 0 .../common/routes/backfill/response/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/apis/create/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/apis/update/schemas/v1.ts | 2 +- .../shared/alerting/common/routes/rule/response/index.ts | 8 ++++---- .../alerting/common/routes/rule/response/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/response/types/v1.ts | 2 +- .../server/application/backfill/result/schemas/index.ts | 2 +- .../methods/create/schemas/create_rule_data_schema.ts | 2 +- .../methods/update/schemas/update_rule_data_schema.ts | 2 +- .../server/application/rule/schemas/rule_schemas.ts | 2 +- .../shared/alerting/server/application/rule/types/rule.ts | 2 +- 25 files changed, 14 insertions(+), 14 deletions(-) rename src/platform/packages/{private => shared}/response-ops/rule_params/README.md (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/index.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/jest.config.js (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/kibana.jsonc (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/latest.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/package.json (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/tsconfig.json (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_duration_anomaly/latest.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_duration_anomaly/v1.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_monitor_status/latest.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_monitor_status/v1.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_tls/latest.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/uptime_tls/v1.ts (100%) rename src/platform/packages/{private => shared}/response-ops/rule_params/v1.ts (100%) diff --git a/src/platform/packages/private/response-ops/rule_params/README.md b/src/platform/packages/shared/response-ops/rule_params/README.md similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/README.md rename to src/platform/packages/shared/response-ops/rule_params/README.md diff --git a/src/platform/packages/private/response-ops/rule_params/index.ts b/src/platform/packages/shared/response-ops/rule_params/index.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/index.ts rename to src/platform/packages/shared/response-ops/rule_params/index.ts diff --git a/src/platform/packages/private/response-ops/rule_params/jest.config.js b/src/platform/packages/shared/response-ops/rule_params/jest.config.js similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/jest.config.js rename to src/platform/packages/shared/response-ops/rule_params/jest.config.js diff --git a/src/platform/packages/private/response-ops/rule_params/kibana.jsonc b/src/platform/packages/shared/response-ops/rule_params/kibana.jsonc similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/kibana.jsonc rename to src/platform/packages/shared/response-ops/rule_params/kibana.jsonc diff --git a/src/platform/packages/private/response-ops/rule_params/latest.ts b/src/platform/packages/shared/response-ops/rule_params/latest.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/latest.ts rename to src/platform/packages/shared/response-ops/rule_params/latest.ts diff --git a/src/platform/packages/private/response-ops/rule_params/package.json b/src/platform/packages/shared/response-ops/rule_params/package.json similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/package.json rename to src/platform/packages/shared/response-ops/rule_params/package.json diff --git a/src/platform/packages/private/response-ops/rule_params/tsconfig.json b/src/platform/packages/shared/response-ops/rule_params/tsconfig.json similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/tsconfig.json rename to src/platform/packages/shared/response-ops/rule_params/tsconfig.json diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/latest.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/latest.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/latest.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_duration_anomaly/v1.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/latest.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/latest.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/latest.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_monitor_status/v1.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/latest.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_tls/latest.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_tls/latest.ts diff --git a/src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/uptime_tls/v1.ts rename to src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts diff --git a/src/platform/packages/private/response-ops/rule_params/v1.ts b/src/platform/packages/shared/response-ops/rule_params/v1.ts similarity index 100% rename from src/platform/packages/private/response-ops/rule_params/v1.ts rename to src/platform/packages/shared/response-ops/rule_params/v1.ts diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts index 5da51d53dddbb..e54a65bdd5a04 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; import { adHocRunStatus } from '../../../../constants'; export const statusSchema = schema.oneOf([ diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts index e70df7f9dc73f..e2420382d6bda 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValueV1 } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaWithDefaultValueV1 } from 'src/platform/packages/shared/response-ops/rule_params'; import { validateDurationV1, validateHoursV1, validateTimezoneV1 } from '../../../validation'; import { notifyWhenSchemaV1, alertDelaySchemaV1 } from '../../../response'; import { alertsFilterQuerySchemaV1 } from '../../../../alerts_filter_query'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts index b838d21e5cc03..055c3b0636e21 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValueV1 } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaWithDefaultValueV1 } from 'src/platform/packages/shared/response-ops/rule_params'; import { validateDurationV1, validateHoursV1, validateTimezoneV1 } from '../../../validation'; import { notifyWhenSchemaV1, alertDelaySchemaV1 } from '../../../response'; import { alertsFilterQuerySchemaV1 } from '../../../../alerts_filter_query'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts index 1c7632ad28988..c0406b6efbaba 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts @@ -39,8 +39,8 @@ export type { Monitoring as MonitoringV1, } from './types/v1'; -export { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; -export { ruleParamsSchema } from '@kbn/response-ops-rule-params'; +export { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +export { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; -export type { RuleParamsV1 } from '@kbn/response-ops-rule-params'; -export type { RuleParams } from '@kbn/response-ops-rule-params'; +export type { RuleParamsV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +export type { RuleParams } from 'src/platform/packages/shared/response-ops/rule_params'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts index 6226a17d51025..b96e8ee0f0e72 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; import { rRuleResponseSchemaV1 } from '../../../r_rule'; import { alertsFilterQuerySchemaV1 } from '../../../alerts_filter_query'; import { diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts index e32a56a302e63..a0034d8baa434 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1 } from '@kbn/response-ops-rule-params'; +import { RuleParamsV1 } from 'src/platform/packages/shared/response-ops/rule_params'; import { ruleResponseSchemaV1, ruleSnoozeScheduleSchemaV1, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts b/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts index b454d41dd40ca..37aff63eac374 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; import { adHocRunStatus } from '../../../../../common/constants'; export const statusSchema = schema.oneOf([ diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts index e2cf0da359b0a..84ef5cda6f1b2 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValue } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaWithDefaultValue } from 'src/platform/packages/shared/response-ops/rule_params'; import { validateDuration } from '../../../validation'; import { notifyWhenSchema, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts index 9c0bf1666f846..c2d92e9cd0a4c 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValue } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchemaWithDefaultValue } from 'src/platform/packages/shared/response-ops/rule_params'; import { validateDuration } from '../../../validation'; import { notifyWhenSchema, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts index 978e11f0183cf..780e462b3d91c 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; import { ruleLastRunOutcomeValues, ruleExecutionStatusValues, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts index 2e5cad45cf92f..3dd1f62b9c146 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts @@ -6,7 +6,7 @@ */ import { TypeOf } from '@kbn/config-schema'; -import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; +import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; import { ruleNotifyWhen, ruleLastRunOutcomeValues, From 179dfae77889589b0764cc8a6b6bd586cfa8688d Mon Sep 17 00:00:00 2001 From: adcoelho Date: Thu, 2 Jan 2025 10:51:57 +0100 Subject: [PATCH 05/10] update kbn_references --- .../packages/shared/response-ops/rule_params/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platform/packages/shared/response-ops/rule_params/tsconfig.json b/src/platform/packages/shared/response-ops/rule_params/tsconfig.json index bd6cfc03c6683..85db7b8bde16c 100644 --- a/src/platform/packages/shared/response-ops/rule_params/tsconfig.json +++ b/src/platform/packages/shared/response-ops/rule_params/tsconfig.json @@ -15,5 +15,6 @@ ], "kbn_references": [ "@kbn/config-schema", + "@kbn/uptime-plugin" ] } From f3fa2fa0720085c4f62c103d8f87da6b48b8bc52 Mon Sep 17 00:00:00 2001 From: adcoelho Date: Thu, 2 Jan 2025 12:21:24 +0100 Subject: [PATCH 06/10] update jest config --- .../packages/shared/response-ops/rule_params/jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/packages/shared/response-ops/rule_params/jest.config.js b/src/platform/packages/shared/response-ops/rule_params/jest.config.js index 76636c7d4fc78..6df21724dbd84 100644 --- a/src/platform/packages/shared/response-ops/rule_params/jest.config.js +++ b/src/platform/packages/shared/response-ops/rule_params/jest.config.js @@ -10,5 +10,5 @@ module.exports = { preset: '@kbn/test/jest_node', rootDir: '../../../../../..', - roots: ['/src/platform/packages/private/response-ops/rule_params'], + roots: ['/src/platform/packages/shared/response-ops/rule_params'], }; From b76375eb0102551a1a1b2c8dcffbd3f5cd942fae Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:42:12 +0000 Subject: [PATCH 07/10] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- package.json | 2 +- tsconfig.base.json | 4 ++-- .../common/routes/backfill/response/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/apis/create/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/apis/update/schemas/v1.ts | 2 +- .../shared/alerting/common/routes/rule/response/index.ts | 8 ++++---- .../alerting/common/routes/rule/response/schemas/v1.ts | 2 +- .../alerting/common/routes/rule/response/types/v1.ts | 2 +- .../server/application/backfill/result/schemas/index.ts | 2 +- .../methods/create/schemas/create_rule_data_schema.ts | 2 +- .../methods/update/schemas/update_rule_data_schema.ts | 2 +- .../server/application/rule/schemas/rule_schemas.ts | 2 +- .../shared/alerting/server/application/rule/types/rule.ts | 2 +- yarn.lock | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index d9a3ed79e323e..cb215ba1f1f97 100644 --- a/package.json +++ b/package.json @@ -764,7 +764,7 @@ "@kbn/resolver-test-plugin": "link:x-pack/test/plugin_functional/plugins/resolver_test", "@kbn/response-ops-feature-flag-service": "link:packages/response-ops/feature_flag_service", "@kbn/response-ops-rule-form": "link:packages/response-ops/rule_form", - "@kbn/response-ops-rule-params": "link:src/platform/packages/private/response-ops/rule_params", + "@kbn/response-ops-rule-params": "link:src/platform/packages/shared/response-ops/rule_params", "@kbn/response-stream-plugin": "link:examples/response_stream", "@kbn/rison": "link:packages/kbn-rison", "@kbn/rollup": "link:x-pack/platform/packages/private/rollup", diff --git a/tsconfig.base.json b/tsconfig.base.json index 71f14340765ff..4779aa370bdb8 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1498,8 +1498,8 @@ "@kbn/response-ops-feature-flag-service/*": ["packages/response-ops/feature_flag_service/*"], "@kbn/response-ops-rule-form": ["packages/response-ops/rule_form"], "@kbn/response-ops-rule-form/*": ["packages/response-ops/rule_form/*"], - "@kbn/response-ops-rule-params": ["src/platform/packages/private/response-ops/rule_params"], - "@kbn/response-ops-rule-params/*": ["src/platform/packages/private/response-ops/rule_params/*"], + "@kbn/response-ops-rule-params": ["src/platform/packages/shared/response-ops/rule_params"], + "@kbn/response-ops-rule-params/*": ["src/platform/packages/shared/response-ops/rule_params/*"], "@kbn/response-stream-plugin": ["examples/response_stream"], "@kbn/response-stream-plugin/*": ["examples/response_stream/*"], "@kbn/rison": ["packages/kbn-rison"], diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts index e54a65bdd5a04..5da51d53dddbb 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/backfill/response/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; import { adHocRunStatus } from '../../../../constants'; export const statusSchema = schema.oneOf([ diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts index e2420382d6bda..e70df7f9dc73f 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/create/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValueV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaWithDefaultValueV1 } from '@kbn/response-ops-rule-params'; import { validateDurationV1, validateHoursV1, validateTimezoneV1 } from '../../../validation'; import { notifyWhenSchemaV1, alertDelaySchemaV1 } from '../../../response'; import { alertsFilterQuerySchemaV1 } from '../../../../alerts_filter_query'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts index 055c3b0636e21..b838d21e5cc03 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/apis/update/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValueV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaWithDefaultValueV1 } from '@kbn/response-ops-rule-params'; import { validateDurationV1, validateHoursV1, validateTimezoneV1 } from '../../../validation'; import { notifyWhenSchemaV1, alertDelaySchemaV1 } from '../../../response'; import { alertsFilterQuerySchemaV1 } from '../../../../alerts_filter_query'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts index c0406b6efbaba..1c7632ad28988 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/index.ts @@ -39,8 +39,8 @@ export type { Monitoring as MonitoringV1, } from './types/v1'; -export { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; -export { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; +export { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; +export { ruleParamsSchema } from '@kbn/response-ops-rule-params'; -export type { RuleParamsV1 } from 'src/platform/packages/shared/response-ops/rule_params'; -export type { RuleParams } from 'src/platform/packages/shared/response-ops/rule_params'; +export type { RuleParamsV1 } from '@kbn/response-ops-rule-params'; +export type { RuleParams } from '@kbn/response-ops-rule-params'; diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts index b96e8ee0f0e72..6226a17d51025 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/schemas/v1.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaV1 } from '@kbn/response-ops-rule-params'; import { rRuleResponseSchemaV1 } from '../../../r_rule'; import { alertsFilterQuerySchemaV1 } from '../../../alerts_filter_query'; import { diff --git a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts index a0034d8baa434..e32a56a302e63 100644 --- a/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts +++ b/x-pack/platform/plugins/shared/alerting/common/routes/rule/response/types/v1.ts @@ -6,7 +6,7 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import { RuleParamsV1 } from 'src/platform/packages/shared/response-ops/rule_params'; +import { RuleParamsV1 } from '@kbn/response-ops-rule-params'; import { ruleResponseSchemaV1, ruleSnoozeScheduleSchemaV1, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts b/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts index 37aff63eac374..b454d41dd40ca 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/backfill/result/schemas/index.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; import { adHocRunStatus } from '../../../../../common/constants'; export const statusSchema = schema.oneOf([ diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts index 84ef5cda6f1b2..e2cf0da359b0a 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/create/schemas/create_rule_data_schema.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValue } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaWithDefaultValue } from '@kbn/response-ops-rule-params'; import { validateDuration } from '../../../validation'; import { notifyWhenSchema, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts index c2d92e9cd0a4c..9c0bf1666f846 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/methods/update/schemas/update_rule_data_schema.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchemaWithDefaultValue } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchemaWithDefaultValue } from '@kbn/response-ops-rule-params'; import { validateDuration } from '../../../validation'; import { notifyWhenSchema, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts index 780e462b3d91c..978e11f0183cf 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/schemas/rule_schemas.ts @@ -6,7 +6,7 @@ */ import { schema } from '@kbn/config-schema'; -import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; import { ruleLastRunOutcomeValues, ruleExecutionStatusValues, diff --git a/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts b/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts index 3dd1f62b9c146..2e5cad45cf92f 100644 --- a/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts +++ b/x-pack/platform/plugins/shared/alerting/server/application/rule/types/rule.ts @@ -6,7 +6,7 @@ */ import { TypeOf } from '@kbn/config-schema'; -import { ruleParamsSchema } from 'src/platform/packages/shared/response-ops/rule_params'; +import { ruleParamsSchema } from '@kbn/response-ops-rule-params'; import { ruleNotifyWhen, ruleLastRunOutcomeValues, diff --git a/yarn.lock b/yarn.lock index 6c94fbe5ba349..8df482b474051 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6813,7 +6813,7 @@ version "0.0.0" uid "" -"@kbn/response-ops-rule-params@link:src/platform/packages/private/response-ops/rule_params": +"@kbn/response-ops-rule-params@link:src/platform/packages/shared/response-ops/rule_params": version "0.0.0" uid "" From b6062f0f1729608f20fcda54fa9bdf6e67a71679 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:50:24 +0000 Subject: [PATCH 08/10] [CI] Auto-commit changed files from 'node scripts/generate codeowners' --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ca9c1b0f90312..0a6557512dec0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -552,7 +552,6 @@ src/platform/packages/private/kbn-management/settings/components/field_category src/platform/packages/private/kbn-management/settings/components/form @elastic/kibana-management src/platform/packages/private/kbn-mapbox-gl @elastic/kibana-presentation src/platform/packages/private/kbn-panel-loader @elastic/kibana-presentation -src/platform/packages/private/response-ops/rule_params @elastic/response-ops src/platform/packages/shared/deeplinks/devtools @elastic/kibana-management src/platform/packages/shared/deeplinks/fleet @elastic/fleet src/platform/packages/shared/deeplinks/management @elastic/kibana-management @@ -607,6 +606,7 @@ src/platform/packages/shared/kbn-xstate-utils @elastic/obs-ux-logs-team src/platform/packages/shared/kbn-zod-helpers @elastic/security-detection-rule-management src/platform/packages/shared/presentation/presentation_containers @elastic/kibana-presentation src/platform/packages/shared/presentation/presentation_publishing @elastic/kibana-presentation +src/platform/packages/shared/response-ops/rule_params @elastic/response-ops src/platform/packages/shared/serverless/settings/security_project @elastic/security-solution @elastic/kibana-management src/platform/plugins/private/input_control_vis @elastic/kibana-presentation src/platform/plugins/private/links @elastic/kibana-presentation From 59db23f0ccdfbceb0e3ce344788f4d97ac3dce48 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:58:51 +0000 Subject: [PATCH 09/10] [CI] Auto-commit changed files from 'node scripts/yarn_deduplicate' --- NOTICE.txt | 2 +- .../packages/shared/response-ops/rule_params/tsconfig.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 9cd38e6773d88..312326d7e41a9 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Kibana source code with Kibana X-Pack source code -Copyright 2012-2024 Elasticsearch B.V. +Copyright 2012-2025 Elasticsearch B.V. --- Adapted from remote-web-worker, which was available under a "MIT" license. diff --git a/src/platform/packages/shared/response-ops/rule_params/tsconfig.json b/src/platform/packages/shared/response-ops/rule_params/tsconfig.json index 85db7b8bde16c..bd6cfc03c6683 100644 --- a/src/platform/packages/shared/response-ops/rule_params/tsconfig.json +++ b/src/platform/packages/shared/response-ops/rule_params/tsconfig.json @@ -15,6 +15,5 @@ ], "kbn_references": [ "@kbn/config-schema", - "@kbn/uptime-plugin" ] } From c9f6057358a6b355d94163e723a37f474d9060ba Mon Sep 17 00:00:00 2001 From: adcoelho Date: Fri, 3 Jan 2025 11:37:57 +0100 Subject: [PATCH 10/10] Create index files and update imports. --- .../rule_params/uptime_duration_anomaly/index.ts | 14 ++++++++++++++ .../rule_params/uptime_duration_anomaly/v1.ts | 4 ++-- .../rule_params/uptime_monitor_status/index.ts | 14 ++++++++++++++ .../rule_params/uptime_monitor_status/v1.ts | 4 ++-- .../response-ops/rule_params/uptime_tls/index.ts | 14 ++++++++++++++ .../response-ops/rule_params/uptime_tls/v1.ts | 4 ++-- .../legacy_uptime/lib/alerts/duration_anomaly.ts | 4 ++-- .../legacy_uptime/lib/alerts/status_check.ts | 4 ++-- .../uptime/server/legacy_uptime/lib/alerts/tls.ts | 4 ++-- 9 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/index.ts create mode 100644 src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/index.ts create mode 100644 src/platform/packages/shared/response-ops/rule_params/uptime_tls/index.ts diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/index.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/index.ts new file mode 100644 index 0000000000000..ab67697c8d42c --- /dev/null +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { uptimeDurationAnomalyRuleParamsSchema } from './latest'; +export { uptimeDurationAnomalyRuleParamsSchema as uptimeDurationAnomalyRuleParamsSchemaV1 } from './v1'; + +export type { UptimeDurationAnomalyRuleParams } from './latest'; +export type { UptimeDurationAnomalyRuleParams as UptimeDurationAnomalyRuleParamsV1 } from './v1'; diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts index 2df767e76fdba..f3cb96ac42dbe 100644 --- a/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_duration_anomaly/v1.ts @@ -9,10 +9,10 @@ import { TypeOf, schema } from '@kbn/config-schema'; -export const UptimeDurationAnomalyRuleParamsSchema = schema.object({ +export const uptimeDurationAnomalyRuleParamsSchema = schema.object({ stackVersion: schema.maybe(schema.string()), monitorId: schema.string(), severity: schema.number(), }); -export type UptimeDurationAnomalyRuleParams = TypeOf; +export type UptimeDurationAnomalyRuleParams = TypeOf; diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/index.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/index.ts new file mode 100644 index 0000000000000..da4a31c8f023a --- /dev/null +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { uptimeMonitorStatusRuleParamsSchema } from './latest'; +export { uptimeMonitorStatusRuleParamsSchema as uptimeMonitorStatusRuleParamsSchemaV1 } from './v1'; + +export type { UptimeMonitorStatusParams } from './latest'; +export type { UptimeMonitorStatusParams as UptimeMonitorStatusParamsV1 } from './v1'; diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts index 47c82b387a8dc..c8588dffdcd1c 100644 --- a/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_monitor_status/v1.ts @@ -9,7 +9,7 @@ import { TypeOf, schema } from '@kbn/config-schema'; -export const UptimeMonitorStatusRuleParamsSchema = schema.object({ +export const uptimeMonitorStatusRuleParamsSchema = schema.object({ stackVersion: schema.maybe(schema.string()), availability: schema.maybe( schema.object({ @@ -49,4 +49,4 @@ export const UptimeMonitorStatusRuleParamsSchema = schema.object({ isAutoGenerated: schema.maybe(schema.boolean()), }); -export type UptimeMonitorStatusParams = TypeOf; +export type UptimeMonitorStatusParams = TypeOf; diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_tls/index.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/index.ts new file mode 100644 index 0000000000000..89b393515819e --- /dev/null +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { uptimeTLSRuleParamsSchema } from './latest'; +export { uptimeTLSRuleParamsSchema as uptimeTLSRuleParamsSchemaV1 } from './v1'; + +export type { UptimeTLSRuleParams } from './latest'; +export type { UptimeTLSRuleParams as UptimeTLSRuleParamsV1 } from './v1'; diff --git a/src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts index 666d98cee79e1..c92b67fb26b23 100644 --- a/src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts +++ b/src/platform/packages/shared/response-ops/rule_params/uptime_tls/v1.ts @@ -9,11 +9,11 @@ import { TypeOf, schema } from '@kbn/config-schema'; -export const UptimeTLSRuleParamsSchema = schema.object({ +export const uptimeTLSRuleParamsSchema = schema.object({ stackVersion: schema.maybe(schema.string()), search: schema.maybe(schema.string()), certExpirationThreshold: schema.maybe(schema.number()), certAgeThreshold: schema.maybe(schema.number()), }); -export type UptimeTLSRuleParams = TypeOf; +export type UptimeTLSRuleParams = TypeOf; diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts index 10058aa80e8b9..653bbd798fdd4 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.ts @@ -20,7 +20,7 @@ import { import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common'; import type { MlAnomaliesTableRecord } from '@kbn/ml-anomaly-utils'; import { getSeverityType } from '@kbn/ml-anomaly-utils'; -import { UptimeDurationAnomalyRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_duration_anomaly/latest'; +import { uptimeDurationAnomalyRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_duration_anomaly'; import { alertsLocatorID, AlertsLocatorParams, @@ -109,7 +109,7 @@ export const durationAnomalyAlertFactory: UptimeAlertTypeFactory producer: 'uptime', name: durationAnomalyTranslations.alertFactoryName, validate: { - params: UptimeDurationAnomalyRuleParamsSchema, + params: uptimeDurationAnomalyRuleParamsSchema, }, defaultActionGroupId: DURATION_ANOMALY.id, actionGroups: [ diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts index 27e61af48a079..da49a9e67cadf 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/status_check.ts @@ -15,7 +15,7 @@ import { JsonObject } from '@kbn/utility-types'; import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; import { ALERT_REASON } from '@kbn/rule-data-utils'; import { ActionGroupIdsOf } from '@kbn/alerting-plugin/common'; -import { UptimeMonitorStatusRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_monitor_status/latest'; +import { uptimeMonitorStatusRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_monitor_status'; import { alertsLocatorID, AlertsLocatorParams, @@ -294,7 +294,7 @@ export const statusCheckAlertFactory: UptimeAlertTypeFactory = ( defaultMessage: 'Uptime monitor status', }), validate: { - params: UptimeMonitorStatusRuleParamsSchema, + params: uptimeMonitorStatusRuleParamsSchema, }, defaultActionGroupId: MONITOR_STATUS.id, actionGroups: [ diff --git a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts index 8ba11faf02b23..d2557256c9b6b 100644 --- a/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts +++ b/x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/tls.ts @@ -19,7 +19,7 @@ import { LocatorPublic } from '@kbn/share-plugin/common'; import { ALERT_REASON, ALERT_UUID } from '@kbn/rule-data-utils'; import { asyncForEach } from '@kbn/std'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; -import { UptimeTLSRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_tls/latest'; +import { uptimeTLSRuleParamsSchema } from '@kbn/response-ops-rule-params/uptime_tls'; import { uptimeRuleFieldMap } from '../../../../common/rules/uptime_rule_field_map'; import { formatFilterString } from './status_check'; @@ -124,7 +124,7 @@ export const tlsAlertFactory: UptimeAlertTypeFactory = ( producer: 'uptime', name: tlsTranslations.alertFactoryName, validate: { - params: UptimeTLSRuleParamsSchema, + params: uptimeTLSRuleParamsSchema, }, defaultActionGroupId: TLS.id, actionGroups: [