Skip to content

GetSampledRequests

Source: src/AWS/WAFv2/GetSampledRequests.ts

Runtime binding for wafv2:GetSampledRequests — read a sample of the web requests that the bound WebACL evaluated for a given rule and time window; the web ACL ARN and scope are injected automatically.

Provide WAFv2.GetSampledRequestsHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants wafv2:GetSampledRequests on the web ACL
const getSampledRequests = yield* AWS.WAFv2.GetSampledRequests(acl);
// runtime
const now = yield* Effect.sync(() => new Date());
const { SampledRequests } = yield* getSampledRequests({
RuleMetricName: "rate-limit",
TimeWindow: {
StartTime: new Date(now.getTime() - 60 * 60 * 1000),
EndTime: now,
},
MaxItems: 100,
});