diff --git a/acceptance/bundle/resources/jobs/request-summary/output.txt b/acceptance/bundle/resources/jobs/request-summary/output.txt index 1e303638e8d..0f0514c2e5c 100644 --- a/acceptance/bundle/resources/jobs/request-summary/output.txt +++ b/acceptance/bundle/resources/jobs/request-summary/output.txt @@ -7,9 +7,9 @@ Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged >>> print_requests GET /.well-known/databricks-config GET /api/2.0/preview/scim/v2/Me -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate return_export_info=true +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/request-summary/default/files... @@ -20,14 +20,14 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged >>> print_requests GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/files GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/files GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate return_export_info=true POST /api/2.0/workspace/delete POST /api/2.0/workspace/delete POST /api/2.0/workspace/import @@ -51,13 +51,11 @@ GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNA GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/files GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deployment.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate return_export_info=true GET /api/2.2/jobs/get job_id=[FOO_ID] POST /api/2.0/workspace/delete POST /api/2.0/workspace/delete @@ -78,11 +76,10 @@ Destroy: 1 deleted >>> print_requests GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json +GET /api/2.0/workspace/export direct_download=true path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/deploy.lock return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/resources.json return_export_info=true -GET /api/2.0/workspace/get-status path=/Workspace/Users/[USERNAME]/.bundle/request-summary/default/state/terraform.tfstate return_export_info=true GET /api/2.2/jobs/get job_id=[FOO_ID] POST /api/2.0/workspace/delete POST /api/2.0/workspace/delete diff --git a/acceptance/bundle/state/basic/out.state.txt b/acceptance/bundle/state/basic/out.state.txt index 59cdcbc51f9..88f0a216b86 100644 --- a/acceptance/bundle/state/basic/out.state.txt +++ b/acceptance/bundle/state/basic/out.state.txt @@ -6,6 +6,38 @@ "path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/STATE_FILENAME" } } +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/STATE_FILENAME" + } +} +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/deployment.json" + } +} +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/STATE_FILENAME" + } +} +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/state/default/state/STATE_FILENAME" + } +} { "method": "GET", "path": "/api/2.0/workspace/export", diff --git a/acceptance/bundle/state/force_pull_commands/output.txt b/acceptance/bundle/state/force_pull_commands/output.txt index 728a77b3e3f..9f5d004ce19 100644 --- a/acceptance/bundle/state/force_pull_commands/output.txt +++ b/acceptance/bundle/state/force_pull_commands/output.txt @@ -21,6 +21,14 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged "path": "/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME" } } +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME" + } +} === bundle open without --force-pull: no remote state read @@ -39,3 +47,11 @@ Opening browser at [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID] "path": "/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME" } } +{ + "method": "GET", + "path": "/api/2.0/workspace/export", + "q": { + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME" + } +} diff --git a/acceptance/bundle/user_agent/output.txt b/acceptance/bundle/user_agent/output.txt index d4faf40804a..4f84546f174 100644 --- a/acceptance/bundle/user_agent/output.txt +++ b/acceptance/bundle/user_agent/output.txt @@ -1,9 +1,9 @@ MISS deploy /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none auth/pat' -MISS deploy /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none auth/pat' -MISS deploy /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none auth/pat' +MISS deploy /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none auth/pat' +MISS deploy /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none auth/pat' +OK deploy /api/2.0/workspace/export engine/direct OK deploy /api/2.0/workspace/export engine/direct OK deploy /api/2.0/workspace/export engine/direct -OK deploy /api/2.0/workspace/get-status engine/direct OK deploy /api/2.0/workspace/get-status engine/direct OK deploy /api/2.0/workspace/get-status engine/direct OK deploy /api/2.0/workspace/get-status engine/direct @@ -22,8 +22,7 @@ OK deploy /api/2.1/unity-catalog/schemas engine/direct MISS deploy /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS destroy /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat' MISS destroy /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat' -MISS destroy /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat' -MISS destroy /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat' +MISS destroy /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat' OK destroy /api/2.1/unity-catalog/schemas/mycatalog.myschema engine/direct OK destroy /api/2.0/workspace/export engine/direct OK destroy /api/2.0/workspace/get-status engine/direct @@ -35,26 +34,23 @@ OK destroy /api/2.0/workspace/delete engine/direct OK destroy /api/2.0/workspace/import engine/direct MISS destroy /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS plan /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' -MISS plan /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' -MISS plan /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' -OK plan /api/2.0/workspace/get-status engine/direct +MISS plan /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' +MISS plan /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' +OK plan /api/2.0/workspace/export engine/direct MISS plan /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS plan2 /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' MISS plan2 /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' -MISS plan2 /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' -MISS plan2 /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' +MISS plan2 /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat' OK plan2 /api/2.0/workspace/export engine/direct -OK plan2 /api/2.0/workspace/get-status engine/direct OK plan2 /api/2.1/unity-catalog/schemas/mycatalog.myschema engine/direct MISS plan2 /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS run /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat' MISS run /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat' -MISS run /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat' -MISS run /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat' +MISS run /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat' MISS run /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS summary /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_summary cmd-exec-id/[UUID] interactive/none auth/pat' -MISS summary /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_summary cmd-exec-id/[UUID] interactive/none auth/pat' -MISS summary /api/2.0/workspace/get-status 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_summary cmd-exec-id/[UUID] interactive/none auth/pat' +MISS summary /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_summary cmd-exec-id/[UUID] interactive/none auth/pat' +MISS summary /api/2.0/workspace/export 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_summary cmd-exec-id/[UUID] interactive/none auth/pat' OK summary /api/2.0/preview/scim/v2/Me engine/direct MISS summary /.well-known/databricks-config 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]' MISS validate /api/2.0/preview/scim/v2/Me 'cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_validate cmd-exec-id/[UUID] interactive/none auth/pat' diff --git a/acceptance/bundle/user_agent/simple/out.requests.deploy.json b/acceptance/bundle/user_agent/simple/out.requests.deploy.json index 52d7e5ebf67..43b23a566c3 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.deploy.json +++ b/acceptance/bundle/user_agent/simple/out.requests.deploy.json @@ -14,10 +14,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json" } } { @@ -27,10 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { @@ -66,9 +66,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json" } } { @@ -80,8 +81,7 @@ "method": "GET", "path": "/api/2.0/workspace/get-status", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deploy.lock", - "return_export_info": "true" + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files" } } { @@ -119,7 +119,7 @@ "method": "GET", "path": "/api/2.0/workspace/get-status", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deploy.lock", "return_export_info": "true" } } diff --git a/acceptance/bundle/user_agent/simple/out.requests.destroy.json b/acceptance/bundle/user_agent/simple/out.requests.destroy.json index 2664052a436..90328199953 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.destroy.json +++ b/acceptance/bundle/user_agent/simple/out.requests.destroy.json @@ -27,23 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", - "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" - } -} -{ - "headers": { - "User-Agent": [ - "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_destroy cmd-exec-id/[UUID] interactive/none auth/pat" - ] - }, - "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { diff --git a/acceptance/bundle/user_agent/simple/out.requests.plan.json b/acceptance/bundle/user_agent/simple/out.requests.plan.json index c2e823b5cc2..8658a9f41f4 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.plan.json +++ b/acceptance/bundle/user_agent/simple/out.requests.plan.json @@ -14,10 +14,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json" } } { @@ -27,10 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { @@ -40,10 +40,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json" } } { diff --git a/acceptance/bundle/user_agent/simple/out.requests.plan2.json b/acceptance/bundle/user_agent/simple/out.requests.plan2.json index 16c6d5fa80e..27810cf9e61 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.plan2.json +++ b/acceptance/bundle/user_agent/simple/out.requests.plan2.json @@ -27,23 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", - "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" - } -} -{ - "headers": { - "User-Agent": [ - "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none auth/pat" - ] - }, - "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { @@ -59,19 +46,6 @@ "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json" } } -{ - "headers": { - "User-Agent": [ - "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct lineage/[LINEAGE_HASH] auth/pat" - ] - }, - "method": "GET", - "path": "/api/2.0/workspace/get-status", - "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/deployment.json", - "return_export_info": "true" - } -} { "headers": { "User-Agent": [ diff --git a/acceptance/bundle/user_agent/simple/out.requests.run.json b/acceptance/bundle/user_agent/simple/out.requests.run.json index 8e1baa2f5d0..ace799d7c7e 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.run.json +++ b/acceptance/bundle/user_agent/simple/out.requests.run.json @@ -27,23 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", - "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" - } -} -{ - "headers": { - "User-Agent": [ - "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none auth/pat" - ] - }, - "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { diff --git a/acceptance/bundle/user_agent/simple/out.requests.summary.json b/acceptance/bundle/user_agent/simple/out.requests.summary.json index 9b6f9e31206..6182e907b70 100644 --- a/acceptance/bundle/user_agent/simple/out.requests.summary.json +++ b/acceptance/bundle/user_agent/simple/out.requests.summary.json @@ -14,10 +14,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/resources.json" } } { @@ -27,10 +27,10 @@ ] }, "method": "GET", - "path": "/api/2.0/workspace/get-status", + "path": "/api/2.0/workspace/export", "q": { - "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate", - "return_export_info": "true" + "direct_download": "true", + "path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/terraform.tfstate" } } { diff --git a/bundle/deploy/filer.go b/bundle/deploy/filer.go index 8d7b2a57636..1db8819d3ff 100644 --- a/bundle/deploy/filer.go +++ b/bundle/deploy/filer.go @@ -2,6 +2,7 @@ package deploy import ( "context" + "errors" "fmt" "io" "io/fs" @@ -10,6 +11,7 @@ import ( "github.com/databricks/cli/libs/filer" "github.com/databricks/cli/libs/retry" "github.com/databricks/databricks-sdk-go" + "github.com/databricks/databricks-sdk-go/apierr" ) // FilerFactory is a function that returns a filer.Filer. @@ -37,16 +39,15 @@ func (s stateFiler) Read(ctx context.Context, path string) (io.ReadCloser, error return nil, err } - stat, err := s.Stat(ctx, path) - if err != nil { - return nil, err - } - if stat.IsDir() { - return nil, fmt.Errorf("not a file: %s", absPath) - } - // Stream via the SDK's /workspace/export (direct_download=true); no 10 MB cap. - return s.workspaceClient.Workspace.Download(ctx, absPath) + // No get-status first: a missing file is the common first-deploy case and export's 404 + // reports it in one round trip. A directory at a state path is not a state file; its + // export fails to parse as one. + r, err := s.workspaceClient.Workspace.Download(ctx, absPath) + if errors.Is(err, apierr.ErrNotFound) { + return nil, fmt.Errorf("file does not exist: %s: %w", absPath, fs.ErrNotExist) + } + return r, err } func (s stateFiler) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error) {