1import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { InsightRule } from "./InsightRule.ts";
5
6export 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 */
36export 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<
45 cloudwatch.GetInsightRuleReportOutput,
46 cloudwatch.GetInsightRuleReportError
47 >
48 >
49> {}
50
51export const GetInsightRuleReport = Binding.Service<GetInsightRuleReport>(
52 "AWS.CloudWatch.GetInsightRuleReport",
53);