import type * as cxapi from '@aws-cdk/cloud-assembly-api'; import { type DescribeChangeSetOutput, type TemplateDiff } from '@aws-cdk/cloudformation-diff'; import { PermissionChangeType } from '../../payloads'; import type { NestedStackTemplates, Template } from '../cloudformation'; /** * Output of formatSecurityDiff */ interface FormatSecurityDiffOutput { /** * Complete formatted security diff */ readonly formattedDiff: string; /** * The type of permission changes in the security diff. * The IoHost will use this to decide whether or not to print. */ readonly permissionChangeType: PermissionChangeType; /** * Number of stacks with security changes */ readonly numStacksWithChanges: number; } /** * Output of formatStackDiff */ interface FormatStackDiffOutput { /** * Number of stacks with diff changes */ readonly numStacksWithChanges: number; /** * Complete formatted diff */ readonly formattedDiff: string; } /** * Props for the Diff Formatter */ interface DiffFormatterProps { /** * The relevant information for the Template that is being diffed. * Includes the old/current state of the stack as well as the new state. */ readonly templateInfo: TemplateInfo; } /** * Properties specific to formatting the stack diff */ interface FormatStackDiffOptions { /** * do not filter out AWS::CDK::Metadata or Rules * * @default false */ readonly strict?: boolean; /** * lines of context to use in arbitrary JSON diff * * @default 3 */ readonly contextLines?: number; /** * silences \'There were no differences\' messages * * @default false */ readonly quiet?: boolean; } /** * Properties specific to formatting the security diff */ interface FormatSecurityDiffOptions { /** * silences stack names and 'no changes' messages for stacks without security changes * * @default false */ readonly quiet?: boolean; } /** * Information on a template's old/new state * that is used for diff. */ export interface TemplateInfo { /** * The old/existing template */ readonly oldTemplate: Template; /** * The new template */ readonly newTemplate: cxapi.CloudFormationStackArtifact; /** * A CloudFormation ChangeSet to help the diff operation. * Probably created via `createDiffChangeSet`. * * @default undefined */ readonly changeSet?: DescribeChangeSetOutput; /** * Whether or not there are any imported resources * * @default false */ readonly isImport?: boolean; /** * Any nested stacks included in the template * * @default {} */ readonly nestedStacks?: { [nestedStackLogicalId: string]: NestedStackTemplates; }; /** * Mappings of old locations to new locations. If these are provided, * for all resources that were moved, their corresponding addition * and removal lines will be augmented with the location they were * moved fom and to, respectively. */ readonly mappings?: Record; } /** * Class for formatting the diff output */ export declare class DiffFormatter { private readonly templateInfo; private readonly stackName; private readonly isImport; private readonly mappings; /** * Cache of computed TemplateDiffs, indexed by stack name. */ private readonly cache; constructor(props: DiffFormatterProps); get diffs(): { [k: string]: TemplateDiff; }; /** * Compute the diff for a single stack. Results are cached by stack name. * * @param stackName - The name to cache the diff under * @param oldTemplate - The deployed template * @param newTemplate - The new/generated template (read from the artifact) * @param changeSet - The CloudFormation changeset for this specific stack, if available * @param mappings - Resource move mappings */ private computeDiff; /** * Format the stack diff, including all nested stacks. */ formatStackDiff(options?: FormatStackDiffOptions): FormatStackDiffOutput; private formatStackDiffHelper; /** * Format the security diff, including all nested stacks. */ formatSecurityDiff(options?: FormatSecurityDiffOptions): FormatSecurityDiffOutput; private formatSecurityDiffHelper; } export {}; //# sourceMappingURL=diff-formatter.d.ts.map