| 1 | import type * as dlm from "@distilled.cloud/aws/dlm"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { LifecyclePolicy } from "./LifecyclePolicy.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `dlm:GetLifecyclePolicy`. |
| 8 | * |
| 9 | * Reads the bound {@link LifecyclePolicy}'s full detail — state (including |
| 10 | * the observed-only `ERROR`), status message, execution role, and the |
| 11 | * complete policy document — so an ops function can audit backup coverage |
| 12 | * or alert on a policy that stopped running. The policy id is injected from |
| 13 | * the binding. Provide the implementation with |
| 14 | * `Effect.provide(AWS.DLM.GetLifecyclePolicyHttp)`. |
| 15 | * ### Monitoring Lifecycle Policies |
| 16 | * **Example:** Check A Policy's State |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the lifecycle policy |
| 19 | * const getLifecyclePolicy = yield* AWS.DLM.GetLifecyclePolicy(policy); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { Policy } = yield* getLifecyclePolicy(); |
| 23 | * if (Policy?.State === "ERROR") { |
| 24 | * yield* Effect.logError(`DLM policy failed: ${Policy.StatusMessage}`); |
| 25 | * } |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetLifecyclePolicy extends Binding.Service< |
| 31 | GetLifecyclePolicy, |
| 32 | "AWS.DLM.GetLifecyclePolicy", |
| 33 | ( |
| 34 | policy: LifecyclePolicy, |
| 35 | ) => Effect.Effect< |
| 36 | () => Effect.Effect< |
| 37 | dlm.GetLifecyclePolicyResponse, |
| 38 | dlm.GetLifecyclePolicyError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | export const GetLifecyclePolicy = Binding.Service<GetLifecyclePolicy>( |
| 43 | "AWS.DLM.GetLifecyclePolicy", |
| 44 | ); |