| 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 MergeShardsRequest extends Omit< |
| 7 | Kinesis.MergeShardsInput, |
| 8 | "StreamName" | "StreamARN" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `kinesis:MergeShards`. |
| 13 | * |
| 14 | * Bind this operation to a `Stream` to merge two adjacent shards of a |
| 15 | * PROVISIONED-mode stream into one — the stream ARN is injected |
| 16 | * automatically. Useful for building custom shard-scaling logic (the |
| 17 | * `Stream` resource's `shardCount` prop covers uniform scaling via |
| 18 | * `UpdateShardCount`; merge/split give per-shard control). Provide the |
| 19 | * implementation with `Effect.provide(AWS.Kinesis.MergeShardsHttp)`. |
| 20 | * ### Managing Shards |
| 21 | * **Example:** Merge Two Adjacent Shards |
| 22 | * ```typescript |
| 23 | * // init — bind the operation to the stream |
| 24 | * const mergeShards = yield* AWS.Kinesis.MergeShards(stream); |
| 25 | * |
| 26 | * // runtime — merge a shard with its adjacent neighbor |
| 27 | * yield* mergeShards({ |
| 28 | * ShardToMerge: "shardId-000000000000", |
| 29 | * AdjacentShardToMerge: "shardId-000000000001", |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface MergeShards extends Binding.Service< |
| 36 | MergeShards, |
| 37 | "AWS.Kinesis.MergeShards", |
| 38 | ( |
| 39 | stream: Stream, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: MergeShardsRequest, |
| 43 | ) => Effect.Effect<Kinesis.MergeShardsResponse, Kinesis.MergeShardsError> |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const MergeShards = Binding.Service<MergeShards>( |
| 48 | "AWS.Kinesis.MergeShards", |
| 49 | ); |