1import type * as ce from "@distilled.cloud/aws/cost-explorer";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Request for {@link GetCostAndUsageWithResources}.
7 */
8export interface GetCostAndUsageWithResourcesRequest
9 extends ce.GetCostAndUsageWithResourcesRequest {}
10
11/**
12 * Runtime binding for `ce:GetCostAndUsageWithResources`.
13 *
14 * Query cost and usage at individual-resource granularity (EC2
15 * instance ids etc.). Requires resource-level data to be enabled in Cost
16 * Explorer settings and only covers the trailing 14 days. Provide the implementation with
17 * `Effect.provide(AWS.CostExplorer.GetCostAndUsageWithResourcesHttp)`.
18 * ### Querying Cost and Usage
19 * **Example:** Query Resource-Level Cost
20 * ```typescript
21 * // init — account-level binding takes no resource
22 * const getCostAndUsageWithResources = yield* AWS.CostExplorer.GetCostAndUsageWithResources();
23 *
24 * // runtime
25 * const result = yield* getCostAndUsageWithResources({
26 * TimePeriod: { Start: "2026-07-01", End: "2026-07-14" },
27 * Granularity: "DAILY",
28 * Filter: { Dimensions: { Key: "SERVICE", Values: ["Amazon Elastic Compute Cloud - Compute"] } },
29 * Metrics: ["UnblendedCost"],
30 * });
31 * ```
32 *
33 * @binding
34 */
35export interface GetCostAndUsageWithResources extends Binding.Service<
36 GetCostAndUsageWithResources,
37 "AWS.CostExplorer.GetCostAndUsageWithResources",
38 () => Effect.Effect<
39 (
40 request: GetCostAndUsageWithResourcesRequest,
41 ) => Effect.Effect<
42 ce.GetCostAndUsageWithResourcesResponse,
43 ce.GetCostAndUsageWithResourcesError
44 >
45 >
46> {}
47
48export const GetCostAndUsageWithResources =
49 Binding.Service<GetCostAndUsageWithResources>(
50 "AWS.CostExplorer.GetCostAndUsageWithResources",
51 );