1import type * as composer from "@distilled.cloud/gcp/composer_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Environment } from "./Environment.ts";
6
7export interface ExecuteAirflowCommandRequest extends Omit<
8 composer.ExecuteAirflowCommandProjectsLocationsEnvironmentsRequest,
9 "environment"
10> {}
11
12/**
13 * Runtime binding for Cloud Composer `environments.executeAirflowCommand`.
14 *
15 * Starts an Airflow CLI command in the environment. Bind this operation
16 * to an {@link Environment} in a Function/Action init phase. Provide
17 * {@link ExecuteAirflowCommandHttp}. Poll with
18 * `environments.pollAirflowCommand` using the returned `executionId`.
19 *
20 * Grants `roles/composer.editor` on the project because it is the
21 * narrowest predefined role with
22 * `composer.environments.executeAirflowCommand`, and Composer
23 * environments have no per-resource IAM policy.
24 *
25 * ### Running Airflow CLI
26 * **Example:** List DAGs
27 * ```typescript
28 * const execute = yield* GCP.Composer.ExecuteAirflowCommand(airflow);
29 * const started = yield* execute({
30 * body: { command: "dags", subcommand: "list" },
31 * });
32 * ```
33 *
34 * @binding
35 * @category Composer
36 */
37export interface ExecuteAirflowCommand extends Binding.Service<
38 ExecuteAirflowCommand,
39 "GCP.Composer.ExecuteAirflowCommand",
40 (
41 environment: Environment,
42 ) => Effect.Effect<
43 (
44 request?: ExecuteAirflowCommandRequest,
45 ) => Effect.Effect<
46 composer.ExecuteAirflowCommandResponse,
47 composer.ExecuteAirflowCommandProjectsLocationsEnvironmentsError,
48 RuntimeContext
49 >
50 >
51> {}
52
53export const ExecuteAirflowCommand = Binding.Service<ExecuteAirflowCommand>(
54 "GCP.Composer.ExecuteAirflowCommand",
55);