1import type * as ec2 from "@distilled.cloud/aws/ec2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Instance } from "./Instance.ts";
5
6/**
7 * `GetPasswordData` request with `InstanceId` injected from the bound
8 * {@link Instance}.
9 */
10export interface GetPasswordDataRequest extends Omit<
11 ec2.GetPasswordDataRequest,
12 "InstanceId" | "InstanceIds"
13> {}
14
15/**
16 * Runtime binding for the `GetPasswordData` operation scoped to the bound
17 * {@link Instance} (IAM action `ec2:GetPasswordData` on the instance ARN).
18 *
19 * Retrieves the encrypted Windows administrator password for the instance.
20 * The `PasswordData` field is sensitive and surfaces as
21 * `Redacted.Redacted<string>` — decrypt it with the launch key pair's private
22 * key. Linux instances return an empty value. Provide the implementation with
23 * `Effect.provide(AWS.EC2.GetPasswordDataHttp)`.
24 * ### Diagnostics
25 * **Example:** Fetch the encrypted Windows administrator password
26 * ```typescript
27 * // init — bind the operation to the instance
28 * const getPasswordData = yield* AWS.EC2.GetPasswordData(instance);
29 *
30 * // runtime — the ciphertext is Redacted; unwrap explicitly to decrypt
31 * const result = yield* getPasswordData();
32 * const ciphertext = result.PasswordData; // Redacted<string>
33 * ```
34 *
35 * @binding
36 */
37export interface GetPasswordData extends Binding.Service<
38 GetPasswordData,
39 "AWS.EC2.GetPasswordData",
40 (
41 instance: Instance,
42 ) => Effect.Effect<
43 (
44 request?: GetPasswordDataRequest,
45 ) => Effect.Effect<ec2.GetPasswordDataResult, ec2.GetPasswordDataError>
46 >
47> {}
48
49export const GetPasswordData = Binding.Service<GetPasswordData>(
50 "AWS.EC2.GetPasswordData",
51);