import type { GetHookResultCommandOutput, HookResultSummary } from '@aws-sdk/client-cloudformation'; import type { ICloudFormationClient } from '../aws-auth/private'; import type { EnvironmentResources } from '../environment'; import type { IoHelper } from '../io/private'; /** * The relevant parts of a hook result, common to `GetHookResult` outputs and * `ListHookResults` summaries. */ export type HookResultDetails = Pick | HookResultSummary; /** * Format the failure details of a hook result into a human-readable string. * * - Guard Hooks report their details as annotations; failed annotations are * formatted as a list of non-compliant rules. * - Other hooks (e.g. Lambda Hooks or custom hooks) don't emit annotations; their * details live in the top-level `HookStatusReason` of the hook result, which is * usually more detailed than the `HookStatusReason` found on stack events. * * Returns `undefined` if the result carries no failure details. */ export declare function formatHookResultDetails(result: HookResultDetails): string | undefined; /** * Whether the given hook status represents a failure */ export declare function isFailedHookStatus(status: string | undefined): boolean; export interface FetchHookResultDetailsOptions { /** * The IoHelper used to warn when the fetch fails. */ readonly ioHelper: IoHelper; /** * Environment resources, used to look up the bootstrap toolkit version when * diagnosing hook result fetch failures caused by missing permissions. * * @default - Bootstrap version is not reported in error messages */ readonly envResources?: EnvironmentResources; } /** * Fetch a hook invocation's failure details via the `GetHookResult` API and format * them into a human-readable string. * * For Guard Hooks the details come from the failed annotations; for other hooks * (e.g. Lambda Hooks) they come from the hook result's own status reason. * Returns undefined if the fetch fails (emitting a warning, with a bootstrap * upgrade hint if the failure looks permissions-related) or the result carries * no failure details. */ export declare function fetchHookResultDetails(cfn: ICloudFormationClient, hookInvocationId: string, options: FetchHookResultDetailsOptions): Promise; /** * 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. */ export declare function normalizeHookMessage(message: string, maxChars?: number): string; //# sourceMappingURL=hook-result-details.d.ts.map