Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita96ae89

Browse files
committed
🧼
1 parent912bea7 commita96ae89

File tree

8 files changed

+277
-13
lines changed

8 files changed

+277
-13
lines changed

‎coderd/apidoc/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/coderdtest/swaggerparser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ func parseSwaggerComment(commentGroup *ast.CommentGroup) SwaggerComment {
8989
failures: []response{},
9090
}
9191
for_,line:=rangecommentGroup.List {
92-
// @<annotationName> [args...]
92+
//"//@<annotationName> [args...]" -> []string{"//", "@<annotationName>", "args..."}
9393
splitN:=strings.SplitN(strings.TrimSpace(line.Text)," ",3)
94-
iflen(splitN)<2 {
94+
iflen(splitN)<3 {
9595
continue// comment prefix without any content
9696
}
9797

‎coderd/workspaces.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request)
340340
// @Description specify either the Template ID or the Template Version ID,
341341
// @Description not both. If the Template ID is specified, the active version
342342
// @Description of the template will be used.
343-
// @Deprecated
343+
// @Deprecated Use /users/{user}/workspaces instead.
344344
// @ID create-user-workspace-by-organization
345345
// @Security CoderSessionToken
346346
// @Accept json
@@ -397,7 +397,7 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
397397

398398
// Create a new workspace for the currently authenticated user.
399399
//
400-
// @Summary Create user workspace by organization
400+
// @Summary Create user workspace
401401
// @Description Create a new workspace using a template. The request must
402402
// @Description specify either the Template ID or the Template Version ID,
403403
// @Description not both. If the Template ID is specified, the active version

‎codersdk/organizations.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, n
473473
}
474474

475475
// CreateWorkspace creates a new workspace for the template specified.
476+
//
477+
// Deprecated: Use CreateUserWorkspace instead.
476478
func (c*Client)CreateWorkspace(ctx context.Context,organizationID uuid.UUID,userstring,requestCreateWorkspaceRequest) (Workspace,error) {
477479
res,err:=c.Request(ctx,http.MethodPost,fmt.Sprintf("/api/v2/organizations/%s/members/%s/workspaces",organizationID,user),request)
478480
iferr!=nil {
@@ -487,3 +489,19 @@ func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID,
487489
varworkspaceWorkspace
488490
returnworkspace,json.NewDecoder(res.Body).Decode(&workspace)
489491
}
492+
493+
// CreateUserWorkspace creates a new workspace for the template specified.
494+
func (c*Client)CreateUserWorkspace(ctx context.Context,userstring,requestCreateWorkspaceRequest) (Workspace,error) {
495+
res,err:=c.Request(ctx,http.MethodPost,fmt.Sprintf("/api/v2/users/%s/workspaces",user),request)
496+
iferr!=nil {
497+
returnWorkspace{},err
498+
}
499+
deferres.Body.Close()
500+
501+
ifres.StatusCode!=http.StatusCreated {
502+
returnWorkspace{},ReadBodyAsError(res)
503+
}
504+
505+
varworkspaceWorkspace
506+
returnworkspace,json.NewDecoder(res.Body).Decode(&workspace)
507+
}

‎docs/api/workspaces.md

Lines changed: 246 additions & 6 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎enterprise/coderd/coderdenttest/swagger_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@ import (
55

66
"github.com/stretchr/testify/require"
77

8+
"fmt"
9+
810
"github.com/coder/coder/v2/coderd/coderdtest"
911
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
1012
)
1113

1214
funcTestEnterpriseEndpointsDocumented(t*testing.T) {
1315
t.Parallel()
1416

17+
fmt.Println("wtf")
1518
swaggerComments,err:=coderdtest.ParseSwaggerComments("..","../../../coderd")
1619
require.NoError(t,err,"can't parse swagger comments")
1720
require.NotEmpty(t,swaggerComments,"swagger comments must be present")
21+
fmt.Println("wtf2")
1822

1923
//nolint: dogsled
2024
_,_,api,_:=coderdenttest.NewWithAPI(t,nil)
25+
fmt.Println("wtf3")
2126
coderdtest.VerifySwaggerDefinitions(t,api.AGPL.APIHandler,swaggerComments)
27+
fmt.Println("wtf4")
2228
}

‎enterprise/coderd/workspaces_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestCreateWorkspace(t *testing.T) {
8383
require.Error(t,err)
8484
varapiErr*codersdk.Error
8585
require.ErrorAs(t,err,&apiErr)
86-
require.Equal(t,http.StatusForbidden,apiErr.StatusCode())
86+
require.Equal(t,http.StatusNotAcceptable,apiErr.StatusCode())
8787
})
8888

8989
// Test that a user cannot indirectly access

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp