sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ EMRServerless/ GetSession.ts

import type * as emr from "@distilled.cloud/aws/emr-serverless";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Application } from "./Application.ts";

/**
 * Request accepted by the {@link GetSession} runtime callable. The
 * `applicationId` is injected from the bound {@link Application}.
 */
export type GetSessionInput = Omit<emr.GetSessionRequest, "applicationId">;

/**
 * Runtime binding for `emr-serverless:GetSession`.
 *
 * Reads an interactive session's detail on the bound {@link Application} —
 * state, execution role, idle time, resource utilization. Provide the
 * implementation with `Effect.provide(AWS.EMRServerless.GetSessionHttp)`.
 * ### Interactive Sessions
 * **Example:** Poll A Session
 * ```typescript
 * // init
 * const getSession = yield* AWS.EMRServerless.GetSession(app);
 *
 * // runtime
 * const { session } = yield* getSession({ sessionId });
 * yield* Effect.log(`${session.sessionId} is ${session.state}`);
 * ```
 *
 * @binding
 */
export interface GetSession extends Binding.Service<
  GetSession,
  "AWS.EMRServerless.GetSession",
  (
    application: Application,
  ) => Effect.Effect<
    (request: GetSessionInput) => Effect.Effect<emr.GetSessionResponse, emr.GetSessionError>
  >
> {}
export const GetSession = Binding.Service<GetSession>("AWS.EMRServerless.GetSession");