-
Notifications
You must be signed in to change notification settings - Fork 168
api: route per-call against unified hosts #5137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
eb20678
a775d99
28fbf39
cf65ef8
4769fa7
116914e
f548898
9526263
29a2fb6
b60ab18
adf58b6
f63d896
55a83d5
1ea4ffc
e9e0b4a
f7793ce
556b552
1de3f95
2400ff0
5f4e552
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| $CLI api get /api/2.0/clusters/list --account | ||
| trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/accounts/abc-123/network-policies" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/accounts/abc-123/network-policies | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/accounts/abc-123/network-policies" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| $CLI api get /api/2.0/accounts/abc-123/network-policies | ||
| trace print_requests.py --get --keep //api/2.0/accounts/abc-123/network-policies | contains.py "!X-Databricks-Org-Id" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| RecordRequests = true | ||
| IncludeRequestHeaders = ["Authorization", "User-Agent", "X-Databricks-Org-Id"] | ||
|
|
||
| [Env] | ||
| # MSYS2 (Git Bash on Windows) auto-converts a leading "/" argument to a | ||
| # Windows path (e.g. /api/2.0/... becomes C:/Program Files/Git/api/2.0/...). | ||
| # Disable that so the CLI receives the path verbatim. | ||
| MSYS_NO_PATHCONV = "1" | ||
|
|
||
| # Normalize OS-dependent and CI-only User-Agent segments so the recorded | ||
| # requests are stable across local macOS/Linux runs and GitHub Actions. | ||
| [[Repls]] | ||
| Old = '(linux|darwin|windows)' | ||
| New = '[OS]' | ||
|
|
||
| [[Repls]] | ||
| Old = " cicd/[A-Za-z0-9.-]+" | ||
| New = "" | ||
|
|
||
| [[Repls]] | ||
| Old = " upstream/[A-Za-z0-9.-]+" | ||
| New = "" | ||
|
|
||
| [[Repls]] | ||
| Old = " upstream-version/[A-Za-z0-9.-]+" | ||
| New = "" | ||
|
|
||
| # Common stubs for paths used across variants. Each returns an empty JSON | ||
| # object; the variants assert on the *recorded request* (out.requests.txt), | ||
| # not on the response body, so any well-formed JSON is fine. | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/clusters/list" | ||
| Response.Body = '{}' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/accounts/abc-123/network-policies" | ||
| Response.Body = '{}' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/accounts/abc-123/oauth2/published-app-integrations" | ||
| Response.Body = '{}' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/preview/accounts/access-control/rule-sets" | ||
| Response.Body = '{}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "999" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "999" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| $CLI api get /api/2.0/clusters/list --workspace-id 999 | ||
| trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "999" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list", | ||
| "q": { | ||
| "o": "999" | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "999" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list", | ||
| "q": { | ||
| "o": "999" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| $CLI api get "/api/2.0/clusters/list?o=999" | ||
| trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Profile with workspace_id = none overrides the host-metadata back-fill. | ||
| # The CLI must strip the sentinel before the header decision; the recorded | ||
| # request should not carry the routing identifier. | ||
| sethome "./home" | ||
| cat > "./home/.databrickscfg" <<EOF | ||
| [spog-account] | ||
| host = $DATABRICKS_HOST | ||
| token = $DATABRICKS_TOKEN | ||
| workspace_id = none | ||
| EOF | ||
|
|
||
| $CLI api get /api/2.0/clusters/list --profile spog-account | ||
| trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home" | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| {} | ||
|
|
||
| >>> print_requests.py --get --keep //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| $CLI api get /api/2.0/clusters/list | ||
| trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "headers": { | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/.well-known/databricks-config" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Org-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/preview/accounts/access-control/rule-sets" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal is that we don't see any org ID in the request log, correct?
If so, it's worth capturing in another call here that confirms that assertion.
Easy to miss the intent otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e9e0b4a. Each of the seven
cmd/apiacceptance tests now usesprint_requests.py --get --keep | contains.pyto assert the recorded request either does or does not carryX-Databricks-Org-Id(with a specific value where one is expected). The intent is now visible in the script and inoutput.txt, not implicit inout.requests.txt.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now dups the requests between
out.requests.txtandoutput.txt. Can you keep one of them?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped
--keepin 556b552 —print_requests.pynow consumesout.requests.txt(deleted from the test directories) and the recorded request lives inoutput.txtonly.