Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5a10287
Add name field to rule migrations ui and data model
kqualters-elastic Jun 13, 2025
fadcce7
Merge branch 'main' into siem-migrations-name
kqualters-elastic Jun 13, 2025
f02363a
Unit tests for sub step and migration
kqualters-elastic Jun 13, 2025
8ce8a61
[CI] Auto-commit changed files from 'yarn openapi:generate'
kibanamachine Jun 13, 2025
482e44f
Merge remote-tracking branch 'upstream/main' into siem-migrations-name
kqualters-elastic Jun 16, 2025
d7d20b1
fix migration and make name required
semd Jun 17, 2025
f6732b1
Merge pull request #8 from semd/automatic_migrations/migration_name
kqualters-elastic Jun 17, 2025
5c0293b
Merge remote-tracking branch 'origin/siem-migrations-name' into siem-…
kqualters-elastic Jun 17, 2025
0eba80b
PR comments, add openapi specs, merge with sergi migration
kqualters-elastic Jun 17, 2025
2bfff82
Merge remote-tracking branch 'upstream/main' into siem-migrations-name
kqualters-elastic Jun 17, 2025
4487e9f
Remove disabling name input per pr comment
kqualters-elastic Jun 17, 2025
340b2c8
Fix intl
kqualters-elastic Jun 17, 2025
48fc7d1
Fix intl again
kqualters-elastic Jun 17, 2025
0567e42
Merge remote-tracking branch 'upstream/main' into siem-migrations-name
semd Jun 19, 2025
39c396d
migration name form in the flyout
semd Jun 19, 2025
8356053
rename migration from panels
semd Jun 19, 2025
6491bee
name migrator
semd Jun 19, 2025
78444e6
typo
semd Jun 19, 2025
8b1bcb1
cleaning dead code
semd Jun 19, 2025
6ea6533
[CI] Auto-commit changed files from 'yarn openapi:generate'
kibanamachine Jun 19, 2025
6387f35
quick checks fix
semd Jun 19, 2025
ddc7b34
Merge remote-tracking branch 'refs/remotes/kqualters-elastic/siem-mig…
semd Jun 19, 2025
e78fd85
fix type errors
semd Jun 20, 2025
47776c3
update mock
semd Jun 20, 2025
f678449
address comments
semd Jun 20, 2025
640e47a
tests fixed
semd Jun 20, 2025
71c5bde
fix test types
semd Jun 20, 2025
712e1d0
solve conflicts
semd Jun 20, 2025
73c56ac
Fix types
kqualters-elastic Jun 20, 2025
07e18a5
Fix types pt2
kqualters-elastic Jun 20, 2025
f2b7c2c
audit logger for the migration update
semd Jun 20, 2025
037b3d5
Merge remote-tracking branch 'refs/remotes/kqualters-elastic/siem-mig…
semd Jun 20, 2025
9fd21bf
resolve lint issue
semd Jun 20, 2025
2198915
Fix unit test missing TestProviders
kqualters-elastic Jun 20, 2025
31e73a1
Merge remote-tracking branch 'origin/siem-migrations-name' into siem-…
kqualters-elastic Jun 20, 2025
4997ecc
Merge remote-tracking branch 'upstream/main' into siem-migrations-name
kqualters-elastic Jun 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40775,7 +40775,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.expand": "Développer la migration de règles",
"xpack.securitySolution.siemMigrations.rules.panel.help.readDocs": "Lire les documents d'IA",
"xpack.securitySolution.siemMigrations.rules.panel.help.readMore": "Pour en savoir plus sur nos traductions assistées par IA et les autres fonctionnalités. {readMore}",
"xpack.securitySolution.siemMigrations.rules.panel.migrationTitle": "Migration de règles SIEM #{number}",
"xpack.securitySolution.siemMigrations.rules.panel.progress.badge": "Traduction en cours",
"xpack.securitySolution.siemMigrations.rules.panel.progress.description": "Traitement de la migration de {totalRules} règles.",
"xpack.securitySolution.siemMigrations.rules.panel.progress.preparing": "Préparation de l'environnement pour la traduction alimentée par l'IA.",
Expand All @@ -40795,7 +40794,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.uploadMissingResourcesDescription": "Cliquez sur Charger pour continuer à traduire {partialRulesCount} règles",
"xpack.securitySolution.siemMigrations.rules.retryFailedRulesFailDescription": "Échec du re-traitement des règles de migration",
"xpack.securitySolution.siemMigrations.rules.selectionOption.arealLabel": "Sélectionnez une migration",
"xpack.securitySolution.siemMigrations.rules.selectionOption.title": "Migration de règle SIEM {optionIndex}",
"xpack.securitySolution.siemMigrations.rules.service.createRuleError": "Échec du chargement du fichier de règles",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.description": "{rules} règles téléchargées",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.title": "Migration de règle créée avec succès",
Expand Down Expand Up @@ -40909,7 +40907,6 @@
"xpack.securitySolution.siemMigrations.rulesService.noConnector.text": "Aucun connecteur par IA configuré. Sélectionnez un connecteur par IA pour lancer les traductions de règles.",
"xpack.securitySolution.siemMigrations.rulesService.noConnector.title": "Aucun connecteur configuré.",
"xpack.securitySolution.siemMigrations.rulesService.polling.successLinkText": "Rendez-vous aux règles traduites",
"xpack.securitySolution.siemMigrations.rulesService.polling.successText": "La traduction de la migration de règles SIEM #{number} est terminée. Les résultats ont été ajoutés à une page dédiée.",
"xpack.securitySolution.siemMigrations.rulesService.polling.successTitle": "Traduction de règles terminée.",
"xpack.securitySolution.siemMigrations.rulesService.pollingError": "Erreur lors de la récupération des migrations de règles",
"xpack.securitySolution.siemMigrations.service.capabilities.connectorsRead": "Gestion > Actions & connecteurs : Lire",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40739,7 +40739,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.expand": "ルール移行を展開",
"xpack.securitySolution.siemMigrations.rules.panel.help.readDocs": "AIドキュメントを読む",
"xpack.securitySolution.siemMigrations.rules.panel.help.readMore": "AIを活用した翻訳やその他の機能の詳細についてお読みください。{readMore}",
"xpack.securitySolution.siemMigrations.rules.panel.migrationTitle": "SIEMルール移行#{number}",
"xpack.securitySolution.siemMigrations.rules.panel.progress.badge": "変換中",
"xpack.securitySolution.siemMigrations.rules.panel.progress.description": "{totalRules}ルールの移行を処理しています。",
"xpack.securitySolution.siemMigrations.rules.panel.progress.preparing": "AIを活用した変換の環境を準備しています。",
Expand All @@ -40759,7 +40758,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.uploadMissingResourcesDescription": "[アップロード]をクリックして、{partialRulesCount}ルールの変換を続行",
"xpack.securitySolution.siemMigrations.rules.retryFailedRulesFailDescription": "移行ルールを再処理できませんでした",
"xpack.securitySolution.siemMigrations.rules.selectionOption.arealLabel": "移行を選択",
"xpack.securitySolution.siemMigrations.rules.selectionOption.title": "SIEMルール移行{optionIndex}",
"xpack.securitySolution.siemMigrations.rules.service.createRuleError": "ルールファイルをアップロードできませんでした",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.description": "{rules}ルールがアップロードされました",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.title": "ルール移行が正常に作成されました",
Expand Down Expand Up @@ -40873,7 +40871,6 @@
"xpack.securitySolution.siemMigrations.rulesService.noConnector.text": "AIコネクターが構成されていませんルール変換を開始するには、AIコネクターを選択してください。",
"xpack.securitySolution.siemMigrations.rulesService.noConnector.title": "コネクターが構成されていません。",
"xpack.securitySolution.siemMigrations.rulesService.polling.successLinkText": "変換されたルールに移動",
"xpack.securitySolution.siemMigrations.rulesService.polling.successText": "SIEMルール移行#{number}の変換が完了しました。結果が専用ページに追加されました。",
"xpack.securitySolution.siemMigrations.rulesService.polling.successTitle": "ルール変換が完了しました。",
"xpack.securitySolution.siemMigrations.rulesService.pollingError": "ルール移行の取得エラー",
"xpack.securitySolution.siemMigrations.service.capabilities.connectorsRead": "管理 > アクションとコネクター:読み取り",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40817,7 +40817,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.expand": "展开规则迁移",
"xpack.securitySolution.siemMigrations.rules.panel.help.readDocs": "阅读 AI 文档",
"xpack.securitySolution.siemMigrations.rules.panel.help.readMore": "阅读有关我们的 AI 驱动式转换和其他功能的更多信息。{readMore}",
"xpack.securitySolution.siemMigrations.rules.panel.migrationTitle": "SIEM 规则迁移 #{number}",
"xpack.securitySolution.siemMigrations.rules.panel.progress.badge": "正在进行转换",
"xpack.securitySolution.siemMigrations.rules.panel.progress.description": "正在处理 {totalRules} 个规则的迁移。",
"xpack.securitySolution.siemMigrations.rules.panel.progress.preparing": "正在准备环境以进行 AI 驱动式转换。",
Expand All @@ -40837,7 +40836,6 @@
"xpack.securitySolution.siemMigrations.rules.panel.uploadMissingResourcesDescription": "单击“上传”以继续转换 {partialRulesCount} 个规则",
"xpack.securitySolution.siemMigrations.rules.retryFailedRulesFailDescription": "无法重新处理迁移规则",
"xpack.securitySolution.siemMigrations.rules.selectionOption.arealLabel": "选择迁移",
"xpack.securitySolution.siemMigrations.rules.selectionOption.title": "SIEM 规则迁移 {optionIndex}",
"xpack.securitySolution.siemMigrations.rules.service.createRuleError": "无法上传规则文件",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.description": "{rules} 个规则已上传",
"xpack.securitySolution.siemMigrations.rules.service.createRuleSuccess.title": "已成功创建规则迁移",
Expand Down Expand Up @@ -40951,7 +40949,6 @@
"xpack.securitySolution.siemMigrations.rulesService.noConnector.text": "未配置 AI 连接器。选择 AI 连接器以开始规则转换。",
"xpack.securitySolution.siemMigrations.rulesService.noConnector.title": "未配置连接器。",
"xpack.securitySolution.siemMigrations.rulesService.polling.successLinkText": "前往已转换规则",
"xpack.securitySolution.siemMigrations.rulesService.polling.successText": "SIEM 规则迁移 #{number} 已完成转换。结果已添加到专用页面。",
"xpack.securitySolution.siemMigrations.rulesService.polling.successTitle": "规则转换完成。",
"xpack.securitySolution.siemMigrations.rulesService.pollingError": "获取规则迁移时出错",
"xpack.securitySolution.siemMigrations.service.capabilities.connectorsRead": "管理 > 操作和连接器:读取",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ import type {
ResolveTimelineResponse,
} from './timeline/resolve_timeline/resolve_timeline_route.gen';
import type {
CreateRuleMigrationRequestBodyInput,
CreateRuleMigrationResponse,
CreateRuleMigrationRulesRequestParamsInput,
CreateRuleMigrationRulesRequestBodyInput,
Expand Down Expand Up @@ -405,7 +406,7 @@ import type {
StopRuleMigrationRequestParamsInput,
StopRuleMigrationResponse,
UpdateRuleMigrationRequestParamsInput,
UpdateRuleMigrationResponse,
UpdateRuleMigrationRequestBodyInput,
UpdateRuleMigrationRulesRequestParamsInput,
UpdateRuleMigrationRulesRequestBodyInput,
UpdateRuleMigrationRulesResponse,
Expand Down Expand Up @@ -710,7 +711,7 @@ For detailed information on Kibana actions and alerting, and additional API call
/**
* Creates a new rule migration and returns the corresponding migration_id
*/
async createRuleMigration() {
async createRuleMigration(props: CreateRuleMigrationProps) {
this.log.info(`${new Date().toISOString()} Calling API CreateRuleMigration`);
return this.kbnClient
.request<CreateRuleMigrationResponse>({
Expand All @@ -719,6 +720,7 @@ For detailed information on Kibana actions and alerting, and additional API call
[ELASTIC_HTTP_VERSION_HEADER]: '1',
},
method: 'PUT',
body: props.body,
})
.catch(catchAxiosErrorFormatAndThrow);
}
Expand Down Expand Up @@ -2505,12 +2507,13 @@ The difference between the `id` and `rule_id` is that the `id` is a unique rule
async updateRuleMigration(props: UpdateRuleMigrationProps) {
this.log.info(`${new Date().toISOString()} Calling API UpdateRuleMigration`);
return this.kbnClient
.request<UpdateRuleMigrationResponse>({
.request({
path: replaceParams('/internal/siem_migrations/rules/{migration_id}', props.params),
headers: {
[ELASTIC_HTTP_VERSION_HEADER]: '1',
},
method: 'PATCH',
body: props.body,
})
.catch(catchAxiosErrorFormatAndThrow);
}
Expand Down Expand Up @@ -2604,6 +2607,9 @@ export interface CreatePrivMonUserProps {
export interface CreateRuleProps {
body: CreateRuleRequestBodyInput;
}
export interface CreateRuleMigrationProps {
body: CreateRuleMigrationRequestBodyInput;
}
export interface CreateRuleMigrationRulesProps {
params: CreateRuleMigrationRulesRequestParamsInput;
body: CreateRuleMigrationRulesRequestBodyInput;
Expand Down Expand Up @@ -2884,6 +2890,7 @@ export interface UpdateRuleProps {
}
export interface UpdateRuleMigrationProps {
params: UpdateRuleMigrationRequestParamsInput;
body: UpdateRuleMigrationRequestBodyInput;
}
export interface UpdateRuleMigrationRulesProps {
params: UpdateRuleMigrationRulesRequestParamsInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ import { RelatedIntegration } from '../../../../api/detection_engine/model/rule_
import { NonEmptyString } from '../../../../api/model/primitives.gen';
import { LangSmithOptions } from '../../common.gen';

export type CreateRuleMigrationRequestBody = z.infer<typeof CreateRuleMigrationRequestBody>;
export const CreateRuleMigrationRequestBody = z.object({
/**
* The rule migration name
*/
name: NonEmptyString,
});
export type CreateRuleMigrationRequestBodyInput = z.input<typeof CreateRuleMigrationRequestBody>;

export type CreateRuleMigrationResponse = z.infer<typeof CreateRuleMigrationResponse>;
export const CreateRuleMigrationResponse = z.object({
/**
Expand Down Expand Up @@ -313,8 +322,14 @@ export type UpdateRuleMigrationRequestParamsInput = z.input<
typeof UpdateRuleMigrationRequestParams
>;

export type UpdateRuleMigrationResponse = z.infer<typeof UpdateRuleMigrationResponse>;
export const UpdateRuleMigrationResponse = RuleMigration;
export type UpdateRuleMigrationRequestBody = z.infer<typeof UpdateRuleMigrationRequestBody>;
export const UpdateRuleMigrationRequestBody = z.object({
/**
* The rule migration name
*/
name: NonEmptyString,
});
export type UpdateRuleMigrationRequestBodyInput = z.input<typeof UpdateRuleMigrationRequestBody>;

export type UpdateRuleMigrationRulesRequestParams = z.infer<
typeof UpdateRuleMigrationRulesRequestParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,37 @@ paths:
/internal/siem_migrations/rules:
put:
summary: Creates a new rule migration
operationId: "CreateRuleMigration"
operationId: 'CreateRuleMigration'
x-codegen-enabled: true
x-internal: true
description: Creates a new rule migration and returns the corresponding migration_id
tags:
- SIEM Rule Migrations
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
description: The rule migration name
$ref: '../../../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
responses:
200:
description: The migration was created successfully and migrationId is returned
description: The migration was created successfully and migrationId, name is returned
content:
application/json:
schema:
type: object
required:
- migration_id
properties:
migration_id:
description: The migration id created.
$ref: '../../../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
migration_id:
description: The migration id created.
$ref: '../../../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'

## Specific rule migration APIs
/internal/siem_migrations/rules/{migration_id}:
Expand All @@ -101,13 +113,21 @@ paths:
schema:
description: The migration id to start
$ref: '../../../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
description: The rule migration name
$ref: '../../../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
responses:
200:
description: Indicates rules migrations have been updated correctly.
content:
application/json:
schema:
$ref: '../../rule_migration.schema.yaml#/components/schemas/RuleMigration'
404:
description: Indicates the migration id was not found.
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export const RuleMigration = z
* The rule migration id
*/
id: NonEmptyString,
/**
* The rule migration name
*/
name: NonEmptyString,
})
.merge(RuleMigrationData);

Expand Down Expand Up @@ -328,6 +332,10 @@ export const RuleMigrationTaskStats = z.object({
* The migration id
*/
id: NonEmptyString,
/**
* The migration name
*/
name: NonEmptyString,
/**
* Indicates if the migration task status.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ components:
- type: object
required:
- id
- name
properties:
id:
description: The rule migration id
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
name:
description: The rule migration name
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
- $ref: '#/components/schemas/RuleMigrationData'

RuleMigrationData:
Expand Down Expand Up @@ -207,6 +211,7 @@ components:
description: The rule migration task stats object.
required:
- id
- name
- status
- rules
- created_at
Expand All @@ -215,6 +220,9 @@ components:
id:
description: The migration id
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
name:
description: The migration name
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
status:
description: Indicates if the migration task status.
$ref: '#/components/schemas/RuleMigrationTaskStatus'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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.
*/

export * from './use_is_open_state';
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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.
*/

import { renderHook, act } from '@testing-library/react';
import { useIsOpenState } from './use_is_open_state';

describe('useIsOpenState', () => {
let initialState: boolean;
let onOpen: jest.Mock;
let onClose: jest.Mock;
let onToggle: jest.Mock;

beforeEach(() => {
initialState = false;
onOpen = jest.fn();
onClose = jest.fn();
onToggle = jest.fn();
});

it('should initialize with the correct state', () => {
const { result } = renderHook(() => useIsOpenState(initialState));
expect(result.current.isOpen).toBe(initialState);
});

it('should call onOpen when opening', () => {
const { result } = renderHook(() => useIsOpenState(initialState, { onOpen }));
act(() => {
result.current.open();
});
expect(result.current.isOpen).toBe(true);
expect(onOpen).toHaveBeenCalled();
});

it('should call onClose when closing', () => {
const { result } = renderHook(() => useIsOpenState(true, { onClose }));
act(() => {
result.current.close();
});
expect(result.current.isOpen).toBe(false);
expect(onClose).toHaveBeenCalled();
});

it('should call onToggle when toggling', () => {
const { result } = renderHook(() => useIsOpenState(true, { onToggle }));
act(() => {
result.current.toggle();
});
expect(result.current.isOpen).toBe(false);
expect(onToggle).toHaveBeenCalledTimes(1);

act(() => {
result.current.toggle();
});
expect(result.current.isOpen).toBe(true);
expect(onToggle).toHaveBeenCalledTimes(2);
});
});
Loading