UNPKG

cdk-insights

Version:

AWS CDK security and cost analysis tool with AI-powered insights

53 lines (52 loc) 2.27 kB
import type { AnalyzeResourceFn } from '../helpers/analyzeResource/analyzeResource'; import { FileBasedCache } from '../helpers/cache/fileBasedCache'; import type { RedactResourcesFn } from '../helpers/redactResources/redactResources'; import type { CloudFormationResource, AnalysisResult as ImportedAnalysisResult, Issue, SingleResourceAnalysis } from '../types/analysis.types'; import type { ErrorHandler } from './types/cli.types'; interface ConcurrencyConfig { maxConcurrent: number; retryAttempts: number; retryDelay: number; timeoutMs: number; } export interface CreateResourceAnalyzerParams { analyzeResource: AnalyzeResourceFn; redactionMapping: Record<string, string>; aggregatedResult: Record<string, { issues: Issue[]; resourceName?: string; }>; errorHandler: ErrorHandler; config: ConcurrencyConfig; authToken: string; fingerprint: string; stackName: string; analysisCache: FileBasedCache<SingleResourceAnalysis>; } export interface ResourceAnalyzerParams { redactedId: string; redactedResources: Record<string, CloudFormationResource>; findingsByResource: Map<string, Issue[]>; progressTracker?: { startJob: (jobId: string, resourceId: string) => void; updateJobStatus: (jobId: string, resourceId: string, status: string, attempt: number) => void; completeJob: (jobId: string, resourceId: string) => void; failJob: (jobId: string, resourceId: string, error: string) => void; timeoutJob: (jobId: string, resourceId: string) => void; }; } export interface CreateResourceHandlerParams { analyzeResource: AnalyzeResourceFn; redactResources: RedactResourcesFn; config?: ConcurrencyConfig; } export interface ResourceHandlerParams { stackName: string; resources: Record<string, CloudFormationResource>; authToken: string; existingFindingsMap: Issue[]; pathToLogicalId: Record<string, string>; fingerprint: string; } export declare const createResourceHandler: ({ analyzeResource, redactResources, config, }: CreateResourceHandlerParams) => ({ stackName, resources, authToken, existingFindingsMap, pathToLogicalId, fingerprint, }: ResourceHandlerParams) => Promise<ImportedAnalysisResult>; export {};