CreateFirstUser attempts to create the first user on a Coder deployment. This initial user has superadmin privileges. If >0 users exist, this request will fail.
(ctx context.Context, req CreateFirstUserRequest)
| 525 | // CreateFirstUser attempts to create the first user on a Coder deployment. |
| 526 | // This initial user has superadmin privileges. If >0 users exist, this request will fail. |
| 527 | func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error) { |
| 528 | res, err := c.Request(ctx, http.MethodPost, "/api/v2/users/first", req) |
| 529 | if err != nil { |
| 530 | return CreateFirstUserResponse{}, err |
| 531 | } |
| 532 | defer res.Body.Close() |
| 533 | if res.StatusCode != http.StatusCreated { |
| 534 | return CreateFirstUserResponse{}, ReadBodyAsError(res) |
| 535 | } |
| 536 | var resp CreateFirstUserResponse |
| 537 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 538 | } |
| 539 | |
| 540 | // CreateUser |
| 541 | // Deprecated: Use CreateUserWithOrgs instead. This will be removed. |