diff --git a/.nextchanges/bundles/url-not-supported.md b/.nextchanges/bundles/url-not-supported.md new file mode 100644 index 00000000000..67135362796 --- /dev/null +++ b/.nextchanges/bundles/url-not-supported.md @@ -0,0 +1 @@ +* CLI commands no longer imply that a resource whose type has no workspace URL is merely not deployed yet. ([#6583](https://github.com/databricks/cli/pull/6583)) diff --git a/acceptance/bundle/deployment/bind/postgres_database/output.txt b/acceptance/bundle/deployment/bind/postgres_database/output.txt index 86bb47f3eff..72b43b9c2e3 100644 --- a/acceptance/bundle/deployment/bind/postgres_database/output.txt +++ b/acceptance/bundle/deployment/bind/postgres_database/output.txt @@ -13,7 +13,6 @@ Resources: Postgres databases: database1: Name: - URL: (not deployed) >>> [CLI] bundle deployment unbind database1 @@ -27,4 +26,3 @@ Resources: Postgres databases: database1: Name: - URL: (not deployed) diff --git a/acceptance/bundle/deployment/bind/postgres_role/output.txt b/acceptance/bundle/deployment/bind/postgres_role/output.txt index ade277df2ae..cea418c36e2 100644 --- a/acceptance/bundle/deployment/bind/postgres_role/output.txt +++ b/acceptance/bundle/deployment/bind/postgres_role/output.txt @@ -13,7 +13,6 @@ Resources: Postgres roles: role1: Name: - URL: (not deployed) >>> [CLI] bundle deployment unbind role1 @@ -27,4 +26,3 @@ Resources: Postgres roles: role1: Name: - URL: (not deployed) diff --git a/acceptance/bundle/deployment/bind/postgres_snapshot_schedule/output.txt b/acceptance/bundle/deployment/bind/postgres_snapshot_schedule/output.txt index 8701019ab60..5033cd73dfc 100644 --- a/acceptance/bundle/deployment/bind/postgres_snapshot_schedule/output.txt +++ b/acceptance/bundle/deployment/bind/postgres_snapshot_schedule/output.txt @@ -13,7 +13,6 @@ Resources: Postgres snapshot schedules: schedule1: Name: projects/test-project/branches/main/snapshot-schedule - URL: (not deployed) >>> [CLI] bundle deployment unbind schedule1 @@ -27,4 +26,3 @@ Resources: Postgres snapshot schedules: schedule1: Name: - URL: (not deployed) diff --git a/acceptance/bundle/resources/postgres_branches/basic/output.txt b/acceptance/bundle/resources/postgres_branches/basic/output.txt index e06e2d8413b..cff6773cf76 100644 --- a/acceptance/bundle/resources/postgres_branches/basic/output.txt +++ b/acceptance/bundle/resources/postgres_branches/basic/output.txt @@ -18,11 +18,9 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Branch - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-[UNIQUE_NAME]/default/files... @@ -59,11 +57,9 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Branch - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_catalogs/basic/output.txt b/acceptance/bundle/resources/postgres_catalogs/basic/output.txt index 3d0adb7dd20..dbc8e80e82f 100644 --- a/acceptance/bundle/resources/postgres_catalogs/basic/output.txt +++ b/acceptance/bundle/resources/postgres_catalogs/basic/output.txt @@ -22,7 +22,6 @@ Resources: Postgres projects: my_project: Name: Test Project for Catalog - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default/files... @@ -56,7 +55,6 @@ Resources: Postgres projects: my_project: Name: Test Project for Catalog - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_databases/basic/output.txt b/acceptance/bundle/resources/postgres_databases/basic/output.txt index defd7cfdd1e..42d3dfa4e4e 100644 --- a/acceptance/bundle/resources/postgres_databases/basic/output.txt +++ b/acceptance/bundle/resources/postgres_databases/basic/output.txt @@ -18,19 +18,15 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres databases: my_database: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Database - URL: (not deployed) Postgres roles: owner: Name: - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-database-[UNIQUE_NAME]/default/files... @@ -63,19 +59,15 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres databases: my_database: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Database - URL: (not deployed) Postgres roles: owner: Name: - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_endpoints/basic/output.txt b/acceptance/bundle/resources/postgres_endpoints/basic/output.txt index cef82784922..2a9c7fa37db 100644 --- a/acceptance/bundle/resources/postgres_endpoints/basic/output.txt +++ b/acceptance/bundle/resources/postgres_endpoints/basic/output.txt @@ -18,15 +18,12 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres endpoints: custom: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Endpoint - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-[UNIQUE_NAME]/default/files... @@ -61,15 +58,12 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres endpoints: custom: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Endpoint - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_projects/basic/output.txt b/acceptance/bundle/resources/postgres_projects/basic/output.txt index 8290600440e..6fe7c79ee6b 100644 --- a/acceptance/bundle/resources/postgres_projects/basic/output.txt +++ b/acceptance/bundle/resources/postgres_projects/basic/output.txt @@ -18,7 +18,6 @@ Resources: Postgres projects: my_project: Name: Test Postgres Project - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-single-project-[UNIQUE_NAME]/default/files... @@ -59,7 +58,6 @@ Resources: Postgres projects: my_project: Name: Test Postgres Project - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_roles/basic/output.txt b/acceptance/bundle/resources/postgres_roles/basic/output.txt index 7b292070dfb..979bb99ca15 100644 --- a/acceptance/bundle/resources/postgres_roles/basic/output.txt +++ b/acceptance/bundle/resources/postgres_roles/basic/output.txt @@ -18,15 +18,12 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Role - URL: (not deployed) Postgres roles: my_role: Name: - URL: (not deployed) >>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-role-[UNIQUE_NAME]/default/files... @@ -54,6 +51,9 @@ Resources: 3 created, 0 changed, 0 deleted, 0 unchanged } } +>>> musterr [CLI] bundle open my_role +Error: this resource type does not have a URL + >>> [CLI] bundle summary Name: deploy-postgres-role-[UNIQUE_NAME] Target: default @@ -64,15 +64,12 @@ Resources: Postgres branches: main: Name: - URL: (not deployed) Postgres projects: my_project: Name: Test Project for Role - URL: (not deployed) Postgres roles: my_role: Name: - URL: (not deployed) >>> print_requests.py --del-body project_id,branch_id,endpoint_id,database_id,role_id,catalog_id,synced_table_id --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ diff --git a/acceptance/bundle/resources/postgres_roles/basic/script b/acceptance/bundle/resources/postgres_roles/basic/script index d5e3f421cd7..bd91b06dd39 100644 --- a/acceptance/bundle/resources/postgres_roles/basic/script +++ b/acceptance/bundle/resources/postgres_roles/basic/script @@ -19,6 +19,10 @@ branch_name="${project_name}/branches/main" role_name="${branch_name}/roles/test-role" trace $CLI postgres get-role "${role_name}" | role_fields +# Postgres roles have no workspace URL, so opening one reports that rather than +# suggesting a deploy. +trace musterr $CLI bundle open my_role + trace $CLI bundle summary # Filter requests to only show postgres operations (exclude workspace, telemetry, and operation polling) diff --git a/acceptance/bundle/resources/postgres_synced_tables/basic/output.txt b/acceptance/bundle/resources/postgres_synced_tables/basic/output.txt index e752198edcf..9916219e124 100644 --- a/acceptance/bundle/resources/postgres_synced_tables/basic/output.txt +++ b/acceptance/bundle/resources/postgres_synced_tables/basic/output.txt @@ -26,7 +26,6 @@ Resources: Postgres projects: my_project: Name: Test Project for Synced Table - URL: (not deployed) Postgres synced tables: my_table: Name: ${resources.postgres_catalogs.my_catalog.catalog_id}.public.trips_synced @@ -65,7 +64,6 @@ Resources: Postgres projects: my_project: Name: Test Project for Synced Table - URL: (not deployed) Postgres synced tables: my_table: Name: lakebase_test_[UNIQUE_NAME].public.trips_synced diff --git a/bundle/config/mutator/initialize_urls_test.go b/bundle/config/mutator/initialize_urls_test.go index b3e10660b31..980c4d88514 100644 --- a/bundle/config/mutator/initialize_urls_test.go +++ b/bundle/config/mutator/initialize_urls_test.go @@ -124,7 +124,8 @@ func TestInitializeURLs(t *testing.T) { for _, group := range b.Config.Resources.AllResources() { for key, r := range group.Resources { - require.Equal(t, expectedURLs[key], r.GetURL(), "Unexpected URL for "+key) + url, _ := r.GetURL() + require.Equal(t, expectedURLs[key], url, "Unexpected URL for "+key) } } } diff --git a/bundle/config/resources.go b/bundle/config/resources.go index ca92f8f3fe6..d62b89d9384 100644 --- a/bundle/config/resources.go +++ b/bundle/config/resources.go @@ -63,8 +63,10 @@ type ConfigResource interface { // GetName returns the in-product name of the resource. GetName() string - // GetURL returns the URL of the resource. - GetURL() string + // GetURL returns the resource's workspace URL and whether this resource type + // has one at all. A supported type that is not deployed yet returns ("", true); + // a type that never has a URL returns ("", false). + GetURL() (string, bool) // InitializeURL initializes the URL field of the resource. InitializeURL(baseURL url.URL) diff --git a/bundle/config/resources/alerts.go b/bundle/config/resources/alerts.go index 628302c4e3b..cf3119a6f9c 100644 --- a/bundle/config/resources/alerts.go +++ b/bundle/config/resources/alerts.go @@ -59,7 +59,3 @@ func (a *Alert) InitializeURL(baseURL url.URL) { func (a *Alert) GetName() string { return a.DisplayName } - -func (a *Alert) GetURL() string { - return a.URL -} diff --git a/bundle/config/resources/apps.go b/bundle/config/resources/apps.go index a26670c4897..f1d62bcc893 100644 --- a/bundle/config/resources/apps.go +++ b/bundle/config/resources/apps.go @@ -102,7 +102,3 @@ func (a *App) GetName() string { } return a.Name } - -func (a *App) GetURL() string { - return a.URL -} diff --git a/bundle/config/resources/base.go b/bundle/config/resources/base.go index ceeb1f0b869..6a27d2b6e47 100644 --- a/bundle/config/resources/base.go +++ b/bundle/config/resources/base.go @@ -12,3 +12,9 @@ type BaseResource struct { func (b *BaseResource) GetLifecycle() LifecycleConfig { return b.Lifecycle } + +// GetURL returns the resource's workspace URL and true. Resource types whose +// IDs don't map to a web UI page override this to return ("", false). +func (b *BaseResource) GetURL() (string, bool) { + return b.URL, true +} diff --git a/bundle/config/resources/catalog.go b/bundle/config/resources/catalog.go index 0bc28f1d99f..8c5f6dcb853 100644 --- a/bundle/config/resources/catalog.go +++ b/bundle/config/resources/catalog.go @@ -51,10 +51,6 @@ func (c *Catalog) InitializeURL(baseURL url.URL) { c.URL = workspaceurls.ResourceURL(baseURL, "catalogs", c.ID) } -func (c *Catalog) GetURL() string { - return c.URL -} - func (c *Catalog) GetName() string { return c.Name } diff --git a/bundle/config/resources/cluster_policy.go b/bundle/config/resources/cluster_policy.go index b0b07ff5fb9..f8f4a0f7170 100644 --- a/bundle/config/resources/cluster_policy.go +++ b/bundle/config/resources/cluster_policy.go @@ -63,7 +63,3 @@ func (s *ClusterPolicy) InitializeURL(baseURL url.URL) { func (s *ClusterPolicy) GetName() string { return s.Name } - -func (s *ClusterPolicy) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/clusters.go b/bundle/config/resources/clusters.go index 235ea6eee1a..9de7b62c526 100644 --- a/bundle/config/resources/clusters.go +++ b/bundle/config/resources/clusters.go @@ -65,7 +65,3 @@ func (s *Cluster) InitializeURL(baseURL url.URL) { func (s *Cluster) GetName() string { return s.ClusterName } - -func (s *Cluster) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/dashboard.go b/bundle/config/resources/dashboard.go index 8bd5603f150..692fc62b61b 100644 --- a/bundle/config/resources/dashboard.go +++ b/bundle/config/resources/dashboard.go @@ -128,7 +128,3 @@ func (r *Dashboard) InitializeURL(baseURL url.URL) { func (r *Dashboard) GetName() string { return r.DisplayName } - -func (r *Dashboard) GetURL() string { - return r.URL -} diff --git a/bundle/config/resources/database_catalog.go b/bundle/config/resources/database_catalog.go index ce525be2e9e..ddae1ea1892 100644 --- a/bundle/config/resources/database_catalog.go +++ b/bundle/config/resources/database_catalog.go @@ -47,10 +47,6 @@ func (d *DatabaseCatalog) GetName() string { return d.Name } -func (d *DatabaseCatalog) GetURL() string { - return d.URL -} - func (d *DatabaseCatalog) InitializeURL(baseURL url.URL) { if d.Name == "" { return diff --git a/bundle/config/resources/database_instance.go b/bundle/config/resources/database_instance.go index f219467d2ab..661ced94996 100644 --- a/bundle/config/resources/database_instance.go +++ b/bundle/config/resources/database_instance.go @@ -49,10 +49,6 @@ func (d *DatabaseInstance) GetName() string { return d.Name } -func (d *DatabaseInstance) GetURL() string { - return d.URL -} - func (d *DatabaseInstance) InitializeURL(baseURL url.URL) { if d.ModifiedStatus == ModifiedStatusCreated { return diff --git a/bundle/config/resources/external_location.go b/bundle/config/resources/external_location.go index cc413de84f3..5d9a52a1b75 100644 --- a/bundle/config/resources/external_location.go +++ b/bundle/config/resources/external_location.go @@ -53,9 +53,9 @@ func (e *ExternalLocation) InitializeURL(baseURL url.URL) { // The Url field is for the storage path (s3://...), not a workspace URL } -func (e *ExternalLocation) GetURL() string { - // Return empty as external locations don't have a workspace URL - return "" +func (e *ExternalLocation) GetURL() (string, bool) { + // External locations don't have a workspace URL + return "", false } func (e *ExternalLocation) GetName() string { diff --git a/bundle/config/resources/genie_space.go b/bundle/config/resources/genie_space.go index 18e2fa1d8c7..19ce4702892 100644 --- a/bundle/config/resources/genie_space.go +++ b/bundle/config/resources/genie_space.go @@ -104,7 +104,3 @@ func (r *GenieSpace) InitializeURL(baseURL url.URL) { func (r *GenieSpace) GetName() string { return r.Title } - -func (r *GenieSpace) GetURL() string { - return r.URL -} diff --git a/bundle/config/resources/instance_pools.go b/bundle/config/resources/instance_pools.go index 31c4ee45a69..09179f509a0 100644 --- a/bundle/config/resources/instance_pools.go +++ b/bundle/config/resources/instance_pools.go @@ -53,7 +53,3 @@ func (s *InstancePool) InitializeURL(baseURL url.URL) { func (s *InstancePool) GetName() string { return s.InstancePoolName } - -func (s *InstancePool) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/job.go b/bundle/config/resources/job.go index 646750ef859..5f0eda4a172 100644 --- a/bundle/config/resources/job.go +++ b/bundle/config/resources/job.go @@ -61,7 +61,3 @@ func (j *Job) InitializeURL(baseURL url.URL) { func (j *Job) GetName() string { return j.Name } - -func (j *Job) GetURL() string { - return j.URL -} diff --git a/bundle/config/resources/job_run.go b/bundle/config/resources/job_run.go index 56f3c39a356..167530465e8 100644 --- a/bundle/config/resources/job_run.go +++ b/bundle/config/resources/job_run.go @@ -84,10 +84,6 @@ func (r *JobRun) GetName() string { return "" } -func (r *JobRun) GetURL() string { - return r.URL -} - // InitializeURL sets the run's workspace URL. The job id comes from RunNow.JobId // when resolved (deploy) or ResolvedJobID from state (read-only commands); if // either id is missing we skip rather than emit a broken jobs/0 URL. diff --git a/bundle/config/resources/mlflow_experiment.go b/bundle/config/resources/mlflow_experiment.go index c7db059bc8b..55b1bde4f23 100644 --- a/bundle/config/resources/mlflow_experiment.go +++ b/bundle/config/resources/mlflow_experiment.go @@ -56,7 +56,3 @@ func (s *MlflowExperiment) InitializeURL(baseURL url.URL) { func (s *MlflowExperiment) GetName() string { return s.Name } - -func (s *MlflowExperiment) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/mlflow_model.go b/bundle/config/resources/mlflow_model.go index c153e2d95e9..eb2adf01583 100644 --- a/bundle/config/resources/mlflow_model.go +++ b/bundle/config/resources/mlflow_model.go @@ -56,7 +56,3 @@ func (s *MlflowModel) InitializeURL(baseURL url.URL) { func (s *MlflowModel) GetName() string { return s.Name } - -func (s *MlflowModel) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/model_serving_endpoint.go b/bundle/config/resources/model_serving_endpoint.go index 5a917c2e268..e23d3d7b682 100644 --- a/bundle/config/resources/model_serving_endpoint.go +++ b/bundle/config/resources/model_serving_endpoint.go @@ -61,7 +61,3 @@ func (s *ModelServingEndpoint) InitializeURL(baseURL url.URL) { func (s *ModelServingEndpoint) GetName() string { return s.Name } - -func (s *ModelServingEndpoint) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/pipeline.go b/bundle/config/resources/pipeline.go index 7c205f7dc14..80c72e62fc9 100644 --- a/bundle/config/resources/pipeline.go +++ b/bundle/config/resources/pipeline.go @@ -61,7 +61,3 @@ func (p *Pipeline) InitializeURL(baseURL url.URL) { func (p *Pipeline) GetName() string { return p.Name } - -func (p *Pipeline) GetURL() string { - return p.URL -} diff --git a/bundle/config/resources/postgres_branch.go b/bundle/config/resources/postgres_branch.go index 2713c0cdd58..9d77863792a 100644 --- a/bundle/config/resources/postgres_branch.go +++ b/bundle/config/resources/postgres_branch.go @@ -82,9 +82,9 @@ func (b *PostgresBranch) GetName() string { return "" } -func (b *PostgresBranch) GetURL() string { +func (b *PostgresBranch) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (b *PostgresBranch) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_catalog.go b/bundle/config/resources/postgres_catalog.go index d1c788aece6..65c0f97112c 100644 --- a/bundle/config/resources/postgres_catalog.go +++ b/bundle/config/resources/postgres_catalog.go @@ -62,10 +62,6 @@ func (c *PostgresCatalog) GetName() string { return c.CatalogId } -func (c *PostgresCatalog) GetURL() string { - return c.URL -} - func (c *PostgresCatalog) InitializeURL(baseURL url.URL) { if c.CatalogId == "" { return diff --git a/bundle/config/resources/postgres_database.go b/bundle/config/resources/postgres_database.go index ad16d720bb9..3bebe476c2d 100644 --- a/bundle/config/resources/postgres_database.go +++ b/bundle/config/resources/postgres_database.go @@ -74,9 +74,9 @@ func (d *PostgresDatabase) GetName() string { return "" } -func (d *PostgresDatabase) GetURL() string { +func (d *PostgresDatabase) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (d *PostgresDatabase) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_endpoint.go b/bundle/config/resources/postgres_endpoint.go index 1ae81fdf8ad..0bdfc25306c 100644 --- a/bundle/config/resources/postgres_endpoint.go +++ b/bundle/config/resources/postgres_endpoint.go @@ -70,9 +70,9 @@ func (e *PostgresEndpoint) GetName() string { return "" } -func (e *PostgresEndpoint) GetURL() string { +func (e *PostgresEndpoint) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (e *PostgresEndpoint) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_project.go b/bundle/config/resources/postgres_project.go index 1f0165fd9b7..4b021737c97 100644 --- a/bundle/config/resources/postgres_project.go +++ b/bundle/config/resources/postgres_project.go @@ -75,9 +75,9 @@ func (p *PostgresProject) GetName() string { return p.DisplayName } -func (p *PostgresProject) GetURL() string { +func (p *PostgresProject) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (p *PostgresProject) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_role.go b/bundle/config/resources/postgres_role.go index b45c6928557..53dcc02d47c 100644 --- a/bundle/config/resources/postgres_role.go +++ b/bundle/config/resources/postgres_role.go @@ -75,9 +75,9 @@ func (r *PostgresRole) GetName() string { return "" } -func (r *PostgresRole) GetURL() string { +func (r *PostgresRole) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (r *PostgresRole) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_snapshot_schedule.go b/bundle/config/resources/postgres_snapshot_schedule.go index cc35d357417..a13b78cef82 100644 --- a/bundle/config/resources/postgres_snapshot_schedule.go +++ b/bundle/config/resources/postgres_snapshot_schedule.go @@ -72,9 +72,9 @@ func (b *PostgresSnapshotSchedule) GetName() string { return b.ID } -func (b *PostgresSnapshotSchedule) GetURL() string { +func (b *PostgresSnapshotSchedule) GetURL() (string, bool) { // The IDs in the API do not (yet) map to IDs in the web UI. - return "" + return "", false } func (b *PostgresSnapshotSchedule) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/postgres_synced_table.go b/bundle/config/resources/postgres_synced_table.go index e92f19c2ab4..d377e6cc1cd 100644 --- a/bundle/config/resources/postgres_synced_table.go +++ b/bundle/config/resources/postgres_synced_table.go @@ -72,10 +72,6 @@ func (s *PostgresSyncedTable) GetName() string { return s.SyncedTableId } -func (s *PostgresSyncedTable) GetURL() string { - return s.URL -} - func (s *PostgresSyncedTable) InitializeURL(baseURL url.URL) { // UC explore expects /{catalog}/{schema}/{table}, so bail if the name isn't // a fully resolved three-part identifier; an unresolved ${...} reference diff --git a/bundle/config/resources/quality_monitor.go b/bundle/config/resources/quality_monitor.go index e3f39c7c69c..dd6143aa4a4 100644 --- a/bundle/config/resources/quality_monitor.go +++ b/bundle/config/resources/quality_monitor.go @@ -60,7 +60,3 @@ func (s *QualityMonitor) InitializeURL(baseURL url.URL) { func (s *QualityMonitor) GetName() string { return s.TableName } - -func (s *QualityMonitor) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/registered_model.go b/bundle/config/resources/registered_model.go index 87b0f0748c1..85288bee629 100644 --- a/bundle/config/resources/registered_model.go +++ b/bundle/config/resources/registered_model.go @@ -60,7 +60,3 @@ func (s *RegisteredModel) InitializeURL(baseURL url.URL) { func (s *RegisteredModel) GetName() string { return s.Name } - -func (s *RegisteredModel) GetURL() string { - return s.URL -} diff --git a/bundle/config/resources/schema.go b/bundle/config/resources/schema.go index f40a94c3529..71f2b13f887 100644 --- a/bundle/config/resources/schema.go +++ b/bundle/config/resources/schema.go @@ -53,10 +53,6 @@ func (s *Schema) InitializeURL(baseURL url.URL) { s.URL = workspaceurls.ResourceURL(baseURL, "schemas", s.ID) } -func (s *Schema) GetURL() string { - return s.URL -} - func (s *Schema) GetName() string { return s.Name } diff --git a/bundle/config/resources/secret.go b/bundle/config/resources/secret.go index d7fe4ed1a71..5730fcac92f 100644 --- a/bundle/config/resources/secret.go +++ b/bundle/config/resources/secret.go @@ -63,10 +63,6 @@ func (s *Secret) InitializeURL(baseURL url.URL) { s.URL = workspaceurls.ResourceURL(baseURL, "secrets", s.ID) } -func (s *Secret) GetURL() string { - return s.URL -} - func (s *Secret) GetName() string { if s.ID != "" { return s.ID diff --git a/bundle/config/resources/secret_scope.go b/bundle/config/resources/secret_scope.go index 30d0ebd901d..73647d2802a 100644 --- a/bundle/config/resources/secret_scope.go +++ b/bundle/config/resources/secret_scope.go @@ -104,9 +104,9 @@ func (s SecretScope) GetName() string { return s.Name } -func (s SecretScope) GetURL() string { +func (s SecretScope) GetURL() (string, bool) { // Secret scopes do not have a URL - return "" + return "", false } func (s SecretScope) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/snapshot.go b/bundle/config/resources/snapshot.go index f323c93067b..95d98c89271 100644 --- a/bundle/config/resources/snapshot.go +++ b/bundle/config/resources/snapshot.go @@ -98,12 +98,12 @@ func (s *Snapshot) GetName() string { return s.RelativePath() } -func (s *Snapshot) GetURL() string { +func (s *Snapshot) GetURL() (string, bool) { // A snapshot is a workspace folder owned by the project's service principal, so // a browser URL is constructible from its path. We don't surface one yet: // workspaceurls has no folder-path helper, and the path is only known during // deploy (its content hash is derived from the zip staged by the deploy pipeline). - return "" + return "", false } func (s *Snapshot) InitializeURL(_ url.URL) { diff --git a/bundle/config/resources/sql_warehouses.go b/bundle/config/resources/sql_warehouses.go index 56653d27c99..a279c0054cf 100644 --- a/bundle/config/resources/sql_warehouses.go +++ b/bundle/config/resources/sql_warehouses.go @@ -65,7 +65,3 @@ func (sw *SqlWarehouse) InitializeURL(baseURL url.URL) { func (sw *SqlWarehouse) GetName() string { return sw.Name } - -func (sw *SqlWarehouse) GetURL() string { - return sw.URL -} diff --git a/bundle/config/resources/synced_database_table.go b/bundle/config/resources/synced_database_table.go index 4f6bb301463..18dcde00a74 100644 --- a/bundle/config/resources/synced_database_table.go +++ b/bundle/config/resources/synced_database_table.go @@ -47,10 +47,6 @@ func (s *SyncedDatabaseTable) GetName() string { return s.Name } -func (s *SyncedDatabaseTable) GetURL() string { - return s.URL -} - func (s *SyncedDatabaseTable) InitializeURL(baseURL url.URL) { if s.Name == "" { return diff --git a/bundle/config/resources/vector_search_endpoint.go b/bundle/config/resources/vector_search_endpoint.go index 13f8d790a53..dffb75e95f7 100644 --- a/bundle/config/resources/vector_search_endpoint.go +++ b/bundle/config/resources/vector_search_endpoint.go @@ -58,7 +58,3 @@ func (e *VectorSearchEndpoint) InitializeURL(baseURL url.URL) { func (e *VectorSearchEndpoint) GetName() string { return e.Name } - -func (e *VectorSearchEndpoint) GetURL() string { - return e.URL -} diff --git a/bundle/config/resources/vector_search_index.go b/bundle/config/resources/vector_search_index.go index c2990efac8d..4f82d51e2f8 100644 --- a/bundle/config/resources/vector_search_index.go +++ b/bundle/config/resources/vector_search_index.go @@ -64,7 +64,3 @@ func (e *VectorSearchIndex) InitializeURL(baseURL url.URL) { func (e *VectorSearchIndex) GetName() string { return e.Name } - -func (e *VectorSearchIndex) GetURL() string { - return e.URL -} diff --git a/bundle/config/resources/volume.go b/bundle/config/resources/volume.go index 139ca5e4785..8377414b588 100644 --- a/bundle/config/resources/volume.go +++ b/bundle/config/resources/volume.go @@ -66,10 +66,6 @@ func (v *Volume) InitializeURL(baseURL url.URL) { v.URL = workspaceurls.ResourceURL(baseURL, "volumes", v.ID) } -func (v *Volume) GetURL() string { - return v.URL -} - func (v *Volume) GetName() string { return v.Name } diff --git a/bundle/render/render_text_output.go b/bundle/render/render_text_output.go index b1f0c6442d1..27ae5b6f7c5 100644 --- a/bundle/render/render_text_output.go +++ b/bundle/render/render_text_output.go @@ -40,7 +40,9 @@ const resourcesTemplate = `Resources: {{- range .Resources }} {{ .Key | bold }}: Name: {{ .Name }} + {{- if .SupportsURL }} URL: {{ if .URL }}{{ .URL | cyan }}{{ else }}{{ "(not deployed)" | cyan }}{{ end }} + {{- end }} {{- end }} {{- end }} ` @@ -51,9 +53,10 @@ type ResourceGroup struct { } type ResourceInfo struct { - Key string - Name string - URL string + Key string + Name string + URL string + SupportsURL bool } func pluralize(n int, singular, plural string) string { @@ -149,10 +152,12 @@ func RenderSummary(ctx context.Context, out io.Writer, b *bundle.Bundle) error { for _, group := range b.Config.Resources.AllResources() { resources := make([]ResourceInfo, 0, len(group.Resources)) for key, resource := range group.Resources { + url, supportsURL := resource.GetURL() resources = append(resources, ResourceInfo{ - Key: key, - Name: resource.GetName(), - URL: resource.GetURL(), + Key: key, + Name: resource.GetName(), + URL: url, + SupportsURL: supportsURL, }) } diff --git a/bundle/render/render_text_output_test.go b/bundle/render/render_text_output_test.go index b797b423ad5..192a95c108b 100644 --- a/bundle/render/render_text_output_test.go +++ b/bundle/render/render_text_output_test.go @@ -335,6 +335,12 @@ func TestRenderSummary(t *testing.T) { }, }, }, + SecretScopes: map[string]*resources.SecretScope{ + // Secret scopes never have a URL, regardless of deployment. + "scope1": { + Name: "my_scope", + }, + }, }, }, } @@ -370,6 +376,9 @@ Resources: schema1: Name: schema URL: (not deployed) + Secret Scopes: + scope1: + Name: my_scope ` assert.Equal(t, expectedSummary, writer.String()) } diff --git a/cmd/bundle/open.go b/cmd/bundle/open.go index d357b4f39e1..5926b1419f8 100644 --- a/cmd/bundle/open.go +++ b/cmd/bundle/open.go @@ -88,7 +88,10 @@ Use after deployment to quickly navigate to your resources in the workspace.`, } // Confirm that the resource has a URL. - url := ref.Resource.GetURL() + url, supported := ref.Resource.GetURL() + if !supported { + return errors.New("this resource type does not have a URL") + } if url == "" { return errors.New("resource does not have a URL associated with it (has it been deployed?)") } diff --git a/cmd/pipelines/deploy.go b/cmd/pipelines/deploy.go index 53af02c55a4..7275eb246b5 100644 --- a/cmd/pipelines/deploy.go +++ b/cmd/pipelines/deploy.go @@ -74,7 +74,13 @@ func deployCommand() *cobra.Command { for _, group := range b.Config.Resources.AllResources() { for _, resourceKey := range slices.Sorted(maps.Keys(group.Resources)) { resource := group.Resources[resourceKey] - cmdio.LogString(ctx, fmt.Sprintf("View your %s %s here: %s", resource.ResourceDescription().SingularName, resourceKey, resource.GetURL())) + // Skip resource types that never have a URL; otherwise we'd print + // "View your here:" with a blank URL. + url, supported := resource.GetURL() + if !supported { + continue + } + cmdio.LogString(ctx, fmt.Sprintf("View your %s %s here: %s", resource.ResourceDescription().SingularName, resourceKey, url)) } } diff --git a/cmd/pipelines/open.go b/cmd/pipelines/open.go index 6a8419703be..8c0e88510e7 100644 --- a/cmd/pipelines/open.go +++ b/cmd/pipelines/open.go @@ -72,7 +72,10 @@ If there is only one pipeline in the project, KEY is optional and the pipeline w } // Confirm that the resource has a URL. - url := ref.Resource.GetURL() + url, supported := ref.Resource.GetURL() + if !supported { + return errors.New("this resource type does not have a URL") + } if url == "" { return errors.New("pipeline does not have a URL associated with it (has it been deployed?)") }