import type { CloudFormationStackArtifact } from '@aws-cdk/cloud-assembly-api'; import type { ICloudFormationClient } from '../aws-auth/private'; import type { EnvironmentResources } from '../environment'; import { type IoHelper } from '../io/private'; export interface StackActivityMonitorProps { /** * The CloudFormation client */ readonly cfn: ICloudFormationClient; /** * The IoHelper used for messaging */ readonly ioHelper: IoHelper; /** * The stack artifact that is getting deployed */ readonly stack: CloudFormationStackArtifact; /** * The ARN of the Stack that is getting deployed */ readonly stackArn: string; /** * Total number of resources to update * * Used to calculate a progress bar. * * @default - No progress reporting */ readonly resourcesTotal?: number; /** * Creation time of the change set * * This will be used to filter events, only showing those from after the change * set creation time. * * It is recommended to use this, otherwise the filtering will be subject * to clock drift between local and cloud machines. * * @default - Local machine's current time */ readonly changeSetCreationTime?: Date; /** * Time to wait between fetching new activities. * * Must wait a reasonable amount of time between polls, since we need to consider CloudFormation API limits * * @default 2_000 */ readonly pollingInterval?: number; /** * Environment resources, used to look up the bootstrap toolkit version when * diagnosing Guard Hook annotation fetch failures. * * @default - Bootstrap version is not reported in error messages */ readonly envResources?: EnvironmentResources; } /** * Drives the monitoring of a Stack deployment * * ``` * ┌───────────────────────┐ ┌───────────────────────┐ ┌───────────────────────┐ * │ Stack │ poll() │ Stack │ process(ev) │ Stack │ * │ EventPoller │◀───────│ ActivityMonitor │─────────────▶│ ProgressMonitor │ * └───────────────────────┘ └───────────────────────┘ └───────────────────────┘ * ``` */ export declare class StackActivityMonitor { /** * The poller used to read stack events */ private readonly poller; /** * Fetch new activity every 1 second * Printers can decide to update a view less frequently if desired */ private readonly pollingInterval; private monitorId?; private readonly progressMonitor; /** * Current tick timer */ private tickTimer?; /** * Set to the activity of reading the current events */ private readPromise?; private readonly ioHelper; private readonly stackDisplayName; private readonly stack; private readonly cfn; private readonly envResources?; constructor({ cfn, ioHelper, stack, stackArn, resourcesTotal, changeSetCreationTime, pollingInterval, envResources, }: StackActivityMonitorProps); /** * The resource errors that were discovered during monitoring of this stack */ get errors(): import("./resource-errors").ResourceErrors; start(): Promise; stop(): Promise; private scheduleNextTick; private tick; private findMetadataFor; /** * Trims leading/trailing whitespace, collapses all internal whitespace * (including newlines) to a single space, and truncates to `maxChars` * characters, appending `[...truncated]` when the original was longer. */ private normalizeMessage; /** * Fetches Guard Hook annotation details via GetHookResult API and formats them * into a human-readable string. Returns undefined if the fetch fails or there * are no failed annotations. */ private fetchGuardHookAnnotations; /** * Reads all new events from the stack history * * The events are returned in chronological order by the underlying poller. */ private readNewEvents; /** * Perform a final poll to the end and flush out all events to the printer * * Finish any poll currently in progress, then do a final one until we've * reached the last page. */ private finalPollToEnd; /** * Formats a stack activity into a basic string */ private formatActivity; } //# sourceMappingURL=stack-activity-monitor.d.ts.map