Commit 30b5035
authored
Add method to fetch Host Metadata (#678)
## 🥞 Stacked PR
Use this
[link](https://github.com/databricks/databricks-sdk-java/pull/678/files)
to review incremental changes.
-
[**stack/config-auto-complete-1**](#678)
[[Files
changed](https://github.com/databricks/databricks-sdk-java/pull/678/files)]
-
[stack/config-auto-complete-2](#679)
[[Files
changed](https://github.com/databricks/databricks-sdk-java/pull/679/files/82fbbc2e5c9b9f38705df9a88ad0b6898d793b82..37e2032fd767f99b0c52b6ea57f60dea92e516e1)]
-
[stack/config-auto-complete-3](#680)
[[Files
changed](https://github.com/databricks/databricks-sdk-java/pull/680/files/adbceef3cc10ffef3e5844fe09f58c210f922f6a..18b73249bb564d01fe237f2464145a2ca025e9b4)]
---------
## Summary
Adds `HostMetadata` and a package-private `getHostMetadata()` on
`DatabricksConfig` for parsing the `/.well-known/databricks-config`
discovery endpoint.
## Why
Databricks hosts expose a standard `/.well-known/databricks-config`
endpoint that returns the OIDC endpoint, account ID, and workspace ID in
a single request. The SDK had no primitive to consume it — OIDC endpoint
discovery was handled entirely through host-type-specific logic that
requires the caller to already know whether the host is a workspace,
account console, or unified host.
This PR introduces the foundational building block: a `HostMetadata`
class and a package-private `getHostMetadata()` on `DatabricksConfig`
that fetches and parses the endpoint. The method returns raw metadata
with no substitution (e.g. `{account_id}` placeholders are left as-is),
keeping it a pure discovery primitive. Callers decide how to interpret
the result.
## What changed
### Interface changes
- **`HostMetadata`** — New class in `com.databricks.sdk.core.oauth` with
fields `oidcEndpoint`, `accountId`, `workspaceId`. Deserialized from
JSON via Jackson.
- **`DatabricksConfig.getHostMetadata()` (package-private)** — Fetches
`{host}/.well-known/databricks-config` and returns a `HostMetadata`.
Throws `DatabricksException` on any HTTP error.
### Behavioral changes
None. No existing code paths are modified.
### Internal changes
Tests in `DatabricksConfigTest` covering the two response shapes
(workspace with static OIDC endpoint, account host with `{account_id}`
template) and the HTTP error path.
## How is this tested?
Unit tests in `DatabricksConfigTest` using `FixtureServer`. Both
workspace and account host response shapes are exercised, plus an HTTP
error case.
NO_CHANGELOG=true1 parent d86b772 commit 30b5035
File tree
3 files changed
+127
-0
lines changed- databricks-sdk-java/src
- main/java/com/databricks/sdk/core
- oauth
- test/java/com/databricks/sdk/core
3 files changed
+127
-0
lines changedLines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
803 | 830 | | |
804 | 831 | | |
805 | 832 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
424 | 482 | | |
0 commit comments