1import type * as pubsublite from "@distilled.cloud/gcp/pubsublite_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { AdminTopic } from "./AdminTopic.ts";
6
7export interface GetPartitionsRequest extends Omit<
8 pubsublite.GetPartitionsAdminProjectsLocationsTopicsRequest,
9 "name"
10> {}
11
12/**
13 * Runtime binding for Pub/Sub Lite `topics.getPartitions`.
14 *
15 * Bind this operation to an {@link AdminTopic} in a Function/Action init
16 * phase. Provide {@link GetPartitionsHttp}.
17 *
18 * Grants `roles/pubsublite.viewer` on the project: Pub/Sub Lite has no
19 * resource-level IAM.
20 *
21 * ### Reading Partition Count
22 * **Example:** Get the live partition count
23 * ```typescript
24 * const getPartitions = yield* GCP.PubSubLite.GetPartitions(events);
25 * const { partitionCount } = yield* getPartitions();
26 * ```
27 *
28 * @binding
29 * @category PubSubLite
30 */
31export interface GetPartitions extends Binding.Service<
32 GetPartitions,
33 "GCP.PubSubLite.GetPartitions",
34 (
35 topic: AdminTopic,
36 ) => Effect.Effect<
37 (
38 request?: GetPartitionsRequest,
39 ) => Effect.Effect<
40 pubsublite.TopicPartitions,
41 pubsublite.GetPartitionsAdminProjectsLocationsTopicsError,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const GetPartitions = Binding.Service<GetPartitions>(
48 "GCP.PubSubLite.GetPartitions",
49);