1import * as Kinesis from "@distilled.cloud/aws/kinesis";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Stream } from "./Stream.ts";
5
6export interface SplitShardRequest extends Omit<
7 Kinesis.SplitShardInput,
8 "StreamName" | "StreamARN"
9> {}
10
11/**
12 * Runtime binding for `kinesis:SplitShard`.
13 *
14 * Bind this operation to a `Stream` to split one shard of a
15 * PROVISIONED-mode stream into two — the stream ARN is injected
16 * automatically. Useful for building custom shard-scaling logic that
17 * targets a hot shard directly (the `Stream` resource's `shardCount`
18 * prop covers uniform scaling via `UpdateShardCount`). Provide the
19 * implementation with `Effect.provide(AWS.Kinesis.SplitShardHttp)`.
20 * ### Managing Shards
21 * **Example:** Split a Hot Shard
22 * ```typescript
23 * // init — bind the operation to the stream
24 * const splitShard = yield* AWS.Kinesis.SplitShard(stream);
25 *
26 * // runtime — split at the midpoint of the shard's hash-key range
27 * yield* splitShard({
28 * ShardToSplit: "shardId-000000000000",
29 * NewStartingHashKey: "170141183460469231731687303715884105728",
30 * });
31 * ```
32 *
33 * @binding
34 */
35export interface SplitShard extends Binding.Service<
36 SplitShard,
37 "AWS.Kinesis.SplitShard",
38 (
39 stream: Stream,
40 ) => Effect.Effect<
41 (
42 request: SplitShardRequest,
43 ) => Effect.Effect<Kinesis.SplitShardResponse, Kinesis.SplitShardError>
44 >
45> {}
46
47export const SplitShard = Binding.Service<SplitShard>("AWS.Kinesis.SplitShard");