| 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 `DescribeStacks` operation (IAM action |
| 8 | * `cloudformation:DescribeStacks`). |
| 9 | * |
| 10 | * Bind this operation to a {@link Stack} to read its live status, parameters, |
| 11 | * and template outputs from inside a function runtime — the classic |
| 12 | * service-discovery pattern of resolving endpoints/ARNs from a stack's |
| 13 | * outputs. Provide the implementation with |
| 14 | * `Effect.provide(AWS.CloudFormation.DescribeStacksHttp)`. |
| 15 | * ### Reading Stacks |
| 16 | * **Example:** Read a Stack's Outputs |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the stack |
| 19 | * const describeStacks = yield* AWS.CloudFormation.DescribeStacks(stack); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { Stacks } = yield* describeStacks(); |
| 23 | * const outputs = Stacks?.[0]?.Outputs ?? []; |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface DescribeStacks extends Binding.Service< |
| 29 | DescribeStacks, |
| 30 | "AWS.CloudFormation.DescribeStacks", |
| 31 | ( |
| 32 | stack: Stack, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request?: Omit<cloudformation.DescribeStacksInput, "StackName">, |
| 36 | ) => Effect.Effect< |
| 37 | cloudformation.DescribeStacksOutput, |
| 38 | cloudformation.DescribeStacksError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | export const DescribeStacks = Binding.Service<DescribeStacks>( |
| 43 | "AWS.CloudFormation.DescribeStacks", |
| 44 | ); |