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

Commit6ca1e59

Browse files
authored
chore: add api endpoints to get idp field values (#16063)
Supportscoder/internal#210
1 parent303c4a9 commit6ca1e59

File tree

7 files changed

+359
-0
lines changed

7 files changed

+359
-0
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 92 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: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎codersdk/idpsync.go‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"net/http"
8+
"net/url"
89
"regexp"
910

1011
"github.com/google/uuid"
@@ -163,3 +164,35 @@ func (c *Client) GetOrganizationAvailableIDPSyncFields(ctx context.Context, orgI
163164
varresp []string
164165
returnresp,json.NewDecoder(res.Body).Decode(&resp)
165166
}
167+
168+
func (c*Client)GetIDPSyncFieldValues(ctx context.Context,claimFieldstring) ([]string,error) {
169+
qv:= url.Values{}
170+
qv.Add("claimField",claimField)
171+
res,err:=c.Request(ctx,http.MethodGet,fmt.Sprintf("/api/v2/settings/idpsync/field-values?%s",qv.Encode()),nil)
172+
iferr!=nil {
173+
returnnil,xerrors.Errorf("make request: %w",err)
174+
}
175+
deferres.Body.Close()
176+
177+
ifres.StatusCode!=http.StatusOK {
178+
returnnil,ReadBodyAsError(res)
179+
}
180+
varresp []string
181+
returnresp,json.NewDecoder(res.Body).Decode(&resp)
182+
}
183+
184+
func (c*Client)GetOrganizationIDPSyncFieldValues(ctx context.Context,orgIDstring,claimFieldstring) ([]string,error) {
185+
qv:= url.Values{}
186+
qv.Add("claimField",claimField)
187+
res,err:=c.Request(ctx,http.MethodGet,fmt.Sprintf("/api/v2/organizations/%s/settings/idpsync/field-values?%s",orgID,qv.Encode()),nil)
188+
iferr!=nil {
189+
returnnil,xerrors.Errorf("make request: %w",err)
190+
}
191+
deferres.Body.Close()
192+
193+
ifres.StatusCode!=http.StatusOK {
194+
returnnil,ReadBodyAsError(res)
195+
}
196+
varresp []string
197+
returnresp,json.NewDecoder(res.Body).Decode(&resp)
198+
}

‎docs/reference/api/enterprise.md‎

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

‎enterprise/coderd/coderd.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
297297
r.Patch("/",api.patchOrganizationIDPSyncSettings)
298298
})
299299
r.Get("/available-fields",api.deploymentIDPSyncClaimFields)
300+
r.Get("/field-values",api.deploymentIDPSyncClaimFieldValues)
300301
})
301302
})
302303

@@ -311,6 +312,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
311312
r.Patch("/idpsync/groups",api.patchGroupIDPSyncSettings)
312313
r.Get("/idpsync/roles",api.roleIDPSyncSettings)
313314
r.Patch("/idpsync/roles",api.patchRoleIDPSyncSettings)
315+
r.Get("/idpsync/field-values",api.organizationIDPSyncClaimFieldValues)
314316
})
315317
})
316318

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp