sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ WAFv2/ GetWebACLForResource.ts

import type * as WAFV2 from "@distilled.cloud/aws/wafv2";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Runtime binding for `wafv2:GetWebACLForResource` — look up which web ACL
 * (if any) protects an arbitrary regional resource (ALB, API Gateway
 * stage, AppSync API, Cognito user pool, ...). A resource with no web ACL
 * association fails with the typed `WAFNonexistentItemException`.
 *
 * Provide `WAFv2.GetWebACLForResourceHttp` on the hosting Lambda Function
 * to satisfy the requirement.
 * ### Inspecting Associations
 * **Example:** Look Up the Web ACL Protecting a Load Balancer
 * ```typescript
 * // init — grants wafv2:GetWebACLForResource + wafv2:GetWebACL
 * const getWebACLForResource = yield* AWS.WAFv2.GetWebACLForResource();
 *
 * // runtime
 * const { WebACL } = yield* getWebACLForResource({
 *   ResourceArn: loadBalancerArn,
 * });
 * ```
 *
 * @binding
 */
export interface GetWebACLForResource extends Binding.Service<
  GetWebACLForResource,
  "AWS.WAFv2.GetWebACLForResource",
  () => Effect.Effect<
    (
      request: WAFV2.GetWebACLForResourceRequest,
    ) => Effect.Effect<WAFV2.GetWebACLForResourceResponse, WAFV2.GetWebACLForResourceError>
  >
> {}

export const GetWebACLForResource = Binding.Service<GetWebACLForResource>(
  "AWS.WAFv2.GetWebACLForResource",
);