| 1 | import type * as microvms from "@distilled.cloud/aws/lambda-microvms"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { MicrovmImage } from "./MicrovmImage.ts"; |
| 5 | |
| 6 | export interface CreateShellAuthTokenRequest |
| 7 | extends microvms.CreateMicrovmShellAuthTokenRequest {} |
| 8 | |
| 9 | /** |
| 10 | * Runtime binding for `CreateMicrovmShellAuthToken`. |
| 11 | * |
| 12 | * Bind it to a {@link MicrovmImage} to get a callable that mints a short-lived |
| 13 | * token for interactive shell access to a running MicroVM (the MicroVM must |
| 14 | * have been run with the shell ingress connector attached). |
| 15 | * ### Auth Tokens |
| 16 | * **Example:** Mint a shell auth token |
| 17 | * ```typescript |
| 18 | * const createShellAuthToken = yield* AWS.Lambda.CreateShellAuthToken(Sandbox); |
| 19 | * const { authToken } = yield* createShellAuthToken({ |
| 20 | * microvmIdentifier: vm.microvmId, |
| 21 | * expirationInMinutes: 5, |
| 22 | * }); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface CreateShellAuthToken extends Binding.Service< |
| 28 | CreateShellAuthToken, |
| 29 | "AWS.Lambda.CreateShellAuthToken", |
| 30 | ( |
| 31 | image: MicrovmImage, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request: CreateShellAuthTokenRequest, |
| 35 | ) => Effect.Effect< |
| 36 | microvms.CreateMicrovmShellAuthTokenResponse, |
| 37 | microvms.CreateMicrovmShellAuthTokenError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | export const CreateShellAuthToken = Binding.Service<CreateShellAuthToken>( |
| 42 | "AWS.Lambda.CreateShellAuthToken", |
| 43 | ); |