| 1 | import type * as kafka from "@distilled.cloud/aws/kafka"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ServerlessCluster } from "./ServerlessCluster.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `ListTopics` operation (IAM action |
| 8 | * `kafka:ListTopics`), scoped to one {@link ServerlessCluster}. |
| 9 | * |
| 10 | * Lists the topics on the bound cluster through the MSK control plane, |
| 11 | * optionally filtered by name prefix. Provide the implementation with |
| 12 | * `Effect.provide(AWS.Kafka.ListTopicsHttp)`. |
| 13 | * ### Managing Topics |
| 14 | * **Example:** List the Cluster's Topics |
| 15 | * ```typescript |
| 16 | * const listTopics = yield* Kafka.ListTopics(cluster); |
| 17 | * |
| 18 | * const page = yield* listTopics({ TopicNameFilter: "orders" }); |
| 19 | * // page.Topics → [{ TopicName: "orders", PartitionCount: 3, … }] |
| 20 | * ``` |
| 21 | * |
| 22 | * @binding |
| 23 | */ |
| 24 | export interface ListTopics extends Binding.Service< |
| 25 | ListTopics, |
| 26 | "AWS.Kafka.ListTopics", |
| 27 | ( |
| 28 | cluster: ServerlessCluster, |
| 29 | ) => Effect.Effect< |
| 30 | ( |
| 31 | request?: Omit<kafka.ListTopicsRequest, "ClusterArn">, |
| 32 | ) => Effect.Effect<kafka.ListTopicsResponse, kafka.ListTopicsError> |
| 33 | > |
| 34 | > {} |
| 35 | export const ListTopics = Binding.Service<ListTopics>("AWS.Kafka.ListTopics"); |