@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 46 lines 1.57 KB
Raw
1 import type * as ECS from "@distilled.cloud/aws/ecs";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Cluster } from "./Cluster.ts";
5
6 export interface ExecuteCommandRequest extends Omit<ECS.ExecuteCommandRequest, "cluster"> {}
7
8 /**
9 * Runtime binding for `ecs:ExecuteCommand` (ECS Exec).
10 *
11 * Bind this operation to a `Cluster` inside a function runtime to get a
12 * callable that starts a command against a running container in the bound
13 * cluster. The cluster ARN is injected automatically and the host is granted
14 * `ecs:ExecuteCommand` on the cluster and its tasks.
15 *
16 * The target task must have been launched with `enableExecuteCommand` and the
17 * task role must allow the SSM messages channel. The response's
18 * `session.tokenValue` is a `Redacted` bearer token for the SSM WebSocket
19 * stream (`session.streamUrl`).
20 * ### Executing Commands
21 * **Example:** Run a Command in a Container
22 * ```typescript
23 * const executeCommand = yield* AWS.ECS.ExecuteCommand(cluster);
24 *
25 * const response = yield* executeCommand({
26 * task: taskArn,
27 * command: "ls -al /",
28 * interactive: true,
29 * });
30 * const streamUrl = response.session?.streamUrl;
31 * ```
32 *
33 * @binding
34 */
35 export interface ExecuteCommand extends Binding.Service<
36 ExecuteCommand,
37 "AWS.ECS.ExecuteCommand",
38 (
39 cluster: Cluster,
40 ) => Effect.Effect<
41 (
42 request: ExecuteCommandRequest,
43 ) => Effect.Effect<ECS.ExecuteCommandResponse, ECS.ExecuteCommandError>
44 >
45 > {}
46 export const ExecuteCommand = Binding.Service<ExecuteCommand>("AWS.ECS.ExecuteCommand");