Skip to content

Commit f1cbbd1

Browse files
committed
Send X-Databricks-Workspace-Id on workspace-routed API calls
On unified Databricks hosts that serve multiple workspaces, the CLI sends a routing header so the gateway can dispatch each request to the correct workspace. The platform is consolidating workspace addressing onto a single header name. Switch the header sent on workspace-scoped API calls from X-Databricks-Org-Id to X-Databricks-Workspace-Id. The previous header continues to be accepted by the platform, so older CLI versions keep working. This change covers the hand-written paths in the CLI that issue workspace- routed API calls without going through generated SDK service methods: - databricks api {verb} (cmd/api/api.go) - Files API filer (libs/filer/files_client.go) - Workspace files filer (libs/filer/workspace_files_client.go) - Telemetry uploads (libs/telemetry/logger.go) The value continues to come from the workspace_id config field or DATABRICKS_WORKSPACE_ID. The CurrentWorkspaceID() helper in the SDK still reads X-Databricks-Org-Id from the response on /api/2.0/preview/scim/v2/Me, so the response-side references in libs/testserver/handlers.go and libs/testproxy/server.go intentionally remain on the legacy header name.
1 parent 3f1e9c3 commit f1cbbd1

24 files changed

Lines changed: 58 additions & 56 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/clusters/list --account
2-
trace print_requests.py --get //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id"
2+
trace print_requests.py --get //api/2.0/clusters/list | contains.py "!X-Databricks-Workspace-Id"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/accounts/abc-123/network-policies
2-
trace print_requests.py --get //api/2.0/accounts/abc-123/network-policies | contains.py "!X-Databricks-Org-Id"
2+
trace print_requests.py --get //api/2.0/accounts/abc-123/network-policies | contains.py "!X-Databricks-Workspace-Id"

acceptance/cmd/api/default-profile/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"User-Agent": [
1414
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
1515
],
16-
"X-Databricks-Org-Id": [
16+
"X-Databricks-Workspace-Id": [
1717
"[NUMID]"
1818
]
1919
},

acceptance/cmd/api/default-profile/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ unset DATABRICKS_CONFIG_PROFILE
2222

2323
title "default_profile is used when no --profile flag and no DATABRICKS_CONFIG_PROFILE\n"
2424
MSYS_NO_PATHCONV=1 trace $CLI api get /api/2.0/clusters/list
25-
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id"
25+
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Workspace-Id"
2626

2727
title "--profile overrides default_profile (negative case)\n"
2828
MSYS_NO_PATHCONV=1 errcode $CLI api get /api/2.0/clusters/list -p other 2>&1 | contains.py "other.test"

acceptance/cmd/api/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
RecordRequests = true
2-
IncludeRequestHeaders = ["Authorization", "User-Agent", "X-Databricks-Org-Id"]
2+
IncludeRequestHeaders = ["Authorization", "User-Agent", "X-Databricks-Workspace-Id"]
33

44
# Normalize OS-dependent and CI-only User-Agent segments so the recorded
55
# requests are stable across local macOS/Linux runs and GitHub Actions.

acceptance/cmd/api/workspace-id-flag/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"User-Agent": [
1010
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
1111
],
12-
"X-Databricks-Org-Id": [
12+
"X-Databricks-Workspace-Id": [
1313
"999"
1414
]
1515
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/clusters/list --workspace-id 999
2-
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999"
2+
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Workspace-Id" "999"

acceptance/cmd/api/workspace-id-from-query/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"User-Agent": [
1010
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
1111
],
12-
"X-Databricks-Org-Id": [
12+
"X-Databricks-Workspace-Id": [
1313
"999"
1414
]
1515
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MSYS_NO_PATHCONV=1 $CLI api get "/api/2.0/clusters/list?o=999"
2-
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999"
2+
trace print_requests.py --get //api/2.0/clusters/list | contains.py "X-Databricks-Workspace-Id" "999"

acceptance/cmd/api/workspace-id-none/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ workspace_id = none
1010
EOF
1111

1212
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/clusters/list --profile spog-account
13-
trace print_requests.py --get //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id"
13+
trace print_requests.py --get //api/2.0/clusters/list | contains.py "!X-Databricks-Workspace-Id"

0 commit comments

Comments
 (0)