1import type * as emr from "@distilled.cloud/aws/emr-serverless";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Application } from "./Application.ts";
5
6/**
7 * Request accepted by the {@link StartSession} runtime callable. The
8 * `applicationId` is injected from the bound {@link Application}; the
9 * idempotency `clientToken` is auto-generated when omitted.
10 */
11export type StartSessionInput = Omit<
12 emr.StartSessionRequest,
13 "applicationId" | "clientToken"
14> & {
15 /**
16 * Idempotency token deduplicating retried submissions.
17 * @default a generated UUID per call
18 */
19 clientToken?: string;
20};
21
22/**
23 * Runtime binding for `emr-serverless:StartSession`.
24 *
25 * Starts an interactive session on the bound {@link Application} (the
26 * application must enable `interactiveConfiguration`). The session assumes
27 * the given execution role; grants `iam:PassRole` (conditioned to
28 * `emr-serverless.amazonaws.com`) accordingly. Provide the implementation
29 * with `Effect.provide(AWS.EMRServerless.StartSessionHttp)`.
30 * ### Interactive Sessions
31 * **Example:** Start A Session
32 * ```typescript
33 * // init
34 * const startSession = yield* AWS.EMRServerless.StartSession(app);
35 *
36 * // runtime
37 * const session = yield* startSession({ executionRoleArn: sessionRoleArn });
38 * yield* Effect.log(`started ${session.sessionId}`);
39 * ```
40 *
41 * @binding
42 */
43export interface StartSession extends Binding.Service<
44 StartSession,
45 "AWS.EMRServerless.StartSession",
46 (
47 application: Application,
48 ) => Effect.Effect<
49 (
50 request: StartSessionInput,
51 ) => Effect.Effect<emr.StartSessionResponse, emr.StartSessionError>
52 >
53> {}
54export const StartSession = Binding.Service<StartSession>(
55 "AWS.EMRServerless.StartSession",
56);