import type { StackEvent } from '@aws-sdk/client-cloudformation'; import type { ResourceEvent } from './stack-event-poller'; /** * A failed CloudFormation Hook invocation that caused a resource error. */ export interface ResourceHookFailure { /** * The type name of the hook that failed (e.g. `Private::Guard::TestHook`) */ readonly hookType: string; /** * The unique identifier of the hook invocation. * * Can be used to fetch the full failure details via the `GetHookResult` API. */ readonly hookInvocationId?: string; /** * The status reason reported on the hook's stack event. * * This is usually a terse summary; the `GetHookResult` API has richer details. */ readonly hookStatusReason?: string; } export interface ResourceError { /** * The stack this resource error occurred in * * NOTE: This will be a stack ID (which is a full ARN including the unique identifier), * not just a name. */ readonly stackArn: string; /** * IDs of parent stacks of the resource, in case of resources in nested stacks */ readonly parentStackLogicalIds: string[]; /** * Logical ID of the resource * * (May be absent in case this message is about the stack itself) */ readonly logicalId?: string; /** * Resource type */ readonly resourceType?: string; /** * Physical ID of the resource */ readonly physicalId?: string; /** * Error message of the resource */ readonly message: string; /** * Error code of the resource */ readonly errorCode?: string; /** * Timestamp of the failure event, if known. * * Used to bound exploratory lookups (e.g. CloudWatch Logs queries) to the time * around the failure. This matters for resources whose logs span multiple * deployments (creates, updates, rollbacks), where the most recent invocation * is not necessarily the one that failed. * * Only populated for errors derived from stack events; absent for change-set * and early-validation errors. */ readonly timestamp?: Date; /** * CloudFormation Hook failures that caused this resource error, if any. * * Hook failures are reported on separate stack events from the resource failure * itself; they are correlated to the resource error by logical ID and by the * hook type appearing in the resource's status reason. */ readonly hookFailures?: ResourceHookFailure[]; } /** * Class used to send stack event errors into, to come up with root causes. */ export declare class ResourceErrors { /** * A list of all non-cancellation errors we have seen. * * By the nature of the order we see events in, will be ordered from oldest to newest. */ private readonly _errors; /** * Failed hook invocations seen so far, keyed by stack ARN + logical ID of the * resource they were invoked on. * * Hook failures are reported on their own events (usually with an `IN_PROGRESS` * resource status), before the resource failure event they cause. We remember * them here so they can be attached to that resource error when it arrives. */ private readonly seenHookFailures; isEmpty(): boolean; get all(): ReadonlyArray; /** * Update the error collection with the given stack activity * * May be from a nested stack as well. * * This class expects to see all events in chronological order. */ update(...events: ResourceEvent[]): void; private trackHookFailure; /** * Return the hook failures that caused the given resource failure, if any. * * A hook failure belongs to a resource failure when it was recorded for the same * resource, and its hook type is mentioned in the resource's status reason (e.g. * "The following hook(s) failed: [Private::Guard::TestHook]"). */ private hookFailuresFor; /** * Take our best guess at the error code of the root cause * * The first error that occurs is the root cause. */ get rootCauseErrorCode(): string | undefined; /** * Return error messages of all encountered errors (that aren't cancellations) */ get allErrorMessages(): string[]; /** * Return error codeds of all encountered errors (that aren't cancellations nor stack errors) * * We don't need to include nested stack errors because our poller will poll the nested stack, * and have returned the actual error as well. */ get allErrorCodes(): string[]; } /** * Extract an error code from the given stack event. * * Always contains the services, and includes the handler error code if available. */ export declare function extractErrorCode(event: StackEvent): string; //# sourceMappingURL=resource-errors.d.ts.map