1import type * as datapipelines from "@distilled.cloud/gcp/datapipelines_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Pipeline } from "./Pipeline.ts";
6
7export interface StopPipelineRequest extends Omit<
8 datapipelines.StopProjectsLocationsPipelinesRequest,
9 "name"
10> {}
11
12/**
13 * Runtime binding for Data Pipelines `pipelines.stop`.
14 *
15 * Grants `roles/datapipelines.admin` on the project because
16 * `datapipelines.pipelines.stop` is only in that role and Data Pipelines has
17 * no per-resource IAM.
18 *
19 * Freezes pipeline execution permanently (state becomes `STATE_ARCHIVED`)
20 * and deletes any attached scheduler job. Bind in a Function/Action init
21 * phase and provide {@link StopPipelineHttp}.
22 *
23 * ### Stopping Pipelines
24 * **Example:** Archive the bound pipeline
25 * ```typescript
26 * const stopPipeline = yield* GCP.DataPipelines.StopPipeline(batch);
27 * const archived = yield* stopPipeline();
28 * ```
29 *
30 * @binding
31 * @category DataPipelines
32 */
33export interface StopPipeline extends Binding.Service<
34 StopPipeline,
35 "GCP.DataPipelines.StopPipeline",
36 (
37 pipeline: Pipeline,
38 ) => Effect.Effect<
39 (
40 request?: StopPipelineRequest,
41 ) => Effect.Effect<
42 datapipelines.GoogleCloudDatapipelinesV1Pipeline,
43 datapipelines.StopProjectsLocationsPipelinesError,
44 RuntimeContext
45 >
46 >
47> {}
48
49export const StopPipeline = Binding.Service<StopPipeline>(
50 "GCP.DataPipelines.StopPipeline",
51);