The best way to control Claude Code, Codex and more from any computer or phone

main
ts 46 lines 1.66 KB
Raw
1 import type * as mwaa from "@distilled.cloud/aws/mwaa";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Environment } from "./Environment.ts";
5
6 /**
7 * Runtime binding for `airflow:CreateCliToken`.
8 *
9 * Bind an {@link Environment} inside a function runtime to mint short-lived
10 * (60-second) Apache Airflow CLI tokens — exchange the token against
11 * `https://{WebServerHostname}/aws_mwaa/cli` to run Airflow CLI commands.
12 * The `CliToken` is `Redacted` — unwrap it with `Redacted.value` when
13 * building the request. Provide the implementation with
14 * `Effect.provide(AWS.MWAA.CreateCliTokenHttp)`.
15 * ### Creating CLI Tokens
16 * **Example:** Mint a CLI Token and Run an Airflow Command
17 * ```typescript
18 * // init — bind the operation to the environment
19 * const createCliToken = yield* AWS.MWAA.CreateCliToken(environment);
20 *
21 * // runtime — mint a token and POST a CLI command to the webserver
22 * const token = yield* createCliToken();
23 * const response = yield* HttpClient.execute(
24 * HttpClientRequest.post(
25 * `https://${token.WebServerHostname}/aws_mwaa/cli`,
26 * ).pipe(
27 * HttpClientRequest.setHeader(
28 * "Authorization",
29 * `Bearer ${Redacted.value(token.CliToken!)}`,
30 * ),
31 * HttpClientRequest.bodyText("dags list -o json"),
32 * ),
33 * );
34 * ```
35 *
36 * @binding
37 */
38 export interface CreateCliToken extends Binding.Service<
39 CreateCliToken,
40 "AWS.MWAA.CreateCliToken",
41 (
42 environment: Environment,
43 ) => Effect.Effect<() => Effect.Effect<mwaa.CreateCliTokenResponse, mwaa.CreateCliTokenError>>
44 > {}
45
46 export const CreateCliToken = Binding.Service<CreateCliToken>("AWS.MWAA.CreateCliToken");