Skip to main content

operators_create

Function operators_create 

Source
pub async fn operators_create(
    __arg0: State<AppState>,
    __arg1: Json<OperatorsCreateReq>,
) -> Response
Expand description

POST /v1/operators. Mints sid (op-<uuid>) + a 10-hex-char token (mlua_swarm::types::secure_hex(5) — OS-RNG hex, unguessable across calls and restarts, which is the point: this token is the sole bearer secret on the short-handle path). When roles is non-empty, checks AppState.roles_to_sid for conflicts under a single lock (check + insert atomic w.r.t. concurrent mints) and returns 409 CONFLICT with the conflicting role names on collision. Empty roles never conflicts (= no exclusivity is claimed).