| 1 | import type * as budgets from "@distilled.cloud/aws/budgets"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { BudgetAction } from "./BudgetAction.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link ExecuteBudgetAction} — the bound action's `AccountId`, |
| 8 | * `BudgetName`, and `ActionId` are injected automatically. |
| 9 | */ |
| 10 | export interface ExecuteBudgetActionRequest extends Omit< |
| 11 | budgets.ExecuteBudgetActionRequest, |
| 12 | "AccountId" | "BudgetName" | "ActionId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `budgets:ExecuteBudgetAction`. |
| 17 | * |
| 18 | * Bind this operation to a {@link BudgetAction} to approve, retry, reverse, |
| 19 | * or reset it from inside a function runtime — e.g. an approval workflow that |
| 20 | * approves a pending kill-switch, or an automated recovery that reverses it |
| 21 | * at the start of a new period. Provide the implementation with |
| 22 | * `Effect.provide(AWS.Budgets.ExecuteBudgetActionHttp)`. |
| 23 | * ### Executing Budget Actions |
| 24 | * **Example:** Approve a Pending Action |
| 25 | * ```typescript |
| 26 | * // init — bind the operation to the action |
| 27 | * const execute = yield* AWS.Budgets.ExecuteBudgetAction(action); |
| 28 | * |
| 29 | * // runtime |
| 30 | * yield* execute({ ExecutionType: "APPROVE_BUDGET_ACTION" }); |
| 31 | * ``` |
| 32 | * |
| 33 | * **Example:** Reverse an Executed Action |
| 34 | * ```typescript |
| 35 | * yield* execute({ ExecutionType: "REVERSE_BUDGET_ACTION" }); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface ExecuteBudgetAction extends Binding.Service< |
| 41 | ExecuteBudgetAction, |
| 42 | "AWS.Budgets.ExecuteBudgetAction", |
| 43 | ( |
| 44 | action: BudgetAction, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: ExecuteBudgetActionRequest, |
| 48 | ) => Effect.Effect< |
| 49 | budgets.ExecuteBudgetActionResponse, |
| 50 | budgets.ExecuteBudgetActionError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | |
| 55 | export const ExecuteBudgetAction = Binding.Service<ExecuteBudgetAction>( |
| 56 | "AWS.Budgets.ExecuteBudgetAction", |
| 57 | ); |