[ResponseOps][Rules] Move the params of transform health rule type to the @kbn/response-ops-rule-params package (#210990)

Connected with https://github.com/elastic/kibana/issues/195188

## Summary

- Moved the params of transform health rule type to
@kbn/response-ops-rule-params/transform_health package

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Georgiana-Andreea Onoleață 2025-02-14 12:29:02 +02:00 committed by GitHub
parent 4f0eafc7c3
commit 0d4be1db49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 42 additions and 14 deletions

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 { transformHealthRuleParamsSchema } from './latest';
export { transformHealthRuleParamsSchema as transformHealthRuleParamsSchemaV1 } from './latest';
export type { TransformHealthRuleParams } from './latest';
export type { TransformHealthRuleParams as TransformHealthRuleParamsV1 } from './latest';

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

@ -1,14 +1,15 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 type { TypeOf } from '@kbn/config-schema';
import { schema } from '@kbn/config-schema';
import { schema, TypeOf } from '@kbn/config-schema';
export const transformHealthRuleParams = schema.object({
export const transformHealthRuleParamsSchema = schema.object({
includeTransforms: schema.arrayOf(schema.string()),
excludeTransforms: schema.nullable(schema.arrayOf(schema.string(), { defaultValue: [] })),
testsConfig: schema.nullable(
@ -32,4 +33,4 @@ export const transformHealthRuleParams = schema.object({
),
});
export type TransformHealthRuleParams = TypeOf<typeof transformHealthRuleParams>;
export type TransformHealthRuleParams = TypeOf<typeof transformHealthRuleParamsSchema>;

View file

@ -21,6 +21,10 @@ import type { FieldFormatsStart } from '@kbn/field-formats-plugin/server';
import type { TransformHealthAlert } from '@kbn/alerts-as-data-utils';
import { ALERT_REASON } from '@kbn/rule-data-utils';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import {
transformHealthRuleParamsSchema,
type TransformHealthRuleParams,
} from '@kbn/response-ops-rule-params/transform_health';
import {
PLUGIN,
type TransformHealthStatus,
@ -28,8 +32,6 @@ import {
TRANSFORM_HEALTH_RESULTS,
TRANSFORM_HEALTH_CHECK_NAMES,
} from '../../../../common/constants';
import type { TransformHealthRuleParams } from './schema';
import { transformHealthRuleParams } from './schema';
import { transformHealthServiceProvider } from './transform_health_service';
export interface BaseTransformAlertResponse {
@ -129,11 +131,11 @@ export function getTransformHealthRuleType(
}),
actionGroups: [TRANSFORM_ISSUE_DETECTED],
defaultActionGroupId: TRANSFORM_ISSUE,
validate: { params: transformHealthRuleParams },
validate: { params: transformHealthRuleParamsSchema },
schemas: {
params: {
type: 'config-schema',
schema: transformHealthRuleParams,
schema: transformHealthRuleParamsSchema,
},
},
actionVariables: {

View file

@ -16,7 +16,7 @@ import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks';
import type { ElasticsearchClient } from '@kbn/core/server';
import type { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common';
import { transformHealthServiceProvider } from './transform_health_service';
import type { TransformHealthRuleParams } from './schema';
import type { TransformHealthRuleParams } from '@kbn/response-ops-rule-params/transform_health';
describe('transformHealthServiceProvider', () => {
let esClient: jest.Mocked<ElasticsearchClient>;

View file

@ -12,6 +12,7 @@ import { keyBy, memoize, partition } from 'lodash';
import type { RulesClient } from '@kbn/alerting-plugin/server';
import type { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common';
import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common';
import type { TransformHealthRuleParams } from '@kbn/response-ops-rule-params/transform_health';
import type { TransformStats } from '../../../../common/types/transform_stats';
import {
ALL_TRANSFORMS_SELECTION,
@ -22,7 +23,6 @@ import {
TRANSFORM_RULE_TYPE,
TRANSFORM_STATE,
} from '../../../../common/constants';
import type { TransformHealthRuleParams } from './schema';
import { getResultTestConfig } from '../../../../common/utils/alerts';
import type {
ErrorMessagesTransformResponse,

View file

@ -79,7 +79,8 @@
"@kbn/json-schemas",
"@kbn/ml-field-stats-flyout",
"@kbn/ml-validators",
"@kbn/core-user-profile-browser-mocks"
"@kbn/core-user-profile-browser-mocks",
"@kbn/response-ops-rule-params"
],
"exclude": [
"target/**/*",