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 GetTopicRequest extends Omit<
8 pubsublite.GetAdminProjectsLocationsTopicsRequest,
9 "name"
10> {}
11
12/**
13 * Runtime binding for Pub/Sub Lite `topics.get`.
14 *
15 * Bind this operation to an {@link AdminTopic} in a Function/Action init
16 * phase. Provide {@link GetTopicHttp}.
17 *
18 * Grants `roles/pubsublite.viewer` on the project: Pub/Sub Lite has no
19 * resource-level IAM.
20 *
21 * ### Observing Topics
22 * **Example:** Read the bound topic
23 * ```typescript
24 * const getTopic = yield* GCP.PubSubLite.GetTopic(events);
25 * const live = yield* getTopic();
26 * ```
27 *
28 * @binding
29 * @category PubSubLite
30 */
31export interface GetTopic extends Binding.Service<
32 GetTopic,
33 "GCP.PubSubLite.GetTopic",
34 (
35 topic: AdminTopic,
36 ) => Effect.Effect<
37 (
38 request?: GetTopicRequest,
39 ) => Effect.Effect<
40 pubsublite.Topic,
41 pubsublite.GetAdminProjectsLocationsTopicsError,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const GetTopic = Binding.Service<GetTopic>("GCP.PubSubLite.GetTopic");