| 1 | import type * as mq from "@distilled.cloud/aws/mq"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Broker } from "./Broker.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `CreateUser` operation (IAM action |
| 8 | * `mq:CreateUser`), scoped to one {@link Broker}. |
| 9 | * |
| 10 | * Creates a broker user — e.g. provisioning per-tenant credentials at |
| 11 | * runtime. On ActiveMQ the change is staged and applied at the next broker |
| 12 | * reboot or maintenance window; on RabbitMQ it takes effect immediately. |
| 13 | * The password is marked sensitive — pass a `Redacted` value and it stays |
| 14 | * redacted until wire encoding. Provide the implementation with |
| 15 | * `Effect.provide(AWS.MQ.CreateUserHttp)`. |
| 16 | * ### Managing Users |
| 17 | * **Example:** Provision a User at Runtime |
| 18 | * ```typescript |
| 19 | * const createUser = yield* MQ.CreateUser(broker); |
| 20 | * |
| 21 | * yield* createUser({ |
| 22 | * Username: "tenant-42", |
| 23 | * Password: Redacted.make("SuperSecretPassw0rd"), |
| 24 | * }); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface CreateUser extends Binding.Service< |
| 30 | CreateUser, |
| 31 | "AWS.MQ.CreateUser", |
| 32 | ( |
| 33 | broker: Broker, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request: Omit<mq.CreateUserRequest, "BrokerId">, |
| 37 | ) => Effect.Effect<mq.CreateUserResponse, mq.CreateUserError> |
| 38 | > |
| 39 | > {} |
| 40 | export const CreateUser = Binding.Service<CreateUser>("AWS.MQ.CreateUser"); |