| 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 { Budget } from "./Budget.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link DescribeBudgetPerformanceHistory} — the bound budget's |
| 8 | * `AccountId` and `BudgetName` are injected automatically. |
| 9 | */ |
| 10 | export interface DescribeBudgetPerformanceHistoryRequest extends Omit< |
| 11 | budgets.DescribeBudgetPerformanceHistoryRequest, |
| 12 | "AccountId" | "BudgetName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `budgets:ViewBudget` via |
| 17 | * `DescribeBudgetPerformanceHistory`. |
| 18 | * |
| 19 | * Bind this operation to a {@link Budget} to read its budgeted-vs-actual |
| 20 | * amounts for past periods — e.g. to render a spend trend or detect |
| 21 | * consistently blown budgets. Provide the implementation with |
| 22 | * `Effect.provide(AWS.Budgets.DescribeBudgetPerformanceHistoryHttp)`. |
| 23 | * ### Reading Budget Spend |
| 24 | * **Example:** Read Budgeted vs Actual Amounts |
| 25 | * ```typescript |
| 26 | * // init — bind the operation to the budget |
| 27 | * const history = yield* AWS.Budgets.DescribeBudgetPerformanceHistory(budget); |
| 28 | * |
| 29 | * // runtime |
| 30 | * const result = yield* history(); |
| 31 | * const periods = |
| 32 | * result.BudgetPerformanceHistory?.BudgetedAndActualAmountsList ?? []; |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface DescribeBudgetPerformanceHistory extends Binding.Service< |
| 38 | DescribeBudgetPerformanceHistory, |
| 39 | "AWS.Budgets.DescribeBudgetPerformanceHistory", |
| 40 | ( |
| 41 | budget: Budget, |
| 42 | ) => Effect.Effect< |
| 43 | ( |
| 44 | request?: DescribeBudgetPerformanceHistoryRequest, |
| 45 | ) => Effect.Effect< |
| 46 | budgets.DescribeBudgetPerformanceHistoryResponse, |
| 47 | budgets.DescribeBudgetPerformanceHistoryError |
| 48 | > |
| 49 | > |
| 50 | > {} |
| 51 | |
| 52 | export const DescribeBudgetPerformanceHistory = |
| 53 | Binding.Service<DescribeBudgetPerformanceHistory>( |
| 54 | "AWS.Budgets.DescribeBudgetPerformanceHistory", |
| 55 | ); |