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

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Rules] Move the params of transform health rule type to
the @kbn/response-ops-rule-params package
(#210990)](https://github.com/elastic/kibana/pull/210990)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Georgiana-Andreea
Onoleață","email":"georgiana.onoleata@elastic.co"},"sourceCommit":{"committedDate":"2025-02-14T10:29:02Z","message":"[ResponseOps][Rules]
Move the params of transform health rule type to the
@kbn/response-ops-rule-params package (#210990)\n\nConnected with
https://github.com/elastic/kibana/issues/195188\r\n\r\n##
Summary\r\n\r\n- Moved the params of transform health rule type
to\r\n@kbn/response-ops-rule-params/transform_health
package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0d4be1db495c106d97295779722fea0395d71faa","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","backport:version","v9.1.0","v8.19.0"],"title":"[ResponseOps][Rules]
Move the params of transform health rule type to the
@kbn/response-ops-rule-params
package","number":210990,"url":"https://github.com/elastic/kibana/pull/210990","mergeCommit":{"message":"[ResponseOps][Rules]
Move the params of transform health rule type to the
@kbn/response-ops-rule-params package (#210990)\n\nConnected with
https://github.com/elastic/kibana/issues/195188\r\n\r\n##
Summary\r\n\r\n- Moved the params of transform health rule type
to\r\n@kbn/response-ops-rule-params/transform_health
package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0d4be1db495c106d97295779722fea0395d71faa"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210990","number":210990,"mergeCommit":{"message":"[ResponseOps][Rules]
Move the params of transform health rule type to the
@kbn/response-ops-rule-params package (#210990)\n\nConnected with
https://github.com/elastic/kibana/issues/195188\r\n\r\n##
Summary\r\n\r\n- Moved the params of transform health rule type
to\r\n@kbn/response-ops-rule-params/transform_health
package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0d4be1db495c106d97295779722fea0395d71faa"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Georgiana-Andreea Onoleață <georgiana.onoleata@elastic.co>
This commit is contained in:
Kibana Machine 2025-02-14 23:53:20 +11:00 committed by GitHub
parent 88a796ea33
commit b7b0a97fdc
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/**/*",