From 3d3fa6e783e7584adaa89aa5f8474d7bec4ef2c5 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 09:22:54 +0000 Subject: [PATCH 1/9] remove unified flag usage --- .github/workflows/tagging.yml | 0 NEXT_CHANGELOG.md | 2 +- databricks/sdk/config.py | 67 ++--- databricks/sdk/credentials_provider.py | 4 +- databricks/sdk/service/agentbricks.py | 13 +- databricks/sdk/service/apps.py | 55 ++-- databricks/sdk/service/catalog.py | 249 +++++++++--------- databricks/sdk/service/cleanrooms.py | 41 ++- databricks/sdk/service/compute.py | 127 +++++---- databricks/sdk/service/dashboards.py | 89 ++++--- databricks/sdk/service/database.py | 49 ++-- databricks/sdk/service/dataclassification.py | 9 +- databricks/sdk/service/dataquality.py | 23 +- databricks/sdk/service/files.py | 37 ++- databricks/sdk/service/iam.py | 65 +++-- databricks/sdk/service/iamv2.py | 9 +- databricks/sdk/service/jobs.py | 47 ++-- databricks/sdk/service/knowledgeassistants.py | 23 +- databricks/sdk/service/marketplace.py | 101 ++++--- databricks/sdk/service/ml.py | 213 ++++++++------- databricks/sdk/service/oauth2.py | 7 +- databricks/sdk/service/pipelines.py | 31 ++- databricks/sdk/service/postgres.py | 55 ++-- databricks/sdk/service/qualitymonitorv2.py | 11 +- databricks/sdk/service/serving.py | 45 ++-- databricks/sdk/service/settings.py | 135 +++++----- databricks/sdk/service/settingsv2.py | 7 +- databricks/sdk/service/sharing.py | 55 ++-- databricks/sdk/service/sql.py | 139 +++++----- databricks/sdk/service/tags.py | 21 +- databricks/sdk/service/vectorsearch.py | 37 ++- databricks/sdk/service/workspace.py | 71 +++-- tests/databricks/sdk/service/httpcallv2.py | 7 +- .../sdk/service/idempotencytesting.py | 4 +- .../databricks/sdk/service/jsonmarshallv2.py | 3 +- tests/databricks/sdk/service/lrotesting.py | 11 +- tests/test_config.py | 11 - 37 files changed, 898 insertions(+), 975 deletions(-) mode change 100755 => 100644 .github/workflows/tagging.yml diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml old mode 100755 new mode 100644 diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index caa6b211c..81eecae51 100755 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -17,4 +17,4 @@ * Add `alert_output` field for `databricks.sdk.service.jobs.RunOutput`. * Add `alert_task` field for `databricks.sdk.service.jobs.RunTask`. * Add `alert_task` field for `databricks.sdk.service.jobs.SubmitTask`. -* Add `alert_task` field for `databricks.sdk.service.jobs.Task`. \ No newline at end of file +* Add `alert_task` field for `databricks.sdk.service.jobs.Task`. diff --git a/databricks/sdk/config.py b/databricks/sdk/config.py index 02a8f2ce2..7195e961c 100644 --- a/databricks/sdk/config.py +++ b/databricks/sdk/config.py @@ -19,10 +19,9 @@ OAuthCredentialsProvider) from .environments import (ALL_ENVS, AzureEnvironment, Cloud, DatabricksEnvironment, get_environment_for_hostname) -from .oauth import (OidcEndpoints, Token, get_account_endpoints, +from .oauth import (OidcEndpoints, Token, get_azure_entra_id_workspace_endpoints, - get_endpoints_from_url, get_host_metadata, - get_unified_endpoints, get_workspace_endpoints) + get_endpoints_from_url, get_host_metadata) logger = logging.getLogger("databricks.sdk") @@ -411,14 +410,12 @@ def is_aws(self) -> bool: @property def host_type(self) -> HostType: - """Determine the type of host based on the configuration. - - Returns the HostType which can be ACCOUNTS, WORKSPACE, or UNIFIED. """ - # Check if explicitly marked as unified host - if self.experimental_is_unified_host: - return HostType.UNIFIED - + [DEPRECATED] + Host type and client type are deprecated. Some hosts can now support both workspace and account APIs. + This method returns the HostType based on the host pattern, which is not accurate. + For example, a unified host can support both workspace and account APIs, but WORKSPACE is returned. + """ if not self.host: return HostType.WORKSPACE @@ -430,15 +427,12 @@ def host_type(self) -> HostType: @property def client_type(self) -> ClientType: - """Determine the type of client configuration. - - This is separate from host_type. For example, a unified host can support both - workspace and account client types. - - Returns ClientType.ACCOUNT or ClientType.WORKSPACE based on the configuration. - - For unified hosts, account_id must be set. If workspace_id is also set, - returns WORKSPACE, otherwise returns ACCOUNT. + """ + [DEPRECATED] + Host type and client type are deprecated. Some hosts can now support both workspace and account APIs. + This method returns the ClientType based on the host pattern, which is not accurate. + For example, a unified host can support both workspace and account APIs, but WORKSPACE is returned. + Use client_type instead. """ host_type = self.host_type @@ -448,13 +442,6 @@ def client_type(self) -> ClientType: if host_type == HostType.WORKSPACE: return ClientType.WORKSPACE - if host_type == HostType.UNIFIED: - if not self.account_id: - raise ValueError("Unified host requires account_id to be set") - if self.workspace_id: - return ClientType.WORKSPACE - return ClientType.ACCOUNT - # Default to workspace for backward compatibility return ClientType.WORKSPACE @@ -462,11 +449,10 @@ def client_type(self) -> ClientType: def is_account_client(self) -> bool: """[Deprecated] Host type and client type are deprecated. Clients can now support both workspace and account APIs. + This method returns True if the host is an accounts host, which is not accurate. + For example, a unified host can support both workspace and account APIs, but False is returned. + Use client_type instead. """ - if self.experimental_is_unified_host: - raise ValueError( - "is_account_client cannot be used with unified hosts; use host_type or client_type instead" - ) if not self.host: return False return self.host.startswith("https://accounts.") or self.host.startswith("https://accounts-dod.") @@ -531,21 +517,7 @@ def databricks_oidc_endpoints(self) -> Optional[OidcEndpoints]: if not self.host: return None - if self.discovery_url: - return get_endpoints_from_url(self.discovery_url) - - # Handle unified hosts - if self.host_type == HostType.UNIFIED: - if not self.account_id: - raise ValueError("Unified host requires account_id to be set for OAuth endpoints") - return get_unified_endpoints(self.host, self.account_id) - - # Handle traditional account hosts - if self.host_type == HostType.ACCOUNTS and self.account_id: - return get_account_endpoints(self.host, self.account_id) - - # Default to workspace endpoints - return get_workspace_endpoints(self.host) + return get_endpoints_from_url(self.discovery_url) @property def oidc_endpoints(self) -> Optional[OidcEndpoints]: @@ -643,15 +615,12 @@ def attributes(cls) -> Iterable[ConfigAttribute]: return cls._attributes def _resolve_host_metadata(self) -> None: - """[Experimental] Populate missing config fields from the host's + """Populate missing config fields from the host's /.well-known/databricks-config discovery endpoint. Fills in account_id, workspace_id, and discovery_url (derived from oidc_endpoint, with any {account_id} placeholder substituted) if not already set. """ - # TODO: Enable this everywhere - if not self.host_type == HostType.UNIFIED: - return if not self.host: return try: diff --git a/databricks/sdk/credentials_provider.py b/databricks/sdk/credentials_provider.py index 808a65ea4..2d4bf04fb 100644 --- a/databricks/sdk/credentials_provider.py +++ b/databricks/sdk/credentials_provider.py @@ -440,9 +440,7 @@ def _oidc_credentials_provider( # Determine the audience for token exchange audience = cfg.token_audience - if audience is None and cfg.client_type == ClientType.ACCOUNT: - audience = cfg.account_id - if audience is None and cfg.client_type != ClientType.ACCOUNT: + if audience is None: audience = cfg.databricks_oidc_endpoints.token_endpoint # Try to get an OIDC token. If no supplier returns a token, we cannot use this authentication mode. diff --git a/databricks/sdk/service/agentbricks.py b/databricks/sdk/service/agentbricks.py index dbc2a808c..74dfa5d8c 100755 --- a/databricks/sdk/service/agentbricks.py +++ b/databricks/sdk/service/agentbricks.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -211,7 +210,7 @@ def cancel_optimize(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/custom-llms/{id}/optimize/cancel", headers=headers) @@ -261,7 +260,7 @@ def create_custom_llm( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/custom-llms", body=body, headers=headers) @@ -281,7 +280,7 @@ def delete_custom_llm(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/custom-llms/{id}", headers=headers) @@ -300,7 +299,7 @@ def get_custom_llm(self, id: str) -> CustomLlm: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/custom-llms/{id}", headers=headers) @@ -321,7 +320,7 @@ def start_optimize(self, id: str) -> CustomLlm: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/custom-llms/{id}/optimize", headers=headers) @@ -362,7 +361,7 @@ def update_custom_llm(self, id: str, custom_llm: CustomLlm, update_mask: str) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/custom-llms/{id}", body=body, headers=headers) diff --git a/databricks/sdk/service/apps.py b/databricks/sdk/service/apps.py index 2e19dd7b5..63b32d072 100755 --- a/databricks/sdk/service/apps.py +++ b/databricks/sdk/service/apps.py @@ -12,7 +12,6 @@ from google.protobuf.timestamp_pb2 import Timestamp -from databricks.sdk.client_types import HostType from databricks.sdk.common import lro from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.retries import RetryError, poll @@ -2890,7 +2889,7 @@ def create(self, app: App, *, no_compute: Optional[bool] = None) -> Wait[App]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/apps", query=query, body=body, headers=headers) @@ -2914,7 +2913,7 @@ def create_space(self, space: Space) -> CreateSpaceOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/app-spaces", body=body, headers=headers) @@ -2954,7 +2953,7 @@ def create_update(self, app_name: str, update_mask: str, *, app: Optional[App] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/update", body=body, headers=headers) @@ -2979,7 +2978,7 @@ def delete(self, name: str) -> App: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/apps/{name}", headers=headers) @@ -2999,7 +2998,7 @@ def delete_space(self, name: str) -> DeleteSpaceOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/app-spaces/{name}", headers=headers) @@ -3026,7 +3025,7 @@ def deploy(self, app_name: str, app_deployment: AppDeployment) -> Wait[AppDeploy } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/deployments", body=body, headers=headers) @@ -3056,7 +3055,7 @@ def get(self, name: str) -> App: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/apps/{name}", headers=headers) @@ -3078,7 +3077,7 @@ def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/apps/{app_name}/deployments/{deployment_id}", headers=headers) @@ -3098,7 +3097,7 @@ def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}/permissionLevels", headers=headers) @@ -3118,7 +3117,7 @@ def get_permissions(self, app_name: str) -> AppPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}", headers=headers) @@ -3138,7 +3137,7 @@ def get_space(self, name: str) -> Space: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/app-spaces/{name}", headers=headers) @@ -3158,7 +3157,7 @@ def get_space_operation(self, name: str) -> Operation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/app-spaces/{name}/operation", headers=headers) @@ -3178,7 +3177,7 @@ def get_update(self, app_name: str) -> AppUpdate: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/apps/{app_name}/update", headers=headers) @@ -3211,7 +3210,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3248,7 +3247,7 @@ def list_deployments( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3281,7 +3280,7 @@ def list_spaces(self, *, page_size: Optional[int] = None, page_token: Optional[s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3315,7 +3314,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers) @@ -3338,7 +3337,7 @@ def start(self, name: str) -> Wait[App]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/apps/{name}/start", headers=headers) @@ -3364,7 +3363,7 @@ def stop(self, name: str) -> Wait[App]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/apps/{name}/stop", headers=headers) @@ -3391,7 +3390,7 @@ def update(self, name: str, app: App) -> App: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/apps/{name}", body=body, headers=headers) @@ -3418,7 +3417,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers) @@ -3456,7 +3455,7 @@ def update_space(self, name: str, space: Space, update_mask: FieldMask) -> Updat } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/app-spaces/{name}", query=query, body=body, headers=headers) @@ -3714,7 +3713,7 @@ def create_custom_template(self, template: CustomTemplate) -> CustomTemplate: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/apps-settings/templates", body=body, headers=headers) @@ -3734,7 +3733,7 @@ def delete_custom_template(self, name: str) -> CustomTemplate: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/apps-settings/templates/{name}", headers=headers) @@ -3754,7 +3753,7 @@ def get_custom_template(self, name: str) -> CustomTemplate: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/apps-settings/templates/{name}", headers=headers) @@ -3783,7 +3782,7 @@ def list_custom_templates( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3813,7 +3812,7 @@ def update_custom_template(self, name: str, template: CustomTemplate) -> CustomT } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/apps-settings/templates/{name}", body=body, headers=headers) diff --git a/databricks/sdk/service/catalog.py b/databricks/sdk/service/catalog.py index 9d6c56454..dfd957109 100755 --- a/databricks/sdk/service/catalog.py +++ b/databricks/sdk/service/catalog.py @@ -12,7 +12,6 @@ from google.protobuf.timestamp_pb2 import Timestamp -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum, _timestamp) @@ -11145,7 +11144,7 @@ def get(self, artifact_type: ArtifactType) -> ArtifactAllowlistInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/artifact-allowlists/{artifact_type.value}", headers=headers) @@ -11193,7 +11192,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -11273,7 +11272,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/catalogs", body=body, headers=headers) @@ -11299,7 +11298,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/catalogs/{name}", query=query, headers=headers) @@ -11325,7 +11324,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> CatalogInf } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/catalogs/{name}", query=query, headers=headers) @@ -11385,7 +11384,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -11455,7 +11454,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/catalogs/{name}", body=body, headers=headers) @@ -11525,7 +11524,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/connections", body=body, headers=headers) @@ -11545,7 +11544,7 @@ def delete(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/connections/{name}", headers=headers) @@ -11564,7 +11563,7 @@ def get(self, name: str) -> ConnectionInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/connections/{name}", headers=headers) @@ -11601,7 +11600,7 @@ def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -11645,7 +11644,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/connections/{name}", body=body, headers=headers) @@ -11732,7 +11731,7 @@ def create_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/credentials", body=body, headers=headers) @@ -11759,7 +11758,7 @@ def delete_credential(self, name_arg: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/credentials/{name_arg}", query=query, headers=headers) @@ -11795,7 +11794,7 @@ def generate_temporary_service_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/temporary-service-credentials", body=body, headers=headers) @@ -11816,7 +11815,7 @@ def get_credential(self, name_arg: str) -> CredentialInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/credentials/{name_arg}", headers=headers) @@ -11870,7 +11869,7 @@ def list_credentials( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -11962,7 +11961,7 @@ def update_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/credentials/{name_arg}", body=body, headers=headers) @@ -12036,7 +12035,7 @@ def validate_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/validate-credentials", body=body, headers=headers) @@ -12076,7 +12075,7 @@ def create(self, tag_assignment: EntityTagAssignment) -> EntityTagAssignment: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/entity-tag-assignments", body=body, headers=headers) @@ -12110,7 +12109,7 @@ def delete(self, entity_type: str, entity_name: str, tag_key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -12138,7 +12137,7 @@ def get(self, entity_type: str, entity_name: str, tag_key: str) -> EntityTagAssi } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -12180,7 +12179,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -12243,7 +12242,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -12285,7 +12284,7 @@ def create_external_lineage_relationship( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/lineage-tracking/external-lineage", body=body, headers=headers) @@ -12308,7 +12307,7 @@ def delete_external_lineage_relationship(self, external_lineage_relationship: De } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/lineage-tracking/external-lineage", query=query, headers=headers) @@ -12353,7 +12352,7 @@ def list_external_lineage_relationships( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -12396,7 +12395,7 @@ def update_external_lineage_relationship( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -12498,7 +12497,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/external-locations", body=body, headers=headers) @@ -12524,7 +12523,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/external-locations/{name}", query=query, headers=headers) @@ -12550,7 +12549,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> ExternalLo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/external-locations/{name}", query=query, headers=headers) @@ -12606,7 +12605,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -12715,7 +12714,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/external-locations/{name}", body=body, headers=headers) @@ -12750,7 +12749,7 @@ def create_external_metadata(self, external_metadata: ExternalMetadata) -> Exter } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/lineage-tracking/external-metadata", body=body, headers=headers) @@ -12770,7 +12769,7 @@ def delete_external_metadata(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/lineage-tracking/external-metadata/{name}", headers=headers) @@ -12789,7 +12788,7 @@ def get_external_metadata(self, name: str) -> ExternalMetadata: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/lineage-tracking/external-metadata/{name}", headers=headers) @@ -12822,7 +12821,7 @@ def list_external_metadata( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -12869,7 +12868,7 @@ def update_external_metadata( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -12912,7 +12911,7 @@ def create(self, function_info: CreateFunction) -> FunctionInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/functions", body=body, headers=headers) @@ -12940,7 +12939,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/functions/{name}", query=query, headers=headers) @@ -12971,7 +12970,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> FunctionIn } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/functions/{name}", query=query, headers=headers) @@ -13033,7 +13032,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -13073,7 +13072,7 @@ def update(self, name: str, *, owner: Optional[str] = None) -> FunctionInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/functions/{name}", body=body, headers=headers) @@ -13146,7 +13145,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13209,7 +13208,7 @@ def get_effective( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13244,7 +13243,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13296,7 +13295,7 @@ def assign(self, workspace_id: int, metastore_id: str, default_catalog_name: str } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", body=body, headers=headers) @@ -13341,7 +13340,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/metastores", body=body, headers=headers) @@ -13359,7 +13358,7 @@ def current(self) -> MetastoreAssignment: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/unity-catalog/current-metastore-assignment", headers=headers) @@ -13384,7 +13383,7 @@ def delete(self, id: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/metastores/{id}", query=query, headers=headers) @@ -13404,7 +13403,7 @@ def get(self, id: str) -> MetastoreInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/metastores/{id}", headers=headers) @@ -13445,7 +13444,7 @@ def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -13472,7 +13471,7 @@ def summary(self) -> GetMetastoreSummaryResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/unity-catalog/metastore_summary", headers=headers) @@ -13497,7 +13496,7 @@ def unassign(self, workspace_id: int, metastore_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -13568,7 +13567,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/metastores/{id}", body=body, headers=headers) @@ -13604,7 +13603,7 @@ def update_assignment( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", body=body, headers=headers) @@ -13640,7 +13639,7 @@ def delete(self, full_name: str, version: int): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", headers=headers) @@ -13682,7 +13681,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13715,7 +13714,7 @@ def get_by_alias(self, full_name: str, alias: str, *, include_aliases: Optional[ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13776,7 +13775,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -13906,7 +13905,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -13968,7 +13967,7 @@ def create(self, table: OnlineTable) -> Wait[OnlineTable]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/online-tables", body=body, headers=headers) @@ -13995,7 +13994,7 @@ def delete(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/online-tables/{name}", headers=headers) @@ -14014,7 +14013,7 @@ def get(self, name: str) -> OnlineTable: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/online-tables/{name}", headers=headers) @@ -14048,7 +14047,7 @@ def create_policy(self, policy_info: PolicyInfo) -> PolicyInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/policies", body=body, headers=headers) @@ -14072,7 +14071,7 @@ def delete_policy(self, on_securable_type: str, on_securable_fullname: str, name } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -14100,7 +14099,7 @@ def get_policy(self, on_securable_type: str, on_securable_fullname: str, name: s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -14155,7 +14154,7 @@ def list_policies( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -14213,7 +14212,7 @@ def update_policy( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -14256,7 +14255,7 @@ def cancel_refresh(self, table_name: str, refresh_id: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -14371,7 +14370,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", body=body, headers=headers) @@ -14403,7 +14402,7 @@ def delete(self, table_name: str) -> DeleteMonitorResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", headers=headers) @@ -14434,7 +14433,7 @@ def get(self, table_name: str) -> MonitorInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", headers=headers) @@ -14464,7 +14463,7 @@ def get_refresh(self, table_name: str, refresh_id: int) -> MonitorRefreshInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -14495,7 +14494,7 @@ def list_refreshes(self, table_name: str) -> MonitorRefreshListResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", headers=headers) @@ -14534,7 +14533,7 @@ def regenerate_dashboard( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -14565,7 +14564,7 @@ def run_refresh(self, table_name: str) -> MonitorRefreshInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", headers=headers) @@ -14670,7 +14669,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", body=body, headers=headers) @@ -14802,7 +14801,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/models", body=body, headers=headers) @@ -14824,7 +14823,7 @@ def delete(self, full_name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}", headers=headers) @@ -14847,7 +14846,7 @@ def delete_alias(self, full_name: str, alias: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", headers=headers) @@ -14882,7 +14881,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/models/{full_name}", query=query, headers=headers) @@ -14957,7 +14956,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -14995,7 +14994,7 @@ def set_alias(self, full_name: str, alias: str, version_num: int) -> RegisteredM } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -15100,7 +15099,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/models/{full_name}", body=body, headers=headers) @@ -15139,7 +15138,7 @@ def get_quota(self, parent_securable_type: str, parent_full_name: str, quota_nam } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -15177,7 +15176,7 @@ def list_quotas( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -15229,7 +15228,7 @@ def batch_create_access_requests( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/3.0/rfa/requests", body=body, headers=headers) @@ -15256,7 +15255,7 @@ def get_access_request_destinations(self, securable_type: str, full_name: str) - } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/3.0/rfa/destinations/{securable_type}/{full_name}", headers=headers) @@ -15303,7 +15302,7 @@ def update_access_request_destinations( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/3.0/rfa/destinations", query=query, body=body, headers=headers) @@ -15362,7 +15361,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/schemas", body=body, headers=headers) @@ -15388,7 +15387,7 @@ def delete(self, full_name: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/schemas/{full_name}", query=query, headers=headers) @@ -15414,7 +15413,7 @@ def get(self, full_name: str, *, include_browse: Optional[bool] = None) -> Schem } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/schemas/{full_name}", query=query, headers=headers) @@ -15470,7 +15469,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -15532,7 +15531,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/schemas/{full_name}", body=body, headers=headers) @@ -15621,7 +15620,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/storage-credentials", body=body, headers=headers) @@ -15648,7 +15647,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/storage-credentials/{name}", query=query, headers=headers) @@ -15668,7 +15667,7 @@ def get(self, name: str) -> StorageCredentialInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/storage-credentials/{name}", headers=headers) @@ -15720,7 +15719,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -15818,7 +15817,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/storage-credentials/{name}", body=body, headers=headers) @@ -15894,7 +15893,7 @@ def validate( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/validate-storage-credentials", body=body, headers=headers) @@ -15925,7 +15924,7 @@ def disable(self, metastore_id: str, schema_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -15955,7 +15954,7 @@ def enable(self, metastore_id: str, schema_name: str, *, catalog_name: Optional[ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -16001,7 +16000,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -16061,7 +16060,7 @@ def create(self, full_name_arg: str, constraint: TableConstraint) -> TableConstr } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/constraints", body=body, headers=headers) @@ -16098,7 +16097,7 @@ def delete(self, full_name: str, constraint_name: str, cascade: bool): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/constraints/{full_name}", query=query, headers=headers) @@ -16189,7 +16188,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/tables", body=body, headers=headers) @@ -16212,7 +16211,7 @@ def delete(self, full_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/tables/{full_name}", headers=headers) @@ -16236,7 +16235,7 @@ def exists(self, full_name: str) -> TableExistsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{full_name}/exists", headers=headers) @@ -16281,7 +16280,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{full_name}", query=query, headers=headers) @@ -16366,7 +16365,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -16443,7 +16442,7 @@ def list_summaries( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -16478,7 +16477,7 @@ def update(self, full_name: str, *, owner: Optional[str] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.1/unity-catalog/tables/{full_name}", body=body, headers=headers) @@ -16548,7 +16547,7 @@ def generate_temporary_path_credentials( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/unity-catalog/temporary-path-credentials", body=body, headers=headers) @@ -16601,7 +16600,7 @@ def generate_temporary_table_credentials( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/unity-catalog/temporary-table-credentials", body=body, headers=headers) @@ -16684,7 +16683,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/volumes", body=body, headers=headers) @@ -16706,7 +16705,7 @@ def delete(self, name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/volumes/{name}", headers=headers) @@ -16776,7 +16775,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -16812,7 +16811,7 @@ def read(self, name: str, *, include_browse: Optional[bool] = None) -> VolumeInf } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/volumes/{name}", query=query, headers=headers) @@ -16854,7 +16853,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/volumes/{name}", body=body, headers=headers) @@ -16895,7 +16894,7 @@ def get(self, name: str) -> GetCatalogWorkspaceBindingsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}", headers=headers) @@ -16945,7 +16944,7 @@ def get_bindings( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -16995,7 +16994,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -17040,7 +17039,7 @@ def update_bindings( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/databricks/sdk/service/cleanrooms.py b/databricks/sdk/service/cleanrooms.py index ab08c8855..b46099160 100755 --- a/databricks/sdk/service/cleanrooms.py +++ b/databricks/sdk/service/cleanrooms.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service import catalog, jobs, settings, sharing from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -1421,7 +1420,7 @@ def get(self, clean_room_name: str, asset_type: CleanRoomAssetAssetType, name: s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1466,7 +1465,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1512,7 +1511,7 @@ def create(self, clean_room_name: str, asset: CleanRoomAsset) -> CleanRoomAsset: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/clean-rooms/{clean_room_name}/assets", body=body, headers=headers) @@ -1548,7 +1547,7 @@ def create_clean_room_asset_review( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1577,7 +1576,7 @@ def delete(self, clean_room_name: str, asset_type: CleanRoomAssetAssetType, name } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -1602,7 +1601,7 @@ def get(self, clean_room_name: str, asset_type: CleanRoomAssetAssetType, name: s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1629,7 +1628,7 @@ def list(self, clean_room_name: str, *, page_token: Optional[str] = None) -> Ite } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1674,7 +1673,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1712,7 +1711,7 @@ def create(self, clean_room_name: str, auto_approval_rule: CleanRoomAutoApproval } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1734,7 +1733,7 @@ def delete(self, clean_room_name: str, rule_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/clean-rooms/{clean_room_name}/auto-approval-rules/{rule_id}", headers=headers) @@ -1753,7 +1752,7 @@ def get(self, clean_room_name: str, rule_id: str) -> CleanRoomAutoApprovalRule: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1785,7 +1784,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1821,7 +1820,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1870,7 +1869,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1939,7 +1938,7 @@ def create(self, clean_room: CleanRoom) -> Wait[CleanRoom]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/clean-rooms", body=body, headers=headers) @@ -1969,7 +1968,7 @@ def create_output_catalog( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1993,7 +1992,7 @@ def delete(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/clean-rooms/{name}", headers=headers) @@ -2011,7 +2010,7 @@ def get(self, name: str) -> CleanRoom: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/clean-rooms/{name}", headers=headers) @@ -2039,7 +2038,7 @@ def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = N } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2073,7 +2072,7 @@ def update(self, name: str, *, clean_room: Optional[CleanRoom] = None) -> CleanR } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/clean-rooms/{name}", body=body, headers=headers) diff --git a/databricks/sdk/service/compute.py b/databricks/sdk/service/compute.py index 5a613ac31..af3e5abc7 100755 --- a/databricks/sdk/service/compute.py +++ b/databricks/sdk/service/compute.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -7963,7 +7962,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/policies/clusters/create", body=body, headers=headers) @@ -7987,7 +7986,7 @@ def delete(self, policy_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/policies/clusters/delete", body=body, headers=headers) @@ -8065,7 +8064,7 @@ def edit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/policies/clusters/edit", body=body, headers=headers) @@ -8087,7 +8086,7 @@ def get(self, policy_id: str) -> Policy: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/policies/clusters/get", query=query, headers=headers) @@ -8107,7 +8106,7 @@ def get_permission_levels(self, cluster_policy_id: str) -> GetClusterPolicyPermi } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8130,7 +8129,7 @@ def get_permissions(self, cluster_policy_id: str) -> ClusterPolicyPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", headers=headers) @@ -8161,7 +8160,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/policies/clusters/list", query=query, headers=headers) @@ -8190,7 +8189,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8220,7 +8219,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8344,7 +8343,7 @@ def change_owner(self, cluster_id: str, owner_username: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.1/clusters/change-owner", body=body, headers=headers) @@ -8619,7 +8618,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/create", body=body, headers=headers) @@ -8729,7 +8728,7 @@ def delete(self, cluster_id: str) -> Wait[ClusterDetails]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/delete", body=body, headers=headers) @@ -9005,7 +9004,7 @@ def edit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/edit", body=body, headers=headers) @@ -9162,7 +9161,7 @@ def events( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9192,7 +9191,7 @@ def get(self, cluster_id: str) -> ClusterDetails: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/clusters/get", query=query, headers=headers) @@ -9212,7 +9211,7 @@ def get_permission_levels(self, cluster_id: str) -> GetClusterPermissionLevelsRe } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/clusters/{cluster_id}/permissionLevels", headers=headers) @@ -9232,7 +9231,7 @@ def get_permissions(self, cluster_id: str) -> ClusterPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/clusters/{cluster_id}", headers=headers) @@ -9277,7 +9276,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9301,7 +9300,7 @@ def list_node_types(self) -> ListNodeTypesResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/clusters/list-node-types", headers=headers) @@ -9320,7 +9319,7 @@ def list_zones(self) -> ListAvailableZonesResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/clusters/list-zones", headers=headers) @@ -9348,7 +9347,7 @@ def permanent_delete(self, cluster_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.1/clusters/permanent-delete", body=body, headers=headers) @@ -9371,7 +9370,7 @@ def pin(self, cluster_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.1/clusters/pin", body=body, headers=headers) @@ -9415,7 +9414,7 @@ def resize( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/resize", body=body, headers=headers) @@ -9455,7 +9454,7 @@ def restart(self, cluster_id: str, *, restart_user: Optional[str] = None) -> Wai } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/restart", body=body, headers=headers) @@ -9488,7 +9487,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/clusters/{cluster_id}", body=body, headers=headers) @@ -9506,7 +9505,7 @@ def spark_versions(self) -> GetSparkVersionsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/clusters/spark-versions", headers=headers) @@ -9536,7 +9535,7 @@ def start(self, cluster_id: str) -> Wait[ClusterDetails]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/start", body=body, headers=headers) @@ -9564,7 +9563,7 @@ def unpin(self, cluster_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.1/clusters/unpin", body=body, headers=headers) @@ -9617,7 +9616,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.1/clusters/update", body=body, headers=headers) @@ -9654,7 +9653,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/clusters/{cluster_id}", body=body, headers=headers) @@ -9806,7 +9805,7 @@ def cancel( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/1.2/commands/cancel", body=body, headers=headers) @@ -9851,7 +9850,7 @@ def command_status(self, cluster_id: str, context_id: str, command_id: str) -> C } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/1.2/commands/status", query=query, headers=headers) @@ -9876,7 +9875,7 @@ def context_status(self, cluster_id: str, context_id: str) -> ContextStatusRespo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/1.2/contexts/status", query=query, headers=headers) @@ -9909,7 +9908,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/1.2/contexts/create", body=body, headers=headers) @@ -9945,7 +9944,7 @@ def destroy(self, cluster_id: str, context_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/1.2/contexts/destroy", body=body, headers=headers) @@ -9990,7 +9989,7 @@ def execute( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/1.2/commands/execute", body=body, headers=headers) @@ -10068,7 +10067,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/global-init-scripts", body=body, headers=headers) @@ -10088,7 +10087,7 @@ def delete(self, script_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/global-init-scripts/{script_id}", headers=headers) @@ -10107,7 +10106,7 @@ def get(self, script_id: str) -> GlobalInitScriptDetailsWithContent: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/global-init-scripts/{script_id}", headers=headers) @@ -10127,7 +10126,7 @@ def list(self) -> Iterator[GlobalInitScriptDetails]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/global-init-scripts", headers=headers) @@ -10177,7 +10176,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/global-init-scripts/{script_id}", body=body, headers=headers) @@ -10321,7 +10320,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/instance-pools/create", body=body, headers=headers) @@ -10345,7 +10344,7 @@ def delete(self, instance_pool_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/instance-pools/delete", body=body, headers=headers) @@ -10427,7 +10426,7 @@ def edit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/instance-pools/edit", body=body, headers=headers) @@ -10449,7 +10448,7 @@ def get(self, instance_pool_id: str) -> GetInstancePool: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/instance-pools/get", query=query, headers=headers) @@ -10469,7 +10468,7 @@ def get_permission_levels(self, instance_pool_id: str) -> GetInstancePoolPermiss } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -10492,7 +10491,7 @@ def get_permissions(self, instance_pool_id: str) -> InstancePoolPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/instance-pools/{instance_pool_id}", headers=headers) @@ -10510,7 +10509,7 @@ def list(self) -> Iterator[InstancePoolAndStats]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/instance-pools/list", headers=headers) @@ -10539,7 +10538,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/instance-pools/{instance_pool_id}", body=body, headers=headers) @@ -10567,7 +10566,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -10640,7 +10639,7 @@ def add( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/instance-profiles/add", body=body, headers=headers) @@ -10697,7 +10696,7 @@ def edit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/instance-profiles/edit", body=body, headers=headers) @@ -10716,7 +10715,7 @@ def list(self) -> Iterator[InstanceProfile]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/instance-profiles/list", headers=headers) @@ -10744,7 +10743,7 @@ def remove(self, instance_profile_arn: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/instance-profiles/remove", body=body, headers=headers) @@ -10781,7 +10780,7 @@ def all_cluster_statuses(self) -> Iterator[ClusterLibraryStatuses]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/libraries/all-cluster-statuses", headers=headers) @@ -10809,7 +10808,7 @@ def cluster_status(self, cluster_id: str) -> Iterator[LibraryFullStatus]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/libraries/cluster-status", query=query, headers=headers) @@ -10839,7 +10838,7 @@ def install(self, cluster_id: str, libraries: List[Library]): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/libraries/install", body=body, headers=headers) @@ -10867,7 +10866,7 @@ def uninstall(self, cluster_id: str, libraries: List[Library]): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/libraries/uninstall", body=body, headers=headers) @@ -10921,7 +10920,7 @@ def enforce_compliance( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/policies/clusters/enforce-compliance", body=body, headers=headers) @@ -10945,7 +10944,7 @@ def get_compliance(self, cluster_id: str) -> GetClusterComplianceResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/policies/clusters/get-compliance", query=query, headers=headers) @@ -10981,7 +10980,7 @@ def list_compliance( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -11027,7 +11026,7 @@ def get(self, policy_family_id: str, *, version: Optional[int] = None) -> Policy } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/policy-families/{policy_family_id}", query=query, headers=headers) @@ -11055,7 +11054,7 @@ def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: diff --git a/databricks/sdk/service/dashboards.py b/databricks/sdk/service/dashboards.py index b091f1dd6..8c2700695 100755 --- a/databricks/sdk/service/dashboards.py +++ b/databricks/sdk/service/dashboards.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service import sql from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -2291,7 +2290,7 @@ def create_message(self, space_id: str, conversation_id: str, content: str) -> W } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do( @@ -2360,7 +2359,7 @@ def create_space( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/genie/spaces", body=body, headers=headers) @@ -2382,7 +2381,7 @@ def delete_conversation(self, space_id: str, conversation_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}", headers=headers) @@ -2405,7 +2404,7 @@ def delete_conversation_message(self, space_id: str, conversation_id: str, messa } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -2437,7 +2436,7 @@ def execute_message_attachment_query( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2468,7 +2467,7 @@ def execute_message_query( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2519,7 +2518,7 @@ def generate_download_full_query_result( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2552,7 +2551,7 @@ def genie_create_eval_run( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/genie/spaces/{space_id}/eval-runs", body=body, headers=headers) @@ -2576,7 +2575,7 @@ def genie_get_eval_result_details(self, space_id: str, eval_run_id: str, result_ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2599,7 +2598,7 @@ def genie_get_eval_run(self, space_id: str, eval_run_id: str) -> GenieEvalRunRes } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/genie/spaces/{space_id}/eval-runs/{eval_run_id}", headers=headers) @@ -2632,7 +2631,7 @@ def genie_list_eval_results( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2665,7 +2664,7 @@ def genie_list_eval_runs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/genie/spaces/{space_id}/eval-runs", query=query, headers=headers) @@ -2727,7 +2726,7 @@ def get_download_full_query_result( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2756,7 +2755,7 @@ def get_message(self, space_id: str, conversation_id: str, message_id: str) -> G } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2789,7 +2788,7 @@ def get_message_attachment_query_result( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2820,7 +2819,7 @@ def get_message_query_result( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2853,7 +2852,7 @@ def get_message_query_result_by_attachment( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2883,7 +2882,7 @@ def get_space(self, space_id: str, *, include_serialized_space: Optional[bool] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/genie/spaces/{space_id}", query=query, headers=headers) @@ -2916,7 +2915,7 @@ def list_conversation_messages( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2962,7 +2961,7 @@ def list_conversations( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/genie/spaces/{space_id}/conversations", query=query, headers=headers) @@ -2991,7 +2990,7 @@ def list_spaces( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/genie/spaces", query=query, headers=headers) @@ -3021,7 +3020,7 @@ def send_message_feedback(self, space_id: str, conversation_id: str, message_id: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -3053,7 +3052,7 @@ def start_conversation(self, space_id: str, content: str) -> Wait[GenieMessage]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do( @@ -3084,7 +3083,7 @@ def trash_space(self, space_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/genie/spaces/{space_id}", headers=headers) @@ -3132,7 +3131,7 @@ def update_space( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/genie/spaces/{space_id}", body=body, headers=headers) @@ -3176,7 +3175,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/lakeview/dashboards", query=query, body=body, headers=headers) @@ -3200,7 +3199,7 @@ def create_schedule(self, dashboard_id: str, schedule: Schedule) -> Schedule: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", body=body, headers=headers) @@ -3226,7 +3225,7 @@ def create_subscription(self, dashboard_id: str, schedule_id: str, subscription: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3259,7 +3258,7 @@ def delete_schedule(self, dashboard_id: str, schedule_id: str, *, etag: Optional } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -3295,7 +3294,7 @@ def delete_subscription( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -3319,7 +3318,7 @@ def get(self, dashboard_id: str) -> Dashboard: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers) @@ -3339,7 +3338,7 @@ def get_published(self, dashboard_id: str) -> PublishedDashboard: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers) @@ -3361,7 +3360,7 @@ def get_schedule(self, dashboard_id: str, schedule_id: str) -> Schedule: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3387,7 +3386,7 @@ def get_subscription(self, dashboard_id: str, schedule_id: str, subscription_id: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3435,7 +3434,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3473,7 +3472,7 @@ def list_schedules( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3515,7 +3514,7 @@ def list_subscriptions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3570,7 +3569,7 @@ def migrate( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/lakeview/dashboards/migrate", body=body, headers=headers) @@ -3603,7 +3602,7 @@ def publish( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", body=body, headers=headers) @@ -3623,7 +3622,7 @@ def trash(self, dashboard_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers) @@ -3642,7 +3641,7 @@ def unpublish(self, dashboard_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers) @@ -3684,7 +3683,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3712,7 +3711,7 @@ def update_schedule(self, dashboard_id: str, schedule_id: str, schedule: Schedul } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3752,7 +3751,7 @@ def get_published_dashboard_token_info( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/databricks/sdk/service/database.py b/databricks/sdk/service/database.py index b3072b266..9a9e8cdea 100755 --- a/databricks/sdk/service/database.py +++ b/databricks/sdk/service/database.py @@ -11,7 +11,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict) @@ -1609,7 +1608,7 @@ def create_database_catalog(self, catalog: DatabaseCatalog) -> DatabaseCatalog: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/database/catalogs", body=body, headers=headers) @@ -1633,7 +1632,7 @@ def create_database_instance(self, database_instance: DatabaseInstance) -> Wait[ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/database/instances", body=body, headers=headers) @@ -1674,7 +1673,7 @@ def create_database_instance_role( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1698,7 +1697,7 @@ def create_database_table(self, table: DatabaseTable) -> DatabaseTable: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/database/tables", body=body, headers=headers) @@ -1719,7 +1718,7 @@ def create_synced_database_table(self, synced_table: SyncedDatabaseTable) -> Syn } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/database/synced_tables", body=body, headers=headers) @@ -1738,7 +1737,7 @@ def delete_database_catalog(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/database/catalogs/{name}", headers=headers) @@ -1768,7 +1767,7 @@ def delete_database_instance(self, name: str, *, force: Optional[bool] = None, p } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/database/instances/{name}", query=query, headers=headers) @@ -1802,7 +1801,7 @@ def delete_database_instance_role( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -1822,7 +1821,7 @@ def delete_database_table(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/database/tables/{name}", headers=headers) @@ -1845,7 +1844,7 @@ def delete_synced_database_table(self, name: str, *, purge_data: Optional[bool] } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/database/synced_tables/{name}", query=query, headers=headers) @@ -1867,7 +1866,7 @@ def find_database_instance_by_uid(self, *, uid: Optional[str] = None) -> Databas } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/database/instances:findByUid", query=query, headers=headers) @@ -1910,7 +1909,7 @@ def generate_database_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/database/credentials", body=body, headers=headers) @@ -1929,7 +1928,7 @@ def get_database_catalog(self, name: str) -> DatabaseCatalog: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/database/catalogs/{name}", headers=headers) @@ -1949,7 +1948,7 @@ def get_database_instance(self, name: str) -> DatabaseInstance: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/database/instances/{name}", headers=headers) @@ -1969,7 +1968,7 @@ def get_database_instance_role(self, instance_name: str, name: str) -> DatabaseI } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/database/instances/{instance_name}/roles/{name}", headers=headers) @@ -1988,7 +1987,7 @@ def get_database_table(self, name: str) -> DatabaseTable: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/database/tables/{name}", headers=headers) @@ -2007,7 +2006,7 @@ def get_synced_database_table(self, name: str) -> SyncedDatabaseTable: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/database/synced_tables/{name}", headers=headers) @@ -2038,7 +2037,7 @@ def list_database_catalogs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2078,7 +2077,7 @@ def list_database_instance_roles( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2115,7 +2114,7 @@ def list_database_instances( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2152,7 +2151,7 @@ def list_synced_database_tables( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2191,7 +2190,7 @@ def update_database_catalog( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/database/catalogs/{name}", query=query, body=body, headers=headers) @@ -2222,7 +2221,7 @@ def update_database_instance( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/database/instances/{name}", query=query, body=body, headers=headers) @@ -2253,7 +2252,7 @@ def update_synced_database_table( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/database/synced_tables/{name}", query=query, body=body, headers=headers) diff --git a/databricks/sdk/service/dataclassification.py b/databricks/sdk/service/dataclassification.py index 295ded86b..26b563352 100755 --- a/databricks/sdk/service/dataclassification.py +++ b/databricks/sdk/service/dataclassification.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict @@ -167,7 +166,7 @@ def create_catalog_config(self, parent: str, catalog_config: CatalogConfig) -> C } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/data-classification/v1/{parent}/config", body=body, headers=headers) @@ -187,7 +186,7 @@ def delete_catalog_config(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/data-classification/v1/{name}", headers=headers) @@ -206,7 +205,7 @@ def get_catalog_config(self, name: str) -> CatalogConfig: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/data-classification/v1/{name}", headers=headers) @@ -238,7 +237,7 @@ def update_catalog_config(self, name: str, catalog_config: CatalogConfig, update } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/data-classification/v1/{name}", query=query, body=body, headers=headers) diff --git a/databricks/sdk/service/dataquality.py b/databricks/sdk/service/dataquality.py index 77c55fb9e..b915283fd 100644 --- a/databricks/sdk/service/dataquality.py +++ b/databricks/sdk/service/dataquality.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _repeated_enum) @@ -889,7 +888,7 @@ def cancel_refresh(self, object_type: str, object_id: str, refresh_id: int) -> C } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -929,7 +928,7 @@ def create_monitor(self, monitor: Monitor) -> Monitor: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/data-quality/v1/monitors", body=body, headers=headers) @@ -971,7 +970,7 @@ def create_refresh(self, object_type: str, object_id: str, refresh: Refresh) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1017,7 +1016,7 @@ def delete_monitor(self, object_type: str, object_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/data-quality/v1/monitors/{object_type}/{object_id}", headers=headers) @@ -1050,7 +1049,7 @@ def delete_refresh(self, object_type: str, object_id: str, refresh_id: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -1096,7 +1095,7 @@ def get_monitor(self, object_type: str, object_id: str) -> Monitor: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/data-quality/v1/monitors/{object_type}/{object_id}", headers=headers) @@ -1140,7 +1139,7 @@ def get_refresh(self, object_type: str, object_id: str, refresh_id: int) -> Refr } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1167,7 +1166,7 @@ def list_monitor(self, *, page_size: Optional[int] = None, page_token: Optional[ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1224,7 +1223,7 @@ def list_refresh( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1286,7 +1285,7 @@ def update_monitor(self, object_type: str, object_id: str, monitor: Monitor, upd } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1333,7 +1332,7 @@ def update_refresh( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/databricks/sdk/service/files.py b/databricks/sdk/service/files.py index bf72b9f96..6dc534680 100755 --- a/databricks/sdk/service/files.py +++ b/databricks/sdk/service/files.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import Any, BinaryIO, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import ( _escape_multi_segment_path_parameter, _repeated_dict) @@ -475,7 +474,7 @@ def add_block(self, handle: int, data: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/add-block", body=body, headers=headers) @@ -499,7 +498,7 @@ def close(self, handle: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/close", body=body, headers=headers) @@ -533,7 +532,7 @@ def create(self, path: str, *, overwrite: Optional[bool] = None) -> CreateRespon } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/dbfs/create", body=body, headers=headers) @@ -575,7 +574,7 @@ def delete(self, path: str, *, recursive: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/delete", body=body, headers=headers) @@ -598,7 +597,7 @@ def get_status(self, path: str) -> FileInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/dbfs/get-status", query=query, headers=headers) @@ -629,7 +628,7 @@ def list(self, path: str) -> Iterator[FileInfo]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/dbfs/list", query=query, headers=headers) @@ -657,7 +656,7 @@ def mkdirs(self, path: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/mkdirs", body=body, headers=headers) @@ -687,7 +686,7 @@ def move(self, source_path: str, destination_path: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/move", body=body, headers=headers) @@ -727,7 +726,7 @@ def put(self, path: str, *, contents: Optional[str] = None, overwrite: Optional[ } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/dbfs/put", body=body, headers=headers) @@ -764,7 +763,7 @@ def read(self, path: str, *, length: Optional[int] = None, offset: Optional[int] } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/dbfs/read", query=query, headers=headers) @@ -809,7 +808,7 @@ def create_directory(self, directory_path: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -828,7 +827,7 @@ def delete(self, file_path: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/fs/files{_escape_multi_segment_path_parameter(file_path)}", headers=headers) @@ -848,7 +847,7 @@ def delete_directory(self, directory_path: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -870,7 +869,7 @@ def download(self, file_path: str) -> DownloadResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id response_headers = [ @@ -905,7 +904,7 @@ def get_directory_metadata(self, directory_path: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -924,7 +923,7 @@ def get_metadata(self, file_path: str) -> GetMetadataResponse: headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id response_headers = [ @@ -979,7 +978,7 @@ def list_directory_contents( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1020,7 +1019,7 @@ def upload(self, file_path: str, contents: BinaryIO, *, overwrite: Optional[bool } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( diff --git a/databricks/sdk/service/iam.py b/databricks/sdk/service/iam.py index fc854613b..f87e68280 100755 --- a/databricks/sdk/service/iam.py +++ b/databricks/sdk/service/iam.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _repeated_enum) @@ -2205,7 +2204,7 @@ def check_policy( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/access-control/check-policy-v2", query=query, headers=headers) @@ -2359,7 +2358,7 @@ def get_assignable_roles_for_resource(self, resource: str) -> GetAssignableRoles } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2406,7 +2405,7 @@ def get_rule_set(self, name: str, etag: str) -> RuleSetResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/preview/accounts/access-control/rule-sets", query=query, headers=headers) @@ -2434,7 +2433,7 @@ def update_rule_set(self, name: str, rule_set: RuleSetUpdateRequest) -> RuleSetR } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", "/api/2.0/preview/accounts/access-control/rule-sets", body=body, headers=headers) @@ -3242,7 +3241,7 @@ def me(self) -> User: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/preview/scim/v2/Me", headers=headers) @@ -3322,7 +3321,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/scim/v2/Groups", body=body, headers=headers) @@ -3340,7 +3339,7 @@ def delete(self, id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/scim/v2/Groups/{id}", headers=headers) @@ -3359,7 +3358,7 @@ def get(self, id: str) -> Group: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/scim/v2/Groups/{id}", headers=headers) @@ -3421,7 +3420,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id query["startIndex"] = 1 @@ -3459,7 +3458,7 @@ def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: O } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/preview/scim/v2/Groups/{id}", body=body, headers=headers) @@ -3524,7 +3523,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/preview/scim/v2/Groups/{id}", body=body, headers=headers) @@ -3573,7 +3572,7 @@ def migrate_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/permissionmigration", body=body, headers=headers) @@ -3627,7 +3626,7 @@ def get(self, request_object_type: str, request_object_id: str) -> ObjectPermiss } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/{request_object_type}/{request_object_id}", headers=headers) @@ -3651,7 +3650,7 @@ def get_permission_levels(self, request_object_type: str, request_object_id: str } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3691,7 +3690,7 @@ def set( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3730,7 +3729,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3812,7 +3811,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/scim/v2/ServicePrincipals", body=body, headers=headers) @@ -3830,7 +3829,7 @@ def delete(self, id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", headers=headers) @@ -3849,7 +3848,7 @@ def get(self, id: str) -> ServicePrincipal: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", headers=headers) @@ -3911,7 +3910,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id query["startIndex"] = 1 @@ -3949,7 +3948,7 @@ def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: O } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", body=body, headers=headers) @@ -4017,7 +4016,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", body=body, headers=headers) @@ -4114,7 +4113,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/scim/v2/Users", body=body, headers=headers) @@ -4133,7 +4132,7 @@ def delete(self, id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/scim/v2/Users/{id}", headers=headers) @@ -4198,7 +4197,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/scim/v2/Users/{id}", query=query, headers=headers) @@ -4216,7 +4215,7 @@ def get_permission_levels(self) -> GetPasswordPermissionLevelsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/permissions/authorization/passwords/permissionLevels", headers=headers) @@ -4234,7 +4233,7 @@ def get_permissions(self) -> PasswordPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/permissions/authorization/passwords", headers=headers) @@ -4297,7 +4296,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id query["startIndex"] = 1 @@ -4335,7 +4334,7 @@ def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: O } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/preview/scim/v2/Users/{id}", body=body, headers=headers) @@ -4360,7 +4359,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", "/api/2.0/permissions/authorization/passwords", body=body, headers=headers) @@ -4440,7 +4439,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/preview/scim/v2/Users/{id}", body=body, headers=headers) @@ -4464,7 +4463,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/permissions/authorization/passwords", body=body, headers=headers) diff --git a/databricks/sdk/service/iamv2.py b/databricks/sdk/service/iamv2.py index 9afd1ef2a..b5e484e3f 100755 --- a/databricks/sdk/service/iamv2.py +++ b/databricks/sdk/service/iamv2.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _enum, _from_dict, _repeated_enum _LOG = logging.getLogger("databricks.sdk") @@ -577,7 +576,7 @@ def get_workspace_access_detail_local( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -605,7 +604,7 @@ def resolve_group_proxy(self, external_id: str) -> ResolveGroupResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/identity/groups/resolveByExternalId", body=body, headers=headers) @@ -631,7 +630,7 @@ def resolve_service_principal_proxy(self, external_id: str) -> ResolveServicePri } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -659,7 +658,7 @@ def resolve_user_proxy(self, external_id: str) -> ResolveUserResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/identity/users/resolveByExternalId", body=body, headers=headers) diff --git a/databricks/sdk/service/jobs.py b/databricks/sdk/service/jobs.py index 3d26e991d..005591fd2 100755 --- a/databricks/sdk/service/jobs.py +++ b/databricks/sdk/service/jobs.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service import compute from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict) @@ -8735,7 +8734,7 @@ def cancel_all_runs(self, *, all_queued_runs: Optional[bool] = None, job_id: Opt } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.2/jobs/runs/cancel-all", body=body, headers=headers) @@ -8760,7 +8759,7 @@ def cancel_run(self, run_id: int) -> Wait[Run]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.2/jobs/runs/cancel", body=body, headers=headers) @@ -8962,7 +8961,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.2/jobs/create", body=body, headers=headers) @@ -8985,7 +8984,7 @@ def delete(self, job_id: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.2/jobs/delete", body=body, headers=headers) @@ -9007,7 +9006,7 @@ def delete_run(self, run_id: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.2/jobs/runs/delete", body=body, headers=headers) @@ -9033,7 +9032,7 @@ def export_run(self, run_id: int, *, views_to_export: Optional[ViewsToExport] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.2/jobs/runs/export", query=query, headers=headers) @@ -9068,7 +9067,7 @@ def get(self, job_id: int, *, page_token: Optional[str] = None) -> Job: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.2/jobs/get", query=query, headers=headers) @@ -9088,7 +9087,7 @@ def get_permission_levels(self, job_id: str) -> GetJobPermissionLevelsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/jobs/{job_id}/permissionLevels", headers=headers) @@ -9108,7 +9107,7 @@ def get_permissions(self, job_id: str) -> JobPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/jobs/{job_id}", headers=headers) @@ -9158,7 +9157,7 @@ def get_run( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.2/jobs/runs/get", query=query, headers=headers) @@ -9188,7 +9187,7 @@ def get_run_output(self, run_id: int) -> RunOutput: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.2/jobs/runs/get-output", query=query, headers=headers) @@ -9239,7 +9238,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9326,7 +9325,7 @@ def list_runs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9499,7 +9498,7 @@ def repair_run( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.2/jobs/runs/repair", body=body, headers=headers) @@ -9572,7 +9571,7 @@ def reset(self, job_id: int, new_settings: JobSettings): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.2/jobs/reset", body=body, headers=headers) @@ -9742,7 +9741,7 @@ def run_now( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.2/jobs/run-now", body=body, headers=headers) @@ -9810,7 +9809,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/jobs/{job_id}", body=body, headers=headers) @@ -9938,7 +9937,7 @@ def submit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.2/jobs/runs/submit", body=body, headers=headers) @@ -10024,7 +10023,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.2/jobs/update", body=body, headers=headers) @@ -10050,7 +10049,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/jobs/{job_id}", body=body, headers=headers) @@ -10098,7 +10097,7 @@ def enforce_compliance( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/policies/jobs/enforce-compliance", body=body, headers=headers) @@ -10123,7 +10122,7 @@ def get_compliance(self, job_id: int) -> GetPolicyComplianceResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/policies/jobs/get-compliance", query=query, headers=headers) @@ -10160,7 +10159,7 @@ def list_compliance( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: diff --git a/databricks/sdk/service/knowledgeassistants.py b/databricks/sdk/service/knowledgeassistants.py index 29f17928b..af30af57e 100755 --- a/databricks/sdk/service/knowledgeassistants.py +++ b/databricks/sdk/service/knowledgeassistants.py @@ -9,7 +9,6 @@ from google.protobuf.timestamp_pb2 import Timestamp -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _timestamp) @@ -459,7 +458,7 @@ def create_knowledge_assistant(self, knowledge_assistant: KnowledgeAssistant) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/knowledge-assistants", body=body, headers=headers) @@ -483,7 +482,7 @@ def create_knowledge_source(self, parent: str, knowledge_source: KnowledgeSource } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.1/{parent}/knowledge-sources", body=body, headers=headers) @@ -504,7 +503,7 @@ def delete_knowledge_assistant(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/{name}", headers=headers) @@ -524,7 +523,7 @@ def delete_knowledge_source(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/{name}", headers=headers) @@ -543,7 +542,7 @@ def get_knowledge_assistant(self, name: str) -> KnowledgeAssistant: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/{name}", headers=headers) @@ -564,7 +563,7 @@ def get_knowledge_source(self, name: str) -> KnowledgeSource: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/{name}", headers=headers) @@ -595,7 +594,7 @@ def list_knowledge_assistants( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -630,7 +629,7 @@ def list_knowledge_sources( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -657,7 +656,7 @@ def sync_knowledge_sources(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.1/{name}/knowledge-sources:sync", headers=headers) @@ -690,7 +689,7 @@ def update_knowledge_assistant( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/{name}", query=query, body=body, headers=headers) @@ -725,7 +724,7 @@ def update_knowledge_source( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/{name}", query=query, body=body, headers=headers) diff --git a/databricks/sdk/service/marketplace.py b/databricks/sdk/service/marketplace.py index e5f194a59..467e38f6d 100755 --- a/databricks/sdk/service/marketplace.py +++ b/databricks/sdk/service/marketplace.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _repeated_enum) @@ -2961,7 +2960,7 @@ def get( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3000,7 +2999,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3061,7 +3060,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3083,7 +3082,7 @@ def delete(self, listing_id: str, installation_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -3113,7 +3112,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3147,7 +3146,7 @@ def list_listing_installations( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3196,7 +3195,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3231,7 +3230,7 @@ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetListingsRespo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/marketplace-consumer/listings:batchGet", query=query, headers=headers) @@ -3250,7 +3249,7 @@ def get(self, id: str) -> GetListingResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/marketplace-consumer/listings/{id}", headers=headers) @@ -3315,7 +3314,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3380,7 +3379,7 @@ def search( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3450,7 +3449,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3475,7 +3474,7 @@ def get(self, listing_id: str) -> GetPersonalizationRequestResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3504,7 +3503,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3541,7 +3540,7 @@ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetProvidersResp } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.1/marketplace-consumer/providers:batchGet", query=query, headers=headers) @@ -3560,7 +3559,7 @@ def get(self, id: str) -> GetProviderResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/marketplace-consumer/providers/{id}", headers=headers) @@ -3590,7 +3589,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3626,7 +3625,7 @@ def create(self, filter: ExchangeFilter) -> CreateExchangeFilterResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-exchange/filters", body=body, headers=headers) @@ -3645,7 +3644,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-exchange/filters/{id}", headers=headers) @@ -3674,7 +3673,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3704,7 +3703,7 @@ def update(self, id: str, filter: ExchangeFilter) -> UpdateExchangeFilterRespons } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/marketplace-exchange/filters/{id}", body=body, headers=headers) @@ -3737,7 +3736,7 @@ def add_listing_to_exchange(self, listing_id: str, exchange_id: str) -> AddExcha } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-exchange/exchanges-for-listing", body=body, headers=headers) @@ -3760,7 +3759,7 @@ def create(self, exchange: Exchange) -> CreateExchangeResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-exchange/exchanges", body=body, headers=headers) @@ -3779,7 +3778,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-exchange/exchanges/{id}", headers=headers) @@ -3797,7 +3796,7 @@ def delete_listing_from_exchange(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-exchange/exchanges-for-listing/{id}", headers=headers) @@ -3815,7 +3814,7 @@ def get(self, id: str) -> GetExchangeResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/marketplace-exchange/exchanges/{id}", headers=headers) @@ -3840,7 +3839,7 @@ def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = N } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3876,7 +3875,7 @@ def list_exchanges_for_listing( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3914,7 +3913,7 @@ def list_listings_for_exchange( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3946,7 +3945,7 @@ def update(self, id: str, exchange: Exchange) -> UpdateExchangeResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/marketplace-exchange/exchanges/{id}", body=body, headers=headers) @@ -3992,7 +3991,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-provider/files", body=body, headers=headers) @@ -4011,7 +4010,7 @@ def delete(self, file_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-provider/files/{file_id}", headers=headers) @@ -4029,7 +4028,7 @@ def get(self, file_id: str) -> GetFileResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/marketplace-provider/files/{file_id}", headers=headers) @@ -4059,7 +4058,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4096,7 +4095,7 @@ def create(self, listing: Listing) -> CreateListingResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-provider/listing", body=body, headers=headers) @@ -4115,7 +4114,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-provider/listings/{id}", headers=headers) @@ -4133,7 +4132,7 @@ def get(self, id: str) -> GetListingResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/marketplace-provider/listings/{id}", headers=headers) @@ -4158,7 +4157,7 @@ def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = N } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4188,7 +4187,7 @@ def update(self, id: str, listing: Listing) -> UpdateListingResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/marketplace-provider/listings/{id}", body=body, headers=headers) @@ -4224,7 +4223,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4271,7 +4270,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4302,7 +4301,7 @@ def create(self) -> ProviderAnalyticsDashboard: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-provider/analytics_dashboard", headers=headers) @@ -4320,7 +4319,7 @@ def get(self) -> ListProviderAnalyticsDashboardResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/marketplace-provider/analytics_dashboard", headers=headers) @@ -4338,7 +4337,7 @@ def get_latest_version(self) -> GetLatestVersionProviderAnalyticsDashboardRespon } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/marketplace-provider/analytics_dashboard/latest", headers=headers) @@ -4365,7 +4364,7 @@ def update(self, id: str, *, version: Optional[int] = None) -> UpdateProviderAna } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/marketplace-provider/analytics_dashboard/{id}", body=body, headers=headers) @@ -4395,7 +4394,7 @@ def create(self, provider: ProviderInfo) -> CreateProviderResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/marketplace-provider/provider", body=body, headers=headers) @@ -4414,7 +4413,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/marketplace-provider/providers/{id}", headers=headers) @@ -4432,7 +4431,7 @@ def get(self, id: str) -> GetProviderResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/marketplace-provider/providers/{id}", headers=headers) @@ -4457,7 +4456,7 @@ def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = N } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4487,7 +4486,7 @@ def update(self, id: str, provider: ProviderInfo) -> UpdateProviderResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/marketplace-provider/providers/{id}", body=body, headers=headers) diff --git a/databricks/sdk/service/ml.py b/databricks/sdk/service/ml.py index 51f9907bc..09132d06c 100755 --- a/databricks/sdk/service/ml.py +++ b/databricks/sdk/service/ml.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -6742,7 +6741,7 @@ def create_experiment( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/experiments/create", body=body, headers=headers) @@ -6795,7 +6794,7 @@ def create_logged_model( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/logged-models", body=body, headers=headers) @@ -6846,7 +6845,7 @@ def create_run( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/runs/create", body=body, headers=headers) @@ -6871,7 +6870,7 @@ def delete_experiment(self, experiment_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/experiments/delete", body=body, headers=headers) @@ -6890,7 +6889,7 @@ def delete_logged_model(self, model_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/mlflow/logged-models/{model_id}", headers=headers) @@ -6911,7 +6910,7 @@ def delete_logged_model_tag(self, model_id: str, tag_key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/mlflow/logged-models/{model_id}/tags/{tag_key}", headers=headers) @@ -6934,7 +6933,7 @@ def delete_run(self, run_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/delete", body=body, headers=headers) @@ -6971,7 +6970,7 @@ def delete_runs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/databricks/runs/delete-runs", body=body, headers=headers) @@ -7000,7 +6999,7 @@ def delete_tag(self, run_id: str, key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/delete-tag", body=body, headers=headers) @@ -7026,7 +7025,7 @@ def finalize_logged_model(self, model_id: str, status: LoggedModelStatus) -> Fin } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/mlflow/logged-models/{model_id}", body=body, headers=headers) @@ -7055,7 +7054,7 @@ def get_by_name(self, experiment_name: str) -> GetExperimentByNameResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/experiments/get-by-name", query=query, headers=headers) @@ -7078,7 +7077,7 @@ def get_experiment(self, experiment_id: str) -> GetExperimentResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/experiments/get", query=query, headers=headers) @@ -7127,7 +7126,7 @@ def get_history( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7153,7 +7152,7 @@ def get_logged_model(self, model_id: str) -> GetLoggedModelResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/mlflow/logged-models/{model_id}", headers=headers) @@ -7173,7 +7172,7 @@ def get_permission_levels(self, experiment_id: str) -> GetExperimentPermissionLe } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/experiments/{experiment_id}/permissionLevels", headers=headers) @@ -7193,7 +7192,7 @@ def get_permissions(self, experiment_id: str) -> ExperimentPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/experiments/{experiment_id}", headers=headers) @@ -7224,7 +7223,7 @@ def get_run(self, run_id: str, *, run_uuid: Optional[str] = None) -> GetRunRespo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/runs/get", query=query, headers=headers) @@ -7275,7 +7274,7 @@ def list_artifacts( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7320,7 +7319,7 @@ def list_experiments( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7411,7 +7410,7 @@ def log_batch( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/log-batch", body=body, headers=headers) @@ -7444,7 +7443,7 @@ def log_inputs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/log-inputs", body=body, headers=headers) @@ -7471,7 +7470,7 @@ def log_logged_model_params(self, model_id: str, *, params: Optional[List[Logged } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/mlflow/logged-models/{model_id}/params", body=body, headers=headers) @@ -7543,7 +7542,7 @@ def log_metric( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/log-metric", body=body, headers=headers) @@ -7573,7 +7572,7 @@ def log_model(self, *, model_json: Optional[str] = None, run_id: Optional[str] = } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/log-model", body=body, headers=headers) @@ -7600,7 +7599,7 @@ def log_outputs(self, run_id: str, *, models: Optional[List[ModelOutput]] = None } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/outputs", body=body, headers=headers) @@ -7638,7 +7637,7 @@ def log_param(self, key: str, value: str, *, run_id: Optional[str] = None, run_u } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/log-parameter", body=body, headers=headers) @@ -7665,7 +7664,7 @@ def restore_experiment(self, experiment_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/experiments/restore", body=body, headers=headers) @@ -7690,7 +7689,7 @@ def restore_run(self, run_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/restore", body=body, headers=headers) @@ -7727,7 +7726,7 @@ def restore_runs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/databricks/runs/restore-runs", body=body, headers=headers) @@ -7777,7 +7776,7 @@ def search_experiments( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7843,7 +7842,7 @@ def search_logged_models( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/logged-models/search", body=body, headers=headers) @@ -7911,7 +7910,7 @@ def search_runs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7949,7 +7948,7 @@ def set_experiment_tag(self, experiment_id: str, key: str, value: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/experiments/set-experiment-tag", body=body, headers=headers) @@ -7974,7 +7973,7 @@ def set_logged_model_tags(self, model_id: str, *, tags: Optional[List[LoggedMode } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/mlflow/logged-models/{model_id}/tags", body=body, headers=headers) @@ -8001,7 +8000,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/experiments/{experiment_id}", body=body, headers=headers) @@ -8038,7 +8037,7 @@ def set_tag(self, key: str, value: str, *, run_id: Optional[str] = None, run_uui } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/runs/set-tag", body=body, headers=headers) @@ -8065,7 +8064,7 @@ def update_experiment(self, experiment_id: str, *, new_name: Optional[str] = Non } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/experiments/update", body=body, headers=headers) @@ -8091,7 +8090,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/experiments/{experiment_id}", body=body, headers=headers) @@ -8140,7 +8139,7 @@ def update_run( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/runs/update", body=body, headers=headers) @@ -8173,7 +8172,7 @@ def batch_create_materialized_features( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8197,7 +8196,7 @@ def create_feature(self, feature: Feature) -> Feature: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/feature-engineering/features", body=body, headers=headers) @@ -8219,7 +8218,7 @@ def create_kafka_config(self, kafka_config: KafkaConfig) -> KafkaConfig: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/feature-engineering/features/kafka-configs", body=body, headers=headers) @@ -8241,7 +8240,7 @@ def create_materialized_feature(self, materialized_feature: MaterializedFeature) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/feature-engineering/materialized-features", body=body, headers=headers) @@ -8261,7 +8260,7 @@ def delete_feature(self, full_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/feature-engineering/features/{full_name}", headers=headers) @@ -8281,7 +8280,7 @@ def delete_kafka_config(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/feature-engineering/features/kafka-configs/{name}", headers=headers) @@ -8300,7 +8299,7 @@ def delete_materialized_feature(self, materialized_feature_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -8321,7 +8320,7 @@ def get_feature(self, full_name: str) -> Feature: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/feature-engineering/features/{full_name}", headers=headers) @@ -8342,7 +8341,7 @@ def get_kafka_config(self, name: str) -> KafkaConfig: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/feature-engineering/features/kafka-configs/{name}", headers=headers) @@ -8362,7 +8361,7 @@ def get_materialized_feature(self, materialized_feature_id: str) -> Materialized } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8391,7 +8390,7 @@ def list_features(self, *, page_size: Optional[int] = None, page_token: Optional } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8427,7 +8426,7 @@ def list_kafka_configs( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8470,7 +8469,7 @@ def list_materialized_features( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8507,7 +8506,7 @@ def update_feature(self, full_name: str, feature: Feature, update_mask: str) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8541,7 +8540,7 @@ def update_kafka_config(self, name: str, kafka_config: KafkaConfig, update_mask: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8579,7 +8578,7 @@ def update_materialized_feature( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8619,7 +8618,7 @@ def create_online_store(self, online_store: OnlineStore) -> OnlineStore: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/feature-store/online-stores", body=body, headers=headers) @@ -8639,7 +8638,7 @@ def delete_online_store(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/feature-store/online-stores/{name}", headers=headers) @@ -8658,7 +8657,7 @@ def delete_online_table(self, online_table_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/feature-store/online-tables/{online_table_name}", headers=headers) @@ -8677,7 +8676,7 @@ def get_online_store(self, name: str) -> OnlineStore: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/feature-store/online-stores/{name}", headers=headers) @@ -8706,7 +8705,7 @@ def list_online_stores( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8738,7 +8737,7 @@ def publish_table(self, source_table_name: str, publish_spec: PublishSpec) -> Pu } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8769,7 +8768,7 @@ def update_online_store(self, name: str, online_store: OnlineStore, update_mask: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8937,7 +8936,7 @@ def create_experiment( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/automl/create-forecasting-experiment", body=body, headers=headers) @@ -9003,7 +9002,7 @@ def get_experiment(self, experiment_id: str) -> ForecastingExperiment: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/automl/get-forecasting-experiment/{experiment_id}", headers=headers) @@ -9034,7 +9033,7 @@ def create_feature_tag(self, table_name: str, feature_name: str, feature_tag: Fe } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9063,7 +9062,7 @@ def delete_feature_tag(self, table_name: str, feature_name: str, key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -9088,7 +9087,7 @@ def get_feature_lineage(self, table_name: str, feature_name: str) -> FeatureLine } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9113,7 +9112,7 @@ def get_feature_tag(self, table_name: str, feature_name: str, key: str) -> Featu } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9148,7 +9147,7 @@ def list_feature_tags( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9196,7 +9195,7 @@ def update_feature_tag( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9265,7 +9264,7 @@ def approve_transition_request( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/approve", body=body, headers=headers) @@ -9298,7 +9297,7 @@ def create_comment(self, name: str, version: str, comment: str) -> CreateComment } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/comments/create", body=body, headers=headers) @@ -9333,7 +9332,7 @@ def create_model( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/registered-models/create", body=body, headers=headers) @@ -9388,7 +9387,7 @@ def create_model_version( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/model-versions/create", body=body, headers=headers) @@ -9434,7 +9433,7 @@ def create_transition_request( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/create", body=body, headers=headers) @@ -9521,7 +9520,7 @@ def create_webhook( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/registry-webhooks/create", body=body, headers=headers) @@ -9544,7 +9543,7 @@ def delete_comment(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/comments/delete", query=query, headers=headers) @@ -9566,7 +9565,7 @@ def delete_model(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/registered-models/delete", query=query, headers=headers) @@ -9593,7 +9592,7 @@ def delete_model_tag(self, name: str, key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/registered-models/delete-tag", query=query, headers=headers) @@ -9619,7 +9618,7 @@ def delete_model_version(self, name: str, version: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/model-versions/delete", query=query, headers=headers) @@ -9650,7 +9649,7 @@ def delete_model_version_tag(self, name: str, version: str, key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/model-versions/delete-tag", query=query, headers=headers) @@ -9699,7 +9698,7 @@ def delete_transition_request( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", "/api/2.0/mlflow/transition-requests/delete", query=query, headers=headers) @@ -9722,7 +9721,7 @@ def delete_webhook(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", "/api/2.0/mlflow/registry-webhooks/delete", query=query, headers=headers) @@ -9749,7 +9748,7 @@ def get_latest_versions(self, name: str, *, stages: Optional[List[str]] = None) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("POST", "/api/2.0/mlflow/registered-models/get-latest-versions", body=body, headers=headers) @@ -9777,7 +9776,7 @@ def get_model(self, name: str) -> GetModelResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/databricks/registered-models/get", query=query, headers=headers) @@ -9804,7 +9803,7 @@ def get_model_version(self, name: str, version: str) -> GetModelVersionResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/model-versions/get", query=query, headers=headers) @@ -9831,7 +9830,7 @@ def get_model_version_download_uri(self, name: str, version: str) -> GetModelVer } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/mlflow/model-versions/get-download-uri", query=query, headers=headers) @@ -9851,7 +9850,7 @@ def get_permission_levels(self, registered_model_id: str) -> GetRegisteredModelP } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9874,7 +9873,7 @@ def get_permissions(self, registered_model_id: str) -> RegisteredModelPermission } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/registered-models/{registered_model_id}", headers=headers) @@ -9901,7 +9900,7 @@ def list_models(self, *, max_results: Optional[int] = None, page_token: Optional } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -9934,7 +9933,7 @@ def list_transition_requests(self, name: str, version: str) -> Iterator[Activity } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/mlflow/transition-requests/list", query=query, headers=headers) @@ -10007,7 +10006,7 @@ def list_webhooks( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -10059,7 +10058,7 @@ def reject_transition_request( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/reject", body=body, headers=headers) @@ -10087,7 +10086,7 @@ def rename_model(self, name: str, *, new_name: Optional[str] = None) -> RenameMo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/registered-models/rename", body=body, headers=headers) @@ -10132,7 +10131,7 @@ def search_model_versions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -10184,7 +10183,7 @@ def search_models( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -10225,7 +10224,7 @@ def set_model_tag(self, name: str, key: str, value: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/registered-models/set-tag", body=body, headers=headers) @@ -10263,7 +10262,7 @@ def set_model_version_tag(self, name: str, version: str, key: str, value: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/mlflow/model-versions/set-tag", body=body, headers=headers) @@ -10293,7 +10292,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -10326,7 +10325,7 @@ def test_registry_webhook( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/mlflow/registry-webhooks/test", body=body, headers=headers) @@ -10379,7 +10378,7 @@ def transition_stage( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -10409,7 +10408,7 @@ def update_comment(self, id: str, comment: str) -> UpdateCommentResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/mlflow/comments/update", body=body, headers=headers) @@ -10437,7 +10436,7 @@ def update_model(self, name: str, *, description: Optional[str] = None) -> Updat } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/mlflow/registered-models/update", body=body, headers=headers) @@ -10471,7 +10470,7 @@ def update_model_version( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/mlflow/model-versions/update", body=body, headers=headers) @@ -10502,7 +10501,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -10581,7 +10580,7 @@ def update_webhook( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/mlflow/registry-webhooks/update", body=body, headers=headers) diff --git a/databricks/sdk/service/oauth2.py b/databricks/sdk/service/oauth2.py index 1647b2801..b47b17eaf 100755 --- a/databricks/sdk/service/oauth2.py +++ b/databricks/sdk/service/oauth2.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _from_dict, _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -1838,7 +1837,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1863,7 +1862,7 @@ def delete(self, service_principal_id: str, secret_id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -1902,7 +1901,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: diff --git a/databricks/sdk/service/pipelines.py b/databricks/sdk/service/pipelines.py index c7bf7879e..d5d04d98a 100755 --- a/databricks/sdk/service/pipelines.py +++ b/databricks/sdk/service/pipelines.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service import compute from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -4024,7 +4023,7 @@ def clone( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/pipelines/{pipeline_id}/clone", body=body, headers=headers) @@ -4209,7 +4208,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/pipelines", body=body, headers=headers) @@ -4235,7 +4234,7 @@ def delete(self, pipeline_id: str, *, force: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/pipelines/{pipeline_id}", query=query, headers=headers) @@ -4253,7 +4252,7 @@ def get(self, pipeline_id: str) -> GetPipelineResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}", headers=headers) @@ -4273,7 +4272,7 @@ def get_permission_levels(self, pipeline_id: str) -> GetPipelinePermissionLevels } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/pipelines/{pipeline_id}/permissionLevels", headers=headers) @@ -4293,7 +4292,7 @@ def get_permissions(self, pipeline_id: str) -> PipelinePermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/pipelines/{pipeline_id}", headers=headers) @@ -4315,7 +4314,7 @@ def get_update(self, pipeline_id: str, update_id: str) -> GetUpdateResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}/updates/{update_id}", headers=headers) @@ -4370,7 +4369,7 @@ def list_pipeline_events( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4428,7 +4427,7 @@ def list_pipelines( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -4474,7 +4473,7 @@ def list_updates( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}/updates", query=query, headers=headers) @@ -4502,7 +4501,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/pipelines/{pipeline_id}", body=body, headers=headers) @@ -4580,7 +4579,7 @@ def start_update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/pipelines/{pipeline_id}/updates", body=body, headers=headers) @@ -4602,7 +4601,7 @@ def stop(self, pipeline_id: str) -> Wait[GetPipelineResponse]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/pipelines/{pipeline_id}/stop", headers=headers) @@ -4794,7 +4793,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/pipelines/{pipeline_id}", body=body, headers=headers) @@ -4820,7 +4819,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/pipelines/{pipeline_id}", body=body, headers=headers) diff --git a/databricks/sdk/service/postgres.py b/databricks/sdk/service/postgres.py index 7f5f358ab..341c66f2e 100755 --- a/databricks/sdk/service/postgres.py +++ b/databricks/sdk/service/postgres.py @@ -10,7 +10,6 @@ from google.protobuf.duration_pb2 import Duration from google.protobuf.timestamp_pb2 import Timestamp -from databricks.sdk.client_types import HostType from databricks.sdk.common import lro from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.retries import RetryError, poll @@ -2124,7 +2123,7 @@ def create_branch(self, parent: str, branch: Branch, branch_id: str) -> CreateBr } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/postgres/{parent}/branches", query=query, body=body, headers=headers) @@ -2164,7 +2163,7 @@ def create_database( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/postgres/{parent}/databases", query=query, body=body, headers=headers) @@ -2197,7 +2196,7 @@ def create_endpoint(self, parent: str, endpoint: Endpoint, endpoint_id: str) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/postgres/{parent}/endpoints", query=query, body=body, headers=headers) @@ -2228,7 +2227,7 @@ def create_project(self, project: Project, project_id: str) -> CreateProjectOper } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/postgres/projects", query=query, body=body, headers=headers) @@ -2264,7 +2263,7 @@ def create_role(self, parent: str, role: Role, *, role_id: Optional[str] = None) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/postgres/{parent}/roles", query=query, body=body, headers=headers) @@ -2285,7 +2284,7 @@ def delete_branch(self, name: str) -> DeleteBranchOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/postgres/{name}", headers=headers) @@ -2307,7 +2306,7 @@ def delete_database(self, name: str) -> DeleteDatabaseOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/postgres/{name}", headers=headers) @@ -2329,7 +2328,7 @@ def delete_endpoint(self, name: str) -> DeleteEndpointOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/postgres/{name}", headers=headers) @@ -2350,7 +2349,7 @@ def delete_project(self, name: str) -> DeleteProjectOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/postgres/{name}", headers=headers) @@ -2383,7 +2382,7 @@ def delete_role(self, name: str, *, reassign_owned_to: Optional[str] = None) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/postgres/{name}", query=query, headers=headers) @@ -2415,7 +2414,7 @@ def generate_database_credential( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/postgres/credentials", body=body, headers=headers) @@ -2435,7 +2434,7 @@ def get_branch(self, name: str) -> Branch: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2456,7 +2455,7 @@ def get_database(self, name: str) -> Database: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2478,7 +2477,7 @@ def get_endpoint(self, name: str) -> Endpoint: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2498,7 +2497,7 @@ def get_operation(self, name: str) -> Operation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2518,7 +2517,7 @@ def get_project(self, name: str) -> Project: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2540,7 +2539,7 @@ def get_role(self, name: str) -> Role: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/postgres/{name}", headers=headers) @@ -2571,7 +2570,7 @@ def list_branches( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2609,7 +2608,7 @@ def list_databases( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2647,7 +2646,7 @@ def list_endpoints( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2680,7 +2679,7 @@ def list_projects(self, *, page_size: Optional[int] = None, page_token: Optional } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2717,7 +2716,7 @@ def list_roles( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2757,7 +2756,7 @@ def update_branch(self, name: str, branch: Branch, update_mask: FieldMask) -> Up } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/postgres/{name}", query=query, body=body, headers=headers) @@ -2791,7 +2790,7 @@ def update_database(self, name: str, database: Database, update_mask: FieldMask) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/postgres/{name}", query=query, body=body, headers=headers) @@ -2826,7 +2825,7 @@ def update_endpoint(self, name: str, endpoint: Endpoint, update_mask: FieldMask) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/postgres/{name}", query=query, body=body, headers=headers) @@ -2858,7 +2857,7 @@ def update_project(self, name: str, project: Project, update_mask: FieldMask) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/postgres/{name}", query=query, body=body, headers=headers) @@ -2893,7 +2892,7 @@ def update_role(self, name: str, role: Role, update_mask: FieldMask) -> UpdateRo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/postgres/{name}", query=query, body=body, headers=headers) diff --git a/databricks/sdk/service/qualitymonitorv2.py b/databricks/sdk/service/qualitymonitorv2.py index 717d1fd7f..c217b009e 100755 --- a/databricks/sdk/service/qualitymonitorv2.py +++ b/databricks/sdk/service/qualitymonitorv2.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -328,7 +327,7 @@ def create_quality_monitor(self, quality_monitor: QualityMonitor) -> QualityMoni } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/quality-monitors", body=body, headers=headers) @@ -351,7 +350,7 @@ def delete_quality_monitor(self, object_type: str, object_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/quality-monitors/{object_type}/{object_id}", headers=headers) @@ -373,7 +372,7 @@ def get_quality_monitor(self, object_type: str, object_id: str) -> QualityMonito } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/quality-monitors/{object_type}/{object_id}", headers=headers) @@ -401,7 +400,7 @@ def list_quality_monitor( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -435,7 +434,7 @@ def update_quality_monitor( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/quality-monitors/{object_type}/{object_id}", body=body, headers=headers) diff --git a/databricks/sdk/service/serving.py b/databricks/sdk/service/serving.py index 0e4ba6144..6104be8a2 100755 --- a/databricks/sdk/service/serving.py +++ b/databricks/sdk/service/serving.py @@ -13,7 +13,6 @@ import requests -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict) @@ -4105,7 +4104,7 @@ def build_logs(self, name: str, served_model_name: str) -> BuildLogsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4180,7 +4179,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/serving-endpoints", body=body, headers=headers) @@ -4266,7 +4265,7 @@ def create_provisioned_throughput_endpoint( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/serving-endpoints/pt", body=body, headers=headers) @@ -4307,7 +4306,7 @@ def delete(self, name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/serving-endpoints/{name}", headers=headers) @@ -4327,7 +4326,7 @@ def export_metrics(self, name: str) -> ExportMetricsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/serving-endpoints/{name}/metrics", headers=headers, raw=True) @@ -4347,7 +4346,7 @@ def get(self, name: str) -> ServingEndpointDetailed: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/serving-endpoints/{name}", headers=headers) @@ -4368,7 +4367,7 @@ def get_open_api(self, name: str) -> GetOpenApiResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/serving-endpoints/{name}/openapi", headers=headers, raw=True) @@ -4388,7 +4387,7 @@ def get_permission_levels(self, serving_endpoint_id: str) -> GetServingEndpointP } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4411,7 +4410,7 @@ def get_permissions(self, serving_endpoint_id: str) -> ServingEndpointPermission } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", headers=headers) @@ -4473,7 +4472,7 @@ def http_request( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/external-function", body=body, headers=headers, raw=True) @@ -4491,7 +4490,7 @@ def list(self) -> Iterator[ServingEndpoint]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/serving-endpoints", headers=headers) @@ -4514,7 +4513,7 @@ def logs(self, name: str, served_model_name: str) -> ServerLogsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4548,7 +4547,7 @@ def patch( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/serving-endpoints/{name}/tags", body=body, headers=headers) @@ -4574,7 +4573,7 @@ def put(self, name: str, *, rate_limits: Optional[List[RateLimit]] = None) -> Pu } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/rate-limits", body=body, headers=headers) @@ -4629,7 +4628,7 @@ def put_ai_gateway( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/ai-gateway", body=body, headers=headers) @@ -4746,7 +4745,7 @@ def query( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id response_headers = [ @@ -4786,7 +4785,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4842,7 +4841,7 @@ def update_config( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/config", body=body, headers=headers) @@ -4893,7 +4892,7 @@ def update_notifications( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/serving-endpoints/{name}/notifications", body=body, headers=headers) @@ -4924,7 +4923,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -4957,7 +4956,7 @@ def update_provisioned_throughput_endpoint_config( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("PUT", f"/api/2.0/serving-endpoints/pt/{name}/config", body=body, headers=headers) @@ -5124,7 +5123,7 @@ def auth(r: requests.PreparedRequest) -> requests.PreparedRequest: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id response_headers = [ diff --git a/databricks/sdk/service/settings.py b/databricks/sdk/service/settings.py index 02cb59cad..5d1bead4e 100755 --- a/databricks/sdk/service/settings.py +++ b/databricks/sdk/service/settings.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _repeated_enum) @@ -5539,7 +5538,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteAibiDashboardEmbeddingA } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5572,7 +5571,7 @@ def get(self, *, etag: Optional[str] = None) -> AibiDashboardEmbeddingAccessPoli } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5615,7 +5614,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5653,7 +5652,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteAibiDashboardEmbeddingA } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5685,7 +5684,7 @@ def get(self, *, etag: Optional[str] = None) -> AibiDashboardEmbeddingApprovedDo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5732,7 +5731,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5772,7 +5771,7 @@ def get(self, *, etag: Optional[str] = None) -> AutomaticClusterUpdateSetting: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5818,7 +5817,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5857,7 +5856,7 @@ def get(self, *, etag: Optional[str] = None) -> ComplianceSecurityProfileSetting } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5903,7 +5902,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -5948,7 +5947,7 @@ def exchange_token( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/credentials-manager/exchange-tokens/token", body=body, headers=headers) @@ -6066,7 +6065,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDashboardEmailSubscript } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6098,7 +6097,7 @@ def get(self, *, etag: Optional[str] = None) -> DashboardEmailSubscriptions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6141,7 +6140,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6189,7 +6188,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDefaultNamespaceSetting } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6218,7 +6217,7 @@ def get(self, *, etag: Optional[str] = None) -> DefaultNamespaceSetting: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6264,7 +6263,7 @@ def update(self, allow_missing: bool, setting: DefaultNamespaceSetting, field_ma } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6301,7 +6300,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDefaultWarehouseIdRespo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6330,7 +6329,7 @@ def get(self, *, etag: Optional[str] = None) -> DefaultWarehouseId: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6371,7 +6370,7 @@ def update(self, allow_missing: bool, setting: DefaultWarehouseId, field_mask: s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6411,7 +6410,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDisableLegacyAccessResp } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6440,7 +6439,7 @@ def get(self, *, etag: Optional[str] = None) -> DisableLegacyAccess: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6481,7 +6480,7 @@ def update(self, allow_missing: bool, setting: DisableLegacyAccess, field_mask: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6524,7 +6523,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDisableLegacyDbfsRespon } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6553,7 +6552,7 @@ def get(self, *, etag: Optional[str] = None) -> DisableLegacyDbfs: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6594,7 +6593,7 @@ def update(self, allow_missing: bool, setting: DisableLegacyDbfs, field_mask: st } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6729,7 +6728,7 @@ def get_enable_export_notebook(self) -> EnableExportNotebook: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/settings/types/enable-export-notebook/names/default", headers=headers) @@ -6771,7 +6770,7 @@ def patch_enable_export_notebook( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6903,7 +6902,7 @@ def get_enable_notebook_table_clipboard(self) -> EnableNotebookTableClipboard: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6947,7 +6946,7 @@ def patch_enable_notebook_table_clipboard( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -6974,7 +6973,7 @@ def get_enable_results_downloading(self) -> EnableResultsDownloading: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/settings/types/enable-results-downloading/names/default", headers=headers) @@ -7016,7 +7015,7 @@ def patch_enable_results_downloading( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -7057,7 +7056,7 @@ def get(self, *, etag: Optional[str] = None) -> EnhancedSecurityMonitoringSettin } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -7103,7 +7102,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -7252,7 +7251,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/ip-access-lists", body=body, headers=headers) @@ -7270,7 +7269,7 @@ def delete(self, ip_access_list_id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/ip-access-lists/{ip_access_list_id}", headers=headers) @@ -7289,7 +7288,7 @@ def get(self, ip_access_list_id: str) -> FetchIpAccessListResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/ip-access-lists/{ip_access_list_id}", headers=headers) @@ -7307,7 +7306,7 @@ def list(self) -> Iterator[IpAccessListInfo]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/ip-access-lists", headers=headers) @@ -7360,7 +7359,7 @@ def replace( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/ip-access-lists/{ip_access_list_id}", body=body, headers=headers) @@ -7415,7 +7414,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/ip-access-lists/{ip_access_list_id}", body=body, headers=headers) @@ -7603,7 +7602,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteLlmProxyPartnerPoweredW } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -7632,7 +7631,7 @@ def get(self, *, etag: Optional[str] = None) -> LlmProxyPartnerPoweredWorkspace: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -7675,7 +7674,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8118,7 +8117,7 @@ def create(self, *, config: Optional[Config] = None, display_name: Optional[str] } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/notification-destinations", body=body, headers=headers) @@ -8137,7 +8136,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/notification-destinations/{id}", headers=headers) @@ -8155,7 +8154,7 @@ def get(self, id: str) -> NotificationDestination: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/notification-destinations/{id}", headers=headers) @@ -8182,7 +8181,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8221,7 +8220,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/notification-destinations/{id}", body=body, headers=headers) @@ -8375,7 +8374,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteRestrictWorkspaceAdmins } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8404,7 +8403,7 @@ def get(self, *, etag: Optional[str] = None) -> RestrictWorkspaceAdminsSetting: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8450,7 +8449,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8591,7 +8590,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteSqlResultsDownloadRespo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8620,7 +8619,7 @@ def get(self, *, etag: Optional[str] = None) -> SqlResultsDownload: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8661,7 +8660,7 @@ def update(self, allow_missing: bool, setting: SqlResultsDownload, field_mask: s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8705,7 +8704,7 @@ def create_obo_token( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/token-management/on-behalf-of/tokens", body=body, headers=headers) @@ -8723,7 +8722,7 @@ def delete(self, token_id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/token-management/tokens/{token_id}", headers=headers) @@ -8742,7 +8741,7 @@ def get(self, token_id: str) -> GetTokenResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/token-management/tokens/{token_id}", headers=headers) @@ -8760,7 +8759,7 @@ def get_permission_levels(self) -> GetTokenPermissionLevelsResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/permissions/authorization/tokens/permissionLevels", headers=headers) @@ -8778,7 +8777,7 @@ def get_permissions(self) -> TokenPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/permissions/authorization/tokens", headers=headers) @@ -8807,7 +8806,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/token-management/tokens", query=query, headers=headers) @@ -8834,7 +8833,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", "/api/2.0/permissions/authorization/tokens", body=body, headers=headers) @@ -8859,7 +8858,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", "/api/2.0/permissions/authorization/tokens", body=body, headers=headers) @@ -8899,7 +8898,7 @@ def create(self, *, comment: Optional[str] = None, lifetime_seconds: Optional[in } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/token/create", body=body, headers=headers) @@ -8925,7 +8924,7 @@ def delete(self, token_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/token/delete", body=body, headers=headers) @@ -8942,7 +8941,7 @@ def list(self) -> Iterator[PublicTokenInfo]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/token/list", headers=headers) @@ -8972,7 +8971,7 @@ def get_status(self, keys: str) -> WorkspaceConf: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/workspace-conf", query=query, headers=headers) @@ -8986,7 +8985,7 @@ def set_status(self, contents: Dict[str, str]): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", "/api/2.0/workspace-conf", body=contents, headers=headers) diff --git a/databricks/sdk/service/settingsv2.py b/databricks/sdk/service/settingsv2.py index cb94f3605..83c811c71 100755 --- a/databricks/sdk/service/settingsv2.py +++ b/databricks/sdk/service/settingsv2.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -1069,7 +1068,7 @@ def get_public_workspace_setting(self, name: str) -> Setting: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/settings/{name}", headers=headers) @@ -1106,7 +1105,7 @@ def list_workspace_settings_metadata( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1140,7 +1139,7 @@ def patch_public_workspace_setting(self, name: str, setting: Setting) -> Setting } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/settings/{name}", body=body, headers=headers) diff --git a/databricks/sdk/service/sharing.py b/databricks/sdk/service/sharing.py index a0226af28..13681c118 100755 --- a/databricks/sdk/service/sharing.py +++ b/databricks/sdk/service/sharing.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service import catalog from databricks.sdk.service._internal import (_enum, _from_dict, _repeated_dict, _repeated_enum) @@ -2471,7 +2470,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/providers", body=body, headers=headers) @@ -2490,7 +2489,7 @@ def delete(self, name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/providers/{name}", headers=headers) @@ -2510,7 +2509,7 @@ def get(self, name: str) -> ProviderInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/providers/{name}", headers=headers) @@ -2557,7 +2556,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -2614,7 +2613,7 @@ def list_provider_share_assets( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2655,7 +2654,7 @@ def list_shares( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -2712,7 +2711,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/providers/{name}", body=body, headers=headers) @@ -2745,7 +2744,7 @@ def get_activation_url_info(self, activation_url: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -2766,7 +2765,7 @@ def retrieve_token(self, activation_url: str) -> RetrieveTokenResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2837,7 +2836,7 @@ def create(self, recipient_name: str, policy: FederationPolicy) -> FederationPol } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2862,7 +2861,7 @@ def delete(self, recipient_name: str, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -2886,7 +2885,7 @@ def get_federation_policy(self, recipient_name: str, name: str) -> FederationPol } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2918,7 +2917,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -3026,7 +3025,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/recipients", body=body, headers=headers) @@ -3044,7 +3043,7 @@ def delete(self, name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/recipients/{name}", headers=headers) @@ -3064,7 +3063,7 @@ def get(self, name: str) -> RecipientInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/recipients/{name}", headers=headers) @@ -3111,7 +3110,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -3148,7 +3147,7 @@ def rotate_token(self, name: str, existing_token_expire_in_seconds: int) -> Reci } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.1/unity-catalog/recipients/{name}/rotate-token", body=body, headers=headers) @@ -3186,7 +3185,7 @@ def share_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3253,7 +3252,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/recipients/{name}", body=body, headers=headers) @@ -3296,7 +3295,7 @@ def create(self, name: str, *, comment: Optional[str] = None, storage_root: Opti } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/unity-catalog/shares", body=body, headers=headers) @@ -3314,7 +3313,7 @@ def delete(self, name: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/unity-catalog/shares/{name}", headers=headers) @@ -3339,7 +3338,7 @@ def get(self, name: str, *, include_shared_data: Optional[bool] = None) -> Share } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/shares/{name}", query=query, headers=headers) @@ -3376,7 +3375,7 @@ def list_shares( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id if "max_results" not in query: @@ -3422,7 +3421,7 @@ def share_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/unity-catalog/shares/{name}/permissions", query=query, headers=headers) @@ -3487,7 +3486,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/shares/{name}", body=body, headers=headers) @@ -3527,7 +3526,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/unity-catalog/shares/{name}/permissions", body=body, headers=headers) diff --git a/databricks/sdk/service/sql.py b/databricks/sdk/service/sql.py index 93442b291..2755b8c29 100755 --- a/databricks/sdk/service/sql.py +++ b/databricks/sdk/service/sql.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict, _repeated_enum) @@ -7568,7 +7567,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/sql/alerts", body=body, headers=headers) @@ -7589,7 +7588,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/sql/alerts/{id}", headers=headers) @@ -7607,7 +7606,7 @@ def get(self, id: str) -> Alert: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/sql/alerts/{id}", headers=headers) @@ -7635,7 +7634,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7689,7 +7688,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/sql/alerts/{id}", body=body, headers=headers) @@ -7757,7 +7756,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/sql/alerts", body=body, headers=headers) @@ -7781,7 +7780,7 @@ def delete(self, alert_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/sql/alerts/{alert_id}", headers=headers) @@ -7803,7 +7802,7 @@ def get(self, alert_id: str) -> LegacyAlert: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/sql/alerts/{alert_id}", headers=headers) @@ -7825,7 +7824,7 @@ def list(self) -> Iterator[LegacyAlert]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/preview/sql/alerts", headers=headers) @@ -7867,7 +7866,7 @@ def update(self, alert_id: str, name: str, options: AlertOptions, query_id: str, } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", f"/api/2.0/preview/sql/alerts/{alert_id}", body=body, headers=headers) @@ -7894,7 +7893,7 @@ def create_alert(self, alert: AlertV2) -> AlertV2: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/alerts", body=body, headers=headers) @@ -7913,7 +7912,7 @@ def get_alert(self, id: str) -> AlertV2: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/alerts/{id}", headers=headers) @@ -7938,7 +7937,7 @@ def list_alerts(self, *, page_size: Optional[int] = None, page_token: Optional[s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -7970,7 +7969,7 @@ def trash_alert(self, id: str, *, purge: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/alerts/{id}", query=query, headers=headers) @@ -8005,7 +8004,7 @@ def update_alert(self, id: str, alert: AlertV2, update_mask: str) -> AlertV2: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/alerts/{id}", query=query, body=body, headers=headers) @@ -8061,7 +8060,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/sql/widgets", body=body, headers=headers) @@ -8081,7 +8080,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/sql/widgets/{id}", headers=headers) @@ -8131,7 +8130,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/preview/sql/widgets/{id}", body=body, headers=headers) @@ -8170,7 +8169,7 @@ def delete(self, dashboard_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", headers=headers) @@ -8192,7 +8191,7 @@ def get(self, dashboard_id: str) -> Dashboard: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", headers=headers) @@ -8241,7 +8240,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id query["page"] = 1 @@ -8271,7 +8270,7 @@ def restore(self, dashboard_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/preview/sql/dashboards/trash/{dashboard_id}", headers=headers) @@ -8317,7 +8316,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", body=body, headers=headers) @@ -8358,7 +8357,7 @@ def list(self) -> Iterator[DataSource]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/preview/sql/data_sources", headers=headers) @@ -8405,7 +8404,7 @@ def get(self, object_type: ObjectTypePlural, object_id: str) -> GetResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/sql/permissions/{object_type.value}/{object_id}", headers=headers) @@ -8443,7 +8442,7 @@ def set( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8480,7 +8479,7 @@ def transfer_ownership( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -8524,7 +8523,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/sql/queries", body=body, headers=headers) @@ -8545,7 +8544,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/sql/queries/{id}", headers=headers) @@ -8563,7 +8562,7 @@ def get(self, id: str) -> Query: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/sql/queries/{id}", headers=headers) @@ -8591,7 +8590,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8625,7 +8624,7 @@ def list_visualizations( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -8679,7 +8678,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/sql/queries/{id}", body=body, headers=headers) @@ -8771,7 +8770,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/sql/queries", body=body, headers=headers) @@ -8795,7 +8794,7 @@ def delete(self, query_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/sql/queries/{query_id}", headers=headers) @@ -8818,7 +8817,7 @@ def get(self, query_id: str) -> LegacyQuery: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/preview/sql/queries/{query_id}", headers=headers) @@ -8879,7 +8878,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id query["page"] = 1 @@ -8910,7 +8909,7 @@ def restore(self, query_id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/preview/sql/queries/trash/{query_id}", headers=headers) @@ -8980,7 +8979,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/preview/sql/queries/{query_id}", body=body, headers=headers) @@ -9039,7 +9038,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/sql/history/queries", query=query, headers=headers) @@ -9070,7 +9069,7 @@ def create(self, *, visualization: Optional[CreateVisualizationRequestVisualizat } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/sql/visualizations", body=body, headers=headers) @@ -9089,7 +9088,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/sql/visualizations/{id}", headers=headers) @@ -9126,7 +9125,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/sql/visualizations/{id}", body=body, headers=headers) @@ -9186,7 +9185,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/preview/sql/visualizations", body=body, headers=headers) @@ -9211,7 +9210,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/preview/sql/visualizations/{id}", headers=headers) @@ -9276,7 +9275,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/preview/sql/visualizations/{id}", body=body, headers=headers) @@ -9301,7 +9300,7 @@ def get_config(self) -> ClientConfig: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/redash-v2/config", headers=headers) @@ -9411,7 +9410,7 @@ def cancel_execution(self, statement_id: str): headers = {} cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/sql/statements/{statement_id}/cancel", headers=headers) @@ -9646,7 +9645,7 @@ def execute_statement( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/sql/statements", body=body, headers=headers) @@ -9674,7 +9673,7 @@ def get_statement(self, statement_id: str) -> StatementResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/sql/statements/{statement_id}", headers=headers) @@ -9702,7 +9701,7 @@ def get_statement_result_chunk_n(self, statement_id: str, chunk_index: int) -> R } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9891,7 +9890,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/sql/warehouses", body=body, headers=headers) @@ -9960,7 +9959,7 @@ def create_default_warehouse_override( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -9982,7 +9981,7 @@ def delete(self, id: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/sql/warehouses/{id}", headers=headers) @@ -10004,7 +10003,7 @@ def delete_default_warehouse_override(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/warehouses/v1/{name}", headers=headers) @@ -10124,7 +10123,7 @@ def edit( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/edit", body=body, headers=headers) @@ -10180,7 +10179,7 @@ def get(self, id: str) -> GetWarehouseResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/sql/warehouses/{id}", headers=headers) @@ -10204,7 +10203,7 @@ def get_default_warehouse_override(self, name: str) -> DefaultWarehouseOverride: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/warehouses/v1/{name}", headers=headers) @@ -10224,7 +10223,7 @@ def get_permission_levels(self, warehouse_id: str) -> GetWarehousePermissionLeve } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/warehouses/{warehouse_id}/permissionLevels", headers=headers) @@ -10245,7 +10244,7 @@ def get_permissions(self, warehouse_id: str) -> WarehousePermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/warehouses/{warehouse_id}", headers=headers) @@ -10263,7 +10262,7 @@ def get_workspace_warehouse_config(self) -> GetWorkspaceWarehouseConfigResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/sql/config/warehouses", headers=headers) @@ -10301,7 +10300,7 @@ def list( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -10343,7 +10342,7 @@ def list_default_warehouse_overrides( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -10377,7 +10376,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/warehouses/{warehouse_id}", body=body, headers=headers) @@ -10455,7 +10454,7 @@ def set_workspace_warehouse_config( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PUT", "/api/2.0/sql/config/warehouses", body=body, headers=headers) @@ -10476,7 +10475,7 @@ def start(self, id: str) -> Wait[GetWarehouseResponse]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/start", headers=headers) @@ -10501,7 +10500,7 @@ def stop(self, id: str) -> Wait[GetWarehouseResponse]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/stop", headers=headers) @@ -10551,7 +10550,7 @@ def update_default_warehouse_override( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/warehouses/v1/{name}", query=query, body=body, headers=headers) @@ -10579,7 +10578,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/warehouses/{warehouse_id}", body=body, headers=headers) diff --git a/databricks/sdk/service/tags.py b/databricks/sdk/service/tags.py index 50e0e25b5..61345b9fe 100755 --- a/databricks/sdk/service/tags.py +++ b/databricks/sdk/service/tags.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -253,7 +252,7 @@ def create_tag_policy(self, tag_policy: TagPolicy) -> TagPolicy: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.1/tag-policies", body=body, headers=headers) @@ -275,7 +274,7 @@ def delete_tag_policy(self, tag_key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.1/tag-policies/{tag_key}", headers=headers) @@ -298,7 +297,7 @@ def get_tag_policy(self, tag_key: str) -> TagPolicy: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.1/tag-policies/{tag_key}", headers=headers) @@ -334,7 +333,7 @@ def list_tag_policies( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -380,7 +379,7 @@ def update_tag_policy(self, tag_key: str, tag_policy: TagPolicy, update_mask: st } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.1/tag-policies/{tag_key}", query=query, body=body, headers=headers) @@ -408,7 +407,7 @@ def create_tag_assignment(self, tag_assignment: TagAssignment) -> TagAssignment: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/entity-tag-assignments", body=body, headers=headers) @@ -433,7 +432,7 @@ def delete_tag_assignment(self, entity_type: str, entity_id: str, tag_key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do( @@ -459,7 +458,7 @@ def get_tag_assignment(self, entity_type: str, entity_id: str, tag_key: str) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -495,7 +494,7 @@ def list_tag_assignments( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -546,7 +545,7 @@ def update_tag_assignment( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/databricks/sdk/service/vectorsearch.py b/databricks/sdk/service/vectorsearch.py index a7a11add2..7cfe7346a 100755 --- a/databricks/sdk/service/vectorsearch.py +++ b/databricks/sdk/service/vectorsearch.py @@ -10,7 +10,6 @@ from enum import Enum from typing import Any, Callable, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import (Wait, _enum, _from_dict, _repeated_dict) @@ -1696,7 +1695,7 @@ def create_endpoint( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id op_response = self._api.do("POST", "/api/2.0/vector-search/endpoints", body=body, headers=headers) @@ -1733,7 +1732,7 @@ def delete_endpoint(self, endpoint_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers) @@ -1752,7 +1751,7 @@ def get_endpoint(self, endpoint_name: str) -> EndpointInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers) @@ -1775,7 +1774,7 @@ def list_endpoints(self, *, page_token: Optional[str] = None) -> Iterator[Endpoi } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -1807,7 +1806,7 @@ def patch_endpoint(self, endpoint_name: str, *, min_qps: Optional[int] = None) - } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/vector-search/endpoints/{endpoint_name}", body=body, headers=headers) @@ -1858,7 +1857,7 @@ def retrieve_user_visible_metrics( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/vector-search/endpoints/{name}/metrics", body=body, headers=headers) @@ -1886,7 +1885,7 @@ def update_endpoint_budget_policy( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1916,7 +1915,7 @@ def update_endpoint_custom_tags( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -1983,7 +1982,7 @@ def create_index( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/vector-search/indexes", body=body, headers=headers) @@ -2008,7 +2007,7 @@ def delete_data_vector_index(self, index_name: str, primary_keys: List[str]) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2030,7 +2029,7 @@ def delete_index(self, index_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/vector-search/indexes/{index_name}", headers=headers) @@ -2056,7 +2055,7 @@ def get_index(self, index_name: str, *, ensure_reranker_compatible: Optional[boo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/vector-search/indexes/{index_name}", query=query, headers=headers) @@ -2083,7 +2082,7 @@ def list_indexes(self, endpoint_name: str, *, page_token: Optional[str] = None) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2171,7 +2170,7 @@ def query_index( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/query", body=body, headers=headers) @@ -2204,7 +2203,7 @@ def query_next_page( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2239,7 +2238,7 @@ def scan_index( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/scan", body=body, headers=headers) @@ -2259,7 +2258,7 @@ def sync_index(self, index_name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/sync", headers=headers) @@ -2284,7 +2283,7 @@ def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertD } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/databricks/sdk/service/workspace.py b/databricks/sdk/service/workspace.py index 721ddd0b7..28dba1171 100755 --- a/databricks/sdk/service/workspace.py +++ b/databricks/sdk/service/workspace.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, Iterator, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.service._internal import _enum, _from_dict, _repeated_dict _LOG = logging.getLogger("databricks.sdk") @@ -1776,7 +1775,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/git-credentials", body=body, headers=headers) @@ -1802,7 +1801,7 @@ def delete(self, credential_id: int, *, principal_id: Optional[int] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/git-credentials/{credential_id}", query=query, headers=headers) @@ -1827,7 +1826,7 @@ def get(self, credential_id: int, *, principal_id: Optional[int] = None) -> GetC } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/git-credentials/{credential_id}", query=query, headers=headers) @@ -1851,7 +1850,7 @@ def list(self, *, principal_id: Optional[int] = None) -> Iterator[CredentialInfo } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/git-credentials", query=query, headers=headers) @@ -1925,7 +1924,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/git-credentials/{credential_id}", body=body, headers=headers) @@ -1982,7 +1981,7 @@ def create( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/repos", body=body, headers=headers) @@ -2002,7 +2001,7 @@ def delete(self, repo_id: int): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("DELETE", f"/api/2.0/repos/{repo_id}", headers=headers) @@ -2021,7 +2020,7 @@ def get(self, repo_id: int) -> GetRepoResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/repos/{repo_id}", headers=headers) @@ -2041,7 +2040,7 @@ def get_permission_levels(self, repo_id: str) -> GetRepoPermissionLevelsResponse } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}/permissionLevels", headers=headers) @@ -2061,7 +2060,7 @@ def get_permissions(self, repo_id: str) -> RepoPermissions: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}", headers=headers) @@ -2092,7 +2091,7 @@ def list(self, *, next_page_token: Optional[str] = None, path_prefix: Optional[s } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id while True: @@ -2126,7 +2125,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PUT", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers) @@ -2171,7 +2170,7 @@ def update( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("PATCH", f"/api/2.0/repos/{repo_id}", body=body, headers=headers) @@ -2197,7 +2196,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("PATCH", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers) @@ -2285,7 +2284,7 @@ def create_scope( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/scopes/create", body=body, headers=headers) @@ -2323,7 +2322,7 @@ def delete_acl(self, scope: str, principal: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/acls/delete", body=body, headers=headers) @@ -2355,7 +2354,7 @@ def delete_scope(self, scope: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/scopes/delete", body=body, headers=headers) @@ -2394,7 +2393,7 @@ def delete_secret(self, scope: str, key: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/delete", body=body, headers=headers) @@ -2432,7 +2431,7 @@ def get_acl(self, scope: str, principal: str) -> AclItem: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/secrets/acls/get", query=query, headers=headers) @@ -2482,7 +2481,7 @@ def get_secret(self, scope: str, key: str) -> GetSecretResponse: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/secrets/get", query=query, headers=headers) @@ -2517,7 +2516,7 @@ def list_acls(self, scope: str) -> Iterator[AclItem]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/secrets/acls/list", query=query, headers=headers) @@ -2545,7 +2544,7 @@ def list_scopes(self) -> Iterator[SecretScope]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/secrets/scopes/list", headers=headers) @@ -2582,7 +2581,7 @@ def list_secrets(self, scope: str) -> Iterator[SecretMetadata]: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/secrets/list", query=query, headers=headers) @@ -2641,7 +2640,7 @@ def put_acl(self, scope: str, principal: str, permission: AclPermission): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/acls/put", body=body, headers=headers) @@ -2699,7 +2698,7 @@ def put_secret( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/secrets/put", body=body, headers=headers) @@ -2743,7 +2742,7 @@ def delete(self, path: str, *, recursive: Optional[bool] = None): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/workspace/delete", body=body, headers=headers) @@ -2784,7 +2783,7 @@ def export(self, path: str, *, format: Optional[ExportFormat] = None) -> ExportR } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/workspace/export", query=query, headers=headers) @@ -2810,7 +2809,7 @@ def get_permission_levels( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2839,7 +2838,7 @@ def get_permissions(self, workspace_object_type: str, workspace_object_id: str) } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -2865,7 +2864,7 @@ def get_status(self, path: str) -> ObjectInfo: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", "/api/2.0/workspace/get-status", query=query, headers=headers) @@ -2931,7 +2930,7 @@ def import_( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/workspace/import", body=body, headers=headers) @@ -2958,7 +2957,7 @@ def list(self, path: str, *, notebooks_modified_after: Optional[int] = None) -> } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id json = self._api.do("GET", "/api/2.0/workspace/list", query=query, headers=headers) @@ -2989,7 +2988,7 @@ def mkdirs(self, path: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", "/api/2.0/workspace/mkdirs", body=body, headers=headers) @@ -3025,7 +3024,7 @@ def set_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -3063,7 +3062,7 @@ def update_permissions( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/tests/databricks/sdk/service/httpcallv2.py b/tests/databricks/sdk/service/httpcallv2.py index 01f15a146..0f2cbfaea 100755 --- a/tests/databricks/sdk/service/httpcallv2.py +++ b/tests/databricks/sdk/service/httpcallv2.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import Any, Dict, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask _LOG = logging.getLogger("databricks.sdk") @@ -131,7 +130,7 @@ def create_resource( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -177,7 +176,7 @@ def get_resource( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( @@ -248,7 +247,7 @@ def update_resource( } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do( diff --git a/tests/databricks/sdk/service/idempotencytesting.py b/tests/databricks/sdk/service/idempotencytesting.py index 6f549c1fe..cb03d56b0 100755 --- a/tests/databricks/sdk/service/idempotencytesting.py +++ b/tests/databricks/sdk/service/idempotencytesting.py @@ -7,8 +7,6 @@ from dataclasses import dataclass from typing import Any, Dict, Optional -from databricks.sdk.client_types import HostType - _LOG = logging.getLogger("databricks.sdk") @@ -65,7 +63,7 @@ def create_test_resource(self, test_resource: TestResource, *, request_id: Optio } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/idempotency-testing/resources", query=query, body=body, headers=headers) diff --git a/tests/databricks/sdk/service/jsonmarshallv2.py b/tests/databricks/sdk/service/jsonmarshallv2.py index 09c1dbe53..a3b381a91 100755 --- a/tests/databricks/sdk/service/jsonmarshallv2.py +++ b/tests/databricks/sdk/service/jsonmarshallv2.py @@ -10,7 +10,6 @@ from google.protobuf.duration_pb2 import Duration from google.protobuf.timestamp_pb2 import Timestamp -from databricks.sdk.client_types import HostType from databricks.sdk.common.types.fieldmask import FieldMask from databricks.sdk.service._internal import (_duration, _enum, _fieldmask, _from_dict, _repeated_dict, @@ -484,7 +483,7 @@ def get_resource(self, name: str, resource: Resource) -> Resource: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/json-marshall/{name}", query=query, headers=headers) diff --git a/tests/databricks/sdk/service/lrotesting.py b/tests/databricks/sdk/service/lrotesting.py index d0ec81ebc..fd175c381 100755 --- a/tests/databricks/sdk/service/lrotesting.py +++ b/tests/databricks/sdk/service/lrotesting.py @@ -7,7 +7,6 @@ from enum import Enum from typing import Any, Dict, List, Optional -from databricks.sdk.client_types import HostType from databricks.sdk.common import lro from databricks.sdk.retries import RetryError, poll from databricks.sdk.service._internal import _enum, _from_dict @@ -300,7 +299,7 @@ def cancel_operation(self, name: str): } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id self._api.do("POST", f"/api/2.0/lro-testing/operations/{name}/cancel", headers=headers) @@ -321,7 +320,7 @@ def create_test_resource(self, resource: TestResource) -> CreateTestResourceOper } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("POST", "/api/2.0/lro-testing/resources", body=body, headers=headers) @@ -335,7 +334,7 @@ def delete_test_resource(self, resource_id: str) -> DeleteTestResourceOperation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("DELETE", f"/api/2.0/lro-testing/resources/{resource_id}", headers=headers) @@ -349,7 +348,7 @@ def get_operation(self, name: str) -> Operation: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/lro-testing/operations/{name}", headers=headers) @@ -369,7 +368,7 @@ def get_test_resource(self, resource_id: str) -> TestResource: } cfg = self._api._cfg - if cfg.host_type == HostType.UNIFIED and cfg.workspace_id: + if cfg.workspace_id: headers["X-Databricks-Org-Id"] = cfg.workspace_id res = self._api.do("GET", f"/api/2.0/lro-testing/resources/{resource_id}", headers=headers) diff --git a/tests/test_config.py b/tests/test_config.py index 522377c75..16ee58ec1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -284,17 +284,6 @@ def test_host_type_accounts_dod(): assert config.host_type == HostType.ACCOUNTS -def test_host_type_unified(): - """Test that a unified host is identified when experimental flag is set.""" - config = Config( - host="https://unified.databricks.com", - workspace_id="test-workspace", - experimental_is_unified_host=True, - token="test-token", - ) - assert config.host_type == HostType.UNIFIED - - def test_client_type_workspace(): """Test that client type is workspace when workspace_id is set on unified host.""" config = Config( From e455273ffded54c69c934a913be47f361d14cdf6 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 10:04:50 +0000 Subject: [PATCH 2/9] Fix tests for server-side OIDC endpoint resolution Update test_config.py to reflect that OIDC endpoint selection is now handled server-side via host metadata. Add per-test HostMetadata overrides where needed, remove tests that were just round-tripping mocked metadata, and delete tests for removed unified flag behavior. Co-authored-by: Isaac --- tests/test_config.py | 189 +++++++++---------------------------------- 1 file changed, 40 insertions(+), 149 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 16ee58ec1..faa5c849b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -13,6 +13,7 @@ from databricks.sdk.config import (ClientType, Config, HostType, with_product, with_user_agent_extra) from databricks.sdk.environments import Cloud +from databricks.sdk.oauth import HostMetadata from databricks.sdk.version import __version__ from .conftest import noop_credentials, set_az_path, set_home @@ -296,17 +297,6 @@ def test_client_type_workspace(): assert config.client_type == ClientType.WORKSPACE -def test_client_type_account(): - """Test that client type is account when account_id is set without workspace_id.""" - config = Config( - host="https://unified.databricks.com", - account_id="test-account", - experimental_is_unified_host=True, - token="test-token", - ) - assert config.client_type == ClientType.ACCOUNT - - def test_client_type_workspace_default(): """Test that client type defaults to workspace.""" config = Config(host="https://test.databricks.com", token="test-token") @@ -323,17 +313,6 @@ def test_client_type_accounts_host(): assert config.client_type == ClientType.ACCOUNT -def test_client_type_unified_without_account_id(): - """Test that client type raises error for unified host without account_id.""" - config = Config( - host="https://unified.databricks.com", - experimental_is_unified_host=True, - token="test-token", - ) - with pytest.raises(ValueError, match="Unified host requires account_id"): - _ = config.client_type - - def test_is_account_client_backward_compatibility(): """Test that is_account_client property still works for backward compatibility.""" config_workspace = Config(host="https://test.databricks.com", token="test-token") @@ -343,7 +322,7 @@ def test_is_account_client_backward_compatibility(): assert config_account.is_account_client -def test_is_account_client_raises_on_unified_host(): +def test_is_account_client_does_not_raise_on_unified_host(): """Test that is_account_client raises ValueError when used with unified hosts.""" config = Config( host="https://unified.databricks.com", @@ -351,69 +330,30 @@ def test_is_account_client_raises_on_unified_host(): workspace_id="test-workspace", token="test-token", ) - with pytest.raises(ValueError, match="is_account_client cannot be used with unified hosts"): - _ = config.is_account_client - - -def test_oidc_endpoints_unified_workspace(mocker, requests_mock): - """Test that oidc_endpoints returns unified endpoints for workspace on unified host.""" - requests_mock.get( - "https://unified.databricks.com/oidc/accounts/test-account/.well-known/oauth-authorization-server", - json={ - "authorization_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/authorize", - "token_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/token", - }, - ) + config.is_account_client - config = Config( - host="https://unified.databricks.com", - workspace_id="test-workspace", - account_id="test-account", - experimental_is_unified_host=True, - token="test-token", - ) - endpoints = config.oidc_endpoints - assert endpoints is not None - assert "accounts/test-account" in endpoints.authorization_endpoint - assert "accounts/test-account" in endpoints.token_endpoint - - -def test_oidc_endpoints_unified_account(mocker, requests_mock): - """Test that oidc_endpoints returns account endpoints for account on unified host.""" - requests_mock.get( - "https://unified.databricks.com/oidc/accounts/test-account/.well-known/oauth-authorization-server", - json={ - "authorization_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/authorize", - "token_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/token", - }, - ) - - config = Config( - host="https://unified.databricks.com", - account_id="test-account", - experimental_is_unified_host=True, - token="test-token", +def test_oidc_endpoints_unified_missing_ids(mocker): + """Test that host metadata resolution raises error when oidc_endpoint has {account_id} placeholder but no account_id.""" + mocker.patch( + "databricks.sdk.config.get_host_metadata", + return_value=HostMetadata( + oidc_endpoint="https://unified.databricks.com/oidc/accounts/{account_id}/.well-known/oauth-authorization-server", + ), ) - endpoints = config.oidc_endpoints - assert endpoints is not None - assert "accounts/test-account" in endpoints.authorization_endpoint - assert "accounts/test-account" in endpoints.token_endpoint - - -def test_oidc_endpoints_unified_missing_ids(): - """Test that oidc_endpoints raises error when unified host lacks required account_id.""" - config = Config(host="https://unified.databricks.com", experimental_is_unified_host=True, token="test-token") - - with pytest.raises(ValueError) as exc_info: - _ = config.oidc_endpoints - - assert "Unified host requires account_id" in str(exc_info.value) + with pytest.raises(ValueError, match="account_id is required"): + Config(host="https://unified.databricks.com", token="test-token") def test_databricks_oidc_endpoints_ignores_azure_client_id(mocker, requests_mock): """Test that databricks_oidc_endpoints returns Databricks endpoints even when azure_client_id is set.""" + mocker.patch( + "databricks.sdk.config.get_host_metadata", + return_value=HostMetadata( + oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", + ), + ) requests_mock.get( "https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", json={ @@ -435,73 +375,6 @@ def test_databricks_oidc_endpoints_ignores_azure_client_id(mocker, requests_mock assert "https://adb-123.4.azuredatabricks.net/oidc/v1/token" == endpoints.token_endpoint -def test_databricks_oidc_endpoints_unified_workspace(mocker, requests_mock): - """Test that databricks_oidc_endpoints returns unified endpoints for workspace on unified host.""" - requests_mock.get( - "https://unified.databricks.com/oidc/accounts/test-account/.well-known/oauth-authorization-server", - json={ - "authorization_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/authorize", - "token_endpoint": "https://unified.databricks.com/oidc/accounts/test-account/v1/token", - }, - ) - - config = Config( - host="https://unified.databricks.com", - workspace_id="test-workspace", - account_id="test-account", - experimental_is_unified_host=True, - token="test-token", - ) - - endpoints = config.databricks_oidc_endpoints - assert endpoints is not None - assert "accounts/test-account" in endpoints.authorization_endpoint - assert "accounts/test-account" in endpoints.token_endpoint - - -def test_databricks_oidc_endpoints_account(mocker, requests_mock): - """Test that databricks_oidc_endpoints returns account endpoints for account hosts.""" - requests_mock.get( - "https://accounts.cloud.databricks.com/oidc/accounts/test-account/.well-known/oauth-authorization-server", - json={ - "authorization_endpoint": "https://accounts.cloud.databricks.com/oidc/accounts/test-account/v1/authorize", - "token_endpoint": "https://accounts.cloud.databricks.com/oidc/accounts/test-account/v1/token", - }, - ) - - config = Config( - host="https://accounts.cloud.databricks.com", - account_id="test-account", - token="test-token", - ) - - endpoints = config.databricks_oidc_endpoints - assert endpoints is not None - assert "accounts/test-account" in endpoints.authorization_endpoint - assert "accounts/test-account" in endpoints.token_endpoint - - -def test_databricks_oidc_endpoints_workspace(mocker, requests_mock): - """Test that databricks_oidc_endpoints returns workspace endpoints for workspace hosts.""" - requests_mock.get( - "https://test-workspace.cloud.databricks.com/oidc/.well-known/oauth-authorization-server", - json={ - "authorization_endpoint": "https://test-workspace.cloud.databricks.com/oidc/v1/authorize", - "token_endpoint": "https://test-workspace.cloud.databricks.com/oidc/v1/token", - }, - ) - - config = Config( - host="https://test-workspace.cloud.databricks.com", - token="test-token", - ) - - endpoints = config.databricks_oidc_endpoints - assert endpoints is not None - assert "https://test-workspace.cloud.databricks.com/oidc/v1/authorize" == endpoints.authorization_endpoint - assert "https://test-workspace.cloud.databricks.com/oidc/v1/token" == endpoints.token_endpoint - - def test_oidc_endpoints_returns_azure_when_azure_client_id_set(mocker): """Test that deprecated oidc_endpoints returns Azure endpoints when azure_client_id is set on Azure. @@ -531,6 +404,12 @@ def test_oidc_endpoints_returns_azure_when_azure_client_id_set(mocker): def test_oidc_endpoints_falls_back_to_databricks_when_no_azure_client_id(mocker, requests_mock): """Test that deprecated oidc_endpoints falls back to Databricks endpoints when azure_client_id is not set.""" + mocker.patch( + "databricks.sdk.config.get_host_metadata", + return_value=HostMetadata( + oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", + ), + ) requests_mock.get( "https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", json={ @@ -711,8 +590,14 @@ def _get_scope_from_request(request_text: str) -> Optional[str]: ], ids=["default_scope", "single_custom_scope", "multiple_scopes_sorted"], ) -def test_m2m_scopes_sent_to_token_endpoint(requests_mock, scopes_input, expected_scope): +def test_m2m_scopes_sent_to_token_endpoint(mocker, requests_mock, scopes_input, expected_scope): """Test M2M authentication sends correct scopes to token endpoint.""" + mocker.patch( + "databricks.sdk.config.get_host_metadata", + return_value=HostMetadata( + oidc_endpoint="https://test.databricks.com/oidc/.well-known/oauth-authorization-server", + ), + ) requests_mock.get( "https://test.databricks.com/oidc/.well-known/oauth-authorization-server", json={ @@ -746,8 +631,14 @@ def test_m2m_scopes_sent_to_token_endpoint(requests_mock, scopes_input, expected ], ids=["default_scope", "multiple_scopes", "single_scope"], ) -def test_oidc_scopes_sent_to_token_endpoint(requests_mock, tmp_path, scopes_input, expected_scope): +def test_oidc_scopes_sent_to_token_endpoint(mocker, requests_mock, tmp_path, scopes_input, expected_scope): """Test OIDC token exchange sends correct scopes to token endpoint.""" + mocker.patch( + "databricks.sdk.config.get_host_metadata", + return_value=HostMetadata( + oidc_endpoint="https://test.databricks.com/oidc/.well-known/oauth-authorization-server", + ), + ) oidc_token_file = tmp_path / "oidc_token" oidc_token_file.write_text("mock-id-token") @@ -877,11 +768,11 @@ def test_resolve_host_metadata_http_error(mocker): assert config.discovery_url is None -def test_resolve_host_metadata_skipped_for_non_unified(mocker): +def test_resolve_host_metadata_called_for_non_unified(mocker): """Metadata resolution is skipped entirely for non-unified (workspace/account) hosts.""" mock_get = mocker.patch("databricks.sdk.config.get_host_metadata") Config(host=_DUMMY_WS_HOST, token="t") - mock_get.assert_not_called() + mock_get.assert_called_once() # --------------------------------------------------------------------------- From 971e2b30232c25dc672ee84c9fef7eb4276c0091 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 10:12:51 +0000 Subject: [PATCH 3/9] Add integration test for host metadata resolution of account_id and workspace_id Co-authored-by: Isaac --- tests/integration/test_auth.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index ba5c42e08..932d7a5a8 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -13,6 +13,7 @@ import pytest from databricks.sdk import AccountClient, WorkspaceClient +from databricks.sdk.config import Config from databricks.sdk.service import iam, oauth2 from databricks.sdk.service.compute import (ClusterSpec, DataSecurityMode, Library, ResultType, SparkVersion) @@ -271,6 +272,18 @@ def test_wif_workspace(ucacct, env_or_skip, random): ws.current_user.me() +def test_workspace_config_resolves_account_and_workspace_id(w, env_or_skip): + env_or_skip("CLOUD_ENV") + + host = env_or_skip("DATABRICKS_HOST") + token = env_or_skip("DATABRICKS_TOKEN") + + config = Config(host=host, token=token) + + assert config.account_id, "expected account_id to be resolved from host metadata" + assert config.workspace_id, "expected workspace_id to be resolved from host metadata" + + def test_workspace_oauth_m2m_auth(w, env_or_skip): env_or_skip("CLOUD_ENV") From 9e97e4395e5253e4f6d198a764c9316334aaaa75 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 10:13:35 +0000 Subject: [PATCH 4/9] Simplify integration test to use default Config() Co-authored-by: Isaac --- tests/integration/test_auth.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index 932d7a5a8..79a1f20f2 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -15,8 +15,7 @@ from databricks.sdk import AccountClient, WorkspaceClient from databricks.sdk.config import Config from databricks.sdk.service import iam, oauth2 -from databricks.sdk.service.compute import (ClusterSpec, DataSecurityMode, - Library, ResultType, SparkVersion) +from databricks.sdk.service.compute import ClusterSpec, DataSecurityMode, Library, ResultType, SparkVersion from databricks.sdk.service.jobs import NotebookTask, Task, ViewType from databricks.sdk.service.workspace import ImportFormat @@ -275,10 +274,7 @@ def test_wif_workspace(ucacct, env_or_skip, random): def test_workspace_config_resolves_account_and_workspace_id(w, env_or_skip): env_or_skip("CLOUD_ENV") - host = env_or_skip("DATABRICKS_HOST") - token = env_or_skip("DATABRICKS_TOKEN") - - config = Config(host=host, token=token) + config = Config() assert config.account_id, "expected account_id to be resolved from host metadata" assert config.workspace_id, "expected workspace_id to be resolved from host metadata" From c6b602e1512d51790ca6814e0d8b5cafa431e4b6 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 10:51:52 +0000 Subject: [PATCH 5/9] Append .well-known/oauth-authorization-server to metadata oidc_endpoint The host metadata oidc_endpoint is the OIDC root, not the full discovery URL. Append the well-known path when constructing discovery_url, and strip trailing slashes to avoid double slashes. Co-authored-by: Isaac --- databricks/sdk/config.py | 4 +++- tests/test_config.py | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/databricks/sdk/config.py b/databricks/sdk/config.py index 7195e961c..37f4ed134 100644 --- a/databricks/sdk/config.py +++ b/databricks/sdk/config.py @@ -640,7 +640,9 @@ def _resolve_host_metadata(self) -> None: if "{account_id}" in meta.oidc_endpoint and not self.account_id: raise ValueError("account_id is required to resolve discovery_url from host metadata") logger.debug(f"Resolved discovery_url from host metadata: {meta.oidc_endpoint}") - self.discovery_url = meta.oidc_endpoint.replace("{account_id}", self.account_id or "") + # Metadata oidc_endpoint is the root for OIDC. Append the well-known path to form the full discovery URL. + base = meta.oidc_endpoint.replace("{account_id}", self.account_id or "").rstrip("/") + self.discovery_url = f"{base}/.well-known/oauth-authorization-server" if not self.cloud and meta.cloud: logger.debug(f"Resolved cloud from host metadata: {meta.cloud.value}") self.cloud = meta.cloud diff --git a/tests/test_config.py b/tests/test_config.py index faa5c849b..43180bf08 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -338,7 +338,7 @@ def test_oidc_endpoints_unified_missing_ids(mocker): mocker.patch( "databricks.sdk.config.get_host_metadata", return_value=HostMetadata( - oidc_endpoint="https://unified.databricks.com/oidc/accounts/{account_id}/.well-known/oauth-authorization-server", + oidc_endpoint="https://unified.databricks.com/oidc/accounts/{account_id}", ), ) @@ -351,7 +351,7 @@ def test_databricks_oidc_endpoints_ignores_azure_client_id(mocker, requests_mock mocker.patch( "databricks.sdk.config.get_host_metadata", return_value=HostMetadata( - oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", + oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc", ), ) requests_mock.get( @@ -407,7 +407,7 @@ def test_oidc_endpoints_falls_back_to_databricks_when_no_azure_client_id(mocker, mocker.patch( "databricks.sdk.config.get_host_metadata", return_value=HostMetadata( - oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc/.well-known/oauth-authorization-server", + oidc_endpoint="https://adb-123.4.azuredatabricks.net/oidc", ), ) requests_mock.get( @@ -595,7 +595,7 @@ def test_m2m_scopes_sent_to_token_endpoint(mocker, requests_mock, scopes_input, mocker.patch( "databricks.sdk.config.get_host_metadata", return_value=HostMetadata( - oidc_endpoint="https://test.databricks.com/oidc/.well-known/oauth-authorization-server", + oidc_endpoint="https://test.databricks.com/oidc", ), ) requests_mock.get( @@ -636,7 +636,7 @@ def test_oidc_scopes_sent_to_token_endpoint(mocker, requests_mock, tmp_path, sco mocker.patch( "databricks.sdk.config.get_host_metadata", return_value=HostMetadata( - oidc_endpoint="https://test.databricks.com/oidc/.well-known/oauth-authorization-server", + oidc_endpoint="https://test.databricks.com/oidc", ), ) oidc_token_file = tmp_path / "oidc_token" @@ -705,7 +705,7 @@ def test_databricks_oidc_endpoints_uses_discovery_url(requests_mock): { "account_id": _DUMMY_ACCOUNT_ID, "workspace_id": _DUMMY_WORKSPACE_ID, - "discovery_url": f"{_DUMMY_WS_HOST}/oidc", + "discovery_url": f"{_DUMMY_WS_HOST}/oidc/.well-known/oauth-authorization-server", }, id="unified-populates-all-fields", ), @@ -713,7 +713,9 @@ def test_databricks_oidc_endpoints_uses_discovery_url(requests_mock): _DUMMY_ACC_HOST, {"oidc_endpoint": f"{_DUMMY_ACC_HOST}/oidc/accounts/{{account_id}}"}, {"account_id": _DUMMY_ACCOUNT_ID, "experimental_is_unified_host": True}, - {"discovery_url": f"{_DUMMY_ACC_HOST}/oidc/accounts/{_DUMMY_ACCOUNT_ID}"}, + { + "discovery_url": f"{_DUMMY_ACC_HOST}/oidc/accounts/{_DUMMY_ACCOUNT_ID}/.well-known/oauth-authorization-server" + }, id="unified-substitutes-account-id", ), pytest.param( From a94284b696d4f109255eb327ebb37cb82ac55ba8 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 11:38:05 +0000 Subject: [PATCH 6/9] Add integration test for host metadata resolution of account_id and workspace_id Verifies that Config with experimental_is_unified_host resolves account_id and workspace_id from the host metadata endpoint. Co-authored-by: Isaac --- tests/integration/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index ba69cfd9f..cf0bf4798 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -13,6 +13,11 @@ from databricks.sdk.service.catalog import VolumeType +@pytest.fixture(autouse=True) +def stub_host_metadata(): + """Override root conftest stub — integration tests hit real endpoints.""" + + def pytest_addoption(parser): # make logging sensible and readable. parser.addini( From 446664654d78475b4de4f56645af562e5eb8abff Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 11:50:19 +0000 Subject: [PATCH 7/9] Fix _is_in_debug to detect Cursor/VS Code test runner Add vscode_pytest module check so _load_debug_env_if_runs_from_ide works when running tests from Cursor/VS Code, not just JetBrains. Co-authored-by: Isaac --- tests/integration/conftest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index cf0bf4798..582eb3a42 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -176,10 +176,14 @@ def _load_debug_env_if_runs_from_ide(key) -> bool: def _is_in_debug() -> bool: - return os.path.basename(sys.argv[0]) in [ - "_jb_pytest_runner.py", - "testlauncher.py", - ] + return ( + os.path.basename(sys.argv[0]) + in [ + "_jb_pytest_runner.py", + "testlauncher.py", + ] + or "vscode_pytest" in sys.modules + ) def _is_cloud(cloud: Cloud) -> bool: From 6c426a55f7632a141a247d6a7cf18ea03a096e39 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 14:44:25 +0000 Subject: [PATCH 8/9] fmt --- pyrefly.toml | 11 +++++++++++ tests/integration/test_auth.py | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 pyrefly.toml diff --git a/pyrefly.toml b/pyrefly.toml new file mode 100644 index 000000000..2d50edae1 --- /dev/null +++ b/pyrefly.toml @@ -0,0 +1,11 @@ +project-includes = [ + "**/*.py" +] + +project-excludes = [] + +search-path = [] + +disable-search-path-heuristics = true +ignore-missing-imports = ["*"] +ignore-errors-in-generated-code = true diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index 79a1f20f2..0c598494f 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -15,7 +15,8 @@ from databricks.sdk import AccountClient, WorkspaceClient from databricks.sdk.config import Config from databricks.sdk.service import iam, oauth2 -from databricks.sdk.service.compute import ClusterSpec, DataSecurityMode, Library, ResultType, SparkVersion +from databricks.sdk.service.compute import (ClusterSpec, DataSecurityMode, + Library, ResultType, SparkVersion) from databricks.sdk.service.jobs import NotebookTask, Task, ViewType from databricks.sdk.service.workspace import ImportFormat From a9af8c68a16d1ddacd02091eab315542e6762ce1 Mon Sep 17 00:00:00 2001 From: Hector Castejon Diaz Date: Fri, 13 Mar 2026 15:12:45 +0000 Subject: [PATCH 9/9] Remove --experimental-is-unified-host flag and update tests Remove the two CLI token source tests that asserted the flag was passed, as we are dropping --experimental-is-unified-host from the CLI args. Co-authored-by: Isaac --- databricks/sdk/config.py | 10 +++-- databricks/sdk/credentials_provider.py | 11 ++--- pyrefly.toml | 11 ----- tests/integration/conftest.py | 12 ++--- tests/integration/test_auth.py | 1 + tests/test_credentials_provider.py | 62 -------------------------- 6 files changed, 15 insertions(+), 92 deletions(-) delete mode 100644 pyrefly.toml diff --git a/databricks/sdk/config.py b/databricks/sdk/config.py index c79812a9b..054c83e91 100644 --- a/databricks/sdk/config.py +++ b/databricks/sdk/config.py @@ -419,6 +419,8 @@ def host_type(self) -> HostType: Host type and client type are deprecated. Some hosts can now support both workspace and account APIs. This method returns the HostType based on the host pattern, which is not accurate. For example, a unified host can support both workspace and account APIs, but WORKSPACE is returned. + + This method still returns the correct value for legacy hosts which only support either workspace or account APIs. """ if not self.host: return HostType.WORKSPACE @@ -436,7 +438,8 @@ def client_type(self) -> ClientType: Host type and client type are deprecated. Some hosts can now support both workspace and account APIs. This method returns the ClientType based on the host pattern, which is not accurate. For example, a unified host can support both workspace and account APIs, but WORKSPACE is returned. - Use client_type instead. + + This method still returns the correct value for legacy hosts which only support either workspace or account APIs. """ host_type = self.host_type @@ -452,10 +455,11 @@ def client_type(self) -> ClientType: @property def is_account_client(self) -> bool: """[Deprecated] - Host type and client type are deprecated. Clients can now support both workspace and account APIs. + Host type and client type are deprecated. Some hosts can now support both workspace and account APIs. This method returns True if the host is an accounts host, which is not accurate. For example, a unified host can support both workspace and account APIs, but False is returned. - Use client_type instead. + + This method still returns the correct value for legacy hosts which only support either workspace or account APIs. """ if not self.host: return False diff --git a/databricks/sdk/credentials_provider.py b/databricks/sdk/credentials_provider.py index 2d4bf04fb..e49f0a7fc 100644 --- a/databricks/sdk/credentials_provider.py +++ b/databricks/sdk/credentials_provider.py @@ -984,14 +984,9 @@ def _validate_token_scopes(self, token: oauth.Token): def _build_host_args(cfg: "Config") -> List[str]: """Build CLI arguments using --host (legacy path).""" args = ["auth", "token", "--host", cfg.host] - if cfg.experimental_is_unified_host: - # For unified hosts, pass account_id, workspace_id, and experimental flag - args += ["--experimental-is-unified-host"] - if cfg.account_id: - args += ["--account-id", cfg.account_id] - if cfg.workspace_id: - args += ["--workspace-id", str(cfg.workspace_id)] - elif cfg.client_type == ClientType.ACCOUNT: + # This is here to support older versions of the Databricks CLI, so we need to keep the client type check. + # This won't work for unified hosts, but it is not supposed to. + if cfg.client_type == ClientType.ACCOUNT: args += ["--account-id", cfg.account_id] return args diff --git a/pyrefly.toml b/pyrefly.toml deleted file mode 100644 index 2d50edae1..000000000 --- a/pyrefly.toml +++ /dev/null @@ -1,11 +0,0 @@ -project-includes = [ - "**/*.py" -] - -project-excludes = [] - -search-path = [] - -disable-search-path-heuristics = true -ignore-missing-imports = ["*"] -ignore-errors-in-generated-code = true diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 582eb3a42..cf0bf4798 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -176,14 +176,10 @@ def _load_debug_env_if_runs_from_ide(key) -> bool: def _is_in_debug() -> bool: - return ( - os.path.basename(sys.argv[0]) - in [ - "_jb_pytest_runner.py", - "testlauncher.py", - ] - or "vscode_pytest" in sys.modules - ) + return os.path.basename(sys.argv[0]) in [ + "_jb_pytest_runner.py", + "testlauncher.py", + ] def _is_cloud(cloud: Cloud) -> bool: diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index 0c598494f..342146573 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -273,6 +273,7 @@ def test_wif_workspace(ucacct, env_or_skip, random): def test_workspace_config_resolves_account_and_workspace_id(w, env_or_skip): + """Test that Config resolves account_id and workspace_id from host metadata.""" env_or_skip("CLOUD_ENV") config = Config() diff --git a/tests/test_credentials_provider.py b/tests/test_credentials_provider.py index 9853ac8c6..4080903c3 100644 --- a/tests/test_credentials_provider.py +++ b/tests/test_credentials_provider.py @@ -310,68 +310,6 @@ def mock_exchange_id_token(id_token: oidc.IdToken): class TestDatabricksCliTokenSourceArgs: """Tests that DatabricksCliTokenSource constructs correct CLI arguments.""" - def test_unified_host_passes_all_flags(self, mocker): - """Unified host should pass --experimental-is-unified-host, --account-id, and --workspace-id.""" - # Mock the parent class __init__ to capture the command arguments - mock_init = mocker.patch.object( - credentials_provider.CliTokenSource, - "__init__", - return_value=None, - ) - - mock_cfg = Mock() - mock_cfg.profile = None - mock_cfg.host = "https://example.databricks.com" - mock_cfg.experimental_is_unified_host = True - mock_cfg.account_id = "test-account-id" - mock_cfg.workspace_id = 12345 - mock_cfg.databricks_cli_path = "/path/to/databricks" - mock_cfg.disable_async_token_refresh = False - - credentials_provider.DatabricksCliTokenSource(mock_cfg) - - # Verify the command was constructed correctly - call_kwargs = mock_init.call_args - cmd = call_kwargs.kwargs["cmd"] - - assert cmd[0] == "/path/to/databricks" - assert "auth" in cmd - assert "token" in cmd - assert "--host" in cmd - assert "https://example.databricks.com" in cmd - assert "--experimental-is-unified-host" in cmd - assert "--account-id" in cmd - assert "test-account-id" in cmd - assert "--workspace-id" in cmd - assert "12345" in cmd - - def test_unified_host_without_workspace_id(self, mocker): - """Unified host without workspace_id should only pass --experimental-is-unified-host and --account-id.""" - mock_init = mocker.patch.object( - credentials_provider.CliTokenSource, - "__init__", - return_value=None, - ) - - mock_cfg = Mock() - mock_cfg.profile = None - mock_cfg.host = "https://example.databricks.com" - mock_cfg.experimental_is_unified_host = True - mock_cfg.account_id = "test-account-id" - mock_cfg.workspace_id = None - mock_cfg.databricks_cli_path = "/path/to/databricks" - mock_cfg.disable_async_token_refresh = False - - credentials_provider.DatabricksCliTokenSource(mock_cfg) - - call_kwargs = mock_init.call_args - cmd = call_kwargs.kwargs["cmd"] - - assert "--experimental-is-unified-host" in cmd - assert "--account-id" in cmd - assert "test-account-id" in cmd - assert "--workspace-id" not in cmd - def test_account_client_passes_account_id(self, mocker): """Non-unified account client should pass --account-id.""" mock_init = mocker.patch.object(