chore(coderd): allow creating workspaces without specifying an organization (#14048)

This commit is contained in:
Kayla Washburn-Love
2024-07-30 10:44:02 -06:00
committed by GitHub
parent 56dfc64bb0
commit bf4b7abf14
53 changed files with 814 additions and 254 deletions
+9 -2
View File
@@ -473,8 +473,15 @@ func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, n
}
// CreateWorkspace creates a new workspace for the template specified.
func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, user string, request CreateWorkspaceRequest) (Workspace, error) {
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/organizations/%s/members/%s/workspaces", organizationID, user), request)
//
// Deprecated: Use CreateUserWorkspace instead.
func (c *Client) CreateWorkspace(ctx context.Context, _ uuid.UUID, user string, request CreateWorkspaceRequest) (Workspace, error) {
return c.CreateUserWorkspace(ctx, user, request)
}
// CreateUserWorkspace creates a new workspace for the template specified.
func (c *Client) CreateUserWorkspace(ctx context.Context, user string, request CreateWorkspaceRequest) (Workspace, error) {
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/users/%s/workspaces", user), request)
if err != nil {
return Workspace{}, err
}