@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 44 lines 1.44 KB
Raw
1 import type * as ce from "@distilled.cloud/aws/cost-explorer";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4
5 /**
6 * Request for {@link GetCostAndUsage}.
7 */
8 export interface GetCostAndUsageRequest extends ce.GetCostAndUsageRequest {}
9
10 /**
11 * Runtime binding for `ce:GetCostAndUsage`.
12 *
13 * Query cost and usage metrics (`UnblendedCost`, `UsageQuantity`, …)
14 * filtered and grouped by dimension over a time range — the core Cost
15 * Explorer query. Provide the implementation with
16 * `Effect.provide(AWS.CostExplorer.GetCostAndUsageHttp)`.
17 * ### Querying Cost and Usage
18 * **Example:** Query Last Month's Unblended Cost
19 * ```typescript
20 * // init — account-level binding takes no resource
21 * const getCostAndUsage = yield* AWS.CostExplorer.GetCostAndUsage();
22 *
23 * // runtime
24 * const result = yield* getCostAndUsage({
25 * TimePeriod: { Start: "2026-06-01", End: "2026-07-01" },
26 * Granularity: "MONTHLY",
27 * Metrics: ["UnblendedCost"],
28 * });
29 * const total = result.ResultsByTime?.[0]?.Total?.UnblendedCost?.Amount;
30 * ```
31 *
32 * @binding
33 */
34 export interface GetCostAndUsage extends Binding.Service<
35 GetCostAndUsage,
36 "AWS.CostExplorer.GetCostAndUsage",
37 () => Effect.Effect<
38 (
39 request: GetCostAndUsageRequest,
40 ) => Effect.Effect<ce.GetCostAndUsageResponse, ce.GetCostAndUsageError>
41 >
42 > {}
43
44 export const GetCostAndUsage = Binding.Service<GetCostAndUsage>("AWS.CostExplorer.GetCostAndUsage");