import type { ChangeSetSummary, Stack } from '@aws-sdk/client-cloudformation'; import type { StackDiagnosis } from '../../actions/diagnose'; import type { SDK } from '../aws-auth/sdk'; import type { EnvironmentResources } from '../environment'; import type { IoHelper } from '../io/private/io-helper'; import type { ISourceTracer } from '../source-tracing/private/source-tracing'; import type { ResourceErrors } from '../stack-events/resource-errors'; export interface CloudFormationStackDiagnoserProps { readonly sdk: SDK; readonly envResources?: EnvironmentResources; readonly sourceTracer: ISourceTracer; readonly ioHelper: IoHelper; readonly topLevelStackHierarchicalId: string; } /** * Diagnose a stack's failed state * * - First, determine the stack's state. * - If it is in a failed state, we started a deployment that failed. Describe the stack * events, and try to determine the root cause from that. * - If it is in a normal state, see if there are any failed change sets. Either * get the failure message from the change set, or get the failure events from * the change set (early validation). * * This class works at the CloudFormation level, and does not deal with tracing * CloudFormation errors to construct code sources yet. */ export declare class CloudFormationStackDiagnoser { private readonly props; private readonly cfn; private parentStackLogicalIds; constructor(props: CloudFormationStackDiagnoserProps); /** * Diagnose a stack's root cause given no pre-existing state */ diagnoseFromFresh(stackName: string): Promise; /** * Diagnose potential problems with the change set */ diagnoseChangeSet(changeSet: ChangeSetSummary): Promise; /** * Diagnose potential problems with the change set */ diagnoseFromErrorCollection(errors: ResourceErrors, stack: Stack): Promise; /** * Diagnose a deployment failure via stack events * * This is the same logic that the deployment monitor uses. */ private _diagnoseViaStackEvents; private _diagnoseChangeSetFailureFromStackName; /** * Try to diagnose the reason that caused a changeset to fail to create * * There are a couple of different reasons this can happen, and we go through each of them in order. * * Usually this starts from trying to detect an error message pattern in the change set status reason, * and then potentially going to fetch additional information using additional API calls. */ private _diagnoseChangeSetFailure; /** * Try to read the resource-specific reasons for a changeset failure from `DescribeEvents`. * * If we couldn't read the events or there are 0 errors returned by that API, return a generic * error. */ private _reportChangeSetFailureFromEvents; private addErrorTraces; private addErrorTrace; /** * Build a generic stack error from the given change set information * * We can't point to a specific resource. */ private _nonSpecificChangeSetError; /** * Look for nested change sets that have failed, and diagnose those. */ private _diagnoseNestedChangeSetFailure; private _findFailedNestedStack; /** * Try to parse failed auto-imports out from a change set status * * The pattern looks like this: * * ``` * CloudFormation is attempting to import some resources because they already exist in your account. The resources must have the DeletionPolicy attribute set to 'Retain' or 'RetainExceptOnCreate' in the template for successful import. The affected resources are SomeBucketD5B70704 ({BucketName=zomaareenbucket}) * ``` * * Followed by * * ``` * LogicalID ({Prop=Value,Prop=Value}), LogicalID ({Prop=Value}), ... * ``` */ private _tryDetectFailedAutoImport; } /** * Return true if the given change set has no changes * * This must be determined from the status, not the 'Changes' array on the * object; the latter can be empty because no resources were changed, but if * there are changes to Outputs, the change set can still be executed. */ export declare function changeSetHasNoChanges(description: ChangeSetSummary): boolean; //# sourceMappingURL=stack-diagnoser.d.ts.map