Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -17,6 +17,13 @@ export const SIEM_RULE_MIGRATION_STOP_PATH = `${SIEM_RULE_MIGRATION_PATH}/stop`

export const SIEM_RULE_MIGRATION_RESOURCES_PATH = `${SIEM_RULE_MIGRATION_PATH}/resources` as const;

export enum SiemMigrationTaskStatus {
READY = 'ready',
RUNNING = 'running',
STOPPED = 'stopped',
FINISHED = 'finished',
}

export enum SiemMigrationStatus {
PENDING = 'pending',
PROCESSING = 'processing',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,7 @@ export type UpsertRuleMigrationResourcesRequestParamsInput = z.input<
export type UpsertRuleMigrationResourcesRequestBody = z.infer<
typeof UpsertRuleMigrationResourcesRequestBody
>;
export const UpsertRuleMigrationResourcesRequestBody = z.array(
RuleMigrationResourceData.merge(
z.object({
/**
* The rule resource migration id
*/
id: NonEmptyString,
})
)
);
export const UpsertRuleMigrationResourcesRequestBody = z.array(RuleMigrationResourceData);
export type UpsertRuleMigrationResourcesRequestBodyInput = z.input<
typeof UpsertRuleMigrationResourcesRequestBody
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ paths:
summary: Creates a new rule migration
operationId: CreateRuleMigration
x-codegen-enabled: true
x-internal: true
description: Creates a new SIEM rules migration using the original vendor rules provided
tags:
- SIEM Rule Migrations
Expand Down Expand Up @@ -39,6 +40,7 @@ paths:
summary: Updates rules migrations
operationId: UpdateRuleMigration
x-codegen-enabled: true
x-internal: true
description: Updates rules migrations attributes
tags:
- SIEM Rule Migrations
Expand Down Expand Up @@ -84,6 +86,7 @@ paths:
summary: Retrieves the stats for all rule migrations
operationId: GetAllStatsRuleMigration
x-codegen-enabled: true
x-internal: true
description: Retrieves the rule migrations stats for all migrations stored in the system
tags:
- SIEM Rule Migrations
Expand All @@ -104,6 +107,7 @@ paths:
summary: Retrieves all the rules of a migration
operationId: GetRuleMigration
x-codegen-enabled: true
x-internal: true
description: Retrieves the rule documents stored in the system given the rule migration id
tags:
- SIEM Rule Migrations
Expand Down Expand Up @@ -131,6 +135,7 @@ paths:
summary: Starts a rule migration
operationId: StartRuleMigration
x-codegen-enabled: true
x-internal: true
description: Starts a SIEM rules migration using the migration id provided
tags:
- SIEM Rule Migrations
Expand Down Expand Up @@ -175,6 +180,7 @@ paths:
summary: Gets a rule migration task stats
operationId: GetRuleMigrationStats
x-codegen-enabled: true
x-internal: true
description: Retrieves the stats of a SIEM rules migration using the migration id provided
tags:
- SIEM Rule Migrations
Expand All @@ -200,6 +206,7 @@ paths:
summary: Stops an existing rule migration
operationId: StopRuleMigration
x-codegen-enabled: true
x-internal: true
description: Stops a running SIEM rules migration using the migration id provided
tags:
- SIEM Rule Migrations
Expand Down Expand Up @@ -233,6 +240,7 @@ paths:
summary: Creates or updates rule migration resources for a migration
operationId: UpsertRuleMigrationResources
x-codegen-enabled: true
x-internal: true
description: Creates or updates resources for an existing SIEM rules migration
tags:
- SIEM Rule Migrations
Expand All @@ -251,15 +259,7 @@ paths:
schema:
type: array
items:
allOf:
- $ref: '../../rule_migration.schema.yaml#/components/schemas/RuleMigrationResourceData'
- type: object
required:
- id
properties:
id:
description: The rule resource migration id
$ref: '../../common.schema.yaml#/components/schemas/NonEmptyString'
$ref: '../../rule_migration.schema.yaml#/components/schemas/RuleMigrationResourceData'
responses:
200:
description: Indicates migration resources have been created or updated correctly.
Expand All @@ -278,6 +278,7 @@ paths:
summary: Gets rule migration resources for a migration
operationId: GetRuleMigrationResources
x-codegen-enabled: true
x-internal: true
description: Retrieves resources for an existing SIEM rules migration
tags:
- SIEM Rule Migrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export type RuleMigrationTranslationResultEnum = typeof RuleMigrationTranslation
export const RuleMigrationTranslationResultEnum = RuleMigrationTranslationResult.enum;

/**
* The status of the rule migration process.
* The status of each rule migration.
*/
export type RuleMigrationStatus = z.infer<typeof RuleMigrationStatus>;
export const RuleMigrationStatus = z.enum(['pending', 'processing', 'completed', 'failed']);
Expand Down Expand Up @@ -186,6 +186,14 @@ export const RuleMigration = z
})
.merge(RuleMigrationData);

/**
* The status of the migration task.
*/
export type RuleMigrationTaskStatus = z.infer<typeof RuleMigrationTaskStatus>;
export const RuleMigrationTaskStatus = z.enum(['ready', 'running', 'stopped', 'finished']);
export type RuleMigrationTaskStatusEnum = typeof RuleMigrationTaskStatus.enum;
export const RuleMigrationTaskStatusEnum = RuleMigrationTaskStatus.enum;

/**
* The rule migration task stats object.
*/
Expand All @@ -198,7 +206,7 @@ export const RuleMigrationTaskStats = z.object({
/**
* Indicates if the migration task status.
*/
status: z.enum(['ready', 'running', 'stopped', 'finished']),
status: RuleMigrationTaskStatus,
/**
* The rules migration stats.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,8 @@ components:
description: The migration id
$ref: './common.schema.yaml#/components/schemas/NonEmptyString'
status:
type: string
description: Indicates if the migration task status.
enum:
- ready
- running
- stopped
- finished
$ref: '#/components/schemas/RuleMigrationTaskStatus'
rules:
type: object
description: The rules migration stats.
Expand Down Expand Up @@ -194,6 +189,15 @@ components:
type: string
description: The moment of the last update.

RuleMigrationTaskStatus:
type: string
description: The status of the migration task.
enum: # should match SiemMigrationTaskStatus enum at ../constants.ts
- ready
- running
- stopped
- finished

RuleMigrationTranslationResult:
type: string
description: The rule translation result.
Expand All @@ -204,7 +208,7 @@ components:

RuleMigrationStatus:
type: string
description: The status of the rule migration process.
description: The status of each rule migration.
enum: # should match SiemMigrationsStatus enum at ../constants.ts
- pending
- processing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@
export const mockReportCardOpen = jest.fn();
export const mockReportCardComplete = jest.fn();
export const mockReportCardLinkClicked = jest.fn();

export const telemetry = {
reportCardOpen: mockReportCardOpen,
reportCardComplete: mockReportCardComplete,
reportCardLinkClicked: mockReportCardLinkClicked,
};
export const mockTelemetry = jest.fn(() => telemetry);

export const onboardingContext = {
spaceId: 'default',
telemetry: mockTelemetry(),
config: new Map(),
};
export const mockOnboardingContext = jest.fn(() => onboardingContext);
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,8 @@
*/

import type { OnboardingContextValue } from '../onboarding_context';
import {
mockReportCardOpen,
mockReportCardComplete,
mockReportCardLinkClicked,
} from './onboarding_context_mocks';
import { mockOnboardingContext } from './mocks';

export const useOnboardingContext = (): OnboardingContextValue => {
return {
spaceId: 'default',
reportCardOpen: mockReportCardOpen,
reportCardComplete: mockReportCardComplete,
reportCardLinkClicked: mockReportCardLinkClicked,
};
return mockOnboardingContext();
};
Loading