mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[8.x] [ResponseOps][Rules] Move the params of tracking containment rule type to @kbn/response-ops-rule-params package (#210955) (#211195)
# Backport This will backport the following commits from `main` to `8.x`: - [[ResponseOps][Rules] Move the params of tracking containment rule type to @kbn/response-ops-rule-params package (#210955)](https://github.com/elastic/kibana/pull/210955) <!--- 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:18Z","message":"[ResponseOps][Rules] Move the params of tracking containment rule type to @kbn/response-ops-rule-params package (#210955)\n\nConnected with https://github.com/elastic/kibana/issues/195188\r\n\r\n## Summary\r\n\r\n- Moved the params of tracking containment rule type to\r\n`@kbn/response-ops-rule-params/geo_containment` package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1d1b6b0638d8b8bb3229c9e8f344a1c4fcbebde","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 tracking containment rule type to @kbn/response-ops-rule-params package","number":210955,"url":"https://github.com/elastic/kibana/pull/210955","mergeCommit":{"message":"[ResponseOps][Rules] Move the params of tracking containment rule type to @kbn/response-ops-rule-params package (#210955)\n\nConnected with https://github.com/elastic/kibana/issues/195188\r\n\r\n## Summary\r\n\r\n- Moved the params of tracking containment rule type to\r\n`@kbn/response-ops-rule-params/geo_containment` package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1d1b6b0638d8b8bb3229c9e8f344a1c4fcbebde"}},"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/210955","number":210955,"mergeCommit":{"message":"[ResponseOps][Rules] Move the params of tracking containment rule type to @kbn/response-ops-rule-params package (#210955)\n\nConnected with https://github.com/elastic/kibana/issues/195188\r\n\r\n## Summary\r\n\r\n- Moved the params of tracking containment rule type to\r\n`@kbn/response-ops-rule-params/geo_containment` package\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1d1b6b0638d8b8bb3229c9e8f344a1c4fcbebde"}},{"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:
parent
b7b0a97fdc
commit
4b98d4d495
5 changed files with 56 additions and 19 deletions
|
@ -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 { trackingContainmentRuleParamsSchema } from './latest';
|
||||
export { trackingContainmentRuleParamsSchema as trackingContainmentRuleParamsSchemaV1 } from './latest';
|
||||
|
||||
export type { TrackingContainmentRuleParams } from './latest';
|
||||
export type { TrackingContainmentRuleParams as TrackingContainmentRuleParamsV1 } from './latest';
|
|
@ -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';
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
export const trackingContainmentRuleParamsSchema = schema.object({
|
||||
index: schema.string({ minLength: 1 }),
|
||||
indexId: schema.string({ minLength: 1 }),
|
||||
geoField: schema.string({ minLength: 1 }),
|
||||
entity: schema.string({ minLength: 1 }),
|
||||
dateField: schema.string({ minLength: 1 }),
|
||||
boundaryType: schema.string({ minLength: 1 }),
|
||||
boundaryIndexTitle: schema.string({ minLength: 1 }),
|
||||
boundaryIndexId: schema.string({ minLength: 1 }),
|
||||
boundaryGeoField: schema.string({ minLength: 1 }),
|
||||
boundaryNameField: schema.maybe(schema.string({ minLength: 1 })),
|
||||
indexQuery: schema.maybe(schema.any({})),
|
||||
boundaryIndexQuery: schema.maybe(schema.any({})),
|
||||
});
|
||||
|
||||
export type TrackingContainmentRuleParams = TypeOf<typeof trackingContainmentRuleParamsSchema>;
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { SavedObjectReference, DEFAULT_APP_CATEGORIES } from '@kbn/core/server';
|
||||
import { RuleParamsAndRefs } from '@kbn/alerting-plugin/server';
|
||||
import { STACK_ALERTS_FEATURE_ID } from '@kbn/rule-data-utils';
|
||||
import { trackingContainmentRuleParamsSchema } from '@kbn/response-ops-rule-params/geo_containment';
|
||||
import type {
|
||||
GeoContainmentRuleType,
|
||||
GeoContainmentExtractedRuleParams,
|
||||
|
@ -90,21 +90,6 @@ const actionVariables = {
|
|||
],
|
||||
};
|
||||
|
||||
export const ParamsSchema = schema.object({
|
||||
index: schema.string({ minLength: 1 }),
|
||||
indexId: schema.string({ minLength: 1 }),
|
||||
geoField: schema.string({ minLength: 1 }),
|
||||
entity: schema.string({ minLength: 1 }),
|
||||
dateField: schema.string({ minLength: 1 }),
|
||||
boundaryType: schema.string({ minLength: 1 }),
|
||||
boundaryIndexTitle: schema.string({ minLength: 1 }),
|
||||
boundaryIndexId: schema.string({ minLength: 1 }),
|
||||
boundaryGeoField: schema.string({ minLength: 1 }),
|
||||
boundaryNameField: schema.maybe(schema.string({ minLength: 1 })),
|
||||
indexQuery: schema.maybe(schema.any({})),
|
||||
boundaryIndexQuery: schema.maybe(schema.any({})),
|
||||
});
|
||||
|
||||
export function extractEntityAndBoundaryReferences(params: GeoContainmentRuleParams): {
|
||||
params: GeoContainmentExtractedRuleParams;
|
||||
references: SavedObjectReference[];
|
||||
|
@ -183,12 +168,12 @@ export function getRuleType(): GeoContainmentRuleType {
|
|||
category: DEFAULT_APP_CATEGORIES.management.id,
|
||||
producer: STACK_ALERTS_FEATURE_ID,
|
||||
validate: {
|
||||
params: ParamsSchema,
|
||||
params: trackingContainmentRuleParamsSchema,
|
||||
},
|
||||
schemas: {
|
||||
params: {
|
||||
type: 'config-schema',
|
||||
schema: ParamsSchema,
|
||||
schema: trackingContainmentRuleParamsSchema,
|
||||
},
|
||||
},
|
||||
actionVariables,
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
"@kbn/task-manager-plugin",
|
||||
"@kbn/core-logging-server-mocks",
|
||||
"@kbn/core-saved-objects-server",
|
||||
"@kbn/alerting-rule-utils"
|
||||
"@kbn/alerting-rule-utils",
|
||||
"@kbn/response-ops-rule-params"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue