Skip to content

GetInsightRuleReport

Source: src/AWS/CloudWatch/GetInsightRuleReport.ts

Runtime binding for cloudwatch:GetInsightRuleReport — fetch the top-contributor report for the bound InsightRule; the rule name is injected automatically.

Provide CloudWatch.GetInsightRuleReportHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants cloudwatch:GetInsightRuleReport on the rule
const getInsightRuleReport = yield* AWS.CloudWatch.GetInsightRuleReport(rule);
// runtime
const now = yield* Effect.sync(() => Date.now());
const result = yield* getInsightRuleReport({
StartTime: new Date(now - 3_600_000),
EndTime: new Date(now),
Period: 300,
});
const contributors = result.Contributors ?? [];