1import type * as WAFV2 from "@distilled.cloud/aws/wafv2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuleGroup } from "./RuleGroup.ts";
5
6/**
7 * Runtime binding for `wafv2:GetPermissionPolicy` — read the IAM policy
8 * that shares the bound {@link RuleGroup} with other accounts; the rule
9 * group ARN is injected automatically. A rule group with no policy
10 * attached fails with the typed `WAFNonexistentItemException`.
11 *
12 * Provide `WAFv2.GetPermissionPolicyHttp` on the hosting Lambda Function to
13 * satisfy the requirement.
14 * ### Sharing Rule Groups
15 * **Example:** Read the Sharing Policy
16 * ```typescript
17 * // init — grants wafv2:GetPermissionPolicy on the rule group
18 * const getPermissionPolicy = yield* AWS.WAFv2.GetPermissionPolicy(group);
19 *
20 * // runtime
21 * const { Policy } = yield* getPermissionPolicy().pipe(
22 * Effect.catchTag("WAFNonexistentItemException", () =>
23 * Effect.succeed({ Policy: undefined }),
24 * ),
25 * );
26 * ```
27 *
28 * @binding
29 */
30export interface GetPermissionPolicy extends Binding.Service<
31 GetPermissionPolicy,
32 "AWS.WAFv2.GetPermissionPolicy",
33 (
34 ruleGroup: RuleGroup,
35 ) => Effect.Effect<
36 () => Effect.Effect<
37 WAFV2.GetPermissionPolicyResponse,
38 WAFV2.GetPermissionPolicyError
39 >
40 >
41> {}
42
43export const GetPermissionPolicy = Binding.Service<GetPermissionPolicy>(
44 "AWS.WAFv2.GetPermissionPolicy",
45);