1import type * as emrc from "@distilled.cloud/aws/emr-containers";
2import type * as Duration from "effect/Duration";
3import type * as Effect from "effect/Effect";
4import * as Binding from "../../Binding.ts";
5import type { VirtualCluster } from "./VirtualCluster.ts";
6
7export interface GetManagedEndpointSessionCredentialsRequest extends Omit<
8 emrc.GetManagedEndpointSessionCredentialsRequest,
9 "virtualClusterIdentifier" | "durationInSeconds"
10> {
11 /**
12 * How long the session token stays valid (wire unit: seconds).
13 * @default the endpoint type's default session duration
14 */
15 duration?: Duration.Input;
16}
17
18/**
19 * Runtime binding for `emr-containers:GetManagedEndpointSessionCredentials`.
20 *
21 * Mints a session token for connecting to a managed endpoint (EMR Studio
22 * gateway) on the bound {@link VirtualCluster}. The virtual cluster
23 * identifier is injected from the binding; pass the `endpointIdentifier`,
24 * the `executionRoleArn` to run as, and the `credentialType`
25 * (`TOKEN`). The returned `credentials.token` is a
26 * `Redacted` value — call `Redacted.value(...)` at the point of use.
27 * Provide the implementation with
28 * `Effect.provide(AWS.EMRContainers.GetManagedEndpointSessionCredentialsHttp)`.
29 * ### Managed Endpoints
30 * **Example:** Mint A Session Token
31 * ```typescript
32 * // init
33 * const getSessionCredentials =
34 * yield* AWS.EMRContainers.GetManagedEndpointSessionCredentials(virtualCluster);
35 *
36 * // runtime
37 * const { credentials } = yield* getSessionCredentials({
38 * endpointIdentifier: endpointId,
39 * executionRoleArn: jobRoleArn,
40 * credentialType: "TOKEN",
41 * duration: "15 minutes",
42 * });
43 * const token = Redacted.value(credentials!.token);
44 * ```
45 *
46 * @binding
47 */
48export interface GetManagedEndpointSessionCredentials extends Binding.Service<
49 GetManagedEndpointSessionCredentials,
50 "AWS.EMRContainers.GetManagedEndpointSessionCredentials",
51 (
52 virtualCluster: VirtualCluster,
53 ) => Effect.Effect<
54 (
55 request: GetManagedEndpointSessionCredentialsRequest,
56 ) => Effect.Effect<
57 emrc.GetManagedEndpointSessionCredentialsResponse,
58 emrc.GetManagedEndpointSessionCredentialsError
59 >
60 >
61> {}
62export const GetManagedEndpointSessionCredentials =
63 Binding.Service<GetManagedEndpointSessionCredentials>(
64 "AWS.EMRContainers.GetManagedEndpointSessionCredentials",
65 );