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

main
ts 50 lines 1.57 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 import type { InsightRule } from "./InsightRule.ts";
5
6 export interface GetInsightRuleReportRequest extends Omit<
7 cloudwatch.GetInsightRuleReportInput,
8 "RuleName"
9 > {}
10
11 /**
12 * Runtime binding for `cloudwatch:GetInsightRuleReport` — fetch the
13 * top-contributor report for the bound {@link InsightRule}; the rule name
14 * is injected automatically.
15 *
16 * Provide `CloudWatch.GetInsightRuleReportHttp` on the hosting Lambda
17 * Function to satisfy the requirement.
18 * ### Reading Insight Rules
19 * **Example:** Fetch the Top Contributors for a Rule
20 * ```typescript
21 * // init — grants cloudwatch:GetInsightRuleReport on the rule
22 * const getInsightRuleReport = yield* AWS.CloudWatch.GetInsightRuleReport(rule);
23 *
24 * // runtime
25 * const now = yield* Effect.sync(() => Date.now());
26 * const result = yield* getInsightRuleReport({
27 * StartTime: new Date(now - 3_600_000),
28 * EndTime: new Date(now),
29 * Period: 300,
30 * });
31 * const contributors = result.Contributors ?? [];
32 * ```
33 *
34 * @binding
35 */
36 export interface GetInsightRuleReport extends Binding.Service<
37 GetInsightRuleReport,
38 "AWS.CloudWatch.GetInsightRuleReport",
39 (
40 rule: InsightRule,
41 ) => Effect.Effect<
42 (
43 request: GetInsightRuleReportRequest,
44 ) => Effect.Effect<cloudwatch.GetInsightRuleReportOutput, cloudwatch.GetInsightRuleReportError>
45 >
46 > {}
47
48 export const GetInsightRuleReport = Binding.Service<GetInsightRuleReport>(
49 "AWS.CloudWatch.GetInsightRuleReport",
50 );