Skip to content

Commit 35bc28a

Browse files
committed
Add X-Databricks-Org-Id header to SharesExtImpl.list() for SPOG
Hand-written extension methods in the mixins bypass the generated per-call header logic. On SPOG hosts, requests without X-Databricks-Org-Id are rejected by the proxy with: Error: Unable to load OAuth Config (400 UNKNOWN) Generated service methods (e.g. WorkspaceImpl.export/importContent, SharesImpl.* generated endpoints) already set this header when cfg.workspaceId is populated. This change brings the hand-written SharesExtImpl.list() in line. Ports databricks/databricks-sdk-go#1635. The other two fixes from databricks/databricks-sdk-py#1397 do not apply to Java: - WorkspaceExt.upload/download: no hand-written Java equivalent; the generated WorkspaceImpl.export()/importContent() already set the header on every call. - WorkspaceClient.get_workspace_id() short-circuit: Java WorkspaceClient has no equivalent method. Co-authored-by: Isaac
1 parent 17f558c commit 35bc28a

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Added automatic detection of AI coding agents (Amp, Antigravity, Augment, Claude Code, Cline, Codex, Copilot CLI, Copilot VS Code, Cursor, Gemini CLI, Goose, Kiro, OpenClaw, OpenCode, Windsurf) in the user-agent string. The SDK now appends `agent/<name>` to HTTP request headers when running inside a known AI agent environment. Also honors the `AGENT=<name>` standard: when `AGENT` is set to a known product name the SDK reports that product, and when set to an unrecognized non-empty value the SDK reports `agent/unknown`. Environment variables set to the empty string (e.g. `CLAUDECODE=""`) now count as "set" for presence-only matchers, matching `databricks-sdk-go` semantics; previously they were treated as unset. Explicit agent env vars (e.g. `CLAUDECODE`, `GOOSE_TERMINAL`) always take precedence over the generic `AGENT=<name>` signal. When multiple agent env vars are present (e.g. a Cursor CLI subagent invoked from Claude Code), the user-agent reports `agent/multiple`.
77

88
### Bug Fixes
9+
* Add `X-Databricks-Org-Id` header to `SharesExtImpl.list()` for SPOG host compatibility. Without this header, calls to the hand-written extension were rejected by the SPOG proxy with `Unable to load OAuth Config (400 UNKNOWN)`. Mirrors [databricks/databricks-sdk-go#1635](https://github.com/databricks/databricks-sdk-go/pull/1635).
910

1011
### Security Vulnerabilities
1112

databricks-sdk-java/src/main/java/com/databricks/sdk/service/sharing/SharesExtImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public ListSharesResponse list(ListSharesRequest request) {
1919
Request req = new Request("GET", path);
2020
ApiClient.setQuery(req, request);
2121
req.withHeader("Accept", "application/json");
22+
if (apiClient.workspaceId() != null) {
23+
req.withHeader("X-Databricks-Org-Id", apiClient.workspaceId());
24+
}
2225
return apiClient.execute(req, ListSharesResponse.class);
2326
} catch (IOException e) {
2427
throw new DatabricksException("IO error: " + e.getMessage(), e);

0 commit comments

Comments
 (0)