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

main
ts 50 lines 1.5 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 GetMetricDataRequest extends cloudwatch.GetMetricDataInput {}
6
7 /**
8 * Runtime binding for `cloudwatch:GetMetricData` — run metric-math queries
9 * over one or more metrics in a single call.
10 *
11 * Provide `CloudWatch.GetMetricDataHttp` on the hosting Lambda Function to
12 * satisfy the requirement.
13 * ### Querying Metrics
14 * **Example:** Query the Last Hour of a Custom Metric
15 * ```typescript
16 * // init — grants cloudwatch:GetMetricData
17 * const getMetricData = yield* AWS.CloudWatch.GetMetricData();
18 *
19 * // runtime
20 * const now = yield* Effect.sync(() => Date.now());
21 * const result = yield* getMetricData({
22 * StartTime: new Date(now - 3_600_000),
23 * EndTime: new Date(now),
24 * MetricDataQueries: [
25 * {
26 * Id: "m1",
27 * MetricStat: {
28 * Metric: { Namespace: "MyApp/Payments", MetricName: "PaymentProcessed" },
29 * Period: 60,
30 * Stat: "Sum",
31 * },
32 * },
33 * ],
34 * });
35 * const series = result.MetricDataResults ?? [];
36 * ```
37 *
38 * @binding
39 */
40 export interface GetMetricData extends Binding.Service<
41 GetMetricData,
42 "AWS.CloudWatch.GetMetricData",
43 () => Effect.Effect<
44 (
45 request: GetMetricDataRequest,
46 ) => Effect.Effect<cloudwatch.GetMetricDataOutput, cloudwatch.GetMetricDataError>
47 >
48 > {}
49
50 export const GetMetricData = Binding.Service<GetMetricData>("AWS.CloudWatch.GetMetricData");