| 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 `DetectStackDrift` operation (IAM actions |
| 8 | * `cloudformation:DetectStackDrift` + `cloudformation:DetectStackResourceDrift` |
| 9 | * — AWS authorizes both on the per-stack call). |
| 10 | * |
| 11 | * Bind this operation to a {@link Stack} to start drift detection from inside |
| 12 | * a function runtime — e.g. a scheduled drift monitor. Detection runs |
| 13 | * asynchronously; poll the returned `StackDriftDetectionId` with |
| 14 | * {@link DescribeStackDriftDetectionStatus}. Note that CloudFormation reads |
| 15 | * the live state of the stack's resources with the caller's credentials, so |
| 16 | * the function also needs read access to the resource types in the template |
| 17 | * for the detection to complete. Provide the implementation with |
| 18 | * `Effect.provide(AWS.CloudFormation.DetectStackDriftHttp)`. |
| 19 | * ### Drift Detection |
| 20 | * **Example:** Start Drift Detection |
| 21 | * ```typescript |
| 22 | * const detectStackDrift = yield* AWS.CloudFormation.DetectStackDrift(stack); |
| 23 | * |
| 24 | * const { StackDriftDetectionId } = yield* detectStackDrift(); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface DetectStackDrift extends Binding.Service< |
| 30 | DetectStackDrift, |
| 31 | "AWS.CloudFormation.DetectStackDrift", |
| 32 | ( |
| 33 | stack: Stack, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request?: Omit<cloudformation.DetectStackDriftInput, "StackName">, |
| 37 | ) => Effect.Effect< |
| 38 | cloudformation.DetectStackDriftOutput, |
| 39 | cloudformation.DetectStackDriftError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const DetectStackDrift = Binding.Service<DetectStackDrift>( |
| 44 | "AWS.CloudFormation.DetectStackDrift", |
| 45 | ); |