1import type * as budgets from "@distilled.cloud/aws/budgets";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Budget } from "./Budget.ts";
5
6/**
7 * Request for {@link DescribeSubscribersForNotification} — the bound budget's
8 * `AccountId` and `BudgetName` are injected automatically. `Notification`
9 * identifies which alert threshold to list subscribers for (the same shape
10 * returned by `DescribeNotificationsForBudget`).
11 */
12export interface DescribeSubscribersForNotificationRequest extends Omit<
13 budgets.DescribeSubscribersForNotificationRequest,
14 "AccountId" | "BudgetName"
15> {}
16
17/**
18 * Runtime binding for `budgets:ViewBudget` via
19 * `DescribeSubscribersForNotification`.
20 *
21 * Bind this operation to a {@link Budget} to list who is notified when a
22 * given alert threshold is crossed — pair it with
23 * `DescribeNotificationsForBudget` to enumerate a budget's full alerting
24 * fan-out (each subscriber's `Address` comes back `Redacted`). Provide the
25 * implementation with
26 * `Effect.provide(AWS.Budgets.DescribeSubscribersForNotificationHttp)`.
27 * ### Reading Budget Alerts
28 * **Example:** List the Recipients of Each Alert
29 * ```typescript
30 * // init — bind both operations to the budget
31 * const notifications = yield* AWS.Budgets.DescribeNotificationsForBudget(budget);
32 * const subscribers = yield* AWS.Budgets.DescribeSubscribersForNotification(budget);
33 *
34 * // runtime
35 * const { Notifications = [] } = yield* notifications();
36 * for (const notification of Notifications) {
37 * const result = yield* subscribers({ Notification: notification });
38 * const recipients = (result.Subscribers ?? []).map((s) => s.SubscriptionType);
39 * }
40 * ```
41 *
42 * @binding
43 */
44export interface DescribeSubscribersForNotification extends Binding.Service<
45 DescribeSubscribersForNotification,
46 "AWS.Budgets.DescribeSubscribersForNotification",
47 (
48 budget: Budget,
49 ) => Effect.Effect<
50 (
51 request: DescribeSubscribersForNotificationRequest,
52 ) => Effect.Effect<
53 budgets.DescribeSubscribersForNotificationResponse,
54 budgets.DescribeSubscribersForNotificationError
55 >
56 >
57> {}
58
59export const DescribeSubscribersForNotification =
60 Binding.Service<DescribeSubscribersForNotification>(
61 "AWS.Budgets.DescribeSubscribersForNotification",
62 );