diff --git a/src/commands/entity_store/index.ts b/src/commands/entity_store/index.ts index 523b74f1..7d1d4112 100644 --- a/src/commands/entity_store/index.ts +++ b/src/commands/entity_store/index.ts @@ -1,16 +1,11 @@ -import { type Command } from 'commander'; -import { type CommandModule } from '../types.ts'; -import { wrapAction } from '../utils/cli_utils.ts'; -import { log } from '../../utils/logger.ts'; -import { - ENTITY_STORE_OPTIONS, - ENTITY_MAINTAINERS_OPTIONS, - generateNewSeed, -} from '../../constants.ts'; -import type { EntityMaintainerOption } from '../../constants.ts'; -import { cleanEntityStore, generateEntityStore } from './entity_store.ts'; -import { setupEntityResolutionDemo } from './entity_resolution.ts'; -import { generateEntityMaintainersData } from './entity_maintainers.ts'; +import { Command } from 'commander'; +import { CommandModule } from '../types'; +import { wrapAction } from '../utils/cli_utils'; +import { ENTITY_STORE_OPTIONS, ENTITY_MAINTAINERS_CONFIG, generateNewSeed } from '../../constants'; +import type { EntityMaintainerOption } from '../../constants'; +import { cleanEntityStore, generateEntityStore } from './entity_store'; +import { setupEntityResolutionDemo } from './entity_resolution'; +import { generateEntityMaintainersData } from './entity_maintainers'; import { promptForNumericInputs, promptForSelection, @@ -140,50 +135,27 @@ export const entityStoreCommands: CommandModule = { ) .option('--space ', 'Kibana space ID', 'default') .option('--quick', 'Run all maintainers for 10000 entities without prompts') + .option('--exclude-wl', 'Exclude watchlists when running with --quick', false) .action( - wrapAction(async ({ space, quick }: { space: string; quick?: boolean }) => { + wrapAction(async ({ space, quick, excludeWl }: { space: string; quick?: boolean; excludeWl?: boolean }) => { if (quick) { + const maintainers = ENTITY_MAINTAINERS_CONFIG.filter( + (maintainer) => maintainer.quickDefault && (!excludeWl || !maintainer.excludeOnQuick), + ).map((maintainer) => maintainer.key); await generateEntityMaintainersData({ count: 10000, - maintainers: Object.values(ENTITY_MAINTAINERS_OPTIONS) as EntityMaintainerOption[], + maintainers, space, }); return; } const selectedMaintainers = await promptForSelection({ message: 'Select maintainers to generate data for', - choices: [ - { - name: 'Risk Score', - value: ENTITY_MAINTAINERS_OPTIONS.riskScore, - checked: true, - }, - { - name: 'Asset Criticality', - value: ENTITY_MAINTAINERS_OPTIONS.assetCriticality, - checked: true, - }, - { - name: 'Anomaly Behaviors', - value: ENTITY_MAINTAINERS_OPTIONS.anomalyBehaviors, - checked: true, - }, - { - name: 'Relationships', - value: ENTITY_MAINTAINERS_OPTIONS.relationships, - checked: true, - }, - { - name: 'Watchlist', - value: ENTITY_MAINTAINERS_OPTIONS.watchlist, - checked: true, - }, - { - name: 'Snapshot (30-day history)', - value: ENTITY_MAINTAINERS_OPTIONS.snapshot, - checked: true, - }, - ], + choices: ENTITY_MAINTAINERS_CONFIG.map((maintainer) => ({ + name: maintainer.label, + value: maintainer.key, + checked: maintainer.defaultChecked, + })), }); if (selectedMaintainers.length === 0) { diff --git a/src/commands/org_data/index.ts b/src/commands/org_data/index.ts index f1f971be..0f7b41d8 100644 --- a/src/commands/org_data/index.ts +++ b/src/commands/org_data/index.ts @@ -40,12 +40,17 @@ export const orgDataCommands: CommandModule = { .alias('org-data-quick') .alias('organization-quick') .description( - 'Quick correlated organization data generation with defaults (medium size, all integrations)', + 'Quick correlated organization data generation with defaults (medium size)', ) .option('--space ', 'Kibana space', 'default') + .option( + '--privmon-wl', + 'Use Privileged User Monitoring watchlist integrations (active_directory, okta, okta_system)', + false, + ) .action( wrapAction(async (options) => { - await runOrgDataQuick(options.space); + await runOrgDataQuick(options.space, { privmonWatchlist: options.privmonWl }); }), ); }, diff --git a/src/constants.ts b/src/constants.ts index c0205abf..3a8c111d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,6 +32,54 @@ export const ENTITY_MAINTAINERS_OPTIONS = { export type EntityMaintainerOption = (typeof ENTITY_MAINTAINERS_OPTIONS)[keyof typeof ENTITY_MAINTAINERS_OPTIONS]; +export type EntityMaintainerConfig = { + key: EntityMaintainerOption; + label: string; + defaultChecked: boolean; + quickDefault: boolean; + excludeOnQuick?: boolean; +}; + +export const ENTITY_MAINTAINERS_CONFIG: EntityMaintainerConfig[] = [ + { + key: ENTITY_MAINTAINERS_OPTIONS.riskScore, + label: 'Risk Score', + defaultChecked: true, + quickDefault: true, + }, + { + key: ENTITY_MAINTAINERS_OPTIONS.assetCriticality, + label: 'Asset Criticality', + defaultChecked: true, + quickDefault: true, + }, + { + key: ENTITY_MAINTAINERS_OPTIONS.anomalyBehaviors, + label: 'Anomaly Behaviors', + defaultChecked: true, + quickDefault: true, + }, + { + key: ENTITY_MAINTAINERS_OPTIONS.relationships, + label: 'Relationships', + defaultChecked: true, + quickDefault: true, + }, + { + key: ENTITY_MAINTAINERS_OPTIONS.watchlist, + label: 'Watchlist', + defaultChecked: true, + quickDefault: true, + excludeOnQuick: true, + }, + { + key: ENTITY_MAINTAINERS_OPTIONS.snapshot, + label: 'Snapshot (30-day history)', + defaultChecked: true, + quickDefault: true, + }, +]; + export const PRIVILEGED_USER_MONITORING_OPTIONS = { anomalyData: 'anomalyData', sourceEventData: 'sourceEventData',