| 1 | import type * as identitystore from "@distilled.cloud/aws/identitystore"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Instance } from "./Instance.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `CreateUser` operation (IAM action |
| 8 | * `identitystore:CreateUser`), scoped to one {@link Instance}. |
| 9 | * |
| 10 | * Creates a user in the bound instance's identity store — e.g. a just-in-time provisioning Lambda mirroring users from an external HR system. The instance's |
| 11 | * `IdentityStoreId` is injected from the binding. Provide the implementation with |
| 12 | * `Effect.provide(AWS.IdentityCenter.CreateUserHttp)`. |
| 13 | * ### Managing Users |
| 14 | * **Example:** Provision a User |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the Identity Center instance |
| 17 | * const createUser = yield* AWS.IdentityCenter.CreateUser(instance); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { UserId } = yield* createUser({ |
| 21 | * UserName: "jdoe", |
| 22 | * DisplayName: "Jane Doe", |
| 23 | * Name: { GivenName: "Jane", FamilyName: "Doe" }, |
| 24 | * Emails: [{ Value: "jdoe@example.com", Primary: true }], |
| 25 | * }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface CreateUser extends Binding.Service< |
| 31 | CreateUser, |
| 32 | "AWS.IdentityCenter.CreateUser", |
| 33 | ( |
| 34 | instance: Instance, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: Omit<identitystore.CreateUserRequest, "IdentityStoreId">, |
| 38 | ) => Effect.Effect< |
| 39 | identitystore.CreateUserResponse, |
| 40 | identitystore.CreateUserError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const CreateUser = Binding.Service<CreateUser>( |
| 45 | "AWS.IdentityCenter.CreateUser", |
| 46 | ); |