| 1 | import type * as pubsublite from "@distilled.cloud/gcp/pubsublite_v1"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { AdminTopic } from "./AdminTopic.ts"; |
| 6 | |
| 7 | export interface ComputeHeadCursorRequest extends Omit< |
| 8 | pubsublite.ComputeHeadCursorTopicStatsProjectsLocationsTopicsRequest, |
| 9 | "topic" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Pub/Sub Lite `topicStats.computeHeadCursor`. |
| 14 | * |
| 15 | * Bind this operation to an {@link AdminTopic} in a Function/Action init |
| 16 | * phase. Provide {@link ComputeHeadCursorHttp}. |
| 17 | * |
| 18 | * Grants `roles/pubsublite.subscriber` on the project: Pub/Sub Lite has no |
| 19 | * resource-level IAM. |
| 20 | * |
| 21 | * ### Computing the Head Cursor |
| 22 | * **Example:** Head cursor of partition 0 |
| 23 | * ```typescript |
| 24 | * const computeHead = yield* GCP.PubSubLite.ComputeHeadCursor(events); |
| 25 | * const { headCursor } = yield* computeHead({ |
| 26 | * body: { partition: "0" }, |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | * @category PubSubLite |
| 32 | */ |
| 33 | export interface ComputeHeadCursor extends Binding.Service< |
| 34 | ComputeHeadCursor, |
| 35 | "GCP.PubSubLite.ComputeHeadCursor", |
| 36 | ( |
| 37 | topic: AdminTopic, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: ComputeHeadCursorRequest, |
| 41 | ) => Effect.Effect< |
| 42 | pubsublite.ComputeHeadCursorResponse, |
| 43 | pubsublite.ComputeHeadCursorTopicStatsProjectsLocationsTopicsError, |
| 44 | RuntimeContext |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const ComputeHeadCursor = Binding.Service<ComputeHeadCursor>( |
| 50 | "GCP.PubSubLite.ComputeHeadCursor", |
| 51 | ); |