mirror of
https://github.com/coder/coder.git
synced 2026-06-04 13:38:21 +00:00
d02ff5f9b2
Closes https://github.com/coder/internal/issues/985 Simple refactor of the user creation logic into it's own test runner. This lets us create users independently of workspaces, for use in a bunch of load generators, including the Coder Connect load generator. This PR creates the new runner, and has the existing `createworkspaces` runner use it.
24 lines
568 B
Go
24 lines
568 B
Go
package createusers
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"golang.org/x/xerrors"
|
|
)
|
|
|
|
type Config struct {
|
|
// OrganizationID is the ID of the organization to add the user to.
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
|
// Username is the username of the new user. Generated if empty.
|
|
Username string `json:"username"`
|
|
// Email is the email of the new user. Generated if empty.
|
|
Email string `json:"email"`
|
|
}
|
|
|
|
func (c Config) Validate() error {
|
|
if c.OrganizationID == uuid.Nil {
|
|
return xerrors.New("organization_id must not be a nil UUID")
|
|
}
|
|
|
|
return nil
|
|
}
|