| 1 | import * as Kinesis from "@distilled.cloud/aws/kinesis"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Stream } from "./Stream.ts"; |
| 5 | |
| 6 | export interface ListShardsRequest extends Omit< |
| 7 | Kinesis.ListShardsInput, |
| 8 | "StreamName" | "StreamARN" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `kinesis:ListShards`. |
| 13 | * |
| 14 | * Bind this operation to a `Stream` to enumerate its shards — typically the |
| 15 | * first step before obtaining a shard iterator and reading records. Provide |
| 16 | * the implementation with `Effect.provide(AWS.Kinesis.ListShardsHttp)`. |
| 17 | * ### Inspecting Streams |
| 18 | * **Example:** List the Stream's Shards |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const listShards = yield* AWS.Kinesis.ListShards(stream); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const result = yield* listShards(); |
| 25 | * const shardIds = (result.Shards ?? []).map((shard) => shard.ShardId); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ListShards extends Binding.Service< |
| 31 | ListShards, |
| 32 | "AWS.Kinesis.ListShards", |
| 33 | ( |
| 34 | stream: Stream, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request?: ListShardsRequest, |
| 38 | ) => Effect.Effect<Kinesis.ListShardsOutput, Kinesis.ListShardsError> |
| 39 | > |
| 40 | > {} |
| 41 | |
| 42 | export const ListShards = Binding.Service<ListShards>("AWS.Kinesis.ListShards"); |