[ResponseOps][Rules] Move synthetic rule types' params to @kbn/response-ops-rule-params (#204582)

Connected with #195187

## Summary

- Moved params of synthetic status monitor rule type to
`/response-ops/rule_params/synthetics_monitor_status/`
- Moved params of TLS rule type to
`/response-ops/rule_params/synthetics_tls/`

I created a follow-up issue to handle the places where io-ts is used for
params validation in `observability/plugins/synthetics`. #205207

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Antonio 2025-01-03 13:20:03 +01:00 committed by GitHub
parent 9215df9200
commit 98cc4b153f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 204 additions and 102 deletions

2
.github/CODEOWNERS vendored
View file

@ -2865,7 +2865,6 @@ src/platform/packages/private/kbn-ui-shared-deps-npm @elastic/kibana-operations
src/platform/packages/private/kbn-ui-shared-deps-src @elastic/kibana-operations
src/platform/packages/private/kbn-unsaved-changes-badge @elastic/kibana-data-discovery
src/platform/packages/private/react/kibana_context/root @elastic/appex-sharedux
src/platform/packages/private/response-ops/rule_params @elastic/response-ops
src/platform/packages/private/serverless/project_switcher @elastic/appex-sharedux
src/platform/packages/private/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management
src/platform/packages/private/serverless/types @elastic/appex-sharedux
@ -3062,6 +3061,7 @@ src/platform/packages/shared/shared-ux/prompt/no_data_views/types @elastic/appex
src/platform/packages/shared/shared-ux/prompt/not_found @elastic/appex-sharedux
src/platform/packages/shared/shared-ux/router/impl @elastic/appex-sharedux
src/platform/packages/shared/shared-ux/storybook/mock @elastic/appex-sharedux
src/platform/packages/shared/response-ops/rule_params @elastic/response-ops
src/platform/plugins/private/advanced_settings @elastic/appex-sharedux @elastic/kibana-management
src/platform/plugins/private/event_annotation @elastic/kibana-visualizations
src/platform/plugins/private/event_annotation_listing @elastic/kibana-visualizations

View file

@ -0,0 +1,20 @@
/*
* 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 { syntheticsMonitorStatusRuleParamsSchema } from './latest';
export { syntheticsMonitorStatusRuleParamsSchema as syntheticsMonitorStatusRuleParamsSchemaV1 } from './v1';
export type { SyntheticsMonitorStatusRuleParams } from './latest';
export type { SyntheticsMonitorStatusRuleParams as SyntheticsMonitorStatusRuleParamsV1 } from './v1';
export type { TimeWindow } from './latest';
export type { TimeWindow as TimeWindowV1 } from './v1';
export type { StatusRuleCondition } from './latest';
export type { StatusRuleCondition as StatusRuleConditionV1 } from './v1';

View file

@ -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';

View file

@ -0,0 +1,76 @@
/*
* 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';
const TimeWindowSchema = schema.object({
unit: schema.oneOf(
[schema.literal('s'), schema.literal('m'), schema.literal('h'), schema.literal('d')],
{
defaultValue: 'm',
}
),
size: schema.number({
defaultValue: 5,
}),
});
const NumberOfChecksSchema = schema.object({
numberOfChecks: schema.number({
defaultValue: 5,
min: 1,
max: 100,
}),
});
const StatusRuleConditionSchema = schema.object({
groupBy: schema.maybe(
schema.string({
defaultValue: 'locationId',
})
),
downThreshold: schema.maybe(
schema.number({
defaultValue: 3,
})
),
locationsThreshold: schema.maybe(
schema.number({
defaultValue: 1,
})
),
window: schema.oneOf([
schema.object({
time: TimeWindowSchema,
}),
NumberOfChecksSchema,
]),
includeRetests: schema.maybe(schema.boolean()),
});
export const syntheticsMonitorStatusRuleParamsSchema = schema.object(
{
condition: schema.maybe(StatusRuleConditionSchema),
monitorIds: schema.maybe(schema.arrayOf(schema.string())),
locations: schema.maybe(schema.arrayOf(schema.string())),
tags: schema.maybe(schema.arrayOf(schema.string())),
monitorTypes: schema.maybe(schema.arrayOf(schema.string())),
projects: schema.maybe(schema.arrayOf(schema.string())),
kqlQuery: schema.maybe(schema.string()),
},
{
meta: { description: 'The parameters for the rule.' },
}
);
export type SyntheticsMonitorStatusRuleParams = TypeOf<
typeof syntheticsMonitorStatusRuleParamsSchema
>;
export type TimeWindow = TypeOf<typeof TimeWindowSchema>;
export type StatusRuleCondition = TypeOf<typeof StatusRuleConditionSchema>;

View file

@ -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 { tlsRuleParamsSchema } from './latest';
export { tlsRuleParamsSchema as tlsRuleParamsSchemaV1 } from './v1';
export type { TLSRuleParams } from './latest';
export type { TLSRuleParams as TLSRuleParamsV1 } from './v1';

View file

@ -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';

View file

@ -0,0 +1,23 @@
/*
* 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 tlsRuleParamsSchema = schema.object(
{
search: schema.maybe(schema.string()),
certExpirationThreshold: schema.maybe(schema.number()),
certAgeThreshold: schema.maybe(schema.number()),
},
{
meta: { description: 'The parameters for the rule.' },
}
);
export type TLSRuleParams = TypeOf<typeof tlsRuleParamsSchema>;

View file

@ -75,8 +75,8 @@
"@kbn/zod",
"@kbn/core-saved-objects-base-server-internal",
"@kbn/core-security-server-mocks",
"@kbn/response-ops-rule-params",
"@kbn/core-http-server-utils"
"@kbn/core-http-server-utils",
"@kbn/response-ops-rule-params"
],
"exclude": [
"target/**/*"

View file

@ -5,68 +5,12 @@
* 2.0.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import {
StatusRuleCondition,
TimeWindow,
} from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { isEmpty } from 'lodash';
export const TimeWindowSchema = schema.object({
unit: schema.oneOf(
[schema.literal('s'), schema.literal('m'), schema.literal('h'), schema.literal('d')],
{
defaultValue: 'm',
}
),
size: schema.number({
defaultValue: 5,
}),
});
export const NumberOfChecksSchema = schema.object({
numberOfChecks: schema.number({
defaultValue: 5,
min: 1,
max: 100,
}),
});
export const StatusRuleConditionSchema = schema.object({
groupBy: schema.maybe(
schema.string({
defaultValue: 'locationId',
})
),
downThreshold: schema.maybe(
schema.number({
defaultValue: 3,
})
),
locationsThreshold: schema.maybe(
schema.number({
defaultValue: 1,
})
),
window: schema.oneOf([
schema.object({
time: TimeWindowSchema,
}),
NumberOfChecksSchema,
]),
includeRetests: schema.maybe(schema.boolean()),
});
export const StatusRulePramsSchema = schema.object({
condition: schema.maybe(StatusRuleConditionSchema),
monitorIds: schema.maybe(schema.arrayOf(schema.string())),
locations: schema.maybe(schema.arrayOf(schema.string())),
tags: schema.maybe(schema.arrayOf(schema.string())),
monitorTypes: schema.maybe(schema.arrayOf(schema.string())),
projects: schema.maybe(schema.arrayOf(schema.string())),
kqlQuery: schema.maybe(schema.string()),
});
export type TimeWindow = TypeOf<typeof TimeWindowSchema>;
export type StatusRuleParams = TypeOf<typeof StatusRulePramsSchema>;
export type StatusRuleCondition = TypeOf<typeof StatusRuleConditionSchema>;
export const getConditionType = (condition?: StatusRuleCondition) => {
let numberOfChecks = 1;
let timeWindow: TimeWindow = { unit: 'm', size: 1 };

View file

@ -7,10 +7,9 @@
import * as t from 'io-ts';
// This should be replaced by TLSParams from @kbn/response-ops-rule-params
export const TLSParamsType = t.partial({
search: t.string,
certAgeThreshold: t.number,
certExpirationThreshold: t.number,
});
export type TLSParams = t.TypeOf<typeof TLSParamsType>;

View file

@ -8,7 +8,7 @@
import React, { useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiFieldNumber, EuiPopoverTitle } from '@elastic/eui';
import { StatusRuleCondition } from '../../../../../../common/rules/status_rule';
import { StatusRuleCondition } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { PopoverExpression } from './popover_expression';
import { StatusRuleParamsProps } from '../status_rule_ui';

View file

@ -9,8 +9,9 @@ import { ForLastExpression, TIME_UNITS } from '@kbn/triggers-actions-ui-plugin/p
import React, { useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiFieldNumber, EuiPopoverTitle } from '@elastic/eui';
import { TimeWindow } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { PopoverExpression } from './popover_expression';
import { getConditionType, TimeWindow } from '../../../../../../common/rules/status_rule';
import { getConditionType } from '../../../../../../common/rules/status_rule';
import { StatusRuleParamsProps } from '../status_rule_ui';
interface Props {

View file

@ -7,7 +7,8 @@
import { EuiExpression, EuiPopover, EuiPopoverTitle, EuiSelectable } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { getConditionType, StatusRuleCondition } from '../../../../../../common/rules/status_rule';
import { StatusRuleCondition } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { getConditionType } from '../../../../../../common/rules/status_rule';
import { StatusRuleParamsProps } from '../status_rule_ui';
interface Props {

View file

@ -9,10 +9,10 @@ import React, { useCallback } from 'react';
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import { Filter } from '@kbn/es-query';
import { EuiSpacer } from '@elastic/eui';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { FieldFilters } from './common/field_filters';
import { AlertSearchBar } from './query_bar';
import { StatusRuleExpression } from './status_rule_expression';
import { StatusRuleParams } from '../../../../../common/rules/status_rule';
export type StatusRuleParamsProps = RuleTypeParamsExpressionProps<StatusRuleParams>;

View file

@ -8,14 +8,14 @@
import { useDispatch, useSelector } from 'react-redux';
import React, { useEffect } from 'react';
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import type { TLSRuleParams } from '@kbn/response-ops-rule-params/synthetics_tls';
import { AlertTlsComponent } from './alert_tls';
import { getDynamicSettingsAction, selectDynamicSettings } from '../../state/settings';
import { TLSParams } from '../../../../../common/runtime_types/alerts/tls';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../common/constants';
export const TLSRuleComponent: React.FC<{
ruleParams: RuleTypeParamsExpressionProps<TLSParams>['ruleParams'];
setRuleParams: RuleTypeParamsExpressionProps<TLSParams>['setRuleParams'];
ruleParams: RuleTypeParamsExpressionProps<TLSRuleParams>['ruleParams'];
setRuleParams: RuleTypeParamsExpressionProps<TLSRuleParams>['setRuleParams'];
}> = ({ ruleParams, setRuleParams }) => {
const dispatch = useDispatch();

View file

@ -14,11 +14,11 @@ import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/p
import { EuiSpacer, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { isEmpty } from 'lodash';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { StatusRuleComponent } from '../../../components/alerts/status_rule_ui';
import { kibanaService } from '../../../../../utils/kibana_service';
import { ClientPluginsStart } from '../../../../../plugin';
import { store } from '../../../state';
import type { StatusRuleParams } from '../../../../../../common/rules/status_rule';
interface Props {
coreStart: CoreStart;

View file

@ -10,17 +10,17 @@ import { Provider as ReduxProvider } from 'react-redux';
import { CoreStart } from '@kbn/core/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import type { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import type { TLSRuleParams } from '@kbn/response-ops-rule-params/synthetics_tls';
import { TLSRuleComponent } from '../../../components/alerts/tls_rule_ui';
import { ClientPluginsStart } from '../../../../../plugin';
import { TLSParams } from '../../../../../../common/runtime_types/alerts/tls';
import { kibanaService } from '../../../../../utils/kibana_service';
import { store } from '../../../state';
interface Props {
coreStart: CoreStart;
plugins: ClientPluginsStart;
ruleParams: RuleTypeParamsExpressionProps<TLSParams>['ruleParams'];
setRuleParams: RuleTypeParamsExpressionProps<TLSParams>['setRuleParams'];
ruleParams: RuleTypeParamsExpressionProps<TLSRuleParams>['ruleParams'];
setRuleParams: RuleTypeParamsExpressionProps<TLSRuleParams>['setRuleParams'];
}
// eslint-disable-next-line import/no-default-export

View file

@ -11,10 +11,10 @@ import { ALERT_REASON, SYNTHETICS_ALERT_RULE_TYPES } from '@kbn/rule-data-utils'
import type { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public';
import type { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { getSyntheticsErrorRouteFromMonitorId } from '../../../../../common/utils/get_synthetics_monitor_url';
import { STATE_ID } from '../../../../../common/field_names';
import { SyntheticsMonitorStatusTranslations } from '../../../../../common/rules/synthetics/translations';
import type { StatusRuleParams } from '../../../../../common/rules/status_rule';
import type { AlertTypeInitializer } from './types';
const { defaultActionMessage, defaultRecoveryMessage, description } =

View file

@ -10,9 +10,9 @@ import { ALERT_REASON, SYNTHETICS_ALERT_RULE_TYPES } from '@kbn/rule-data-utils'
import { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public';
import type { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import { ValidationResult } from '@kbn/triggers-actions-ui-plugin/public';
import type { TLSRuleParams } from '@kbn/response-ops-rule-params/synthetics_tls';
import { TlsTranslations } from '../../../../../common/rules/synthetics/translations';
import { CERTIFICATES_ROUTE } from '../../../../../common/constants/ui';
import type { TLSParams } from '../../../../../common/runtime_types/alerts/tls';
import type { AlertTypeInitializer } from './types';
@ -30,7 +30,7 @@ export const initTlsAlertType: AlertTypeInitializer = ({
documentationUrl(docLinks) {
return `${docLinks.links.observability.syntheticsAlerting}`;
},
ruleParamsExpression: (params: RuleTypeParamsExpressionProps<TLSParams>) => (
ruleParamsExpression: (params: RuleTypeParamsExpressionProps<TLSRuleParams>) => (
<TLSAlert
coreStart={core}
plugins={plugins}

View file

@ -23,7 +23,10 @@ import {
PublicAlertsClient,
RecoveredAlertData,
} from '@kbn/alerting-plugin/server/alerts_client/types';
import { StatusRuleParams, TimeWindow } from '../../common/rules/status_rule';
import {
SyntheticsMonitorStatusRuleParams as StatusRuleParams,
TimeWindow,
} from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { syntheticsRuleFieldMap } from '../../common/rules/synthetics_rule_field_map';
import { combineFiltersAndUserSearch, stringifyKueries } from '../../common/lib';
import {

View file

@ -8,8 +8,9 @@
import moment from 'moment';
import { i18n } from '@kbn/i18n';
import { ALERT_REASON } from '@kbn/rule-data-utils';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { AlertStatusMetaData } from '../../../common/runtime_types/alert_rules/common';
import { getConditionType, StatusRuleParams } from '../../../common/rules/status_rule';
import { getConditionType } from '../../../common/rules/status_rule';
import { AND_LABEL, getTimeUnitLabel } from '../common';
import { ALERT_REASON_MSG } from '../action_variables';
import { MonitorSummaryStatusRule } from './types';

View file

@ -11,12 +11,12 @@ import { GetViewInAppRelativeUrlFnOpts, AlertsClientError } from '@kbn/alerting-
import { observabilityPaths } from '@kbn/observability-plugin/common';
import apm from 'elastic-apm-node';
import { SYNTHETICS_ALERT_RULE_TYPES } from '@kbn/rule-data-utils';
import { syntheticsMonitorStatusRuleParamsSchema } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { AlertOverviewStatus } from '../../../common/runtime_types/alert_rules/common';
import { StatusRuleExecutorOptions } from './types';
import { syntheticsRuleFieldMap } from '../../../common/rules/synthetics_rule_field_map';
import { SyntheticsPluginsSetupDependencies, SyntheticsServerSetup } from '../../types';
import { StatusRuleExecutor } from './status_rule_executor';
import { StatusRulePramsSchema } from '../../../common/rules/status_rule';
import { MONITOR_STATUS } from '../../../common/constants/synthetics_alerts';
import {
setRecoveredAlertsContext,
@ -44,7 +44,7 @@ export const registerSyntheticsStatusCheckRule = (
producer: 'uptime',
name: STATUS_RULE_NAME,
validate: {
params: StatusRulePramsSchema,
params: syntheticsMonitorStatusRuleParamsSchema,
},
defaultActionGroupId: MONITOR_STATUS.id,
actionGroups: [MONITOR_STATUS],

View file

@ -7,7 +7,7 @@
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import { StatusRuleParams } from '../../../../common/rules/status_rule';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { SyntheticsEsClient } from '../../../lib';
import {
FINAL_SUMMARY_FILTER,

View file

@ -12,6 +12,7 @@ import {
import { Logger } from '@kbn/core/server';
import { intersection, isEmpty, uniq } from 'lodash';
import { getAlertDetailsUrl } from '@kbn/observability-plugin/common';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import {
AlertOverviewStatus,
AlertStatusConfigs,
@ -41,7 +42,7 @@ import {
getAllMonitors,
processMonitors,
} from '../../saved_objects/synthetics_monitor/get_all_monitors';
import { getConditionType, StatusRuleParams } from '../../../common/rules/status_rule';
import { getConditionType } from '../../../common/rules/status_rule';
import { ConfigKey, EncryptedSyntheticsMonitorAttributes } from '../../../common/runtime_types';
import { SyntheticsMonitorClient } from '../../synthetics_service/synthetics_monitor/synthetics_monitor_client';
import { monitorAttributes } from '../../../common/types/saved_objects';

View file

@ -11,7 +11,7 @@ import {
AlertInstanceContext as AlertContext,
RuleExecutorOptions,
} from '@kbn/alerting-plugin/server';
import { StatusRuleParams } from '../../../common/rules/status_rule';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { MONITOR_STATUS } from '../../../common/constants/synthetics_alerts';
import {
SyntheticsCommonState,

View file

@ -15,8 +15,11 @@ import {
} from '@kbn/alerting-plugin/server';
import { asyncForEach } from '@kbn/std';
import { SYNTHETICS_ALERT_RULE_TYPES } from '@kbn/rule-data-utils';
import {
tlsRuleParamsSchema,
type TLSRuleParams,
} from '@kbn/response-ops-rule-params/synthetics_tls';
import { getAlertDetailsUrl, observabilityPaths } from '@kbn/observability-plugin/common';
import { schema } from '@kbn/config-schema';
import { ObservabilityUptimeAlert } from '@kbn/alerts-as-data-utils';
import { syntheticsRuleFieldMap } from '../../../common/rules/synthetics_rule_field_map';
import { SyntheticsPluginsSetupDependencies, SyntheticsServerSetup } from '../../types';
@ -27,9 +30,7 @@ import { TLS_CERTIFICATE } from '../../../common/constants/synthetics_alerts';
import { SyntheticsRuleTypeAlertDefinition, updateState } from '../common';
import { ALERT_DETAILS_URL, getActionVariables } from '../action_variables';
import { SyntheticsMonitorClient } from '../../synthetics_service/synthetics_monitor/synthetics_monitor_client';
import { TLSParams } from '../../../common/runtime_types/alerts/tls';
type TLSRuleTypeParams = TLSParams;
type TLSActionGroups = ActionGroupIdsOf<typeof TLS_CERTIFICATE>;
type TLSRuleTypeState = SyntheticsCommonState;
type TLSAlertState = ReturnType<typeof getCertSummary>;
@ -53,11 +54,7 @@ export const registerSyntheticsTLSCheckRule = (
producer: 'uptime',
name: TLS_CERTIFICATE.name,
validate: {
params: schema.object({
search: schema.maybe(schema.string()),
certExpirationThreshold: schema.maybe(schema.number()),
certAgeThreshold: schema.maybe(schema.number()),
}),
params: tlsRuleParamsSchema,
},
defaultActionGroupId: TLS_CERTIFICATE.id,
actionGroups: [TLS_CERTIFICATE],
@ -67,7 +64,7 @@ export const registerSyntheticsTLSCheckRule = (
doesSetRecoveryContext: true,
executor: async (
options: RuleExecutorOptions<
TLSRuleTypeParams,
TLSRuleParams,
TLSRuleTypeState,
TLSAlertState,
TLSAlertContext,

View file

@ -10,12 +10,12 @@ import {
} from '@kbn/core-saved-objects-api-server';
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import type { TLSRuleParams } from '@kbn/response-ops-rule-params/synthetics_tls';
import moment from 'moment';
import { FINAL_SUMMARY_FILTER } from '../../../common/constants/client_defaults';
import { formatFilterString } from '../common';
import { SyntheticsServerSetup } from '../../types';
import { getSyntheticsCerts } from '../../queries/get_certs';
import { TLSParams } from '../../../common/runtime_types/alerts/tls';
import { savedObjectsAdapter } from '../../saved_objects';
import { DYNAMIC_SETTINGS_DEFAULTS, SYNTHETICS_INDEX_PATTERN } from '../../../common/constants';
import {
@ -35,7 +35,7 @@ import { SyntheticsEsClient } from '../../lib';
export class TLSRuleExecutor {
previousStartedAt: Date | null;
params: TLSParams;
params: TLSRuleParams;
esClient: SyntheticsEsClient;
soClient: SavedObjectsClientContract;
server: SyntheticsServerSetup;
@ -44,7 +44,7 @@ export class TLSRuleExecutor {
constructor(
previousStartedAt: Date | null,
p: TLSParams,
p: TLSRuleParams,
soClient: SavedObjectsClientContract,
scopedClient: ElasticsearchClient,
server: SyntheticsServerSetup,

View file

@ -107,7 +107,8 @@
"@kbn/index-lifecycle-management-common-shared",
"@kbn/core-http-server-utils",
"@kbn/apm-data-access-plugin",
"@kbn/charts-theme"
"@kbn/charts-theme",
"@kbn/response-ops-rule-params"
],
"exclude": ["target/**/*"]
}

View file

@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import moment from 'moment';
import { SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants';
import { StatusRuleParams } from '@kbn/synthetics-plugin/common/rules/status_rule';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { SyntheticsRuleHelper, SYNTHETICS_ALERT_ACTION_INDEX } from './synthetics_rule_helper';
import { waitForDocumentInIndex } from '../helpers/alerting_wait_for_helpers';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { StatusRuleParams } from '@kbn/synthetics-plugin/common/rules/status_rule';
import { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status';
import type { Client } from '@elastic/elasticsearch';
import { ToolingLog } from '@kbn/tooling-log';
import { makeDownSummary, makeUpSummary } from '@kbn/observability-synthetics-test-data';

View file

@ -190,6 +190,7 @@
"@kbn/gen-ai-functional-testing",
"@kbn/integration-assistant-plugin",
"@kbn/core-elasticsearch-server",
"@kbn/streams-schema"
"@kbn/streams-schema",
"@kbn/response-ops-rule-params"
]
}