Commit fb01984
authored
Exclude entitlements from CurrentWorkspaceID Me probe (#1681)
This PR makes `WorkspaceClient.CurrentWorkspaceID` ask the SCIM server
to skip the `entitlements` attribute on the underlying `Me` call.
## Why
`CurrentWorkspaceID` issues a `GET /api/2.0/preview/scim/v2/Me` request
and reads the `X-Databricks-Org-Id` response header to identify the
workspace. The body of the response is discarded.
By default, however, the SCIM server computes the `User.Entitlements`
field for `/Me` responses - and that computation scans every entitlement
grant in the workspace, regardless of which user is calling. On
workspaces with a lot of accumulated grants, that's a meaningful amount
of server work for a value the SDK never looks at.
This change passes `?excludedAttributes=entitlements` on the request so
the server can skip the scan entirely. The endpoint already honors that
query parameter today.
## What changed
One option appended to the existing `Do` call:
```go
httpclient.WithRequestData(map[string]string{"excludedAttributes": "entitlements"})
```
And a doc-comment line on `CurrentWorkspaceID` explaining the why.
## Tests
New `TestCurrentWorkspaceIDExcludesEntitlements` stands up an `httptest`
server, captures `r.URL.RawQuery`, and asserts it's
`excludedAttributes=entitlements`. The two existing
`TestCurrentWorkspaceID*` tests in this file already match on
`r.URL.Path`, so they still pass.
---------
Co-authored-by: Omer Lachish <rauchy@users.noreply.github.com>1 parent fbb184c commit fb01984
3 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
45 | 69 | | |
46 | 70 | | |
47 | 71 | | |
| |||
0 commit comments