Skip to content

Commit f02e967

Browse files
authored
Send X-Databricks-Workspace-Id for workspace routing (#216)
## Summary On unified Databricks hosts that serve multiple workspaces, the SDK sends a routing header so the gateway can dispatch each workspace-scoped request to the correct workspace. This PR switches that header from `X-Databricks-Org-Id` to `X-Databricks-Workspace-Id`. ## Why The Databricks platform is consolidating workspace addressing onto a single header, `X-Databricks-Workspace-Id`, which accepts a broader range of workspace identifier formats (the server disambiguates). The previous header continues to be accepted by the platform, so older SDK versions keep working; new versions should send the new name. This brings the JS SDK in line with the same migration already shipped in the Go SDK (databricks/databricks-sdk-go#1688). ## What changed ### Interface changes None. The workspace ID still comes from the same configuration field — `workspaceId` on `ClientOptions`, the `workspace_id` profile key, and the `DATABRICKS_WORKSPACE_ID` environment variable — unchanged in name and type (`string`). ### Behavioral changes Workspace-scoped requests now carry `X-Databricks-Workspace-Id: <workspaceId>` instead of `X-Databricks-Org-Id: <workspaceId>` when a workspace ID is configured. Account-scoped requests are unaffected — they send no routing header. The configured value may now be either a classic numeric workspace ID or another workspace identifier format the server understands; the docs for `ClientOptions.workspaceId` and the `workspaceId` profile field are widened to note this. ### Internal changes The header literal is emitted by the SDK generator, so the bulk of this PR is regenerated client output: a mechanical rename across 74 generated `client.ts` files (774 occurrences) with no logic change, isolated in the first commit. The second commit updates the hand-written docs, the `profile-client` example, and its test. ## How is this tested? `npm run build`, `npm run format:check`, `npm run lint`, `npm run typecheck`, `npm test`, and `npm run test:browser` all pass. The `profile-client` example test asserts the outgoing request carries `X-Databricks-Workspace-Id` set to the configured (non-numeric) workspace ID. This pull request and its description were written by Isaac. --------- Signed-off-by: Divyansh Vijayvergia <divyansh.vijayvergia@databricks.com>
1 parent 2827ae7 commit f02e967

78 files changed

Lines changed: 787 additions & 779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/accessmanagement/src/v1/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export class AccessManagementClient {
435435
const call = async (callSignal?: AbortSignal): Promise<void> => {
436436
const headers = new Headers();
437437
if (workspaceId !== undefined) {
438-
headers.set('X-Databricks-Org-Id', workspaceId);
438+
headers.set('X-Databricks-Workspace-Id', workspaceId);
439439
}
440440
headers.set('User-Agent', this.userAgent);
441441
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -464,7 +464,7 @@ export class AccessManagementClient {
464464
const call = async (callSignal?: AbortSignal): Promise<void> => {
465465
const headers = new Headers();
466466
if (workspaceId !== undefined) {
467-
headers.set('X-Databricks-Org-Id', workspaceId);
467+
headers.set('X-Databricks-Workspace-Id', workspaceId);
468468
}
469469
headers.set('User-Agent', this.userAgent);
470470
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -497,7 +497,7 @@ export class AccessManagementClient {
497497
const call = async (callSignal?: AbortSignal): Promise<void> => {
498498
const headers = new Headers({'Content-Type': 'application/json'});
499499
if (workspaceId !== undefined) {
500-
headers.set('X-Databricks-Org-Id', workspaceId);
500+
headers.set('X-Databricks-Workspace-Id', workspaceId);
501501
}
502502
headers.set('User-Agent', this.userAgent);
503503
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
@@ -530,7 +530,7 @@ export class AccessManagementClient {
530530
const call = async (callSignal?: AbortSignal): Promise<void> => {
531531
const headers = new Headers({'Content-Type': 'application/json'});
532532
if (workspaceId !== undefined) {
533-
headers.set('X-Databricks-Org-Id', workspaceId);
533+
headers.set('X-Databricks-Workspace-Id', workspaceId);
534534
}
535535
headers.set('User-Agent', this.userAgent);
536536
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
@@ -588,7 +588,7 @@ export class AccessManagementClient {
588588
const call = async (callSignal?: AbortSignal): Promise<void> => {
589589
const headers = new Headers();
590590
if (workspaceId !== undefined) {
591-
headers.set('X-Databricks-Org-Id', workspaceId);
591+
headers.set('X-Databricks-Workspace-Id', workspaceId);
592592
}
593593
headers.set('User-Agent', this.userAgent);
594594
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);

packages/alerts/src/v1/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class AlertsClient {
8080
const call = async (callSignal?: AbortSignal): Promise<void> => {
8181
const headers = new Headers({'Content-Type': 'application/json'});
8282
if (workspaceId !== undefined) {
83-
headers.set('X-Databricks-Org-Id', workspaceId);
83+
headers.set('X-Databricks-Workspace-Id', workspaceId);
8484
}
8585
headers.set('User-Agent', this.userAgent);
8686
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -106,7 +106,7 @@ export class AlertsClient {
106106
const call = async (callSignal?: AbortSignal): Promise<void> => {
107107
const headers = new Headers();
108108
if (workspaceId !== undefined) {
109-
headers.set('X-Databricks-Org-Id', workspaceId);
109+
headers.set('X-Databricks-Workspace-Id', workspaceId);
110110
}
111111
headers.set('User-Agent', this.userAgent);
112112
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -144,7 +144,7 @@ export class AlertsClient {
144144
const call = async (callSignal?: AbortSignal): Promise<void> => {
145145
const headers = new Headers();
146146
if (workspaceId !== undefined) {
147-
headers.set('X-Databricks-Org-Id', workspaceId);
147+
headers.set('X-Databricks-Workspace-Id', workspaceId);
148148
}
149149
headers.set('User-Agent', this.userAgent);
150150
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -190,7 +190,7 @@ export class AlertsClient {
190190
const call = async (callSignal?: AbortSignal): Promise<void> => {
191191
const headers = new Headers();
192192
if (workspaceId !== undefined) {
193-
headers.set('X-Databricks-Org-Id', workspaceId);
193+
headers.set('X-Databricks-Workspace-Id', workspaceId);
194194
}
195195
headers.set('User-Agent', this.userAgent);
196196
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
@@ -220,7 +220,7 @@ export class AlertsClient {
220220
const call = async (callSignal?: AbortSignal): Promise<void> => {
221221
const headers = new Headers({'Content-Type': 'application/json'});
222222
if (workspaceId !== undefined) {
223-
headers.set('X-Databricks-Org-Id', workspaceId);
223+
headers.set('X-Databricks-Workspace-Id', workspaceId);
224224
}
225225
headers.set('User-Agent', this.userAgent);
226226
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);

packages/alerts/src/v2/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class AlertsClient {
7878
const call = async (callSignal?: AbortSignal): Promise<void> => {
7979
const headers = new Headers({'Content-Type': 'application/json'});
8080
if (workspaceId !== undefined) {
81-
headers.set('X-Databricks-Org-Id', workspaceId);
81+
headers.set('X-Databricks-Workspace-Id', workspaceId);
8282
}
8383
headers.set('User-Agent', this.userAgent);
8484
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -104,7 +104,7 @@ export class AlertsClient {
104104
const call = async (callSignal?: AbortSignal): Promise<void> => {
105105
const headers = new Headers();
106106
if (workspaceId !== undefined) {
107-
headers.set('X-Databricks-Org-Id', workspaceId);
107+
headers.set('X-Databricks-Workspace-Id', workspaceId);
108108
}
109109
headers.set('User-Agent', this.userAgent);
110110
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -142,7 +142,7 @@ export class AlertsClient {
142142
const call = async (callSignal?: AbortSignal): Promise<void> => {
143143
const headers = new Headers();
144144
if (workspaceId !== undefined) {
145-
headers.set('X-Databricks-Org-Id', workspaceId);
145+
headers.set('X-Databricks-Workspace-Id', workspaceId);
146146
}
147147
headers.set('User-Agent', this.userAgent);
148148
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -194,7 +194,7 @@ export class AlertsClient {
194194
const call = async (callSignal?: AbortSignal): Promise<void> => {
195195
const headers = new Headers();
196196
if (workspaceId !== undefined) {
197-
headers.set('X-Databricks-Org-Id', workspaceId);
197+
headers.set('X-Databricks-Workspace-Id', workspaceId);
198198
}
199199
headers.set('User-Agent', this.userAgent);
200200
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
@@ -230,7 +230,7 @@ export class AlertsClient {
230230
const call = async (callSignal?: AbortSignal): Promise<void> => {
231231
const headers = new Headers({'Content-Type': 'application/json'});
232232
if (workspaceId !== undefined) {
233-
headers.set('X-Databricks-Org-Id', workspaceId);
233+
headers.set('X-Databricks-Workspace-Id', workspaceId);
234234
}
235235
headers.set('User-Agent', this.userAgent);
236236
const httpReq = buildHttpRequest(

packages/apps/src/v1/client.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class AppsClient {
130130
const call = async (callSignal?: AbortSignal): Promise<void> => {
131131
const headers = new Headers({'Content-Type': 'application/json'});
132132
if (workspaceId !== undefined) {
133-
headers.set('X-Databricks-Org-Id', workspaceId);
133+
headers.set('X-Databricks-Workspace-Id', workspaceId);
134134
}
135135
headers.set('User-Agent', this.userAgent);
136136
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -178,7 +178,7 @@ export class AppsClient {
178178
const call = async (callSignal?: AbortSignal): Promise<void> => {
179179
const headers = new Headers({'Content-Type': 'application/json'});
180180
if (workspaceId !== undefined) {
181-
headers.set('X-Databricks-Org-Id', workspaceId);
181+
headers.set('X-Databricks-Workspace-Id', workspaceId);
182182
}
183183
headers.set('User-Agent', this.userAgent);
184184
const httpReq = buildHttpRequest(
@@ -226,7 +226,7 @@ export class AppsClient {
226226
const call = async (callSignal?: AbortSignal): Promise<void> => {
227227
const headers = new Headers({'Content-Type': 'application/json'});
228228
if (workspaceId !== undefined) {
229-
headers.set('X-Databricks-Org-Id', workspaceId);
229+
headers.set('X-Databricks-Workspace-Id', workspaceId);
230230
}
231231
headers.set('User-Agent', this.userAgent);
232232
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -273,7 +273,7 @@ export class AppsClient {
273273
const call = async (callSignal?: AbortSignal): Promise<void> => {
274274
const headers = new Headers({'Content-Type': 'application/json'});
275275
if (workspaceId !== undefined) {
276-
headers.set('X-Databricks-Org-Id', workspaceId);
276+
headers.set('X-Databricks-Workspace-Id', workspaceId);
277277
}
278278
headers.set('User-Agent', this.userAgent);
279279
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -303,7 +303,7 @@ export class AppsClient {
303303
const call = async (callSignal?: AbortSignal): Promise<void> => {
304304
const headers = new Headers({'Content-Type': 'application/json'});
305305
if (workspaceId !== undefined) {
306-
headers.set('X-Databricks-Org-Id', workspaceId);
306+
headers.set('X-Databricks-Workspace-Id', workspaceId);
307307
}
308308
headers.set('User-Agent', this.userAgent);
309309
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -340,7 +340,7 @@ export class AppsClient {
340340
const call = async (callSignal?: AbortSignal): Promise<void> => {
341341
const headers = new Headers();
342342
if (workspaceId !== undefined) {
343-
headers.set('X-Databricks-Org-Id', workspaceId);
343+
headers.set('X-Databricks-Workspace-Id', workspaceId);
344344
}
345345
headers.set('User-Agent', this.userAgent);
346346
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
@@ -368,7 +368,7 @@ export class AppsClient {
368368
const call = async (callSignal?: AbortSignal): Promise<void> => {
369369
const headers = new Headers();
370370
if (workspaceId !== undefined) {
371-
headers.set('X-Databricks-Org-Id', workspaceId);
371+
headers.set('X-Databricks-Workspace-Id', workspaceId);
372372
}
373373
headers.set('User-Agent', this.userAgent);
374374
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
@@ -392,7 +392,7 @@ export class AppsClient {
392392
const call = async (callSignal?: AbortSignal): Promise<void> => {
393393
const headers = new Headers();
394394
if (workspaceId !== undefined) {
395-
headers.set('X-Databricks-Org-Id', workspaceId);
395+
headers.set('X-Databricks-Workspace-Id', workspaceId);
396396
}
397397
headers.set('User-Agent', this.userAgent);
398398
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
@@ -421,7 +421,7 @@ export class AppsClient {
421421
const call = async (callSignal?: AbortSignal): Promise<void> => {
422422
const headers = new Headers();
423423
if (workspaceId !== undefined) {
424-
headers.set('X-Databricks-Org-Id', workspaceId);
424+
headers.set('X-Databricks-Workspace-Id', workspaceId);
425425
}
426426
headers.set('User-Agent', this.userAgent);
427427
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
@@ -458,7 +458,7 @@ export class AppsClient {
458458
const call = async (callSignal?: AbortSignal): Promise<void> => {
459459
const headers = new Headers();
460460
if (workspaceId !== undefined) {
461-
headers.set('X-Databricks-Org-Id', workspaceId);
461+
headers.set('X-Databricks-Workspace-Id', workspaceId);
462462
}
463463
headers.set('User-Agent', this.userAgent);
464464
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -487,7 +487,7 @@ export class AppsClient {
487487
const call = async (callSignal?: AbortSignal): Promise<void> => {
488488
const headers = new Headers();
489489
if (workspaceId !== undefined) {
490-
headers.set('X-Databricks-Org-Id', workspaceId);
490+
headers.set('X-Databricks-Workspace-Id', workspaceId);
491491
}
492492
headers.set('User-Agent', this.userAgent);
493493
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -516,7 +516,7 @@ export class AppsClient {
516516
const call = async (callSignal?: AbortSignal): Promise<void> => {
517517
const headers = new Headers();
518518
if (workspaceId !== undefined) {
519-
headers.set('X-Databricks-Org-Id', workspaceId);
519+
headers.set('X-Databricks-Workspace-Id', workspaceId);
520520
}
521521
headers.set('User-Agent', this.userAgent);
522522
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -545,7 +545,7 @@ export class AppsClient {
545545
const call = async (callSignal?: AbortSignal): Promise<void> => {
546546
const headers = new Headers();
547547
if (workspaceId !== undefined) {
548-
headers.set('X-Databricks-Org-Id', workspaceId);
548+
headers.set('X-Databricks-Workspace-Id', workspaceId);
549549
}
550550
headers.set('User-Agent', this.userAgent);
551551
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -571,7 +571,7 @@ export class AppsClient {
571571
const call = async (callSignal?: AbortSignal): Promise<void> => {
572572
const headers = new Headers();
573573
if (workspaceId !== undefined) {
574-
headers.set('X-Databricks-Org-Id', workspaceId);
574+
headers.set('X-Databricks-Workspace-Id', workspaceId);
575575
}
576576
headers.set('User-Agent', this.userAgent);
577577
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -600,7 +600,7 @@ export class AppsClient {
600600
const call = async (callSignal?: AbortSignal): Promise<void> => {
601601
const headers = new Headers();
602602
if (workspaceId !== undefined) {
603-
headers.set('X-Databricks-Org-Id', workspaceId);
603+
headers.set('X-Databricks-Workspace-Id', workspaceId);
604604
}
605605
headers.set('User-Agent', this.userAgent);
606606
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
@@ -638,7 +638,7 @@ export class AppsClient {
638638
const call = async (callSignal?: AbortSignal): Promise<void> => {
639639
const headers = new Headers();
640640
if (workspaceId !== undefined) {
641-
headers.set('X-Databricks-Org-Id', workspaceId);
641+
headers.set('X-Databricks-Workspace-Id', workspaceId);
642642
}
643643
headers.set('User-Agent', this.userAgent);
644644
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -696,7 +696,7 @@ export class AppsClient {
696696
const call = async (callSignal?: AbortSignal): Promise<void> => {
697697
const headers = new Headers();
698698
if (workspaceId !== undefined) {
699-
headers.set('X-Databricks-Org-Id', workspaceId);
699+
headers.set('X-Databricks-Workspace-Id', workspaceId);
700700
}
701701
headers.set('User-Agent', this.userAgent);
702702
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -751,7 +751,7 @@ export class AppsClient {
751751
const call = async (callSignal?: AbortSignal): Promise<void> => {
752752
const headers = new Headers();
753753
if (workspaceId !== undefined) {
754-
headers.set('X-Databricks-Org-Id', workspaceId);
754+
headers.set('X-Databricks-Workspace-Id', workspaceId);
755755
}
756756
headers.set('User-Agent', this.userAgent);
757757
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -809,7 +809,7 @@ export class AppsClient {
809809
const call = async (callSignal?: AbortSignal): Promise<void> => {
810810
const headers = new Headers();
811811
if (workspaceId !== undefined) {
812-
headers.set('X-Databricks-Org-Id', workspaceId);
812+
headers.set('X-Databricks-Workspace-Id', workspaceId);
813813
}
814814
headers.set('User-Agent', this.userAgent);
815815
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
@@ -856,7 +856,7 @@ export class AppsClient {
856856
const call = async (callSignal?: AbortSignal): Promise<void> => {
857857
const headers = new Headers({'Content-Type': 'application/json'});
858858
if (workspaceId !== undefined) {
859-
headers.set('X-Databricks-Org-Id', workspaceId);
859+
headers.set('X-Databricks-Workspace-Id', workspaceId);
860860
}
861861
headers.set('User-Agent', this.userAgent);
862862
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -898,7 +898,7 @@ export class AppsClient {
898898
const call = async (callSignal?: AbortSignal): Promise<void> => {
899899
const headers = new Headers({'Content-Type': 'application/json'});
900900
if (workspaceId !== undefined) {
901-
headers.set('X-Databricks-Org-Id', workspaceId);
901+
headers.set('X-Databricks-Workspace-Id', workspaceId);
902902
}
903903
headers.set('User-Agent', this.userAgent);
904904
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
@@ -937,7 +937,7 @@ export class AppsClient {
937937
const call = async (callSignal?: AbortSignal): Promise<void> => {
938938
const headers = new Headers({'Content-Type': 'application/json'});
939939
if (workspaceId !== undefined) {
940-
headers.set('X-Databricks-Org-Id', workspaceId);
940+
headers.set('X-Databricks-Workspace-Id', workspaceId);
941941
}
942942
headers.set('User-Agent', this.userAgent);
943943
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
@@ -967,7 +967,7 @@ export class AppsClient {
967967
const call = async (callSignal?: AbortSignal): Promise<void> => {
968968
const headers = new Headers({'Content-Type': 'application/json'});
969969
if (workspaceId !== undefined) {
970-
headers.set('X-Databricks-Org-Id', workspaceId);
970+
headers.set('X-Databricks-Workspace-Id', workspaceId);
971971
}
972972
headers.set('User-Agent', this.userAgent);
973973
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
@@ -997,7 +997,7 @@ export class AppsClient {
997997
const call = async (callSignal?: AbortSignal): Promise<void> => {
998998
const headers = new Headers({'Content-Type': 'application/json'});
999999
if (workspaceId !== undefined) {
1000-
headers.set('X-Databricks-Org-Id', workspaceId);
1000+
headers.set('X-Databricks-Workspace-Id', workspaceId);
10011001
}
10021002
headers.set('User-Agent', this.userAgent);
10031003
const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
@@ -1033,7 +1033,7 @@ export class AppsClient {
10331033
const call = async (callSignal?: AbortSignal): Promise<void> => {
10341034
const headers = new Headers({'Content-Type': 'application/json'});
10351035
if (workspaceId !== undefined) {
1036-
headers.set('X-Databricks-Org-Id', workspaceId);
1036+
headers.set('X-Databricks-Workspace-Id', workspaceId);
10371037
}
10381038
headers.set('User-Agent', this.userAgent);
10391039
const httpReq = buildHttpRequest(

0 commit comments

Comments
 (0)