sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ EventBridge/ ListRules.ts

import * as eventbridge from "@distilled.cloud/aws/eventbridge";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";
import type { EventBus } from "./EventBus.ts";

export interface ListRulesRequest extends Omit<eventbridge.ListRulesRequest, "EventBusName"> {}

/**
 * Lists the rules on an EventBridge event bus (`events:ListRules`).
 *
 * Bind this operation to an {@link EventBus} inside a function runtime to get
 * a callable scoped to that bus; omit the bus argument to list rules on the
 * account's default bus. Provide the `ListRulesHttp` layer on the Function to
 * satisfy the binding.
 * ### Listing Rules
 * **Example:** List Rules on a Bus
 * ```typescript
 * // init — bind the bus (provide AWS.EventBridge.ListRulesHttp on the Function)
 * const listRules = yield* AWS.EventBridge.ListRules(bus);
 *
 * // runtime — list rules, optionally filtered by name prefix
 * const { Rules } = yield* listRules({ NamePrefix: "orders-" });
 * ```
 *
 * @binding
 */
export interface ListRules extends Binding.Service<
  ListRules,
  "AWS.EventBridge.ListRules",
  (
    bus?: EventBus,
  ) => Effect.Effect<
    (
      request?: ListRulesRequest,
    ) => Effect.Effect<eventbridge.ListRulesResponse, eventbridge.ListRulesError>
  >
> {}
export const ListRules = Binding.Service<ListRules>("AWS.EventBridge.ListRules");