1import type * as workflowexecutions from "@distilled.cloud/gcp/workflowexecutions_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Workflow } from "./Workflow.ts";
6
7export interface CreateExecutionRequest extends Omit<
8 workflowexecutions.CreateProjectsLocationsWorkflowsExecutionsRequest,
9 "parent"
10> {}
11
12/**
13 * Runtime binding for Workflows `executions.create`.
14 *
15 * Starts a new execution of the latest revision of a {@link Workflow}.
16 * Bind this operation in a Function/Action init phase. Provide
17 * {@link CreateExecutionHttp}.
18 *
19 * ### Starting Executions
20 * **Example:** Run the bound workflow
21 * ```typescript
22 * const createExecution = yield* GCP.Workflows.CreateExecution(greet);
23 * const execution = yield* createExecution({
24 * body: { argument: JSON.stringify({ name: "world" }) },
25 * });
26 * ```
27 *
28 * @binding
29 * @category Workflows
30 */
31export interface CreateExecution extends Binding.Service<
32 CreateExecution,
33 "GCP.Workflows.CreateExecution",
34 (
35 workflow: Workflow,
36 ) => Effect.Effect<
37 (
38 request?: CreateExecutionRequest,
39 ) => Effect.Effect<
40 workflowexecutions.Execution,
41 workflowexecutions.CreateProjectsLocationsWorkflowsExecutionsError,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const CreateExecution = Binding.Service<CreateExecution>(
48 "GCP.Workflows.CreateExecution",
49);