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

Commitb5ad628

Browse files
authored
chore: Allow editing proxy fields via api. (#7435)
* chore: Add ability to update workspace proxy fields
1 parentfc1bc37 commitb5ad628

File tree

15 files changed

+879
-61
lines changed

15 files changed

+879
-61
lines changed

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/database/dbauthz/querier.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,13 @@ func (q *querier) InsertWorkspaceProxy(ctx context.Context, arg database.InsertW
17051705
returninsert(q.log,q.auth,rbac.ResourceWorkspaceProxy,q.db.InsertWorkspaceProxy)(ctx,arg)
17061706
}
17071707

1708+
func (q*querier)UpdateWorkspaceProxy(ctx context.Context,arg database.UpdateWorkspaceProxyParams) (database.WorkspaceProxy,error) {
1709+
fetch:=func(ctx context.Context,arg database.UpdateWorkspaceProxyParams) (database.WorkspaceProxy,error) {
1710+
returnq.db.GetWorkspaceProxyByID(ctx,arg.ID)
1711+
}
1712+
returnupdateWithReturn(q.log,q.auth,fetch,q.db.UpdateWorkspaceProxy)(ctx,arg)
1713+
}
1714+
17081715
func (q*querier)RegisterWorkspaceProxy(ctx context.Context,arg database.RegisterWorkspaceProxyParams) (database.WorkspaceProxy,error) {
17091716
fetch:=func(ctx context.Context,arg database.RegisterWorkspaceProxyParams) (database.WorkspaceProxy,error) {
17101717
returnq.db.GetWorkspaceProxyByID(ctx,arg.ID)

‎coderd/database/dbfake/databasefake.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5233,6 +5233,31 @@ func (q *fakeQuerier) RegisterWorkspaceProxy(_ context.Context, arg database.Reg
52335233
return database.WorkspaceProxy{},sql.ErrNoRows
52345234
}
52355235

5236+
func (q*fakeQuerier)UpdateWorkspaceProxy(_ context.Context,arg database.UpdateWorkspaceProxyParams) (database.WorkspaceProxy,error) {
5237+
q.mutex.Lock()
5238+
deferq.mutex.Unlock()
5239+
5240+
for_,p:=rangeq.workspaceProxies {
5241+
ifp.Name==arg.Name&&p.ID!=arg.ID {
5242+
return database.WorkspaceProxy{},errDuplicateKey
5243+
}
5244+
}
5245+
5246+
fori,p:=rangeq.workspaceProxies {
5247+
ifp.ID==arg.ID {
5248+
p.Name=arg.Name
5249+
p.DisplayName=arg.DisplayName
5250+
p.Icon=arg.Icon
5251+
iflen(p.TokenHashedSecret)>0 {
5252+
p.TokenHashedSecret=arg.TokenHashedSecret
5253+
}
5254+
q.workspaceProxies[i]=p
5255+
returnp,nil
5256+
}
5257+
}
5258+
return database.WorkspaceProxy{},sql.ErrNoRows
5259+
}
5260+
52365261
func (q*fakeQuerier)UpdateWorkspaceProxyDeleted(_ context.Context,arg database.UpdateWorkspaceProxyDeletedParams)error {
52375262
q.mutex.Lock()
52385263
deferq.mutex.Unlock()

‎coderd/database/querier.go

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

‎coderd/database/queries.sql.go

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp