1import type * as frauddetector from "@distilled.cloud/aws/frauddetector";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { List } from "./List.ts";
5
6/**
7 * The list `name` is injected by the binding from the bound list; the caller
8 * supplies the elements and the `updateMode` (`APPEND`, `REMOVE`, or
9 * `REPLACE`).
10 */
11export interface UpdateListRequest extends Omit<
12 frauddetector.UpdateListRequest,
13 "name"
14> {}
15
16/**
17 * Mutate the elements of a bound Amazon Fraud Detector list at runtime — the
18 * effectful write call made from a deployed Lambda or Task, e.g. to append a
19 * newly-confirmed fraudulent IP to a deny-list the detector's rules reference.
20 *
21 * Note that the `List` resource reconciles `elements` declaratively on every
22 * deploy (a `REPLACE` update), so elements appended at runtime are removed by
23 * the next deploy unless they are also added to the resource's props.
24 *
25 * ### Updating List Elements
26 * Provide the `UpdateListHttp` implementation layer on the Function effect,
27 * bind the list in the init phase, then call the returned client at runtime.
28 * The binding grants `frauddetector:UpdateList` on the list and injects its
29 * `name` automatically.
30 *
31 * **Example:** Append from a Lambda
32 * ```typescript
33 * // init
34 * const updateList = yield* FraudDetector.UpdateList(blockedIps);
35 *
36 * return {
37 * fetch: Effect.gen(function* () {
38 * // runtime
39 * yield* updateList({ elements: ["192.0.2.44"], updateMode: "APPEND" });
40 * return HttpServerResponse.json({ ok: true });
41 * }),
42 * };
43 * // on the Function effect:
44 * // .pipe(Effect.provide(FraudDetector.UpdateListHttp))
45 * ```
46 *
47 * @binding
48 */
49export interface UpdateList extends Binding.Service<
50 UpdateList,
51 "AWS.FraudDetector.UpdateList",
52 (
53 list: List,
54 ) => Effect.Effect<
55 (
56 request: UpdateListRequest,
57 ) => Effect.Effect<
58 frauddetector.UpdateListResult,
59 frauddetector.UpdateListError
60 >
61 >
62> {}
63export const UpdateList = Binding.Service<UpdateList>(
64 "AWS.FraudDetector.UpdateList",
65);