| 1 | import type * as cloudformation from "@distilled.cloud/aws/cloudformation"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Stack } from "./Stack.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `DescribeStackEvents` operation (IAM action |
| 8 | * `cloudformation:DescribeStackEvents`). |
| 9 | * |
| 10 | * Bind this operation to a {@link Stack} to read its event history — |
| 11 | * per-resource create/update/delete progress and failure reasons — from |
| 12 | * inside a function runtime. Useful for deployment dashboards and failure |
| 13 | * alerting. Provide the implementation with |
| 14 | * `Effect.provide(AWS.CloudFormation.DescribeStackEventsHttp)`. |
| 15 | * ### Reading Stacks |
| 16 | * **Example:** Read Recent Stack Events |
| 17 | * ```typescript |
| 18 | * const describeStackEvents = |
| 19 | * yield* AWS.CloudFormation.DescribeStackEvents(stack); |
| 20 | * |
| 21 | * const { StackEvents } = yield* describeStackEvents(); |
| 22 | * const failures = (StackEvents ?? []).filter( |
| 23 | * (e) => e.ResourceStatus?.endsWith("_FAILED"), |
| 24 | * ); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface DescribeStackEvents extends Binding.Service< |
| 30 | DescribeStackEvents, |
| 31 | "AWS.CloudFormation.DescribeStackEvents", |
| 32 | ( |
| 33 | stack: Stack, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request?: Omit<cloudformation.DescribeStackEventsInput, "StackName">, |
| 37 | ) => Effect.Effect< |
| 38 | cloudformation.DescribeStackEventsOutput, |
| 39 | cloudformation.DescribeStackEventsError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const DescribeStackEvents = Binding.Service<DescribeStackEvents>( |
| 44 | "AWS.CloudFormation.DescribeStackEvents", |
| 45 | ); |