1import type * as ec2 from "@distilled.cloud/aws/ec2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { SecurityGroup } from "./SecurityGroup.ts";
5
6/**
7 * `RevokeSecurityGroupIngress` request with `GroupId` injected from the bound
8 * {@link SecurityGroup}.
9 */
10export interface RevokeSecurityGroupIngressRequest extends Omit<
11 ec2.RevokeSecurityGroupIngressRequest,
12 "GroupId" | "GroupName"
13> {}
14
15/**
16 * Runtime binding for the `RevokeSecurityGroupIngress` operation scoped to
17 * the bound {@link SecurityGroup} (IAM action
18 * `ec2:RevokeSecurityGroupIngress` on the security group ARN).
19 *
20 * Removes an inbound rule from the group at runtime — the cleanup half of the
21 * dynamic IP-allowlisting pattern (see
22 * {@link AuthorizeSecurityGroupIngress}). Provide the implementation with
23 * `Effect.provide(AWS.EC2.RevokeSecurityGroupIngressHttp)`.
24 * ### Dynamic Security Group Rules
25 * **Example:** Remove a previously allowlisted address
26 * ```typescript
27 * // init — bind the operation to the security group
28 * const revokeIngress = yield* AWS.EC2.RevokeSecurityGroupIngress(group);
29 *
30 * // runtime — close port 22 for the address again
31 * yield* revokeIngress({
32 * IpProtocol: "tcp",
33 * FromPort: 22,
34 * ToPort: 22,
35 * CidrIp: "203.0.113.7/32",
36 * });
37 * ```
38 *
39 * @binding
40 */
41export interface RevokeSecurityGroupIngress extends Binding.Service<
42 RevokeSecurityGroupIngress,
43 "AWS.EC2.RevokeSecurityGroupIngress",
44 (
45 group: SecurityGroup,
46 ) => Effect.Effect<
47 (
48 request: RevokeSecurityGroupIngressRequest,
49 ) => Effect.Effect<
50 ec2.RevokeSecurityGroupIngressResult,
51 ec2.RevokeSecurityGroupIngressError
52 >
53 >
54> {}
55
56export const RevokeSecurityGroupIngress =
57 Binding.Service<RevokeSecurityGroupIngress>(
58 "AWS.EC2.RevokeSecurityGroupIngress",
59 );