| 1 | import type * as transfer from "@distilled.cloud/aws/transfer"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { User } from "./User.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `transfer:ImportSshPublicKey`. |
| 8 | * |
| 9 | * Registers an additional SSH public key on the bound {@link User} — the |
| 10 | * key-rotation half of a self-service credential portal. The `ServerId` and |
| 11 | * `UserName` are injected from the binding; only the public key body is |
| 12 | * passed at runtime. Returns the new `SshPublicKeyId` for later |
| 13 | * {@link DeleteSshPublicKey}. Importing a key that is already registered |
| 14 | * fails with the typed `ResourceExistsException`. Provide the |
| 15 | * implementation with `Effect.provide(AWS.Transfer.ImportSshPublicKeyHttp)`. |
| 16 | * ### Managing SSH Keys at Runtime |
| 17 | * **Example:** Rotate a User's Key |
| 18 | * ```typescript |
| 19 | * // init — bind the operation to the user |
| 20 | * const importSshPublicKey = yield* AWS.Transfer.ImportSshPublicKey(user); |
| 21 | * |
| 22 | * // runtime |
| 23 | * const { SshPublicKeyId } = yield* importSshPublicKey({ |
| 24 | * SshPublicKeyBody: "ssh-ed25519 AAAA…", |
| 25 | * }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ImportSshPublicKey extends Binding.Service< |
| 31 | ImportSshPublicKey, |
| 32 | "AWS.Transfer.ImportSshPublicKey", |
| 33 | ( |
| 34 | user: User, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: Omit< |
| 38 | transfer.ImportSshPublicKeyRequest, |
| 39 | "ServerId" | "UserName" |
| 40 | >, |
| 41 | ) => Effect.Effect< |
| 42 | transfer.ImportSshPublicKeyResponse, |
| 43 | transfer.ImportSshPublicKeyError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ImportSshPublicKey = Binding.Service<ImportSshPublicKey>( |
| 48 | "AWS.Transfer.ImportSshPublicKey", |
| 49 | ); |