| 1 | import type * as controltower from "@distilled.cloud/aws/controltower"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { EnabledControl } from "./EnabledControl.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `controltower:GetEnabledControl`. |
| 8 | * |
| 9 | * Bind this operation to an {@link EnabledControl} to read the enablement's |
| 10 | * live status, drift status, and parameters from inside a function runtime. |
| 11 | * Useful for drift-monitoring functions that alert when a guardrail drifts. |
| 12 | * Provide the implementation with |
| 13 | * `Effect.provide(AWS.ControlTower.GetEnabledControlHttp)`. |
| 14 | * ### Inspecting an Enabled Control |
| 15 | * **Example:** Read the Enabled Control's Drift Status |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the enabled control |
| 18 | * const getEnabledControl = yield* AWS.ControlTower.GetEnabledControl(guardrail); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const { enabledControlDetails } = yield* getEnabledControl(); |
| 22 | * console.log(enabledControlDetails.driftStatusSummary?.driftStatus); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface GetEnabledControl extends Binding.Service< |
| 28 | GetEnabledControl, |
| 29 | "AWS.ControlTower.GetEnabledControl", |
| 30 | ( |
| 31 | enabledControl: EnabledControl, |
| 32 | ) => Effect.Effect< |
| 33 | () => Effect.Effect< |
| 34 | controltower.GetEnabledControlOutput, |
| 35 | controltower.GetEnabledControlError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | |
| 40 | export const GetEnabledControl = Binding.Service<GetEnabledControl>( |
| 41 | "AWS.ControlTower.GetEnabledControl", |
| 42 | ); |