1import type * as microvms from "@distilled.cloud/aws/lambda-microvms";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { MicrovmImage } from "./MicrovmImage.ts";
5
6export interface CreateAuthTokenRequest
7 extends microvms.CreateMicrovmAuthTokenRequest {}
8
9/**
10 * Runtime binding for `CreateMicrovmAuthToken`.
11 *
12 * Bind it to a {@link MicrovmImage} to get a callable that mints a short-lived
13 * token for a running MicroVM. Send it on the MicroVM `endpoint` in the
14 * `X-aws-proxy-auth` header.
15 * ### Auth Tokens
16 * **Example:** Mint an auth token
17 * ```typescript
18 * const createAuthToken = yield* AWS.Lambda.CreateAuthToken(Sandbox);
19 * const { authToken } = yield* createAuthToken({
20 * microvmIdentifier: vm.microvmId,
21 * expirationInMinutes: 5,
22 * allowedPorts: [{ port: 5000 }],
23 * });
24 * ```
25 *
26 * @binding
27 */
28export interface CreateAuthToken extends Binding.Service<
29 CreateAuthToken,
30 "AWS.Lambda.CreateAuthToken",
31 (
32 image: MicrovmImage,
33 ) => Effect.Effect<
34 (
35 request: CreateAuthTokenRequest,
36 ) => Effect.Effect<
37 microvms.CreateMicrovmAuthTokenResponse,
38 microvms.CreateMicrovmAuthTokenError
39 >
40 >
41> {}
42export const CreateAuthToken = Binding.Service<CreateAuthToken>(
43 "AWS.Lambda.CreateAuthToken",
44);