import type { PolicyValidationReportJson } from '@aws-cdk/cloud-assembly-schema'; import type { ConstructTree, ConstructTrace } from './construct-tree'; import * as report from '../report'; /** * Validation produced by the validation plugin, in construct terms. */ export interface PolicyViolationConstructAware extends report.PolicyViolation { /** * The constructs violating this rule. */ readonly violatingConstructs: ValidationViolatingConstruct[]; } /** * Construct violating a specific rule. */ export interface ValidationViolatingConstruct extends report.PolicyViolatingResource { /** * The construct path as defined in the application. * * @default - construct path will be empty if the cli is not run with `--debug` */ readonly constructPath?: string; /** * A stack of constructs that lead to the violation. * * @default - stack will be empty if the cli is not run with `--debug` */ readonly constructStack?: ConstructTrace; } /** * JSON representation of the report. */ export interface LegacyPolicyValidationReportJson { /** * Report title. */ readonly title: string; /** * Reports for all of the validation plugins registered * in the app */ readonly pluginReports: LegacyPluginReportJson[]; } /** * A report from a single plugin */ export interface LegacyPluginReportJson { /** * List of violations in the report. */ readonly violations: PolicyViolationConstructAware[]; /** * Report summary. */ readonly summary: LegacyPolicyValidationReportSummary; /** * Plugin version. */ readonly version?: string; } /** * Summary of the report. */ export interface LegacyPolicyValidationReportSummary { /** * The final status of the validation (pass/fail) */ readonly status: report.PolicyValidationReportStatus; /** * The name of the plugin that created the report */ readonly pluginName: string; /** * Additional metadata about the report. This property is intended * to be used by plugins to add additional information. * * @default - no metadata */ readonly metadata?: { readonly [key: string]: string; }; } /** * The report containing the name of the plugin that created it. */ export interface NamedValidationPluginReport extends report.PolicyValidationPluginReport { /** * The name of the plugin that created the report */ readonly pluginName: string; } /** * A violation that was suppressed, carrying acknowledgement metadata. * Used internally to pass suppressed violations from synthesis to the formatter. */ export interface SuppressedViolation extends report.PolicyViolation { readonly acknowledgedId: string; readonly reason?: string; readonly acknowledgedAt?: string; readonly acknowledgedStackTrace?: string; } /** * The report emitted by the plugin after evaluation. */ export declare class PolicyValidationReportFormatter { private readonly tree; private readonly reportTrace; constructor(tree: ConstructTree); formatLegacyJson(reps: NamedValidationPluginReport[]): LegacyPolicyValidationReportJson; formatJson(reps: NamedValidationPluginReport[], schemaVersion: string, suppressedByReport?: Map): PolicyValidationReportJson; private formatViolationJson; private formatSuppressedViolationJson; private buildPluginReports; /** * Returns all stack traces on the root path of the construct tree for the given construct path. * * First element of the array will be the stack trace of the root, the next * the stack trace of the first stack, etc. The last element of the array will * be the stack trace of the construct itself. */ private creationStackTrace; } export declare function mkPluginFailure(plugin: { name: string; version?: string; }, e: Error): NamedValidationPluginReport; export declare function isPluginFailure(rep: NamedValidationPluginReport): string | undefined; /** * Report whether it is possible to suppress this violation. * * Violations that are reported as "fatal", or that have been converted from annotations, cannot be suppressed. */ export declare function isSuppressibleViolation(violation: { severity?: string; ruleMetadata?: { [key: string]: string; }; }): boolean;