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

main
ts 47 lines 1.56 KB
Raw
1 import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4
5 export interface GetMetricStatisticsRequest extends cloudwatch.GetMetricStatisticsInput {}
6
7 /**
8 * Runtime binding for `cloudwatch:GetMetricStatistics` — fetch aggregated
9 * datapoints for a single metric (the older single-metric query API;
10 * prefer {@link GetMetricData} for metric math or multi-metric queries).
11 *
12 * Provide `CloudWatch.GetMetricStatisticsHttp` on the hosting Lambda
13 * Function to satisfy the requirement.
14 * ### Querying Metrics
15 * **Example:** Fetch Hourly Sums for a Metric
16 * ```typescript
17 * // init — grants cloudwatch:GetMetricStatistics
18 * const getMetricStatistics = yield* AWS.CloudWatch.GetMetricStatistics();
19 *
20 * // runtime
21 * const now = yield* Effect.sync(() => Date.now());
22 * const result = yield* getMetricStatistics({
23 * Namespace: "MyApp/Payments",
24 * MetricName: "PaymentProcessed",
25 * StartTime: new Date(now - 3_600_000),
26 * EndTime: new Date(now),
27 * Period: 60,
28 * Statistics: ["Sum"],
29 * });
30 * const datapoints = result.Datapoints ?? [];
31 * ```
32 *
33 * @binding
34 */
35 export interface GetMetricStatistics extends Binding.Service<
36 GetMetricStatistics,
37 "AWS.CloudWatch.GetMetricStatistics",
38 () => Effect.Effect<
39 (
40 request: GetMetricStatisticsRequest,
41 ) => Effect.Effect<cloudwatch.GetMetricStatisticsOutput, cloudwatch.GetMetricStatisticsError>
42 >
43 > {}
44
45 export const GetMetricStatistics = Binding.Service<GetMetricStatistics>(
46 "AWS.CloudWatch.GetMetricStatistics",
47 );