diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 9c12df319..ee11717a1 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -3,6 +3,7 @@ ## Release v0.45.0 ### New Features and Improvements +* Update Jobs service to use API 2.2 ([#913](https://github.com/databricks/databricks-sdk-py/pull/913)). ### Bug Fixes diff --git a/databricks/sdk/__init__.py b/databricks/sdk/__init__.py index 81ffbdf24..141e7e44d 100755 --- a/databricks/sdk/__init__.py +++ b/databricks/sdk/__init__.py @@ -324,9 +324,7 @@ def access_control(self) -> service.iam.AccessControlAPI: return self._access_control @property - def account_access_control_proxy( - self, - ) -> service.iam.AccountAccessControlProxyAPI: + def account_access_control_proxy(self) -> service.iam.AccountAccessControlProxyAPI: """These APIs manage access rules on resources in an account.""" return self._account_access_control_proxy @@ -391,16 +389,12 @@ def connections(self) -> service.catalog.ConnectionsAPI: return self._connections @property - def consumer_fulfillments( - self, - ) -> service.marketplace.ConsumerFulfillmentsAPI: + def consumer_fulfillments(self) -> service.marketplace.ConsumerFulfillmentsAPI: """Fulfillments are entities that allow consumers to preview installations.""" return self._consumer_fulfillments @property - def consumer_installations( - self, - ) -> service.marketplace.ConsumerInstallationsAPI: + def consumer_installations(self) -> service.marketplace.ConsumerInstallationsAPI: """Installations are entities that allow consumers to interact with Databricks Marketplace listings.""" return self._consumer_installations @@ -410,9 +404,7 @@ def consumer_listings(self) -> service.marketplace.ConsumerListingsAPI: return self._consumer_listings @property - def consumer_personalization_requests( - self, - ) -> service.marketplace.ConsumerPersonalizationRequestsAPI: + def consumer_personalization_requests(self) -> service.marketplace.ConsumerPersonalizationRequestsAPI: """Personalization Requests allow customers to interact with the individualized Marketplace listing flow.""" return self._consumer_personalization_requests @@ -557,9 +549,7 @@ def model_versions(self) -> service.catalog.ModelVersionsAPI: return self._model_versions @property - def notification_destinations( - self, - ) -> service.settings.NotificationDestinationsAPI: + def notification_destinations(self) -> service.settings.NotificationDestinationsAPI: """The notification destinations API lets you programmatically manage a workspace's notification destinations.""" return self._notification_destinations @@ -584,16 +574,12 @@ def pipelines(self) -> service.pipelines.PipelinesAPI: return self._pipelines @property - def policy_compliance_for_clusters( - self, - ) -> service.compute.PolicyComplianceForClustersAPI: + def policy_compliance_for_clusters(self) -> service.compute.PolicyComplianceForClustersAPI: """The policy compliance APIs allow you to view and manage the policy compliance status of clusters in your workspace.""" return self._policy_compliance_for_clusters @property - def policy_compliance_for_jobs( - self, - ) -> service.jobs.PolicyComplianceForJobsAPI: + def policy_compliance_for_jobs(self) -> service.jobs.PolicyComplianceForJobsAPI: """The compliance APIs allow you to view and manage the policy compliance status of jobs in your workspace.""" return self._policy_compliance_for_jobs @@ -603,9 +589,7 @@ def policy_families(self) -> service.compute.PolicyFamiliesAPI: return self._policy_families @property - def provider_exchange_filters( - self, - ) -> service.marketplace.ProviderExchangeFiltersAPI: + def provider_exchange_filters(self) -> service.marketplace.ProviderExchangeFiltersAPI: """Marketplace exchanges filters curate which groups can access an exchange.""" return self._provider_exchange_filters @@ -625,16 +609,12 @@ def provider_listings(self) -> service.marketplace.ProviderListingsAPI: return self._provider_listings @property - def provider_personalization_requests( - self, - ) -> service.marketplace.ProviderPersonalizationRequestsAPI: + def provider_personalization_requests(self) -> service.marketplace.ProviderPersonalizationRequestsAPI: """Personalization requests are an alternate to instantly available listings.""" return self._provider_personalization_requests @property - def provider_provider_analytics_dashboards( - self, - ) -> service.marketplace.ProviderProviderAnalyticsDashboardsAPI: + def provider_provider_analytics_dashboards(self) -> service.marketplace.ProviderProviderAnalyticsDashboardsAPI: """Manage templated analytics solution for providers.""" return self._provider_provider_analytics_dashboards @@ -679,9 +659,7 @@ def query_visualizations(self) -> service.sql.QueryVisualizationsAPI: return self._query_visualizations @property - def query_visualizations_legacy( - self, - ) -> service.sql.QueryVisualizationsLegacyAPI: + def query_visualizations_legacy(self) -> service.sql.QueryVisualizationsLegacyAPI: """This is an evolving API that facilitates the addition and removal of vizualisations from existing queries within the Databricks Workspace.""" return self._query_visualizations_legacy @@ -736,9 +714,7 @@ def serving_endpoints(self) -> ServingEndpointsExt: return self._serving_endpoints @property - def serving_endpoints_data_plane( - self, - ) -> service.serving.ServingEndpointsDataPlaneAPI: + def serving_endpoints_data_plane(self) -> service.serving.ServingEndpointsDataPlaneAPI: """Serving endpoints DataPlane provides a set of operations to interact with data plane endpoints for Serving endpoints service.""" return self._serving_endpoints_data_plane @@ -778,9 +754,7 @@ def tables(self) -> service.catalog.TablesAPI: return self._tables @property - def temporary_table_credentials( - self, - ) -> service.catalog.TemporaryTableCredentialsAPI: + def temporary_table_credentials(self) -> service.catalog.TemporaryTableCredentialsAPI: """Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage locationswhere table data is stored in Databricks.""" return self._temporary_table_credentials @@ -800,16 +774,12 @@ def users(self) -> service.iam.UsersAPI: return self._users @property - def vector_search_endpoints( - self, - ) -> service.vectorsearch.VectorSearchEndpointsAPI: + def vector_search_endpoints(self) -> service.vectorsearch.VectorSearchEndpointsAPI: """**Endpoint**: Represents the compute resources to host vector search indexes.""" return self._vector_search_endpoints @property - def vector_search_indexes( - self, - ) -> service.vectorsearch.VectorSearchIndexesAPI: + def vector_search_indexes(self) -> service.vectorsearch.VectorSearchIndexesAPI: """**Index**: An efficient representation of your embedding vectors that supports real-time and efficient approximate nearest neighbor (ANN) search queries.""" return self._vector_search_indexes @@ -840,11 +810,7 @@ def workspace_conf(self) -> service.settings.WorkspaceConfAPI: def get_workspace_id(self) -> int: """Get the workspace ID of the workspace that this client is connected to.""" - response = self._api_client.do( - "GET", - "/api/2.0/preview/scim/v2/Me", - response_headers=["X-Databricks-Org-Id"], - ) + response = self._api_client.do("GET", "/api/2.0/preview/scim/v2/Me", response_headers=["X-Databricks-Org-Id"]) return int(response["X-Databricks-Org-Id"]) def __repr__(self): @@ -1003,9 +969,7 @@ def log_delivery(self) -> service.billing.LogDeliveryAPI: return self._log_delivery @property - def metastore_assignments( - self, - ) -> service.catalog.AccountMetastoreAssignmentsAPI: + def metastore_assignments(self) -> service.catalog.AccountMetastoreAssignmentsAPI: """These APIs manage metastore assignments to a workspace.""" return self._metastore_assignments @@ -1035,23 +999,17 @@ def private_access(self) -> service.provisioning.PrivateAccessAPI: return self._private_access @property - def published_app_integration( - self, - ) -> service.oauth2.PublishedAppIntegrationAPI: + def published_app_integration(self) -> service.oauth2.PublishedAppIntegrationAPI: """These APIs enable administrators to manage published OAuth app integrations, which is required for adding/using Published OAuth App Integration like Tableau Desktop for Databricks in AWS cloud.""" return self._published_app_integration @property - def service_principal_federation_policy( - self, - ) -> service.oauth2.ServicePrincipalFederationPolicyAPI: + def service_principal_federation_policy(self) -> service.oauth2.ServicePrincipalFederationPolicyAPI: """These APIs manage service principal federation policies.""" return self._service_principal_federation_policy @property - def service_principal_secrets( - self, - ) -> service.oauth2.ServicePrincipalSecretsAPI: + def service_principal_secrets(self) -> service.oauth2.ServicePrincipalSecretsAPI: """These APIs enable administrators to manage service principal secrets.""" return self._service_principal_secrets @@ -1071,9 +1029,7 @@ def storage(self) -> service.provisioning.StorageAPI: return self._storage @property - def storage_credentials( - self, - ) -> service.catalog.AccountStorageCredentialsAPI: + def storage_credentials(self) -> service.catalog.AccountStorageCredentialsAPI: """These APIs manage storage credentials for a particular metastore.""" return self._storage_credentials diff --git a/databricks/sdk/service/apps.py b/databricks/sdk/service/apps.py index a6eea8bf5..24de93f66 100755 --- a/databricks/sdk/service/apps.py +++ b/databricks/sdk/service/apps.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -437,10 +438,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AppDeploymentStatus: """Deserializes the AppDeploymentStatus from a dictionary.""" - return cls( - message=d.get("message", None), - state=_enum(d, "state", AppDeploymentState), - ) + return cls(message=d.get("message", None), state=_enum(d, "state", AppDeploymentState)) @dataclass @@ -560,8 +558,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> AppPermissionsDescription: """Deserializes the AppPermissionsDescription from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", AppPermissionLevel), + description=d.get("description", None), permission_level=_enum(d, "permission_level", AppPermissionLevel) ) @@ -692,10 +689,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AppResourceJob: """Deserializes the AppResourceJob from a dictionary.""" - return cls( - id=d.get("id", None), - permission=_enum(d, "permission", AppResourceJobJobPermission), - ) + return cls(id=d.get("id", None), permission=_enum(d, "permission", AppResourceJobJobPermission)) class AppResourceJobJobPermission(Enum): @@ -790,11 +784,7 @@ def from_dict(cls, d: Dict[str, any]) -> AppResourceServingEndpoint: """Deserializes the AppResourceServingEndpoint from a dictionary.""" return cls( name=d.get("name", None), - permission=_enum( - d, - "permission", - AppResourceServingEndpointServingEndpointPermission, - ), + permission=_enum(d, "permission", AppResourceServingEndpointServingEndpointPermission), ) @@ -836,8 +826,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> AppResourceSqlWarehouse: """Deserializes the AppResourceSqlWarehouse from a dictionary.""" return cls( - id=d.get("id", None), - permission=_enum(d, "permission", AppResourceSqlWarehouseSqlWarehousePermission), + id=d.get("id", None), permission=_enum(d, "permission", AppResourceSqlWarehouseSqlWarehousePermission) ) @@ -885,10 +874,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ApplicationStatus: """Deserializes the ApplicationStatus from a dictionary.""" - return cls( - message=d.get("message", None), - state=_enum(d, "state", ApplicationState), - ) + return cls(message=d.get("message", None), state=_enum(d, "state", ApplicationState)) class ComputeState(Enum): @@ -931,10 +917,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ComputeStatus: """Deserializes the ComputeStatus from a dictionary.""" - return cls( - message=d.get("message", None), - state=_enum(d, "state", ComputeState), - ) + return cls(message=d.get("message", None), state=_enum(d, "state", ComputeState)) @dataclass @@ -1025,10 +1008,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListAppsResponse: """Deserializes the ListAppsResponse from a dictionary.""" - return cls( - apps=_repeated_dict(d, "apps", App), - next_page_token=d.get("next_page_token", None), - ) + return cls(apps=_repeated_dict(d, "apps", App), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1045,17 +1025,13 @@ class StopAppRequest: class AppsAPI: """Apps run directly on a customer’s Databricks instance, integrate with their data, use and extend - Databricks services, and enable users to interact through single sign-on. - """ + Databricks services, and enable users to interact through single sign-on.""" def __init__(self, api_client): self._api = api_client def wait_get_app_active( - self, - name: str, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[App], None]] = None, + self, name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[App], None]] = None ) -> App: deadline = time.time() + timeout.total_seconds() target_states = (ComputeState.ACTIVE,) @@ -1124,10 +1100,7 @@ def wait_get_deployment_app_succeeded( raise TimeoutError(f"timed out after {timeout}: {status_message}") def wait_get_app_stopped( - self, - name: str, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[App], None]] = None, + self, name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[App], None]] = None ) -> App: deadline = time.time() + timeout.total_seconds() target_states = (ComputeState.STOPPED,) @@ -1180,18 +1153,10 @@ def create(self, *, app: Optional[App] = None, no_compute: Optional[bool] = None } op_response = self._api.do("POST", "/api/2.0/apps", query=query, body=body, headers=headers) - return Wait( - self.wait_get_app_active, - response=App.from_dict(op_response), - name=op_response["name"], - ) + return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response["name"]) def create_and_wait( - self, - *, - app: Optional[App] = None, - no_compute: Optional[bool] = None, - timeout=timedelta(minutes=20), + self, *, app: Optional[App] = None, no_compute: Optional[bool] = None, timeout=timedelta(minutes=20) ) -> App: return self.create(app=app, no_compute=no_compute).result(timeout=timeout) @@ -1232,12 +1197,7 @@ def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = Non "Content-Type": "application/json", } - op_response = self._api.do( - "POST", - f"/api/2.0/apps/{app_name}/deployments", - body=body, - headers=headers, - ) + op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/deployments", body=body, headers=headers) return Wait( self.wait_get_deployment_app_succeeded, response=AppDeployment.from_dict(op_response), @@ -1246,11 +1206,7 @@ def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = Non ) def deploy_and_wait( - self, - app_name: str, - *, - app_deployment: Optional[AppDeployment] = None, - timeout=timedelta(minutes=20), + self, app_name: str, *, app_deployment: Optional[AppDeployment] = None, timeout=timedelta(minutes=20) ) -> AppDeployment: return self.deploy(app_deployment=app_deployment, app_name=app_name).result(timeout=timeout) @@ -1289,11 +1245,7 @@ def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/apps/{app_name}/deployments/{deployment_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/apps/{app_name}/deployments/{deployment_id}", headers=headers) return AppDeployment.from_dict(res) def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse: @@ -1311,11 +1263,7 @@ def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/apps/{app_name}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}/permissionLevels", headers=headers) return GetAppPermissionLevelsResponse.from_dict(res) def get_permissions(self, app_name: str) -> AppPermissions: @@ -1336,12 +1284,7 @@ def get_permissions(self, app_name: str) -> AppPermissions: res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}", headers=headers) return AppPermissions.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[App]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]: """List apps. Lists all apps in the workspace. @@ -1373,11 +1316,7 @@ def list( query["page_token"] = json["next_page_token"] def list_deployments( - self, - app_name: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, app_name: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[AppDeployment]: """List app deployments. @@ -1403,12 +1342,7 @@ def list_deployments( } while True: - json = self._api.do( - "GET", - f"/api/2.0/apps/{app_name}/deployments", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/apps/{app_name}/deployments", query=query, headers=headers) if "app_deployments" in json: for v in json["app_deployments"]: yield AppDeployment.from_dict(v) @@ -1417,10 +1351,7 @@ def list_deployments( query["page_token"] = json["next_page_token"] def set_permissions( - self, - app_name: str, - *, - access_control_list: Optional[List[AppAccessControlRequest]] = None, + self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None ) -> AppPermissions: """Set app permissions. @@ -1441,12 +1372,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/apps/{app_name}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers) return AppPermissions.from_dict(res) def start(self, name: str) -> Wait[App]: @@ -1468,11 +1394,7 @@ def start(self, name: str) -> Wait[App]: } op_response = self._api.do("POST", f"/api/2.0/apps/{name}/start", headers=headers) - return Wait( - self.wait_get_app_active, - response=App.from_dict(op_response), - name=op_response["name"], - ) + return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response["name"]) def start_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App: return self.start(name=name).result(timeout=timeout) @@ -1496,11 +1418,7 @@ def stop(self, name: str) -> Wait[App]: } op_response = self._api.do("POST", f"/api/2.0/apps/{name}/stop", headers=headers) - return Wait( - self.wait_get_app_stopped, - response=App.from_dict(op_response), - name=op_response["name"], - ) + return Wait(self.wait_get_app_stopped, response=App.from_dict(op_response), name=op_response["name"]) def stop_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App: return self.stop(name=name).result(timeout=timeout) @@ -1527,10 +1445,7 @@ def update(self, name: str, *, app: Optional[App] = None) -> App: return App.from_dict(res) def update_permissions( - self, - app_name: str, - *, - access_control_list: Optional[List[AppAccessControlRequest]] = None, + self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None ) -> AppPermissions: """Update app permissions. @@ -1550,10 +1465,5 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/apps/{app_name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers) return AppPermissions.from_dict(res) diff --git a/databricks/sdk/service/billing.py b/databricks/sdk/service/billing.py index ed1c1c48c..12f3ac52f 100755 --- a/databricks/sdk/service/billing.py +++ b/databricks/sdk/service/billing.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import compute # all definitions in this file are in alphabetical order @@ -291,10 +292,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> BudgetConfigurationFilterClause: """Deserializes the BudgetConfigurationFilterClause from a dictionary.""" - return cls( - operator=_enum(d, "operator", BudgetConfigurationFilterOperator), - values=d.get("values", None), - ) + return cls(operator=_enum(d, "operator", BudgetConfigurationFilterOperator), values=d.get("values", None)) class BudgetConfigurationFilterOperator(Enum): @@ -329,10 +327,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> BudgetConfigurationFilterTagClause: """Deserializes the BudgetConfigurationFilterTagClause from a dictionary.""" - return cls( - key=d.get("key", None), - value=_from_dict(d, "value", BudgetConfigurationFilterClause), - ) + return cls(key=d.get("key", None), value=_from_dict(d, "value", BudgetConfigurationFilterClause)) @dataclass @@ -362,10 +357,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> BudgetConfigurationFilterWorkspaceIdClause: """Deserializes the BudgetConfigurationFilterWorkspaceIdClause from a dictionary.""" - return cls( - operator=_enum(d, "operator", BudgetConfigurationFilterOperator), - values=d.get("values", None), - ) + return cls(operator=_enum(d, "operator", BudgetConfigurationFilterOperator), values=d.get("values", None)) @dataclass @@ -445,8 +437,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> CreateBillingUsageDashboardRequest: """Deserializes the CreateBillingUsageDashboardRequest from a dictionary.""" return cls( - dashboard_type=_enum(d, "dashboard_type", UsageDashboardType), - workspace_id=d.get("workspace_id", None), + dashboard_type=_enum(d, "dashboard_type", UsageDashboardType), workspace_id=d.get("workspace_id", None) ) @@ -524,9 +515,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreateBudgetConfigurationBudget: return cls( account_id=d.get("account_id", None), alert_configurations=_repeated_dict( - d, - "alert_configurations", - CreateBudgetConfigurationBudgetAlertConfigurations, + d, "alert_configurations", CreateBudgetConfigurationBudgetAlertConfigurations ), display_name=d.get("display_name", None), filter=_from_dict(d, "filter", BudgetConfigurationFilter), @@ -562,10 +551,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateBudgetConfigurationBudgetActionConfigurations: """Deserializes the CreateBudgetConfigurationBudgetActionConfigurations from a dictionary.""" - return cls( - action_type=_enum(d, "action_type", ActionConfigurationType), - target=d.get("target", None), - ) + return cls(action_type=_enum(d, "action_type", ActionConfigurationType), target=d.get("target", None)) @dataclass @@ -623,9 +609,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreateBudgetConfigurationBudgetAlertCon """Deserializes the CreateBudgetConfigurationBudgetAlertConfigurations from a dictionary.""" return cls( action_configurations=_repeated_dict( - d, - "action_configurations", - CreateBudgetConfigurationBudgetActionConfigurations, + d, "action_configurations", CreateBudgetConfigurationBudgetActionConfigurations ), quantity_threshold=d.get("quantity_threshold", None), quantity_type=_enum(d, "quantity_type", AlertConfigurationQuantityType), @@ -866,7 +850,6 @@ def from_dict(cls, d: Dict[str, any]) -> CreateLogDeliveryConfigurationParams: @dataclass class DeleteBudgetConfigurationResponse: - def as_dict(self) -> dict: """Serializes the DeleteBudgetConfigurationResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -885,7 +868,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteBudgetConfigurationResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -909,8 +891,7 @@ class DeliveryStatus(Enum): misconfiguration of customer provided permissions on role or storage. * `SYSTEM_FAILURE`: The latest attempt of log delivery failed because of an Databricks internal error. Contact support if it doesn't go away soon. * `NOT_FOUND`: The log delivery status as the configuration has been - disabled since the release of this feature or there are no workspaces in the account. - """ + disabled since the release of this feature or there are no workspaces in the account.""" CREATED = "CREATED" NOT_FOUND = "NOT_FOUND" @@ -1018,10 +999,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetBillingUsageDashboardResponse: """Deserializes the GetBillingUsageDashboardResponse from a dictionary.""" - return cls( - dashboard_id=d.get("dashboard_id", None), - dashboard_url=d.get("dashboard_url", None), - ) + return cls(dashboard_id=d.get("dashboard_id", None), dashboard_url=d.get("dashboard_url", None)) @dataclass @@ -1099,8 +1077,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListBudgetConfigurationsResponse: """Deserializes the ListBudgetConfigurationsResponse from a dictionary.""" return cls( - budgets=_repeated_dict(d, "budgets", BudgetConfiguration), - next_page_token=d.get("next_page_token", None), + budgets=_repeated_dict(d, "budgets", BudgetConfiguration), next_page_token=d.get("next_page_token", None) ) @@ -1154,8 +1131,7 @@ class LogDeliveryConfigStatus(Enum): """Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration - is not supported, so disable a log delivery configuration that is no longer needed. - """ + is not supported, so disable a log delivery configuration that is no longer needed.""" DISABLED = "DISABLED" ENABLED = "ENABLED" @@ -1422,8 +1398,7 @@ class OutputFormat(Enum): supported. For the schema, see the [Configuring audit logs]. [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html - [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html - """ + [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html""" CSV = "CSV" JSON = "JSON" @@ -1431,7 +1406,6 @@ class OutputFormat(Enum): @dataclass class PatchStatusResponse: - def as_dict(self) -> dict: """Serializes the PatchStatusResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1477,10 +1451,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SortSpec: """Deserializes the SortSpec from a dictionary.""" - return cls( - descending=d.get("descending", None), - field=_enum(d, "field", SortSpecField), - ) + return cls(descending=d.get("descending", None), field=_enum(d, "field", SortSpecField)) class SortSpecField(Enum): @@ -1579,10 +1550,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateBudgetConfigurationRequest: """Deserializes the UpdateBudgetConfigurationRequest from a dictionary.""" - return cls( - budget=_from_dict(d, "budget", UpdateBudgetConfigurationBudget), - budget_id=d.get("budget_id", None), - ) + return cls(budget=_from_dict(d, "budget", UpdateBudgetConfigurationBudget), budget_id=d.get("budget_id", None)) @dataclass @@ -1676,11 +1644,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> WrappedCreateLogDeliveryConfiguration: """Deserializes the WrappedCreateLogDeliveryConfiguration from a dictionary.""" return cls( - log_delivery_configuration=_from_dict( - d, - "log_delivery_configuration", - CreateLogDeliveryConfigurationParams, - ) + log_delivery_configuration=_from_dict(d, "log_delivery_configuration", CreateLogDeliveryConfigurationParams) ) @@ -1741,13 +1705,7 @@ class BillableUsageAPI: def __init__(self, api_client): self._api = api_client - def download( - self, - start_month: str, - end_month: str, - *, - personal_data: Optional[bool] = None, - ) -> DownloadResponse: + def download(self, start_month: str, end_month: str, *, personal_data: Optional[bool] = None) -> DownloadResponse: """Return billable usage logs. Returns billable usage logs in CSV format for the specified account and date range. For the data @@ -1783,11 +1741,7 @@ def download( } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/usage/download", - query=query, - headers=headers, - raw=True, + "GET", f"/api/2.0/accounts/{self._api.account_id}/usage/download", query=query, headers=headers, raw=True ) return DownloadResponse.from_dict(res) @@ -1833,10 +1787,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.1/accounts/{self._api.account_id}/budget-policies", - body=body, - headers=headers, + "POST", f"/api/2.1/accounts/{self._api.account_id}/budget-policies", body=body, headers=headers ) return BudgetPolicy.from_dict(res) @@ -1855,11 +1806,7 @@ def delete(self, policy_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", headers=headers) def get(self, policy_id: str) -> BudgetPolicy: """Get a budget policy. @@ -1877,9 +1824,7 @@ def get(self, policy_id: str) -> BudgetPolicy: } res = self._api.do( - "GET", - f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", - headers=headers, + "GET", f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", headers=headers ) return BudgetPolicy.from_dict(res) @@ -1927,10 +1872,7 @@ def list( while True: json = self._api.do( - "GET", - f"/api/2.1/accounts/{self._api.account_id}/budget-policies", - query=query, - headers=headers, + "GET", f"/api/2.1/accounts/{self._api.account_id}/budget-policies", query=query, headers=headers ) if "policies" in json: for v in json["policies"]: @@ -1940,11 +1882,7 @@ def list( query["page_token"] = json["next_page_token"] def update( - self, - policy_id: str, - *, - limit_config: Optional[LimitConfig] = None, - policy: Optional[BudgetPolicy] = None, + self, policy_id: str, *, limit_config: Optional[LimitConfig] = None, policy: Optional[BudgetPolicy] = None ) -> BudgetPolicy: """Update a budget policy. @@ -2005,12 +1943,7 @@ def create(self, budget: CreateBudgetConfigurationBudget) -> CreateBudgetConfigu "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.1/accounts/{self._api.account_id}/budgets", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.1/accounts/{self._api.account_id}/budgets", body=body, headers=headers) return CreateBudgetConfigurationResponse.from_dict(res) def delete(self, budget_id: str): @@ -2029,11 +1962,7 @@ def delete(self, budget_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", headers=headers) def get(self, budget_id: str) -> GetBudgetConfigurationResponse: """Get budget. @@ -2050,11 +1979,7 @@ def get(self, budget_id: str) -> GetBudgetConfigurationResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", headers=headers) return GetBudgetConfigurationResponse.from_dict(res) def list(self, *, page_token: Optional[str] = None) -> Iterator[BudgetConfiguration]: @@ -2078,10 +2003,7 @@ def list(self, *, page_token: Optional[str] = None) -> Iterator[BudgetConfigurat while True: json = self._api.do( - "GET", - f"/api/2.1/accounts/{self._api.account_id}/budgets", - query=query, - headers=headers, + "GET", f"/api/2.1/accounts/{self._api.account_id}/budgets", query=query, headers=headers ) if "budgets" in json: for v in json["budgets"]: @@ -2112,10 +2034,7 @@ def update(self, budget_id: str, budget: UpdateBudgetConfigurationBudget) -> Upd } res = self._api.do( - "PUT", - f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", - body=body, - headers=headers, + "PUT", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", body=body, headers=headers ) return UpdateBudgetConfigurationResponse.from_dict(res) @@ -2166,16 +2085,13 @@ class LogDeliveryAPI: [Audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html [Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html [Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html - [create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html - """ + [create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html""" def __init__(self, api_client): self._api = api_client def create( - self, - *, - log_delivery_configuration: Optional[CreateLogDeliveryConfigurationParams] = None, + self, *, log_delivery_configuration: Optional[CreateLogDeliveryConfigurationParams] = None ) -> WrappedLogDeliveryConfiguration: """Create a new log delivery configuration. @@ -2212,12 +2128,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/log-delivery", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/log-delivery", body=body, headers=headers) return WrappedLogDeliveryConfiguration.from_dict(res) def get(self, log_delivery_configuration_id: str) -> WrappedLogDeliveryConfiguration: @@ -2275,19 +2186,12 @@ def list( } json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/log-delivery", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/log-delivery", query=query, headers=headers ) parsed = WrappedLogDeliveryConfigurations.from_dict(json).log_delivery_configurations return parsed if parsed is not None else [] - def patch_status( - self, - log_delivery_configuration_id: str, - status: LogDeliveryConfigStatus, - ): + def patch_status(self, log_delivery_configuration_id: str, status: LogDeliveryConfigStatus): """Enable or disable log delivery configuration. Enables or disables a log delivery configuration. Deletion of delivery configurations is not @@ -2330,10 +2234,7 @@ def __init__(self, api_client): self._api = api_client def create( - self, - *, - dashboard_type: Optional[UsageDashboardType] = None, - workspace_id: Optional[int] = None, + self, *, dashboard_type: Optional[UsageDashboardType] = None, workspace_id: Optional[int] = None ) -> CreateBillingUsageDashboardResponse: """Create new usage dashboard. @@ -2357,19 +2258,11 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/dashboard", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/dashboard", body=body, headers=headers) return CreateBillingUsageDashboardResponse.from_dict(res) def get( - self, - *, - dashboard_type: Optional[UsageDashboardType] = None, - workspace_id: Optional[int] = None, + self, *, dashboard_type: Optional[UsageDashboardType] = None, workspace_id: Optional[int] = None ) -> GetBillingUsageDashboardResponse: """Get usage dashboard. @@ -2393,10 +2286,5 @@ def get( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/dashboard", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/dashboard", query=query, headers=headers) return GetBillingUsageDashboardResponse.from_dict(res) diff --git a/databricks/sdk/service/catalog.py b/databricks/sdk/service/catalog.py index 038dd6d42..accf98ab1 100755 --- a/databricks/sdk/service/catalog.py +++ b/databricks/sdk/service/catalog.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -219,8 +220,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> AccountsUpdateMetastore: """Deserializes the AccountsUpdateMetastore from a dictionary.""" return cls( - metastore_id=d.get("metastore_id", None), - metastore_info=_from_dict(d, "metastore_info", UpdateMetastore), + metastore_id=d.get("metastore_id", None), metastore_info=_from_dict(d, "metastore_info", UpdateMetastore) ) @@ -388,10 +388,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ArtifactMatcher: """Deserializes the ArtifactMatcher from a dictionary.""" - return cls( - artifact=d.get("artifact", None), - match_type=_enum(d, "match_type", MatchType), - ) + return cls(artifact=d.get("artifact", None), match_type=_enum(d, "match_type", MatchType)) class ArtifactType(Enum): @@ -404,7 +401,6 @@ class ArtifactType(Enum): @dataclass class AssignResponse: - def as_dict(self) -> dict: """Serializes the AssignResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -424,8 +420,7 @@ def from_dict(cls, d: Dict[str, any]) -> AssignResponse: @dataclass class AwsCredentials: """AWS temporary credentials for API authentication. Read more at - https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. - """ + https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html.""" access_key_id: Optional[str] = None """The access key ID that identifies the temporary credentials.""" @@ -596,8 +591,7 @@ def from_dict(cls, d: Dict[str, any]) -> AwsIamRoleResponse: class AzureActiveDirectoryToken: """Azure Active Directory token, essentially the Oauth token for Azure Service Principal or Managed Identity. Read more at - https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token - """ + https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token""" aad_token: Optional[str] = None """Opaque token that contains claims that you can use in Azure Active Directory to access cloud @@ -811,8 +805,7 @@ def from_dict(cls, d: Dict[str, any]) -> AzureServicePrincipal: @dataclass class AzureUserDelegationSas: """Azure temporary credentials for API authentication. Read more at - https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas - """ + https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas""" sas_token: Optional[str] = None """The signed URI (SAS Token) used to access blob services for a given path""" @@ -839,7 +832,6 @@ def from_dict(cls, d: Dict[str, any]) -> AzureUserDelegationSas: @dataclass class CancelRefreshResponse: - def as_dict(self) -> dict: """Serializes the CancelRefreshResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1041,15 +1033,9 @@ def from_dict(cls, d: Dict[str, any]) -> CatalogInfo: created_at=d.get("created_at", None), created_by=d.get("created_by", None), effective_predictive_optimization_flag=_from_dict( - d, - "effective_predictive_optimization_flag", - EffectivePredictiveOptimizationFlag, - ), - enable_predictive_optimization=_enum( - d, - "enable_predictive_optimization", - EnablePredictiveOptimization, + d, "effective_predictive_optimization_flag", EffectivePredictiveOptimizationFlag ), + enable_predictive_optimization=_enum(d, "enable_predictive_optimization", EnablePredictiveOptimization), full_name=d.get("full_name", None), isolation_mode=_enum(d, "isolation_mode", CatalogIsolationMode), metastore_id=d.get("metastore_id", None), @@ -1270,10 +1256,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ColumnMask: """Deserializes the ColumnMask from a dictionary.""" - return cls( - function_name=d.get("function_name", None), - using_column_names=d.get("using_column_names", None), - ) + return cls(function_name=d.get("function_name", None), using_column_names=d.get("using_column_names", None)) class ColumnTypeName(Enum): @@ -1765,11 +1748,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreateCredentialRequest: azure_managed_identity=_from_dict(d, "azure_managed_identity", AzureManagedIdentity), azure_service_principal=_from_dict(d, "azure_service_principal", AzureServicePrincipal), comment=d.get("comment", None), - databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccount, - ), + databricks_gcp_service_account=_from_dict(d, "databricks_gcp_service_account", DatabricksGcpServiceAccount), name=d.get("name", None), purpose=_enum(d, "purpose", CredentialPurpose), read_only=d.get("read_only", None), @@ -2152,11 +2131,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateMetastore: """Deserializes the CreateMetastore from a dictionary.""" - return cls( - name=d.get("name", None), - region=d.get("region", None), - storage_root=d.get("storage_root", None), - ) + return cls(name=d.get("name", None), region=d.get("region", None), storage_root=d.get("storage_root", None)) @dataclass @@ -2326,11 +2301,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreateMonitor: assets_dir=d.get("assets_dir", None), baseline_table_name=d.get("baseline_table_name", None), custom_metrics=_repeated_dict(d, "custom_metrics", MonitorMetric), - data_classification_config=_from_dict( - d, - "data_classification_config", - MonitorDataClassificationConfig, - ), + data_classification_config=_from_dict(d, "data_classification_config", MonitorDataClassificationConfig), inference_log=_from_dict(d, "inference_log", MonitorInferenceLog), notifications=_from_dict(d, "notifications", MonitorNotifications), output_schema_name=d.get("output_schema_name", None), @@ -2405,7 +2376,6 @@ def from_dict(cls, d: Dict[str, any]) -> CreateRegisteredModelRequest: @dataclass class CreateResponse: - def as_dict(self) -> dict: """Serializes the CreateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2566,9 +2536,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreateStorageCredential: cloudflare_api_token=_from_dict(d, "cloudflare_api_token", CloudflareApiToken), comment=d.get("comment", None), databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccountRequest, + d, "databricks_gcp_service_account", DatabricksGcpServiceAccountRequest ), name=d.get("name", None), read_only=d.get("read_only", None), @@ -2606,10 +2574,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateTableConstraint: """Deserializes the CreateTableConstraint from a dictionary.""" - return cls( - constraint=_from_dict(d, "constraint", TableConstraint), - full_name_arg=d.get("full_name_arg", None), - ) + return cls(constraint=_from_dict(d, "constraint", TableConstraint), full_name_arg=d.get("full_name_arg", None)) @dataclass @@ -2829,11 +2794,7 @@ def from_dict(cls, d: Dict[str, any]) -> CredentialInfo: comment=d.get("comment", None), created_at=d.get("created_at", None), created_by=d.get("created_by", None), - databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccount, - ), + databricks_gcp_service_account=_from_dict(d, "databricks_gcp_service_account", DatabricksGcpServiceAccount), full_name=d.get("full_name", None), id=d.get("id", None), isolation_mode=_enum(d, "isolation_mode", IsolationMode), @@ -2890,10 +2851,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CredentialValidationResult: """Deserializes the CredentialValidationResult from a dictionary.""" - return cls( - message=d.get("message", None), - result=_enum(d, "result", ValidateCredentialResult), - ) + return cls(message=d.get("message", None), result=_enum(d, "result", ValidateCredentialResult)) @dataclass @@ -3000,7 +2958,6 @@ def from_dict(cls, d: Dict[str, any]) -> DatabricksGcpServiceAccount: @dataclass class DatabricksGcpServiceAccountRequest: - def as_dict(self) -> dict: """Serializes the DatabricksGcpServiceAccountRequest into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3046,15 +3003,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DatabricksGcpServiceAccountResponse: """Deserializes the DatabricksGcpServiceAccountResponse from a dictionary.""" - return cls( - credential_id=d.get("credential_id", None), - email=d.get("email", None), - ) + return cls(credential_id=d.get("credential_id", None), email=d.get("email", None)) @dataclass class DeleteAliasResponse: - def as_dict(self) -> dict: """Serializes the DeleteAliasResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3073,7 +3026,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteAliasResponse: @dataclass class DeleteCredentialResponse: - def as_dict(self) -> dict: """Serializes the DeleteCredentialResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3092,7 +3044,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteCredentialResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3112,8 +3063,7 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteResponse: @dataclass class DeltaRuntimePropertiesKvPairs: """Properties pertaining to the current state of the delta table as given by the commit server. - This does not contain **delta.*** (input) properties in __TableInfo.properties__. - """ + This does not contain **delta.*** (input) properties in __TableInfo.properties__.""" delta_runtime_properties: Dict[str, str] """A map of key-value properties attached to the securable.""" @@ -3171,8 +3121,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> Dependency: """Deserializes the Dependency from a dictionary.""" return cls( - function=_from_dict(d, "function", FunctionDependency), - table=_from_dict(d, "table", TableDependency), + function=_from_dict(d, "function", FunctionDependency), table=_from_dict(d, "table", TableDependency) ) @@ -3205,7 +3154,6 @@ def from_dict(cls, d: Dict[str, any]) -> DependencyList: @dataclass class DisableResponse: - def as_dict(self) -> dict: """Serializes the DisableResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3287,11 +3235,7 @@ def from_dict(cls, d: Dict[str, any]) -> EffectivePredictiveOptimizationFlag: """Deserializes the EffectivePredictiveOptimizationFlag from a dictionary.""" return cls( inherited_from_name=d.get("inherited_from_name", None), - inherited_from_type=_enum( - d, - "inherited_from_type", - EffectivePredictiveOptimizationFlagInheritedFromType, - ), + inherited_from_type=_enum(d, "inherited_from_type", EffectivePredictiveOptimizationFlagInheritedFromType), value=_enum(d, "value", EnablePredictiveOptimization), ) @@ -3378,10 +3322,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EffectivePrivilegeAssignment: """Deserializes the EffectivePrivilegeAssignment from a dictionary.""" - return cls( - principal=d.get("principal", None), - privileges=_repeated_dict(d, "privileges", EffectivePrivilege), - ) + return cls(principal=d.get("principal", None), privileges=_repeated_dict(d, "privileges", EffectivePrivilege)) class EnablePredictiveOptimization(Enum): @@ -3394,7 +3335,6 @@ class EnablePredictiveOptimization(Enum): @dataclass class EnableResponse: - def as_dict(self) -> dict: """Serializes the EnableResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4281,11 +4221,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> GenerateTemporaryServiceCredentialRequest: """Deserializes the GenerateTemporaryServiceCredentialRequest from a dictionary.""" return cls( - azure_options=_from_dict( - d, - "azure_options", - GenerateTemporaryServiceCredentialAzureOptions, - ), + azure_options=_from_dict(d, "azure_options", GenerateTemporaryServiceCredentialAzureOptions), credential_name=d.get("credential_name", None), gcp_options=_from_dict(d, "gcp_options", GenerateTemporaryServiceCredentialGcpOptions), ) @@ -4322,10 +4258,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GenerateTemporaryTableCredentialRequest: """Deserializes the GenerateTemporaryTableCredentialRequest from a dictionary.""" - return cls( - operation=_enum(d, "operation", TableOperation), - table_id=d.get("table_id", None), - ) + return cls(operation=_enum(d, "operation", TableOperation), table_id=d.get("table_id", None)) @dataclass @@ -4580,11 +4513,7 @@ def from_dict(cls, d: Dict[str, any]) -> GetMetastoreSummaryResponse: delta_sharing_recipient_token_lifetime_in_seconds=d.get( "delta_sharing_recipient_token_lifetime_in_seconds", None ), - delta_sharing_scope=_enum( - d, - "delta_sharing_scope", - GetMetastoreSummaryResponseDeltaSharingScope, - ), + delta_sharing_scope=_enum(d, "delta_sharing_scope", GetMetastoreSummaryResponseDeltaSharingScope), external_access_enabled=d.get("external_access_enabled", None), global_metastore_id=d.get("global_metastore_id", None), metastore_id=d.get("metastore_id", None), @@ -4719,10 +4648,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListCatalogsResponse: """Deserializes the ListCatalogsResponse from a dictionary.""" - return cls( - catalogs=_repeated_dict(d, "catalogs", CatalogInfo), - next_page_token=d.get("next_page_token", None), - ) + return cls(catalogs=_repeated_dict(d, "catalogs", CatalogInfo), next_page_token=d.get("next_page_token", None)) @dataclass @@ -4756,8 +4682,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListConnectionsResponse: """Deserializes the ListConnectionsResponse from a dictionary.""" return cls( - connections=_repeated_dict(d, "connections", ConnectionInfo), - next_page_token=d.get("next_page_token", None), + connections=_repeated_dict(d, "connections", ConnectionInfo), next_page_token=d.get("next_page_token", None) ) @@ -4791,8 +4716,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListCredentialsResponse: """Deserializes the ListCredentialsResponse from a dictionary.""" return cls( - credentials=_repeated_dict(d, "credentials", CredentialInfo), - next_page_token=d.get("next_page_token", None), + credentials=_repeated_dict(d, "credentials", CredentialInfo), next_page_token=d.get("next_page_token", None) ) @@ -4863,8 +4787,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListFunctionsResponse: """Deserializes the ListFunctionsResponse from a dictionary.""" return cls( - functions=_repeated_dict(d, "functions", FunctionInfo), - next_page_token=d.get("next_page_token", None), + functions=_repeated_dict(d, "functions", FunctionInfo), next_page_token=d.get("next_page_token", None) ) @@ -4958,10 +4881,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListQuotasResponse: """Deserializes the ListQuotasResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - quotas=_repeated_dict(d, "quotas", QuotaInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), quotas=_repeated_dict(d, "quotas", QuotaInfo)) @dataclass @@ -5029,10 +4949,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListSchemasResponse: """Deserializes the ListSchemasResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - schemas=_repeated_dict(d, "schemas", SchemaInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), schemas=_repeated_dict(d, "schemas", SchemaInfo)) @dataclass @@ -5101,8 +5018,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListSystemSchemasResponse: """Deserializes the ListSystemSchemasResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - schemas=_repeated_dict(d, "schemas", SystemSchemaInfo), + next_page_token=d.get("next_page_token", None), schemas=_repeated_dict(d, "schemas", SystemSchemaInfo) ) @@ -5136,10 +5052,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListTableSummariesResponse: """Deserializes the ListTableSummariesResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - tables=_repeated_dict(d, "tables", TableSummary), - ) + return cls(next_page_token=d.get("next_page_token", None), tables=_repeated_dict(d, "tables", TableSummary)) @dataclass @@ -5172,10 +5085,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListTablesResponse: """Deserializes the ListTablesResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - tables=_repeated_dict(d, "tables", TableInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), tables=_repeated_dict(d, "tables", TableInfo)) @dataclass @@ -5208,10 +5118,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListVolumesResponseContent: """Deserializes the ListVolumesResponseContent from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - volumes=_repeated_dict(d, "volumes", VolumeInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), volumes=_repeated_dict(d, "volumes", VolumeInfo)) class MatchType(Enum): @@ -5625,8 +5532,7 @@ def from_dict(cls, d: Dict[str, any]) -> ModelVersionInfo: class ModelVersionInfoStatus(Enum): """Current status of the model version. Newly created model versions start in PENDING_REGISTRATION status, then move to READY status once the model version files are uploaded and the model - version is finalized. Only model versions in READY status can be loaded for inference or served. - """ + version is finalized. Only model versions in READY status can be loaded for inference or served.""" FAILED_REGISTRATION = "FAILED_REGISTRATION" PENDING_REGISTRATION = "PENDING_REGISTRATION" @@ -5983,11 +5889,7 @@ def from_dict(cls, d: Dict[str, any]) -> MonitorInfo: baseline_table_name=d.get("baseline_table_name", None), custom_metrics=_repeated_dict(d, "custom_metrics", MonitorMetric), dashboard_id=d.get("dashboard_id", None), - data_classification_config=_from_dict( - d, - "data_classification_config", - MonitorDataClassificationConfig, - ), + data_classification_config=_from_dict(d, "data_classification_config", MonitorDataClassificationConfig), drift_metrics_table_name=d.get("drift_metrics_table_name", None), inference_log=_from_dict(d, "inference_log", MonitorInferenceLog), latest_monitor_failure_msg=d.get("latest_monitor_failure_msg", None), @@ -6090,8 +5992,7 @@ class MonitorMetricType(Enum): ``"CUSTOM_METRIC_TYPE_DRIFT"`` compare metrics across baseline and input table, or across the two consecutive time windows. - CUSTOM_METRIC_TYPE_AGGREGATE: only depend on the existing columns in your table - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed aggregate - metrics - CUSTOM_METRIC_TYPE_DRIFT: depend on previously computed aggregate or derived metrics - """ + metrics - CUSTOM_METRIC_TYPE_DRIFT: depend on previously computed aggregate or derived metrics""" CUSTOM_METRIC_TYPE_AGGREGATE = "CUSTOM_METRIC_TYPE_AGGREGATE" CUSTOM_METRIC_TYPE_DERIVED = "CUSTOM_METRIC_TYPE_DERIVED" @@ -6244,7 +6145,6 @@ def from_dict(cls, d: Dict[str, any]) -> MonitorRefreshListResponse: @dataclass class MonitorSnapshot: - def as_dict(self) -> dict: """Serializes the MonitorSnapshot into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6296,10 +6196,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> MonitorTimeSeries: """Deserializes the MonitorTimeSeries from a dictionary.""" - return cls( - granularities=d.get("granularities", None), - timestamp_col=d.get("timestamp_col", None), - ) + return cls(granularities=d.get("granularities", None), timestamp_col=d.get("timestamp_col", None)) @dataclass @@ -6466,11 +6363,7 @@ def from_dict(cls, d: Dict[str, any]) -> OnlineTableSpec: perform_full_copy=d.get("perform_full_copy", None), pipeline_id=d.get("pipeline_id", None), primary_key_columns=d.get("primary_key_columns", None), - run_continuously=_from_dict( - d, - "run_continuously", - OnlineTableSpecContinuousSchedulingPolicy, - ), + run_continuously=_from_dict(d, "run_continuously", OnlineTableSpecContinuousSchedulingPolicy), run_triggered=_from_dict(d, "run_triggered", OnlineTableSpecTriggeredSchedulingPolicy), source_table_full_name=d.get("source_table_full_name", None), timeseries_key=d.get("timeseries_key", None), @@ -6479,7 +6372,6 @@ def from_dict(cls, d: Dict[str, any]) -> OnlineTableSpec: @dataclass class OnlineTableSpecContinuousSchedulingPolicy: - def as_dict(self) -> dict: """Serializes the OnlineTableSpecContinuousSchedulingPolicy into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6498,7 +6390,6 @@ def from_dict(cls, d: Dict[str, any]) -> OnlineTableSpecContinuousSchedulingPoli @dataclass class OnlineTableSpecTriggeredSchedulingPolicy: - def as_dict(self) -> dict: """Serializes the OnlineTableSpecTriggeredSchedulingPolicy into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6763,10 +6654,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PrimaryKeyConstraint: """Deserializes the PrimaryKeyConstraint from a dictionary.""" - return cls( - child_columns=d.get("child_columns", None), - name=d.get("name", None), - ) + return cls(child_columns=d.get("child_columns", None), name=d.get("name", None)) class Privilege(Enum): @@ -6847,10 +6735,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PrivilegeAssignment: """Deserializes the PrivilegeAssignment from a dictionary.""" - return cls( - principal=d.get("principal", None), - privileges=_repeated_enum(d, "privileges", Privilege), - ) + return cls(principal=d.get("principal", None), privileges=_repeated_enum(d, "privileges", Privilege)) PropertiesKvPairs = Dict[str, str] @@ -6895,8 +6780,7 @@ class ProvisioningInfoState(Enum): @dataclass class ProvisioningStatus: """Detailed status of an online table. Shown if the online table is in the - PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT state. - """ + PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT state.""" initial_pipeline_sync_progress: Optional[PipelineProgress] = None """Details about initial data synchronization. Only populated when in the @@ -7065,10 +6949,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RegenerateDashboardRequest: """Deserializes the RegenerateDashboardRequest from a dictionary.""" - return cls( - table_name=d.get("table_name", None), - warehouse_id=d.get("warehouse_id", None), - ) + return cls(table_name=d.get("table_name", None), warehouse_id=d.get("warehouse_id", None)) @dataclass @@ -7100,10 +6981,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RegenerateDashboardResponse: """Deserializes the RegenerateDashboardResponse from a dictionary.""" - return cls( - dashboard_id=d.get("dashboard_id", None), - parent_folder=d.get("parent_folder", None), - ) + return cls(dashboard_id=d.get("dashboard_id", None), parent_folder=d.get("parent_folder", None)) @dataclass @@ -7137,10 +7015,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RegisteredModelAlias: """Deserializes the RegisteredModelAlias from a dictionary.""" - return cls( - alias_name=d.get("alias_name", None), - version_num=d.get("version_num", None), - ) + return cls(alias_name=d.get("alias_name", None), version_num=d.get("version_num", None)) @dataclass @@ -7424,15 +7299,9 @@ def from_dict(cls, d: Dict[str, any]) -> SchemaInfo: created_at=d.get("created_at", None), created_by=d.get("created_by", None), effective_predictive_optimization_flag=_from_dict( - d, - "effective_predictive_optimization_flag", - EffectivePredictiveOptimizationFlag, - ), - enable_predictive_optimization=_enum( - d, - "enable_predictive_optimization", - EnablePredictiveOptimization, + d, "effective_predictive_optimization_flag", EffectivePredictiveOptimizationFlag ), + enable_predictive_optimization=_enum(d, "enable_predictive_optimization", EnablePredictiveOptimization), full_name=d.get("full_name", None), metastore_id=d.get("metastore_id", None), name=d.get("name", None), @@ -7448,6 +7317,7 @@ def from_dict(cls, d: Dict[str, any]) -> SchemaInfo: SecurableOptionsMap = Dict[str, str] + SecurablePropertiesMap = Dict[str, str] @@ -7543,9 +7413,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> SetRegisteredModelAliasRequest: """Deserializes the SetRegisteredModelAliasRequest from a dictionary.""" return cls( - alias=d.get("alias", None), - full_name=d.get("full_name", None), - version_num=d.get("version_num", None), + alias=d.get("alias", None), full_name=d.get("full_name", None), version_num=d.get("version_num", None) ) @@ -7742,9 +7610,7 @@ def from_dict(cls, d: Dict[str, any]) -> StorageCredentialInfo: created_at=d.get("created_at", None), created_by=d.get("created_by", None), databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccountResponse, + d, "databricks_gcp_service_account", DatabricksGcpServiceAccountResponse ), full_name=d.get("full_name", None), id=d.get("id", None), @@ -7789,10 +7655,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SystemSchemaInfo: """Deserializes the SystemSchemaInfo from a dictionary.""" - return cls( - schema=d.get("schema", None), - state=_enum(d, "state", SystemSchemaInfoState), - ) + return cls(schema=d.get("schema", None), state=_enum(d, "state", SystemSchemaInfoState)) class SystemSchemaInfoState(Enum): @@ -7809,8 +7672,7 @@ class SystemSchemaInfoState(Enum): @dataclass class TableConstraint: """A table constraint, as defined by *one* of the following fields being set: - __primary_key_constraint__, __foreign_key_constraint__, __named_table_constraint__. - """ + __primary_key_constraint__, __foreign_key_constraint__, __named_table_constraint__.""" foreign_key_constraint: Optional[ForeignKeyConstraint] = None @@ -8158,20 +8020,12 @@ def from_dict(cls, d: Dict[str, any]) -> TableInfo: data_source_format=_enum(d, "data_source_format", DataSourceFormat), deleted_at=d.get("deleted_at", None), delta_runtime_properties_kvpairs=_from_dict( - d, - "delta_runtime_properties_kvpairs", - DeltaRuntimePropertiesKvPairs, + d, "delta_runtime_properties_kvpairs", DeltaRuntimePropertiesKvPairs ), effective_predictive_optimization_flag=_from_dict( - d, - "effective_predictive_optimization_flag", - EffectivePredictiveOptimizationFlag, - ), - enable_predictive_optimization=_enum( - d, - "enable_predictive_optimization", - EnablePredictiveOptimization, + d, "effective_predictive_optimization_flag", EffectivePredictiveOptimizationFlag ), + enable_predictive_optimization=_enum(d, "enable_predictive_optimization", EnablePredictiveOptimization), encryption_details=_from_dict(d, "encryption_details", EncryptionDetails), full_name=d.get("full_name", None), metastore_id=d.get("metastore_id", None), @@ -8230,10 +8084,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> TableRowFilter: """Deserializes the TableRowFilter from a dictionary.""" - return cls( - function_name=d.get("function_name", None), - input_column_names=d.get("input_column_names", None), - ) + return cls(function_name=d.get("function_name", None), input_column_names=d.get("input_column_names", None)) @dataclass @@ -8264,10 +8115,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> TableSummary: """Deserializes the TableSummary from a dictionary.""" - return cls( - full_name=d.get("full_name", None), - table_type=_enum(d, "table_type", TableType), - ) + return cls(full_name=d.get("full_name", None), table_type=_enum(d, "table_type", TableType)) class TableType(Enum): @@ -8388,7 +8236,6 @@ def from_dict(cls, d: Dict[str, any]) -> TriggeredUpdateStatus: @dataclass class UnassignResponse: - def as_dict(self) -> dict: """Serializes the UnassignResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8407,7 +8254,6 @@ def from_dict(cls, d: Dict[str, any]) -> UnassignResponse: @dataclass class UpdateAssignmentResponse: - def as_dict(self) -> dict: """Serializes the UpdateAssignmentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8505,11 +8351,7 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateCatalog: """Deserializes the UpdateCatalog from a dictionary.""" return cls( comment=d.get("comment", None), - enable_predictive_optimization=_enum( - d, - "enable_predictive_optimization", - EnablePredictiveOptimization, - ), + enable_predictive_optimization=_enum(d, "enable_predictive_optimization", EnablePredictiveOptimization), isolation_mode=_enum(d, "isolation_mode", CatalogIsolationMode), name=d.get("name", None), new_name=d.get("new_name", None), @@ -8676,11 +8518,7 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateCredentialRequest: azure_managed_identity=_from_dict(d, "azure_managed_identity", AzureManagedIdentity), azure_service_principal=_from_dict(d, "azure_service_principal", AzureServicePrincipal), comment=d.get("comment", None), - databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccount, - ), + databricks_gcp_service_account=_from_dict(d, "databricks_gcp_service_account", DatabricksGcpServiceAccount), force=d.get("force", None), isolation_mode=_enum(d, "isolation_mode", IsolationMode), name_arg=d.get("name_arg", None), @@ -9025,11 +8863,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateModelVersionRequest: """Deserializes the UpdateModelVersionRequest from a dictionary.""" - return cls( - comment=d.get("comment", None), - full_name=d.get("full_name", None), - version=d.get("version", None), - ) + return cls(comment=d.get("comment", None), full_name=d.get("full_name", None), version=d.get("version", None)) @dataclass @@ -9141,11 +8975,7 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateMonitor: baseline_table_name=d.get("baseline_table_name", None), custom_metrics=_repeated_dict(d, "custom_metrics", MonitorMetric), dashboard_id=d.get("dashboard_id", None), - data_classification_config=_from_dict( - d, - "data_classification_config", - MonitorDataClassificationConfig, - ), + data_classification_config=_from_dict(d, "data_classification_config", MonitorDataClassificationConfig), inference_log=_from_dict(d, "inference_log", MonitorInferenceLog), notifications=_from_dict(d, "notifications", MonitorNotifications), output_schema_name=d.get("output_schema_name", None), @@ -9253,7 +9083,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateRegisteredModelRequest: @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -9329,11 +9158,7 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateSchema: """Deserializes the UpdateSchema from a dictionary.""" return cls( comment=d.get("comment", None), - enable_predictive_optimization=_enum( - d, - "enable_predictive_optimization", - EnablePredictiveOptimization, - ), + enable_predictive_optimization=_enum(d, "enable_predictive_optimization", EnablePredictiveOptimization), full_name=d.get("full_name", None), new_name=d.get("new_name", None), owner=d.get("owner", None), @@ -9453,9 +9278,7 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateStorageCredential: cloudflare_api_token=_from_dict(d, "cloudflare_api_token", CloudflareApiToken), comment=d.get("comment", None), databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccountRequest, + d, "databricks_gcp_service_account", DatabricksGcpServiceAccountRequest ), force=d.get("force", None), isolation_mode=_enum(d, "isolation_mode", IsolationMode), @@ -9719,10 +9542,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ValidateCredentialResponse: """Deserializes the ValidateCredentialResponse from a dictionary.""" - return cls( - is_dir=d.get("isDir", None), - results=_repeated_dict(d, "results", CredentialValidationResult), - ) + return cls(is_dir=d.get("isDir", None), results=_repeated_dict(d, "results", CredentialValidationResult)) class ValidateCredentialResult(Enum): @@ -9817,9 +9637,7 @@ def from_dict(cls, d: Dict[str, any]) -> ValidateStorageCredential: azure_service_principal=_from_dict(d, "azure_service_principal", AzureServicePrincipal), cloudflare_api_token=_from_dict(d, "cloudflare_api_token", CloudflareApiToken), databricks_gcp_service_account=_from_dict( - d, - "databricks_gcp_service_account", - DatabricksGcpServiceAccountRequest, + d, "databricks_gcp_service_account", DatabricksGcpServiceAccountRequest ), external_location_name=d.get("external_location_name", None), read_only=d.get("read_only", None), @@ -9857,10 +9675,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ValidateStorageCredentialResponse: """Deserializes the ValidateStorageCredentialResponse from a dictionary.""" - return cls( - is_dir=d.get("isDir", None), - results=_repeated_dict(d, "results", ValidationResult), - ) + return cls(is_dir=d.get("isDir", None), results=_repeated_dict(d, "results", ValidationResult)) @dataclass @@ -10111,8 +9926,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> WorkspaceBinding: """Deserializes the WorkspaceBinding from a dictionary.""" return cls( - binding_type=_enum(d, "binding_type", WorkspaceBindingBindingType), - workspace_id=d.get("workspace_id", None), + binding_type=_enum(d, "binding_type", WorkspaceBindingBindingType), workspace_id=d.get("workspace_id", None) ) @@ -10155,8 +9969,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> WorkspaceBindingsResponse: """Deserializes the WorkspaceBindingsResponse from a dictionary.""" return cls( - bindings=_repeated_dict(d, "bindings", WorkspaceBinding), - next_page_token=d.get("next_page_token", None), + bindings=_repeated_dict(d, "bindings", WorkspaceBinding), next_page_token=d.get("next_page_token", None) ) @@ -10167,11 +9980,7 @@ def __init__(self, api_client): self._api = api_client def create( - self, - workspace_id: int, - metastore_id: str, - *, - metastore_assignment: Optional[CreateMetastoreAssignment] = None, + self, workspace_id: int, metastore_id: str, *, metastore_assignment: Optional[CreateMetastoreAssignment] = None ): """Assigns a workspace to a metastore. @@ -10241,9 +10050,7 @@ def get(self, workspace_id: int) -> AccountsMetastoreAssignment: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}/metastore", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}/metastore", headers=headers ) return AccountsMetastoreAssignment.from_dict(res) @@ -10263,19 +10070,13 @@ def list(self, metastore_id: str) -> Iterator[int]: } json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}/workspaces", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}/workspaces", headers=headers ) parsed = ListAccountMetastoreAssignmentsResponse.from_dict(json).workspace_ids return parsed if parsed is not None else [] def update( - self, - workspace_id: int, - metastore_id: str, - *, - metastore_assignment: Optional[UpdateMetastoreAssignment] = None, + self, workspace_id: int, metastore_id: str, *, metastore_assignment: Optional[UpdateMetastoreAssignment] = None ): """Updates a metastore assignment to a workspaces. @@ -10330,12 +10131,7 @@ def create(self, *, metastore_info: Optional[CreateMetastore] = None) -> Account "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/metastores", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/metastores", body=body, headers=headers) return AccountsMetastoreInfo.from_dict(res) def delete(self, metastore_id: str, *, force: Optional[bool] = None): @@ -10381,9 +10177,7 @@ def get(self, metastore_id: str) -> AccountsMetastoreInfo: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}", headers=headers ) return AccountsMetastoreInfo.from_dict(res) @@ -10399,20 +10193,11 @@ def list(self) -> Iterator[MetastoreInfo]: "Accept": "application/json", } - json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/metastores", - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/metastores", headers=headers) parsed = ListMetastoresResponse.from_dict(json).metastores return parsed if parsed is not None else [] - def update( - self, - metastore_id: str, - *, - metastore_info: Optional[UpdateMetastore] = None, - ) -> AccountsMetastoreInfo: + def update(self, metastore_id: str, *, metastore_info: Optional[UpdateMetastore] = None) -> AccountsMetastoreInfo: """Update a metastore. Updates an existing Unity Catalog metastore. @@ -10432,10 +10217,7 @@ def update( } res = self._api.do( - "PUT", - f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/accounts/{self._api.account_id}/metastores/{metastore_id}", body=body, headers=headers ) return AccountsMetastoreInfo.from_dict(res) @@ -10447,10 +10229,7 @@ def __init__(self, api_client): self._api = api_client def create( - self, - metastore_id: str, - *, - credential_info: Optional[CreateStorageCredential] = None, + self, metastore_id: str, *, credential_info: Optional[CreateStorageCredential] = None ) -> AccountsStorageCredentialInfo: """Create a storage credential. @@ -10484,13 +10263,7 @@ def create( ) return AccountsStorageCredentialInfo.from_dict(res) - def delete( - self, - metastore_id: str, - storage_credential_name: str, - *, - force: Optional[bool] = None, - ): + def delete(self, metastore_id: str, storage_credential_name: str, *, force: Optional[bool] = None): """Delete a storage credential. Deletes a storage credential from the metastore. The caller must be an owner of the storage @@ -10607,8 +10380,7 @@ def update( class ArtifactAllowlistsAPI: """In Databricks Runtime 13.3 and above, you can add libraries and init scripts to the `allowlist` in UC so - that users can leverage these artifacts on compute configured with shared access mode. - """ + that users can leverage these artifacts on compute configured with shared access mode.""" def __init__(self, api_client): self._api = api_client @@ -10629,18 +10401,10 @@ def get(self, artifact_type: ArtifactType) -> ArtifactAllowlistInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/artifact-allowlists/{artifact_type.value}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/artifact-allowlists/{artifact_type.value}", headers=headers) return ArtifactAllowlistInfo.from_dict(res) - def update( - self, - artifact_type: ArtifactType, - artifact_matchers: List[ArtifactMatcher], - ) -> ArtifactAllowlistInfo: + def update(self, artifact_type: ArtifactType, artifact_matchers: List[ArtifactMatcher]) -> ArtifactAllowlistInfo: """Set an artifact allowlist. Set the artifact allowlist of a certain artifact type. The whole artifact allowlist is replaced with @@ -10663,10 +10427,7 @@ def update( } res = self._api.do( - "PUT", - f"/api/2.1/unity-catalog/artifact-allowlists/{artifact_type.value}", - body=body, - headers=headers, + "PUT", f"/api/2.1/unity-catalog/artifact-allowlists/{artifact_type.value}", body=body, headers=headers ) return ArtifactAllowlistInfo.from_dict(res) @@ -10742,12 +10503,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/catalogs", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/catalogs", body=body, headers=headers) return CatalogInfo.from_dict(res) def delete(self, name: str, *, force: Optional[bool] = None): @@ -10771,12 +10527,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/catalogs/{name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/catalogs/{name}", query=query, headers=headers) def get(self, name: str, *, include_browse: Optional[bool] = None) -> CatalogInfo: """Get a catalog. @@ -10800,12 +10551,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> CatalogInf "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/catalogs/{name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/catalogs/{name}", query=query, headers=headers) return CatalogInfo.from_dict(res) def list( @@ -10853,12 +10599,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/catalogs", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/catalogs", query=query, headers=headers) if "catalogs" in json: for v in json["catalogs"]: yield CatalogInfo.from_dict(v) @@ -10922,12 +10663,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/catalogs/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/catalogs/{name}", body=body, headers=headers) return CatalogInfo.from_dict(res) @@ -10939,8 +10675,7 @@ class ConnectionsAPI: with the second step being creating a data object (catalog, schema, or table) using the connection. Data objects derived from a connection can be written to or read from similar to other Unity Catalog data objects based on cloud storage. Users may create different types of connections with each connection - having a unique set of configuration options to support credential management and other settings. - """ + having a unique set of configuration options to support credential management and other settings.""" def __init__(self, api_client): self._api = api_client @@ -10995,12 +10730,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/connections", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/connections", body=body, headers=headers) return ConnectionInfo.from_dict(res) def delete(self, name: str): @@ -11018,11 +10748,7 @@ def delete(self, name: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/connections/{name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/connections/{name}", headers=headers) def get(self, name: str) -> ConnectionInfo: """Get a connection. @@ -11039,19 +10765,10 @@ def get(self, name: str) -> ConnectionInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/connections/{name}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/connections/{name}", headers=headers) return ConnectionInfo.from_dict(res) - def list( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[ConnectionInfo]: + def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[ConnectionInfo]: """List connections. List all connections. @@ -11079,12 +10796,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/connections", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/connections", query=query, headers=headers) if "connections" in json: for v in json["connections"]: yield ConnectionInfo.from_dict(v) @@ -11093,12 +10805,7 @@ def list( query["page_token"] = json["next_page_token"] def update( - self, - name: str, - options: Dict[str, str], - *, - new_name: Optional[str] = None, - owner: Optional[str] = None, + self, name: str, options: Dict[str, str], *, new_name: Optional[str] = None, owner: Optional[str] = None ) -> ConnectionInfo: """Update a connection. @@ -11127,12 +10834,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/connections/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/connections/{name}", body=body, headers=headers) return ConnectionInfo.from_dict(res) @@ -11216,12 +10918,7 @@ def create_credential( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/credentials", body=body, headers=headers) return CredentialInfo.from_dict(res) def delete_credential(self, name_arg: str, *, force: Optional[bool] = None): @@ -11246,12 +10943,7 @@ def delete_credential(self, name_arg: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/credentials/{name_arg}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/credentials/{name_arg}", query=query, headers=headers) def generate_temporary_service_credential( self, @@ -11286,12 +10978,7 @@ def generate_temporary_service_credential( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/temporary-service-credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/temporary-service-credentials", body=body, headers=headers) return TemporaryCredentials.from_dict(res) def get_credential(self, name_arg: str) -> CredentialInfo: @@ -11310,11 +10997,7 @@ def get_credential(self, name_arg: str) -> CredentialInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/credentials/{name_arg}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/credentials/{name_arg}", headers=headers) return CredentialInfo.from_dict(res) def list_credentials( @@ -11357,12 +11040,7 @@ def list_credentials( } while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/credentials", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/credentials", query=query, headers=headers) if "credentials" in json: for v in json["credentials"]: yield CredentialInfo.from_dict(v) @@ -11450,12 +11128,7 @@ def update_credential( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/credentials/{name_arg}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/credentials/{name_arg}", body=body, headers=headers) return CredentialInfo.from_dict(res) def validate_credential( @@ -11524,12 +11197,7 @@ def validate_credential( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/validate-credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/validate-credentials", body=body, headers=headers) return ValidateCredentialResponse.from_dict(res) @@ -11614,12 +11282,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/external-locations", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/external-locations", body=body, headers=headers) return ExternalLocationInfo.from_dict(res) def delete(self, name: str, *, force: Optional[bool] = None): @@ -11643,12 +11306,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/external-locations/{name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/external-locations/{name}", query=query, headers=headers) def get(self, name: str, *, include_browse: Optional[bool] = None) -> ExternalLocationInfo: """Get an external location. @@ -11672,12 +11330,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> ExternalLo "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/external-locations/{name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/external-locations/{name}", query=query, headers=headers) return ExternalLocationInfo.from_dict(res) def list( @@ -11721,12 +11374,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/external-locations", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/external-locations", query=query, headers=headers) if "external_locations" in json: for v in json["external_locations"]: yield ExternalLocationInfo.from_dict(v) @@ -11817,12 +11465,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/external-locations/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/external-locations/{name}", body=body, headers=headers) return ExternalLocationInfo.from_dict(res) @@ -11831,8 +11474,7 @@ class FunctionsAPI: The function implementation can be any SQL expression or Query, and it can be invoked wherever a table reference is allowed in a query. In Unity Catalog, a function resides at the same level as a table, so it - can be referenced with the form __catalog_name__.__schema_name__.__function_name__. - """ + can be referenced with the form __catalog_name__.__schema_name__.__function_name__.""" def __init__(self, api_client): self._api = api_client @@ -11861,12 +11503,7 @@ def create(self, function_info: CreateFunction) -> FunctionInfo: "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/functions", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/functions", body=body, headers=headers) return FunctionInfo.from_dict(res) def delete(self, name: str, *, force: Optional[bool] = None): @@ -11894,12 +11531,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/functions/{name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/functions/{name}", query=query, headers=headers) def get(self, name: str, *, include_browse: Optional[bool] = None) -> FunctionInfo: """Get a function. @@ -11928,12 +11560,7 @@ def get(self, name: str, *, include_browse: Optional[bool] = None) -> FunctionIn "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/functions/{name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/functions/{name}", query=query, headers=headers) return FunctionInfo.from_dict(res) def list( @@ -11987,12 +11614,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/functions", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/functions", query=query, headers=headers) if "functions" in json: for v in json["functions"]: yield FunctionInfo.from_dict(v) @@ -12026,12 +11648,7 @@ def update(self, name: str, *, owner: Optional[str] = None) -> FunctionInfo: "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/functions/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/functions/{name}", body=body, headers=headers) return FunctionInfo.from_dict(res) @@ -12049,13 +11666,7 @@ class GrantsAPI: def __init__(self, api_client): self._api = api_client - def get( - self, - securable_type: SecurableType, - full_name: str, - *, - principal: Optional[str] = None, - ) -> PermissionsList: + def get(self, securable_type: SecurableType, full_name: str, *, principal: Optional[str] = None) -> PermissionsList: """Get permissions. Gets the permissions for a securable. @@ -12086,11 +11697,7 @@ def get( return PermissionsList.from_dict(res) def get_effective( - self, - securable_type: SecurableType, - full_name: str, - *, - principal: Optional[str] = None, + self, securable_type: SecurableType, full_name: str, *, principal: Optional[str] = None ) -> EffectivePermissionsList: """Get effective permissions. @@ -12123,11 +11730,7 @@ def get_effective( return EffectivePermissionsList.from_dict(res) def update( - self, - securable_type: SecurableType, - full_name: str, - *, - changes: Optional[List[PermissionsChange]] = None, + self, securable_type: SecurableType, full_name: str, *, changes: Optional[List[PermissionsChange]] = None ) -> PermissionsList: """Update permissions. @@ -12202,20 +11805,9 @@ def assign(self, workspace_id: int, metastore_id: str, default_catalog_name: str "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", body=body, headers=headers) - def create( - self, - name: str, - *, - region: Optional[str] = None, - storage_root: Optional[str] = None, - ) -> MetastoreInfo: + def create(self, name: str, *, region: Optional[str] = None, storage_root: Optional[str] = None) -> MetastoreInfo: """Create a metastore. Creates a new metastore based on a provided name and optional storage root path. By default (if the @@ -12246,12 +11838,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/metastores", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/metastores", body=body, headers=headers) return MetastoreInfo.from_dict(res) def current(self) -> MetastoreAssignment: @@ -12266,11 +11853,7 @@ def current(self) -> MetastoreAssignment: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.1/unity-catalog/current-metastore-assignment", - headers=headers, - ) + res = self._api.do("GET", "/api/2.1/unity-catalog/current-metastore-assignment", headers=headers) return MetastoreAssignment.from_dict(res) def delete(self, id: str, *, force: Optional[bool] = None): @@ -12293,12 +11876,7 @@ def delete(self, id: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/metastores/{id}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/metastores/{id}", query=query, headers=headers) def get(self, id: str) -> MetastoreInfo: """Get a metastore. @@ -12373,10 +11951,7 @@ def unassign(self, workspace_id: int, metastore_id: str): } self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", - query=query, - headers=headers, + "DELETE", f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", query=query, headers=headers ) def update( @@ -12438,20 +12013,11 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/metastores/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/metastores/{id}", body=body, headers=headers) return MetastoreInfo.from_dict(res) def update_assignment( - self, - workspace_id: int, - *, - default_catalog_name: Optional[str] = None, - metastore_id: Optional[str] = None, + self, workspace_id: int, *, default_catalog_name: Optional[str] = None, metastore_id: Optional[str] = None ): """Update an assignment. @@ -12480,12 +12046,7 @@ def update_assignment( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.1/unity-catalog/workspaces/{workspace_id}/metastore", body=body, headers=headers) class ModelVersionsAPI: @@ -12494,8 +12055,7 @@ class ModelVersionsAPI: workspaces. This API reference documents the REST endpoints for managing model versions in Unity Catalog. For more - details, see the [registered models API docs](/api/workspace/registeredmodels). - """ + details, see the [registered models API docs](/api/workspace/registeredmodels).""" def __init__(self, api_client): self._api = api_client @@ -12520,11 +12080,7 @@ def delete(self, full_name: str, version: int): headers = {} - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", headers=headers) def get( self, @@ -12565,20 +12121,11 @@ def get( } res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", - query=query, - headers=headers, + "GET", f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", query=query, headers=headers ) return ModelVersionInfo.from_dict(res) - def get_by_alias( - self, - full_name: str, - alias: str, - *, - include_aliases: Optional[bool] = None, - ) -> ModelVersionInfo: + def get_by_alias(self, full_name: str, alias: str, *, include_aliases: Optional[bool] = None) -> ModelVersionInfo: """Get Model Version By Alias. Get a model version by alias. @@ -12605,10 +12152,7 @@ def get_by_alias( } res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", - query=query, - headers=headers, + "GET", f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", query=query, headers=headers ) return ModelVersionInfo.from_dict(res) @@ -12664,10 +12208,7 @@ def list( while True: json = self._api.do( - "GET", - f"/api/2.1/unity-catalog/models/{full_name}/versions", - query=query, - headers=headers, + "GET", f"/api/2.1/unity-catalog/models/{full_name}/versions", query=query, headers=headers ) if "model_versions" in json: for v in json["model_versions"]: @@ -12705,10 +12246,7 @@ def update(self, full_name: str, version: int, *, comment: Optional[str] = None) } res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", - body=body, - headers=headers, + "PATCH", f"/api/2.1/unity-catalog/models/{full_name}/versions/{version}", body=body, headers=headers ) return ModelVersionInfo.from_dict(res) @@ -12720,10 +12258,7 @@ def __init__(self, api_client): self._api = api_client def wait_get_online_table_active( - self, - name: str, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[OnlineTable], None]] = None, + self, name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[OnlineTable], None]] = None ) -> OnlineTable: deadline = time.time() + timeout.total_seconds() target_states = (ProvisioningInfoState.ACTIVE,) @@ -12771,17 +12306,10 @@ def create(self, *, table: Optional[OnlineTable] = None) -> Wait[OnlineTable]: op_response = self._api.do("POST", "/api/2.0/online-tables", body=body, headers=headers) return Wait( - self.wait_get_online_table_active, - response=OnlineTable.from_dict(op_response), - name=op_response["name"], + self.wait_get_online_table_active, response=OnlineTable.from_dict(op_response), name=op_response["name"] ) - def create_and_wait( - self, - *, - table: Optional[OnlineTable] = None, - timeout=timedelta(minutes=20), - ) -> OnlineTable: + def create_and_wait(self, *, table: Optional[OnlineTable] = None, timeout=timedelta(minutes=20)) -> OnlineTable: return self.create(table=table).result(timeout=timeout) def delete(self, name: str): @@ -12828,8 +12356,7 @@ class QualityMonitorsAPI: Most write operations require the user to be the owner of the table (or its parent schema or parent catalog). Viewing the dashboard, computed metrics, or monitor configuration only requires the user to have - **SELECT** privileges on the table (along with **USE_SCHEMA** and **USE_CATALOG**). - """ + **SELECT** privileges on the table (along with **USE_SCHEMA** and **USE_CATALOG**).""" def __init__(self, api_client): self._api = api_client @@ -12857,9 +12384,7 @@ def cancel_refresh(self, table_name: str, refresh_id: str): headers = {} self._api.do( - "POST", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes/{refresh_id}/cancel", - headers=headers, + "POST", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes/{refresh_id}/cancel", headers=headers ) def create( @@ -12960,12 +12485,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", body=body, headers=headers) return MonitorInfo.from_dict(res) def delete(self, table_name: str): @@ -12991,11 +12511,7 @@ def delete(self, table_name: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", headers=headers) def get(self, table_name: str) -> MonitorInfo: """Get a table monitor. @@ -13021,11 +12537,7 @@ def get(self, table_name: str) -> MonitorInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", headers=headers) return MonitorInfo.from_dict(res) def get_refresh(self, table_name: str, refresh_id: str) -> MonitorRefreshInfo: @@ -13053,9 +12565,7 @@ def get_refresh(self, table_name: str, refresh_id: str) -> MonitorRefreshInfo: } res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes/{refresh_id}", - headers=headers, + "GET", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes/{refresh_id}", headers=headers ) return MonitorRefreshInfo.from_dict(res) @@ -13081,11 +12591,7 @@ def list_refreshes(self, table_name: str) -> MonitorRefreshListResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", headers=headers) return MonitorRefreshListResponse.from_dict(res) def regenerate_dashboard( @@ -13120,10 +12626,7 @@ def regenerate_dashboard( } res = self._api.do( - "POST", - f"/api/2.1/quality-monitoring/tables/{table_name}/monitor/dashboard", - body=body, - headers=headers, + "POST", f"/api/2.1/quality-monitoring/tables/{table_name}/monitor/dashboard", body=body, headers=headers ) return RegenerateDashboardResponse.from_dict(res) @@ -13150,11 +12653,7 @@ def run_refresh(self, table_name: str) -> MonitorRefreshInfo: "Accept": "application/json", } - res = self._api.do( - "POST", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", - headers=headers, - ) + res = self._api.do("POST", f"/api/2.1/unity-catalog/tables/{table_name}/monitor/refreshes", headers=headers) return MonitorRefreshInfo.from_dict(res) def update( @@ -13247,12 +12746,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.1/unity-catalog/tables/{table_name}/monitor", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.1/unity-catalog/tables/{table_name}/monitor", body=body, headers=headers) return MonitorInfo.from_dict(res) @@ -13355,11 +12849,7 @@ def delete(self, full_name: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/models/{full_name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}", headers=headers) def delete_alias(self, full_name: str, alias: str): """Delete a Registered Model Alias. @@ -13380,18 +12870,10 @@ def delete_alias(self, full_name: str, alias: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", headers=headers) def get( - self, - full_name: str, - *, - include_aliases: Optional[bool] = None, - include_browse: Optional[bool] = None, + self, full_name: str, *, include_aliases: Optional[bool] = None, include_browse: Optional[bool] = None ) -> RegisteredModelInfo: """Get a Registered Model. @@ -13421,12 +12903,7 @@ def get( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/models/{full_name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/models/{full_name}", query=query, headers=headers) return RegisteredModelInfo.from_dict(res) def list( @@ -13496,12 +12973,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/models", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/models", query=query, headers=headers) if "registered_models" in json: for v in json["registered_models"]: yield RegisteredModelInfo.from_dict(v) @@ -13536,10 +13008,7 @@ def set_alias(self, full_name: str, alias: str, version_num: int) -> RegisteredM } res = self._api.do( - "PUT", - f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", - body=body, - headers=headers, + "PUT", f"/api/2.1/unity-catalog/models/{full_name}/aliases/{alias}", body=body, headers=headers ) return RegisteredModelAlias.from_dict(res) @@ -13584,12 +13053,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/models/{full_name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/models/{full_name}", body=body, headers=headers) return RegisteredModelInfo.from_dict(res) @@ -13605,12 +13069,7 @@ class ResourceQuotasAPI: def __init__(self, api_client): self._api = api_client - def get_quota( - self, - parent_securable_type: str, - parent_full_name: str, - quota_name: str, - ) -> GetQuotaResponse: + def get_quota(self, parent_securable_type: str, parent_full_name: str, quota_name: str) -> GetQuotaResponse: """Get information for a single resource quota. The GetQuota API returns usage information for a single resource quota, defined as a child-parent @@ -13639,10 +13098,7 @@ def get_quota( return GetQuotaResponse.from_dict(res) def list_quotas( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[QuotaInfo]: """List all resource quotas under a metastore. @@ -13668,10 +13124,7 @@ def list_quotas( while True: json = self._api.do( - "GET", - "/api/2.1/unity-catalog/resource-quotas/all-resource-quotas", - query=query, - headers=headers, + "GET", "/api/2.1/unity-catalog/resource-quotas/all-resource-quotas", query=query, headers=headers ) if "quotas" in json: for v in json["quotas"]: @@ -13733,12 +13186,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/schemas", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/schemas", body=body, headers=headers) return SchemaInfo.from_dict(res) def delete(self, full_name: str, *, force: Optional[bool] = None): @@ -13762,12 +13210,7 @@ def delete(self, full_name: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/schemas/{full_name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/schemas/{full_name}", query=query, headers=headers) def get(self, full_name: str, *, include_browse: Optional[bool] = None) -> SchemaInfo: """Get a schema. @@ -13791,12 +13234,7 @@ def get(self, full_name: str, *, include_browse: Optional[bool] = None) -> Schem "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/schemas/{full_name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/schemas/{full_name}", query=query, headers=headers) return SchemaInfo.from_dict(res) def list( @@ -13846,12 +13284,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/schemas", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/schemas", query=query, headers=headers) if "schemas" in json: for v in json["schemas"]: yield SchemaInfo.from_dict(v) @@ -13907,12 +13340,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/schemas/{full_name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/schemas/{full_name}", body=body, headers=headers) return SchemaInfo.from_dict(res) @@ -13926,8 +13354,7 @@ class StorageCredentialsAPI: Databricks recommends using external locations rather than using storage credentials directly. To create storage credentials, you must be a Databricks account admin. The account admin who creates the - storage credential can delegate ownership to another user or group to manage permissions on it. - """ + storage credential can delegate ownership to another user or group to manage permissions on it.""" def __init__(self, api_client): self._api = api_client @@ -13994,12 +13421,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/storage-credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/storage-credentials", body=body, headers=headers) return StorageCredentialInfo.from_dict(res) def delete(self, name: str, *, force: Optional[bool] = None): @@ -14023,12 +13445,7 @@ def delete(self, name: str, *, force: Optional[bool] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/storage-credentials/{name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/storage-credentials/{name}", query=query, headers=headers) def get(self, name: str) -> StorageCredentialInfo: """Get a credential. @@ -14046,18 +13463,11 @@ def get(self, name: str) -> StorageCredentialInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/storage-credentials/{name}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/storage-credentials/{name}", headers=headers) return StorageCredentialInfo.from_dict(res) def list( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[StorageCredentialInfo]: """List credentials. @@ -14090,12 +13500,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/storage-credentials", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/storage-credentials", query=query, headers=headers) if "storage_credentials" in json: for v in json["storage_credentials"]: yield StorageCredentialInfo.from_dict(v) @@ -14182,12 +13587,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/storage-credentials/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/storage-credentials/{name}", body=body, headers=headers) return StorageCredentialInfo.from_dict(res) def validate( @@ -14260,19 +13660,13 @@ def validate( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/validate-storage-credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/validate-storage-credentials", body=body, headers=headers) return ValidateStorageCredentialResponse.from_dict(res) class SystemSchemasAPI: """A system schema is a schema that lives within the system catalog. A system schema may contain information - about customer usage of Unity Catalog such as audit-logs, billing-logs, lineage information, etc. - """ + about customer usage of Unity Catalog such as audit-logs, billing-logs, lineage information, etc.""" def __init__(self, api_client): self._api = api_client @@ -14296,9 +13690,7 @@ def disable(self, metastore_id: str, schema_name: str): } self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name}", - headers=headers, + "DELETE", f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name}", headers=headers ) def enable(self, metastore_id: str, schema_name: str): @@ -14320,17 +13712,11 @@ def enable(self, metastore_id: str, schema_name: str): } self._api.do( - "PUT", - f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name}", - headers=headers, + "PUT", f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas/{schema_name}", headers=headers ) def list( - self, - metastore_id: str, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, metastore_id: str, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[SystemSchemaInfo]: """List system schemas. @@ -14363,10 +13749,7 @@ def list( query["max_results"] = 0 while True: json = self._api.do( - "GET", - f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas", - query=query, - headers=headers, + "GET", f"/api/2.1/unity-catalog/metastores/{metastore_id}/systemschemas", query=query, headers=headers ) if "schemas" in json: for v in json["schemas"]: @@ -14421,12 +13804,7 @@ def create(self, full_name_arg: str, constraint: TableConstraint) -> TableConstr "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/constraints", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/constraints", body=body, headers=headers) return TableConstraint.from_dict(res) def delete(self, full_name: str, constraint_name: str, cascade: bool): @@ -14461,12 +13839,7 @@ def delete(self, full_name: str, constraint_name: str, cascade: bool): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/constraints/{full_name}", - query=query, - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/constraints/{full_name}", query=query, headers=headers) class TablesAPI: @@ -14500,11 +13873,7 @@ def delete(self, full_name: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/tables/{full_name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/tables/{full_name}", headers=headers) def exists(self, full_name: str) -> TableExistsResponse: """Get boolean reflecting if table exists. @@ -14526,11 +13895,7 @@ def exists(self, full_name: str) -> TableExistsResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/tables/{full_name}/exists", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{full_name}/exists", headers=headers) return TableExistsResponse.from_dict(res) def get( @@ -14573,12 +13938,7 @@ def get( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/tables/{full_name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/tables/{full_name}", query=query, headers=headers) return TableInfo.from_dict(res) def list( @@ -14660,12 +14020,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/tables", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/tables", query=query, headers=headers) if "tables" in json: for v in json["tables"]: yield TableInfo.from_dict(v) @@ -14736,12 +14091,7 @@ def list_summaries( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/table-summaries", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/table-summaries", query=query, headers=headers) if "tables" in json: for v in json["tables"]: yield TableSummary.from_dict(v) @@ -14771,12 +14121,7 @@ def update(self, full_name: str, *, owner: Optional[str] = None): "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/tables/{full_name}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.1/unity-catalog/tables/{full_name}", body=body, headers=headers) class TemporaryTableCredentialsAPI: @@ -14797,10 +14142,7 @@ def __init__(self, api_client): self._api = api_client def generate_temporary_table_credentials( - self, - *, - operation: Optional[TableOperation] = None, - table_id: Optional[str] = None, + self, *, operation: Optional[TableOperation] = None, table_id: Optional[str] = None ) -> GenerateTemporaryTableCredentialResponse: """Generate a temporary table credential. @@ -14827,12 +14169,7 @@ def generate_temporary_table_credentials( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/unity-catalog/temporary-table-credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/unity-catalog/temporary-table-credentials", body=body, headers=headers) return GenerateTemporaryTableCredentialResponse.from_dict(res) @@ -14907,12 +14244,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/volumes", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/volumes", body=body, headers=headers) return VolumeInfo.from_dict(res) def delete(self, name: str): @@ -14997,12 +14329,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/volumes", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/volumes", query=query, headers=headers) if "volumes" in json: for v in json["volumes"]: yield VolumeInfo.from_dict(v) @@ -15035,21 +14362,11 @@ def read(self, name: str, *, include_browse: Optional[bool] = None) -> VolumeInf "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/volumes/{name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/volumes/{name}", query=query, headers=headers) return VolumeInfo.from_dict(res) def update( - self, - name: str, - *, - comment: Optional[str] = None, - new_name: Optional[str] = None, - owner: Optional[str] = None, + self, name: str, *, comment: Optional[str] = None, new_name: Optional[str] = None, owner: Optional[str] = None ) -> VolumeInfo: """Update a Volume. @@ -15084,12 +14401,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/volumes/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/volumes/{name}", body=body, headers=headers) return VolumeInfo.from_dict(res) @@ -15107,8 +14419,7 @@ class WorkspaceBindingsAPI: the new path (/api/2.1/unity-catalog/bindings/{securable_type}/{securable_name}) which introduces the ability to bind a securable in READ_ONLY mode (catalogs only). - Securable types that support binding: - catalog - storage_credential - external_location - """ + Securable types that support binding: - catalog - storage_credential - external_location""" def __init__(self, api_client): self._api = api_client @@ -15129,11 +14440,7 @@ def get(self, name: str) -> CurrentWorkspaceBindings: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}", headers=headers) return CurrentWorkspaceBindings.from_dict(res) def get_bindings( @@ -15219,10 +14526,7 @@ def update( } res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}", - body=body, - headers=headers, + "PATCH", f"/api/2.1/unity-catalog/workspace-bindings/catalogs/{name}", body=body, headers=headers ) return CurrentWorkspaceBindings.from_dict(res) diff --git a/databricks/sdk/service/cleanrooms.py b/databricks/sdk/service/cleanrooms.py index ab1974cb9..6db1adc88 100755 --- a/databricks/sdk/service/cleanrooms.py +++ b/databricks/sdk/service/cleanrooms.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import catalog, jobs, settings, sharing # all definitions in this file are in alphabetical order @@ -254,9 +255,7 @@ def from_dict(cls, d: Dict[str, any]) -> CleanRoomAsset: asset_type=_enum(d, "asset_type", CleanRoomAssetAssetType), foreign_table=_from_dict(d, "foreign_table", CleanRoomAssetForeignTable), foreign_table_local_details=_from_dict( - d, - "foreign_table_local_details", - CleanRoomAssetForeignTableLocalDetails, + d, "foreign_table_local_details", CleanRoomAssetForeignTableLocalDetails ), name=d.get("name", None), notebook=_from_dict(d, "notebook", CleanRoomAssetNotebook), @@ -360,10 +359,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CleanRoomAssetNotebook: """Deserializes the CleanRoomAssetNotebook from a dictionary.""" - return cls( - etag=d.get("etag", None), - notebook_content=d.get("notebook_content", None), - ) + return cls(etag=d.get("etag", None), notebook_content=d.get("notebook_content", None)) class CleanRoomAssetStatusEnum(Enum): @@ -948,7 +944,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteCleanRoomAssetResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -995,10 +990,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListCleanRoomAssetsResponse: """Deserializes the ListCleanRoomAssetsResponse from a dictionary.""" - return cls( - assets=_repeated_dict(d, "assets", CleanRoomAsset), - next_page_token=d.get("next_page_token", None), - ) + return cls(assets=_repeated_dict(d, "assets", CleanRoomAsset), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1032,8 +1024,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListCleanRoomNotebookTaskRunsResponse: """Deserializes the ListCleanRoomNotebookTaskRunsResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - runs=_repeated_dict(d, "runs", CleanRoomNotebookTaskRun), + next_page_token=d.get("next_page_token", None), runs=_repeated_dict(d, "runs", CleanRoomNotebookTaskRun) ) @@ -1067,8 +1058,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListCleanRoomsResponse: """Deserializes the ListCleanRoomsResponse from a dictionary.""" return cls( - clean_rooms=_repeated_dict(d, "clean_rooms", CleanRoom), - next_page_token=d.get("next_page_token", None), + clean_rooms=_repeated_dict(d, "clean_rooms", CleanRoom), next_page_token=d.get("next_page_token", None) ) @@ -1100,10 +1090,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateCleanRoomRequest: """Deserializes the UpdateCleanRoomRequest from a dictionary.""" - return cls( - clean_room=_from_dict(d, "clean_room", CleanRoom), - name=d.get("name", None), - ) + return cls(clean_room=_from_dict(d, "clean_room", CleanRoom), name=d.get("name", None)) class CleanRoomAssetsAPI: @@ -1134,20 +1121,10 @@ def create(self, clean_room_name: str, *, asset: Optional[CleanRoomAsset] = None "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/clean-rooms/{clean_room_name}/assets", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/clean-rooms/{clean_room_name}/assets", body=body, headers=headers) return CleanRoomAsset.from_dict(res) - def delete( - self, - clean_room_name: str, - asset_type: CleanRoomAssetAssetType, - asset_full_name: str, - ): + def delete(self, clean_room_name: str, asset_type: CleanRoomAssetAssetType, asset_full_name: str): """Delete an asset. Delete a clean room asset - unshare/remove the asset from the clean room @@ -1172,12 +1149,7 @@ def delete( headers=headers, ) - def get( - self, - clean_room_name: str, - asset_type: CleanRoomAssetAssetType, - asset_full_name: str, - ) -> CleanRoomAsset: + def get(self, clean_room_name: str, asset_type: CleanRoomAssetAssetType, asset_full_name: str) -> CleanRoomAsset: """Get an asset. Get the details of a clean room asset by its type and full name. @@ -1222,12 +1194,7 @@ def list(self, clean_room_name: str, *, page_token: Optional[str] = None) -> Ite } while True: - json = self._api.do( - "GET", - f"/api/2.0/clean-rooms/{clean_room_name}/assets", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/clean-rooms/{clean_room_name}/assets", query=query, headers=headers) if "assets" in json: for v in json["assets"]: yield CleanRoomAsset.from_dict(v) @@ -1322,12 +1289,7 @@ def list( } while True: - json = self._api.do( - "GET", - f"/api/2.0/clean-rooms/{clean_room_name}/runs", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/clean-rooms/{clean_room_name}/runs", query=query, headers=headers) if "runs" in json: for v in json["runs"]: yield CleanRoomNotebookTaskRun.from_dict(v) @@ -1369,10 +1331,7 @@ def create(self, *, clean_room: Optional[CleanRoom] = None) -> CleanRoom: return CleanRoom.from_dict(res) def create_output_catalog( - self, - clean_room_name: str, - *, - output_catalog: Optional[CleanRoomOutputCatalog] = None, + self, clean_room_name: str, *, output_catalog: Optional[CleanRoomOutputCatalog] = None ) -> CreateCleanRoomOutputCatalogResponse: """Create an output catalog. @@ -1391,10 +1350,7 @@ def create_output_catalog( } res = self._api.do( - "POST", - f"/api/2.0/clean-rooms/{clean_room_name}/output-catalogs", - body=body, - headers=headers, + "POST", f"/api/2.0/clean-rooms/{clean_room_name}/output-catalogs", body=body, headers=headers ) return CreateCleanRoomOutputCatalogResponse.from_dict(res) @@ -1434,12 +1390,7 @@ def get(self, name: str) -> CleanRoom: res = self._api.do("GET", f"/api/2.0/clean-rooms/{name}", headers=headers) return CleanRoom.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[CleanRoom]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[CleanRoom]: """List clean rooms. Get a list of all clean rooms of the metastore. Only clean rooms the caller has access to are diff --git a/databricks/sdk/service/compute.py b/databricks/sdk/service/compute.py index 52db6cfc0..6652ef1d0 100755 --- a/databricks/sdk/service/compute.py +++ b/databricks/sdk/service/compute.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -84,7 +85,6 @@ def from_dict(cls, d: Dict[str, any]) -> AddInstanceProfile: @dataclass class AddResponse: - def as_dict(self) -> dict: """Serializes the AddResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -158,10 +158,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AutoScale: """Deserializes the AutoScale from a dictionary.""" - return cls( - max_workers=d.get("max_workers", None), - min_workers=d.get("min_workers", None), - ) + return cls(max_workers=d.get("max_workers", None), min_workers=d.get("min_workers", None)) @dataclass @@ -315,8 +312,7 @@ def from_dict(cls, d: Dict[str, any]) -> AwsAttributes: class AwsAvailability(Enum): """Availability type used for all subsequent nodes past the `first_on_demand` ones. - Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster. - """ + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster.""" ON_DEMAND = "ON_DEMAND" SPOT = "SPOT" @@ -437,7 +433,6 @@ def from_dict(cls, d: Dict[str, any]) -> CancelCommand: @dataclass class CancelResponse: - def as_dict(self) -> dict: """Serializes the CancelResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -483,15 +478,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ChangeClusterOwner: """Deserializes the ChangeClusterOwner from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - owner_username=d.get("owner_username", None), - ) + return cls(cluster_id=d.get("cluster_id", None), owner_username=d.get("owner_username", None)) @dataclass class ChangeClusterOwnerResponse: - def as_dict(self) -> dict: """Serializes the ChangeClusterOwnerResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2186,9 +2177,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ClusterSettingsChange: """Deserializes the ClusterSettingsChange from a dictionary.""" return cls( - field=d.get("field", None), - new_value=d.get("new_value", None), - previous_value=d.get("previous_value", None), + field=d.get("field", None), new_value=d.get("new_value", None), previous_value=d.get("previous_value", None) ) @@ -2229,16 +2218,12 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ClusterSize: """Deserializes the ClusterSize from a dictionary.""" - return cls( - autoscale=_from_dict(d, "autoscale", AutoScale), - num_workers=d.get("num_workers", None), - ) + return cls(autoscale=_from_dict(d, "autoscale", AutoScale), num_workers=d.get("num_workers", None)) class ClusterSource(Enum): """Determines whether the cluster was created by a user through the UI, created by the Databricks - Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only. - """ + Jobs Scheduler, or through an API request. This is the same as cluster_creator, but read only.""" API = "API" JOB = "JOB" @@ -2690,9 +2675,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> CommandStatusResponse: """Deserializes the CommandStatusResponse from a dictionary.""" return cls( - id=d.get("id", None), - results=_from_dict(d, "results", Results), - status=_enum(d, "status", CommandStatus), + id=d.get("id", None), results=_from_dict(d, "results", Results), status=_enum(d, "status", CommandStatus) ) @@ -3141,10 +3124,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateContext: """Deserializes the CreateContext from a dictionary.""" - return cls( - cluster_id=d.get("clusterId", None), - language=_enum(d, "language", Language), - ) + return cls(cluster_id=d.get("clusterId", None), language=_enum(d, "language", Language)) @dataclass @@ -3668,7 +3648,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteCluster: @dataclass class DeleteClusterResponse: - def as_dict(self) -> dict: """Serializes the DeleteClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3712,7 +3691,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteInstancePool: @dataclass class DeleteInstancePoolResponse: - def as_dict(self) -> dict: """Serializes the DeleteInstancePoolResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3756,7 +3734,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeletePolicy: @dataclass class DeletePolicyResponse: - def as_dict(self) -> dict: """Serializes the DeletePolicyResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3775,7 +3752,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeletePolicyResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3819,15 +3795,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DestroyContext: """Deserializes the DestroyContext from a dictionary.""" - return cls( - cluster_id=d.get("clusterId", None), - context_id=d.get("contextId", None), - ) + return cls(cluster_id=d.get("clusterId", None), context_id=d.get("contextId", None)) @dataclass class DestroyResponse: - def as_dict(self) -> dict: """Serializes the DestroyResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4023,10 +3995,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DockerImage: """Deserializes the DockerImage from a dictionary.""" - return cls( - basic_auth=_from_dict(d, "basic_auth", DockerBasicAuth), - url=d.get("url", None), - ) + return cls(basic_auth=_from_dict(d, "basic_auth", DockerBasicAuth), url=d.get("url", None)) class EbsVolumeType(Enum): @@ -4393,7 +4362,6 @@ def from_dict(cls, d: Dict[str, any]) -> EditCluster: @dataclass class EditClusterResponse: - def as_dict(self) -> dict: """Serializes the EditClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4500,7 +4468,6 @@ def from_dict(cls, d: Dict[str, any]) -> EditInstancePool: @dataclass class EditInstancePoolResponse: - def as_dict(self) -> dict: """Serializes the EditInstancePoolResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4617,7 +4584,6 @@ def from_dict(cls, d: Dict[str, any]) -> EditPolicy: @dataclass class EditPolicyResponse: - def as_dict(self) -> dict: """Serializes the EditPolicyResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4636,7 +4602,6 @@ def from_dict(cls, d: Dict[str, any]) -> EditPolicyResponse: @dataclass class EditResponse: - def as_dict(self) -> dict: """Serializes the EditResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4683,10 +4648,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EnforceClusterComplianceRequest: """Deserializes the EnforceClusterComplianceRequest from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - validate_only=d.get("validate_only", None), - ) + return cls(cluster_id=d.get("cluster_id", None), validate_only=d.get("validate_only", None)) @dataclass @@ -4720,17 +4682,13 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EnforceClusterComplianceResponse: """Deserializes the EnforceClusterComplianceResponse from a dictionary.""" - return cls( - changes=_repeated_dict(d, "changes", ClusterSettingsChange), - has_changes=d.get("has_changes", None), - ) + return cls(changes=_repeated_dict(d, "changes", ClusterSettingsChange), has_changes=d.get("has_changes", None)) @dataclass class Environment: """The environment entity used to preserve serverless environment side panel and jobs' environment - for non-notebook task. In this minimal environment spec, only pip dependencies are supported. - """ + for non-notebook task. In this minimal environment spec, only pip dependencies are supported.""" client: str """Client version used by the environment The client is the user-facing environment of the runtime. @@ -4766,10 +4724,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Environment: """Deserializes the Environment from a dictionary.""" - return cls( - client=d.get("client", None), - dependencies=d.get("dependencies", None), - ) + return cls(client=d.get("client", None), dependencies=d.get("dependencies", None)) @dataclass @@ -5078,8 +5033,7 @@ def from_dict(cls, d: Dict[str, any]) -> GcpAttributes: class GcpAvailability(Enum): """This field determines whether the instance pool will contain preemptible VMs, on-demand VMs, or - preemptible VMs with a fallback to on-demand VMs if the former is unavailable. - """ + preemptible VMs with a fallback to on-demand VMs if the former is unavailable.""" ON_DEMAND_GCP = "ON_DEMAND_GCP" PREEMPTIBLE_GCP = "PREEMPTIBLE_GCP" @@ -5143,10 +5097,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetClusterComplianceResponse: """Deserializes the GetClusterComplianceResponse from a dictionary.""" - return cls( - is_compliant=d.get("is_compliant", None), - violations=d.get("violations", None), - ) + return cls(is_compliant=d.get("is_compliant", None), violations=d.get("violations", None)) @dataclass @@ -6116,15 +6067,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> InstallLibraries: """Deserializes the InstallLibraries from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - libraries=_repeated_dict(d, "libraries", Library), - ) + return cls(cluster_id=d.get("cluster_id", None), libraries=_repeated_dict(d, "libraries", Library)) @dataclass class InstallLibrariesResponse: - def as_dict(self) -> dict: """Serializes the InstallLibrariesResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6505,8 +6452,7 @@ def from_dict(cls, d: Dict[str, any]) -> InstancePoolAwsAttributes: class InstancePoolAwsAttributesAvailability(Enum): """Availability type used for the spot nodes. - The default value is defined by InstancePoolConf.instancePoolDefaultAwsAvailability - """ + The default value is defined by InstancePoolConf.instancePoolDefaultAwsAvailability""" ON_DEMAND = "ON_DEMAND" SPOT = "SPOT" @@ -6553,8 +6499,7 @@ def from_dict(cls, d: Dict[str, any]) -> InstancePoolAzureAttributes: class InstancePoolAzureAttributesAvailability(Enum): """Shows the Availability type used for the spot nodes. - The default value is defined by InstancePoolConf.instancePoolDefaultAzureAvailability - """ + The default value is defined by InstancePoolConf.instancePoolDefaultAzureAvailability""" ON_DEMAND_AZURE = "ON_DEMAND_AZURE" SPOT_AZURE = "SPOT_AZURE" @@ -7138,10 +7083,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListAvailableZonesResponse: """Deserializes the ListAvailableZonesResponse from a dictionary.""" - return cls( - default_zone=d.get("default_zone", None), - zones=d.get("zones", None), - ) + return cls(default_zone=d.get("default_zone", None), zones=d.get("zones", None)) @dataclass @@ -7599,10 +7541,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> LogSyncStatus: """Deserializes the LogSyncStatus from a dictionary.""" - return cls( - last_attempted=d.get("last_attempted", None), - last_exception=d.get("last_exception", None), - ) + return cls(last_attempted=d.get("last_attempted", None), last_exception=d.get("last_exception", None)) @dataclass @@ -7646,9 +7585,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> MavenLibrary: """Deserializes the MavenLibrary from a dictionary.""" return cls( - coordinates=d.get("coordinates", None), - exclusions=d.get("exclusions", None), - repo=d.get("repo", None), + coordinates=d.get("coordinates", None), exclusions=d.get("exclusions", None), repo=d.get("repo", None) ) @@ -7911,10 +7848,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PendingInstanceError: """Deserializes the PendingInstanceError from a dictionary.""" - return cls( - instance_id=d.get("instance_id", None), - message=d.get("message", None), - ) + return cls(instance_id=d.get("instance_id", None), message=d.get("message", None)) @dataclass @@ -7944,7 +7878,6 @@ def from_dict(cls, d: Dict[str, any]) -> PermanentDeleteCluster: @dataclass class PermanentDeleteClusterResponse: - def as_dict(self) -> dict: """Serializes the PermanentDeleteClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -7988,7 +7921,6 @@ def from_dict(cls, d: Dict[str, any]) -> PinCluster: @dataclass class PinClusterResponse: - def as_dict(self) -> dict: """Serializes the PinClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8276,7 +8208,6 @@ def from_dict(cls, d: Dict[str, any]) -> RemoveInstanceProfile: @dataclass class RemoveResponse: - def as_dict(self) -> dict: """Serializes the RemoveResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8346,7 +8277,6 @@ def from_dict(cls, d: Dict[str, any]) -> ResizeCluster: @dataclass class ResizeClusterResponse: - def as_dict(self) -> dict: """Serializes the ResizeClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8392,15 +8322,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RestartCluster: """Deserializes the RestartCluster from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - restart_user=d.get("restart_user", None), - ) + return cls(cluster_id=d.get("cluster_id", None), restart_user=d.get("restart_user", None)) @dataclass class RestartClusterResponse: - def as_dict(self) -> dict: """Serializes the RestartClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8794,7 +8720,6 @@ def from_dict(cls, d: Dict[str, any]) -> StartCluster: @dataclass class StartClusterResponse: - def as_dict(self) -> dict: """Serializes the StartClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8989,15 +8914,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UninstallLibraries: """Deserializes the UninstallLibraries from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - libraries=_repeated_dict(d, "libraries", Library), - ) + return cls(cluster_id=d.get("cluster_id", None), libraries=_repeated_dict(d, "libraries", Library)) @dataclass class UninstallLibrariesResponse: - def as_dict(self) -> dict: """Serializes the UninstallLibrariesResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -9041,7 +8962,6 @@ def from_dict(cls, d: Dict[str, any]) -> UnpinCluster: @dataclass class UnpinClusterResponse: - def as_dict(self) -> dict: """Serializes the UnpinClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -9444,7 +9364,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateClusterResource: @dataclass class UpdateClusterResponse: - def as_dict(self) -> dict: """Serializes the UpdateClusterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -9463,7 +9382,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateClusterResponse: @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -9644,12 +9562,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/policies/clusters/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/policies/clusters/create", body=body, headers=headers) return CreatePolicyResponse.from_dict(res) def delete(self, policy_id: str): @@ -9670,12 +9583,7 @@ def delete(self, policy_id: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/policies/clusters/delete", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/policies/clusters/delete", body=body, headers=headers) def edit( self, @@ -9750,12 +9658,7 @@ def edit( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/policies/clusters/edit", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/policies/clusters/edit", body=body, headers=headers) def get(self, policy_id: str) -> Policy: """Get a cluster policy. @@ -9775,12 +9678,7 @@ def get(self, policy_id: str) -> Policy: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/policies/clusters/get", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/policies/clusters/get", query=query, headers=headers) return Policy.from_dict(res) def get_permission_levels(self, cluster_policy_id: str) -> GetClusterPolicyPermissionLevelsResponse: @@ -9799,9 +9697,7 @@ def get_permission_levels(self, cluster_policy_id: str) -> GetClusterPolicyPermi } res = self._api.do( - "GET", - f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}/permissionLevels", - headers=headers, + "GET", f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}/permissionLevels", headers=headers ) return GetClusterPolicyPermissionLevelsResponse.from_dict(res) @@ -9821,18 +9717,11 @@ def get_permissions(self, cluster_policy_id: str) -> ClusterPolicyPermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", headers=headers) return ClusterPolicyPermissions.from_dict(res) def list( - self, - *, - sort_column: Optional[ListSortColumn] = None, - sort_order: Optional[ListSortOrder] = None, + self, *, sort_column: Optional[ListSortColumn] = None, sort_order: Optional[ListSortOrder] = None ) -> Iterator[Policy]: """List cluster policies. @@ -9857,20 +9746,12 @@ def list( "Accept": "application/json", } - json = self._api.do( - "GET", - "/api/2.0/policies/clusters/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/policies/clusters/list", query=query, headers=headers) parsed = ListPoliciesResponse.from_dict(json).policies return parsed if parsed is not None else [] def set_permissions( - self, - cluster_policy_id: str, - *, - access_control_list: Optional[List[ClusterPolicyAccessControlRequest]] = None, + self, cluster_policy_id: str, *, access_control_list: Optional[List[ClusterPolicyAccessControlRequest]] = None ) -> ClusterPolicyPermissions: """Set cluster policy permissions. @@ -9892,18 +9773,12 @@ def set_permissions( } res = self._api.do( - "PUT", - f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", body=body, headers=headers ) return ClusterPolicyPermissions.from_dict(res) def update_permissions( - self, - cluster_policy_id: str, - *, - access_control_list: Optional[List[ClusterPolicyAccessControlRequest]] = None, + self, cluster_policy_id: str, *, access_control_list: Optional[List[ClusterPolicyAccessControlRequest]] = None ) -> ClusterPolicyPermissions: """Update cluster policy permissions. @@ -9925,10 +9800,7 @@ def update_permissions( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/cluster-policies/{cluster_policy_id}", body=body, headers=headers ) return ClusterPolicyPermissions.from_dict(res) @@ -10049,12 +9921,7 @@ def change_owner(self, cluster_id: str, owner_username: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.1/clusters/change-owner", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.1/clusters/change-owner", body=body, headers=headers) def create( self, @@ -10705,9 +10572,7 @@ def edit( op_response = self._api.do("POST", "/api/2.1/clusters/edit", body=body, headers=headers) return Wait( - self.wait_get_cluster_running, - response=EditClusterResponse.from_dict(op_response), - cluster_id=cluster_id, + self.wait_get_cluster_running, response=EditClusterResponse.from_dict(op_response), cluster_id=cluster_id ) def edit_and_wait( @@ -10882,11 +10747,7 @@ def get_permission_levels(self, cluster_id: str) -> GetClusterPermissionLevelsRe "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/clusters/{cluster_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/clusters/{cluster_id}/permissionLevels", headers=headers) return GetClusterPermissionLevelsResponse.from_dict(res) def get_permissions(self, cluster_id: str) -> ClusterPermissions: @@ -10904,11 +10765,7 @@ def get_permissions(self, cluster_id: str) -> ClusterPermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/clusters/{cluster_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/clusters/{cluster_id}", headers=headers) return ClusterPermissions.from_dict(res) def list( @@ -11013,12 +10870,7 @@ def permanent_delete(self, cluster_id: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.1/clusters/permanent-delete", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.1/clusters/permanent-delete", body=body, headers=headers) def pin(self, cluster_id: str): """Pin cluster. @@ -11042,11 +10894,7 @@ def pin(self, cluster_id: str): self._api.do("POST", "/api/2.1/clusters/pin", body=body, headers=headers) def resize( - self, - cluster_id: str, - *, - autoscale: Optional[AutoScale] = None, - num_workers: Optional[int] = None, + self, cluster_id: str, *, autoscale: Optional[AutoScale] = None, num_workers: Optional[int] = None ) -> Wait[ClusterDetails]: """Resize cluster. @@ -11086,9 +10934,7 @@ def resize( op_response = self._api.do("POST", "/api/2.1/clusters/resize", body=body, headers=headers) return Wait( - self.wait_get_cluster_running, - response=ResizeClusterResponse.from_dict(op_response), - cluster_id=cluster_id, + self.wait_get_cluster_running, response=ResizeClusterResponse.from_dict(op_response), cluster_id=cluster_id ) def resize_and_wait( @@ -11128,25 +10974,16 @@ def restart(self, cluster_id: str, *, restart_user: Optional[str] = None) -> Wai op_response = self._api.do("POST", "/api/2.1/clusters/restart", body=body, headers=headers) return Wait( - self.wait_get_cluster_running, - response=RestartClusterResponse.from_dict(op_response), - cluster_id=cluster_id, + self.wait_get_cluster_running, response=RestartClusterResponse.from_dict(op_response), cluster_id=cluster_id ) def restart_and_wait( - self, - cluster_id: str, - *, - restart_user: Optional[str] = None, - timeout=timedelta(minutes=20), + self, cluster_id: str, *, restart_user: Optional[str] = None, timeout=timedelta(minutes=20) ) -> ClusterDetails: return self.restart(cluster_id=cluster_id, restart_user=restart_user).result(timeout=timeout) def set_permissions( - self, - cluster_id: str, - *, - access_control_list: Optional[List[ClusterAccessControlRequest]] = None, + self, cluster_id: str, *, access_control_list: Optional[List[ClusterAccessControlRequest]] = None ) -> ClusterPermissions: """Set cluster permissions. @@ -11167,12 +11004,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/clusters/{cluster_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/clusters/{cluster_id}", body=body, headers=headers) return ClusterPermissions.from_dict(res) def spark_versions(self) -> GetSparkVersionsResponse: @@ -11217,9 +11049,7 @@ def start(self, cluster_id: str) -> Wait[ClusterDetails]: op_response = self._api.do("POST", "/api/2.1/clusters/start", body=body, headers=headers) return Wait( - self.wait_get_cluster_running, - response=StartClusterResponse.from_dict(op_response), - cluster_id=cluster_id, + self.wait_get_cluster_running, response=StartClusterResponse.from_dict(op_response), cluster_id=cluster_id ) def start_and_wait(self, cluster_id: str, timeout=timedelta(minutes=20)) -> ClusterDetails: @@ -11248,11 +11078,7 @@ def unpin(self, cluster_id: str): self._api.do("POST", "/api/2.1/clusters/unpin", body=body, headers=headers) def update( - self, - cluster_id: str, - update_mask: str, - *, - cluster: Optional[UpdateClusterResource] = None, + self, cluster_id: str, update_mask: str, *, cluster: Optional[UpdateClusterResource] = None ) -> Wait[ClusterDetails]: """Update cluster configuration (partial). @@ -11293,9 +11119,7 @@ def update( op_response = self._api.do("POST", "/api/2.1/clusters/update", body=body, headers=headers) return Wait( - self.wait_get_cluster_running, - response=UpdateClusterResponse.from_dict(op_response), - cluster_id=cluster_id, + self.wait_get_cluster_running, response=UpdateClusterResponse.from_dict(op_response), cluster_id=cluster_id ) def update_and_wait( @@ -11309,10 +11133,7 @@ def update_and_wait( return self.update(cluster=cluster, cluster_id=cluster_id, update_mask=update_mask).result(timeout=timeout) def update_permissions( - self, - cluster_id: str, - *, - access_control_list: Optional[List[ClusterAccessControlRequest]] = None, + self, cluster_id: str, *, access_control_list: Optional[List[ClusterAccessControlRequest]] = None ) -> ClusterPermissions: """Update cluster permissions. @@ -11332,19 +11153,13 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/clusters/{cluster_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/clusters/{cluster_id}", body=body, headers=headers) return ClusterPermissions.from_dict(res) class CommandExecutionAPI: """This API allows execution of Python, Scala, SQL, or R commands on running Databricks Clusters. This API - only supports (classic) all-purpose clusters. Serverless compute is not supported. - """ + only supports (classic) all-purpose clusters. Serverless compute is not supported.""" def __init__(self, api_client): self._api = api_client @@ -11363,11 +11178,7 @@ def wait_command_status_command_execution_cancelled( status_message = "polling..." attempt = 1 while time.time() < deadline: - poll = self.command_status( - cluster_id=cluster_id, - command_id=command_id, - context_id=context_id, - ) + poll = self.command_status(cluster_id=cluster_id, command_id=command_id, context_id=context_id) status = poll.status status_message = f"current status: {status}" if poll.results: @@ -11442,11 +11253,7 @@ def wait_command_status_command_execution_finished_or_error( status_message = "polling..." attempt = 1 while time.time() < deadline: - poll = self.command_status( - cluster_id=cluster_id, - command_id=command_id, - context_id=context_id, - ) + poll = self.command_status(cluster_id=cluster_id, command_id=command_id, context_id=context_id) status = poll.status status_message = f"current status: {status}" if status in target_states: @@ -11467,11 +11274,7 @@ def wait_command_status_command_execution_finished_or_error( raise TimeoutError(f"timed out after {timeout}: {status_message}") def cancel( - self, - *, - cluster_id: Optional[str] = None, - command_id: Optional[str] = None, - context_id: Optional[str] = None, + self, *, cluster_id: Optional[str] = None, command_id: Optional[str] = None, context_id: Optional[str] = None ) -> Wait[CommandStatusResponse]: """Cancel a command. @@ -11570,10 +11373,7 @@ def context_status(self, cluster_id: str, context_id: str) -> ContextStatusRespo return ContextStatusResponse.from_dict(res) def create( - self, - *, - cluster_id: Optional[str] = None, - language: Optional[Language] = None, + self, *, cluster_id: Optional[str] = None, language: Optional[Language] = None ) -> Wait[ContextStatusResponse]: """Create an execution context. @@ -11608,11 +11408,7 @@ def create( ) def create_and_wait( - self, - *, - cluster_id: Optional[str] = None, - language: Optional[Language] = None, - timeout=timedelta(minutes=20), + self, *, cluster_id: Optional[str] = None, language: Optional[Language] = None, timeout=timedelta(minutes=20) ) -> ContextStatusResponse: return self.create(cluster_id=cluster_id, language=language).result(timeout=timeout) @@ -11696,12 +11492,9 @@ def execute_and_wait( language: Optional[Language] = None, timeout=timedelta(minutes=20), ) -> CommandStatusResponse: - return self.execute( - cluster_id=cluster_id, - command=command, - context_id=context_id, - language=language, - ).result(timeout=timeout) + return self.execute(cluster_id=cluster_id, command=command, context_id=context_id, language=language).result( + timeout=timeout + ) class GlobalInitScriptsAPI: @@ -11717,12 +11510,7 @@ def __init__(self, api_client): self._api = api_client def create( - self, - name: str, - script: str, - *, - enabled: Optional[bool] = None, - position: Optional[int] = None, + self, name: str, script: str, *, enabled: Optional[bool] = None, position: Optional[int] = None ) -> CreateResponse: """Create init script. @@ -11777,11 +11565,7 @@ def delete(self, script_id: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/global-init-scripts/{script_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/global-init-scripts/{script_id}", headers=headers) def get(self, script_id: str) -> GlobalInitScriptDetailsWithContent: """Get an init script. @@ -11820,13 +11604,7 @@ def list(self) -> Iterator[GlobalInitScriptDetails]: return parsed if parsed is not None else [] def update( - self, - script_id: str, - name: str, - script: str, - *, - enabled: Optional[bool] = None, - position: Optional[int] = None, + self, script_id: str, name: str, script: str, *, enabled: Optional[bool] = None, position: Optional[int] = None ): """Update init script. @@ -11867,12 +11645,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/global-init-scripts/{script_id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/global-init-scripts/{script_id}", body=body, headers=headers) class InstancePoolsAPI: @@ -11996,12 +11769,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/instance-pools/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/instance-pools/create", body=body, headers=headers) return CreateInstancePoolResponse.from_dict(res) def delete(self, instance_pool_id: str): @@ -12022,12 +11790,7 @@ def delete(self, instance_pool_id: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/instance-pools/delete", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/instance-pools/delete", body=body, headers=headers) def edit( self, @@ -12133,9 +11896,7 @@ def get_permission_levels(self, instance_pool_id: str) -> GetInstancePoolPermiss } res = self._api.do( - "GET", - f"/api/2.0/permissions/instance-pools/{instance_pool_id}/permissionLevels", - headers=headers, + "GET", f"/api/2.0/permissions/instance-pools/{instance_pool_id}/permissionLevels", headers=headers ) return GetInstancePoolPermissionLevelsResponse.from_dict(res) @@ -12155,11 +11916,7 @@ def get_permissions(self, instance_pool_id: str) -> InstancePoolPermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/instance-pools/{instance_pool_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/instance-pools/{instance_pool_id}", headers=headers) return InstancePoolPermissions.from_dict(res) def list(self) -> Iterator[InstancePoolAndStats]: @@ -12179,10 +11936,7 @@ def list(self) -> Iterator[InstancePoolAndStats]: return parsed if parsed is not None else [] def set_permissions( - self, - instance_pool_id: str, - *, - access_control_list: Optional[List[InstancePoolAccessControlRequest]] = None, + self, instance_pool_id: str, *, access_control_list: Optional[List[InstancePoolAccessControlRequest]] = None ) -> InstancePoolPermissions: """Set instance pool permissions. @@ -12203,19 +11957,11 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/instance-pools/{instance_pool_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/instance-pools/{instance_pool_id}", body=body, headers=headers) return InstancePoolPermissions.from_dict(res) def update_permissions( - self, - instance_pool_id: str, - *, - access_control_list: Optional[List[InstancePoolAccessControlRequest]] = None, + self, instance_pool_id: str, *, access_control_list: Optional[List[InstancePoolAccessControlRequest]] = None ) -> InstancePoolPermissions: """Update instance pool permissions. @@ -12237,10 +11983,7 @@ def update_permissions( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/instance-pools/{instance_pool_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/instance-pools/{instance_pool_id}", body=body, headers=headers ) return InstancePoolPermissions.from_dict(res) @@ -12307,12 +12050,7 @@ def add( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/instance-profiles/add", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/instance-profiles/add", body=body, headers=headers) def edit( self, @@ -12366,12 +12104,7 @@ def edit( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/instance-profiles/edit", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/instance-profiles/edit", body=body, headers=headers) def list(self) -> Iterator[InstanceProfile]: """List available instance profiles. @@ -12412,12 +12145,7 @@ def remove(self, instance_profile_arn: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/instance-profiles/remove", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/instance-profiles/remove", body=body, headers=headers) class LibrariesAPI: @@ -12433,8 +12161,7 @@ class LibrariesAPI: or using an init script. When you uninstall a library from a cluster, the library is removed only when you restart the cluster. - Until you restart the cluster, the status of the uninstalled library appears as Uninstall pending restart. - """ + Until you restart the cluster, the status of the uninstalled library appears as Uninstall pending restart.""" def __init__(self, api_client): self._api = api_client @@ -12478,12 +12205,7 @@ def cluster_status(self, cluster_id: str) -> Iterator[LibraryFullStatus]: "Accept": "application/json", } - json = self._api.do( - "GET", - "/api/2.0/libraries/cluster-status", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/libraries/cluster-status", query=query, headers=headers) parsed = ClusterLibraryStatuses.from_dict(json).library_statuses return parsed if parsed is not None else [] @@ -12546,8 +12268,7 @@ class PolicyComplianceForClustersAPI: be out of compliance if their policy was updated after the cluster was last edited. The get and list compliance APIs allow you to view the policy compliance status of a cluster. The enforce - compliance API allows you to update a cluster to be compliant with the current version of its policy. - """ + compliance API allows you to update a cluster to be compliant with the current version of its policy.""" def __init__(self, api_client): self._api = api_client @@ -12587,12 +12308,7 @@ def enforce_compliance( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/policies/clusters/enforce-compliance", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/policies/clusters/enforce-compliance", body=body, headers=headers) return EnforceClusterComplianceResponse.from_dict(res) def get_compliance(self, cluster_id: str) -> GetClusterComplianceResponse: @@ -12614,20 +12330,11 @@ def get_compliance(self, cluster_id: str) -> GetClusterComplianceResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/policies/clusters/get-compliance", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/policies/clusters/get-compliance", query=query, headers=headers) return GetClusterComplianceResponse.from_dict(res) def list_compliance( - self, - policy_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, policy_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ClusterCompliance]: """List cluster policy compliance. @@ -12658,12 +12365,7 @@ def list_compliance( } while True: - json = self._api.do( - "GET", - "/api/2.0/policies/clusters/list-compliance", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/policies/clusters/list-compliance", query=query, headers=headers) if "clusters" in json: for v in json["clusters"]: yield ClusterCompliance.from_dict(v) @@ -12706,20 +12408,10 @@ def get(self, policy_family_id: str, *, version: Optional[int] = None) -> Policy "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/policy-families/{policy_family_id}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/policy-families/{policy_family_id}", query=query, headers=headers) return PolicyFamily.from_dict(res) - def list( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[PolicyFamily]: + def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[PolicyFamily]: """List policy families. Returns the list of policy definition types available to use at their latest version. This API is diff --git a/databricks/sdk/service/dashboards.py b/databricks/sdk/service/dashboards.py index d3f00a535..4a6473bf6 100755 --- a/databricks/sdk/service/dashboards.py +++ b/databricks/sdk/service/dashboards.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import sql # all definitions in this file are in alphabetical order @@ -125,10 +126,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CronSchedule: """Deserializes the CronSchedule from a dictionary.""" - return cls( - quartz_cron_expression=d.get("quartz_cron_expression", None), - timezone_id=d.get("timezone_id", None), - ) + return cls(quartz_cron_expression=d.get("quartz_cron_expression", None), timezone_id=d.get("timezone_id", None)) @dataclass @@ -267,7 +265,6 @@ class DataType(Enum): @dataclass class DeleteScheduleResponse: - def as_dict(self) -> dict: """Serializes the DeleteScheduleResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -286,7 +283,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteScheduleResponse: @dataclass class DeleteSubscriptionResponse: - def as_dict(self) -> dict: """Serializes the DeleteSubscriptionResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -375,7 +371,6 @@ def from_dict(cls, d: Dict[str, any]) -> ExecutePublishedDashboardQueryRequest: @dataclass class ExecuteQueryResponse: - def as_dict(self) -> dict: """Serializes the ExecuteQueryResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -421,10 +416,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GenieAttachment: """Deserializes the GenieAttachment from a dictionary.""" - return cls( - query=_from_dict(d, "query", QueryAttachment), - text=_from_dict(d, "text", TextAttachment), - ) + return cls(query=_from_dict(d, "query", QueryAttachment), text=_from_dict(d, "text", TextAttachment)) @dataclass @@ -765,7 +757,6 @@ def from_dict(cls, d: Dict[str, any]) -> GenieStartConversationResponse: @dataclass class GetPublishedDashboardEmbeddedResponse: - def as_dict(self) -> dict: """Serializes the GetPublishedDashboardEmbeddedResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -818,8 +809,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListDashboardsResponse: """Deserializes the ListDashboardsResponse from a dictionary.""" return cls( - dashboards=_repeated_dict(d, "dashboards", Dashboard), - next_page_token=d.get("next_page_token", None), + dashboards=_repeated_dict(d, "dashboards", Dashboard), next_page_token=d.get("next_page_token", None) ) @@ -852,10 +842,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListSchedulesResponse: """Deserializes the ListSchedulesResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - schedules=_repeated_dict(d, "schedules", Schedule), - ) + return cls(next_page_token=d.get("next_page_token", None), schedules=_repeated_dict(d, "schedules", Schedule)) @dataclass @@ -981,8 +968,7 @@ class MessageStatus(Enum): processing is completed. Results are in the `attachments` field. Get the SQL query result by calling [getMessageQueryResult](:method:genie/getMessageQueryResult) API. * `SUBMITTED`: Message has been submitted. * `QUERY_RESULT_EXPIRED`: SQL result is not available anymore. The user - needs to execute the query again. * `CANCELLED`: Message has been cancelled. - """ + needs to execute the query again. * `CANCELLED`: Message has been cancelled.""" ASKING_AI = "ASKING_AI" CANCELLED = "CANCELLED" @@ -1396,10 +1382,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> QuerySchema: """Deserializes the QuerySchema from a dictionary.""" - return cls( - columns=_repeated_dict(d, "columns", QuerySchemaColumn), - statement_id=d.get("statement_id", None), - ) + return cls(columns=_repeated_dict(d, "columns", QuerySchemaColumn), statement_id=d.get("statement_id", None)) @dataclass @@ -1438,9 +1421,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> QuerySchemaColumn: """Deserializes the QuerySchemaColumn from a dictionary.""" return cls( - data_type=_enum(d, "data_type", DataType), - name=d.get("name", None), - type_text=d.get("type_text", None), + data_type=_enum(d, "data_type", DataType), name=d.get("name", None), type_text=d.get("type_text", None) ) @@ -1789,10 +1770,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SuccessStatus: """Deserializes the SuccessStatus from a dictionary.""" - return cls( - data_token=d.get("data_token", None), - truncated=d.get("truncated", None), - ) + return cls(data_token=d.get("data_token", None), truncated=d.get("truncated", None)) @dataclass @@ -1828,7 +1806,6 @@ def from_dict(cls, d: Dict[str, any]) -> TextAttachment: @dataclass class TrashDashboardResponse: - def as_dict(self) -> dict: """Serializes the TrashDashboardResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1847,7 +1824,6 @@ def from_dict(cls, d: Dict[str, any]) -> TrashDashboardResponse: @dataclass class UnpublishDashboardResponse: - def as_dict(self) -> dict: """Serializes the UnpublishDashboardResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1887,11 +1863,7 @@ def wait_get_message_genie_completed( status_message = "polling..." attempt = 1 while time.time() < deadline: - poll = self.get_message( - conversation_id=conversation_id, - message_id=message_id, - space_id=space_id, - ) + poll = self.get_message(conversation_id=conversation_id, message_id=message_id, space_id=space_id) status = poll.status status_message = f"current status: {status}" if status in target_states: @@ -1951,11 +1923,7 @@ def create_message(self, space_id: str, conversation_id: str, content: str) -> W ) def create_message_and_wait( - self, - space_id: str, - conversation_id: str, - content: str, - timeout=timedelta(minutes=20), + self, space_id: str, conversation_id: str, content: str, timeout=timedelta(minutes=20) ) -> GenieMessage: return self.create_message(content=content, conversation_id=conversation_id, space_id=space_id).result( timeout=timeout @@ -2045,11 +2013,7 @@ def get_message_query_result( return GenieGetMessageQueryResultResponse.from_dict(res) def get_message_query_result_by_attachment( - self, - space_id: str, - conversation_id: str, - message_id: str, - attachment_id: str, + self, space_id: str, conversation_id: str, message_id: str, attachment_id: str ) -> GenieGetMessageQueryResultResponse: """Get conversation message SQL query result by attachment id. @@ -2102,10 +2066,7 @@ def start_conversation(self, space_id: str, content: str) -> Wait[GenieMessage]: } op_response = self._api.do( - "POST", - f"/api/2.0/genie/spaces/{space_id}/start-conversation", - body=body, - headers=headers, + "POST", f"/api/2.0/genie/spaces/{space_id}/start-conversation", body=body, headers=headers ) return Wait( self.wait_get_message_genie_completed, @@ -2159,20 +2120,11 @@ def create_schedule(self, dashboard_id: str, *, schedule: Optional[Schedule] = N "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", body=body, headers=headers) return Schedule.from_dict(res) def create_subscription( - self, - dashboard_id: str, - schedule_id: str, - *, - subscription: Optional[Subscription] = None, + self, dashboard_id: str, schedule_id: str, *, subscription: Optional[Subscription] = None ) -> Subscription: """Create schedule subscription. @@ -2198,13 +2150,7 @@ def create_subscription( ) return Subscription.from_dict(res) - def delete_schedule( - self, - dashboard_id: str, - schedule_id: str, - *, - etag: Optional[str] = None, - ): + def delete_schedule(self, dashboard_id: str, schedule_id: str, *, etag: Optional[str] = None): """Delete dashboard schedule. :param dashboard_id: str @@ -2233,12 +2179,7 @@ def delete_schedule( ) def delete_subscription( - self, - dashboard_id: str, - schedule_id: str, - subscription_id: str, - *, - etag: Optional[str] = None, + self, dashboard_id: str, schedule_id: str, subscription_id: str, *, etag: Optional[str] = None ): """Delete schedule subscription. @@ -2284,11 +2225,7 @@ def get(self, dashboard_id: str) -> Dashboard: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/lakeview/dashboards/{dashboard_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers) return Dashboard.from_dict(res) def get_published(self, dashboard_id: str) -> PublishedDashboard: @@ -2306,11 +2243,7 @@ def get_published(self, dashboard_id: str) -> PublishedDashboard: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers) return PublishedDashboard.from_dict(res) def get_schedule(self, dashboard_id: str, schedule_id: str) -> Schedule: @@ -2329,9 +2262,7 @@ def get_schedule(self, dashboard_id: str, schedule_id: str) -> Schedule: } res = self._api.do( - "GET", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", - headers=headers, + "GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", headers=headers ) return Schedule.from_dict(res) @@ -2397,12 +2328,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/lakeview/dashboards", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/lakeview/dashboards", query=query, headers=headers) if "dashboards" in json: for v in json["dashboards"]: yield Dashboard.from_dict(v) @@ -2411,11 +2337,7 @@ def list( query["page_token"] = json["next_page_token"] def list_schedules( - self, - dashboard_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, dashboard_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[Schedule]: """List dashboard schedules. @@ -2441,10 +2363,7 @@ def list_schedules( while True: json = self._api.do( - "GET", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", - query=query, - headers=headers, + "GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules", query=query, headers=headers ) if "schedules" in json: for v in json["schedules"]: @@ -2454,12 +2373,7 @@ def list_schedules( query["page_token"] = json["next_page_token"] def list_subscriptions( - self, - dashboard_id: str, - schedule_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, dashboard_id: str, schedule_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[Subscription]: """List schedule subscriptions. @@ -2537,20 +2451,11 @@ def migrate( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/lakeview/dashboards/migrate", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/lakeview/dashboards/migrate", body=body, headers=headers) return Dashboard.from_dict(res) def publish( - self, - dashboard_id: str, - *, - embed_credentials: Optional[bool] = None, - warehouse_id: Optional[str] = None, + self, dashboard_id: str, *, embed_credentials: Optional[bool] = None, warehouse_id: Optional[str] = None ) -> PublishedDashboard: """Publish dashboard. @@ -2576,12 +2481,7 @@ def publish( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", body=body, headers=headers) return PublishedDashboard.from_dict(res) def trash(self, dashboard_id: str): @@ -2599,11 +2499,7 @@ def trash(self, dashboard_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/lakeview/dashboards/{dashboard_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}", headers=headers) def unpublish(self, dashboard_id: str): """Unpublish dashboard. @@ -2620,11 +2516,7 @@ def unpublish(self, dashboard_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published", headers=headers) def update(self, dashboard_id: str, *, dashboard: Optional[Dashboard] = None) -> Dashboard: """Update dashboard. @@ -2643,21 +2535,10 @@ def update(self, dashboard_id: str, *, dashboard: Optional[Dashboard] = None) -> "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/lakeview/dashboards/{dashboard_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/lakeview/dashboards/{dashboard_id}", body=body, headers=headers) return Dashboard.from_dict(res) - def update_schedule( - self, - dashboard_id: str, - schedule_id: str, - *, - schedule: Optional[Schedule] = None, - ) -> Schedule: + def update_schedule(self, dashboard_id: str, schedule_id: str, *, schedule: Optional[Schedule] = None) -> Schedule: """Update dashboard schedule. :param dashboard_id: str @@ -2675,10 +2556,7 @@ def update_schedule( } res = self._api.do( - "PUT", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}", body=body, headers=headers ) return Schedule.from_dict(res) @@ -2704,11 +2582,7 @@ def get_published_dashboard_embedded(self, dashboard_id: str): "Accept": "application/json", } - self._api.do( - "GET", - f"/api/2.0/lakeview/dashboards/{dashboard_id}/published/embedded", - headers=headers, - ) + self._api.do("GET", f"/api/2.0/lakeview/dashboards/{dashboard_id}/published/embedded", headers=headers) class QueryExecutionAPI: @@ -2718,11 +2592,7 @@ def __init__(self, api_client): self._api = api_client def cancel_published_query_execution( - self, - dashboard_name: str, - dashboard_revision_id: str, - *, - tokens: Optional[List[str]] = None, + self, dashboard_name: str, dashboard_revision_id: str, *, tokens: Optional[List[str]] = None ) -> CancelQueryExecutionResponse: """Cancel the results for the a query for a published, embedded dashboard. @@ -2745,20 +2615,11 @@ def cancel_published_query_execution( "Accept": "application/json", } - res = self._api.do( - "DELETE", - "/api/2.0/lakeview-query/query/published", - query=query, - headers=headers, - ) + res = self._api.do("DELETE", "/api/2.0/lakeview-query/query/published", query=query, headers=headers) return CancelQueryExecutionResponse.from_dict(res) def execute_published_dashboard_query( - self, - dashboard_name: str, - dashboard_revision_id: str, - *, - override_warehouse_id: Optional[str] = None, + self, dashboard_name: str, dashboard_revision_id: str, *, override_warehouse_id: Optional[str] = None ): """Execute a query for a published dashboard. @@ -2784,19 +2645,10 @@ def execute_published_dashboard_query( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/lakeview-query/query/published", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/lakeview-query/query/published", body=body, headers=headers) def poll_published_query_status( - self, - dashboard_name: str, - dashboard_revision_id: str, - *, - tokens: Optional[List[str]] = None, + self, dashboard_name: str, dashboard_revision_id: str, *, tokens: Optional[List[str]] = None ) -> PollQueryStatusResponse: """Poll the results for the a query for a published, embedded dashboard. @@ -2819,10 +2671,5 @@ def poll_published_query_status( "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/lakeview-query/query/published", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/lakeview-query/query/published", query=query, headers=headers) return PollQueryStatusResponse.from_dict(res) diff --git a/databricks/sdk/service/files.py b/databricks/sdk/service/files.py index ff892d85d..579472472 100755 --- a/databricks/sdk/service/files.py +++ b/databricks/sdk/service/files.py @@ -10,6 +10,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -47,7 +48,6 @@ def from_dict(cls, d: Dict[str, any]) -> AddBlock: @dataclass class AddBlockResponse: - def as_dict(self) -> dict: """Serializes the AddBlockResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -91,7 +91,6 @@ def from_dict(cls, d: Dict[str, any]) -> Close: @dataclass class CloseResponse: - def as_dict(self) -> dict: """Serializes the CloseResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -142,7 +141,6 @@ def from_dict(cls, d: Dict[str, any]) -> Create: @dataclass class CreateDirectoryResponse: - def as_dict(self) -> dict: """Serializes the CreateDirectoryResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -220,7 +218,6 @@ def from_dict(cls, d: Dict[str, any]) -> Delete: @dataclass class DeleteDirectoryResponse: - def as_dict(self) -> dict: """Serializes the DeleteDirectoryResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -239,7 +236,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteDirectoryResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -415,7 +411,6 @@ def from_dict(cls, d: Dict[str, any]) -> FileInfo: @dataclass class GetDirectoryMetadataResponse: - def as_dict(self) -> dict: """Serializes the GetDirectoryMetadataResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -502,8 +497,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListDirectoryResponse: """Deserializes the ListDirectoryResponse from a dictionary.""" return cls( - contents=_repeated_dict(d, "contents", DirectoryEntry), - next_page_token=d.get("next_page_token", None), + contents=_repeated_dict(d, "contents", DirectoryEntry), next_page_token=d.get("next_page_token", None) ) @@ -559,7 +553,6 @@ def from_dict(cls, d: Dict[str, any]) -> MkDirs: @dataclass class MkDirsResponse: - def as_dict(self) -> dict: """Serializes the MkDirsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -605,15 +598,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Move: """Deserializes the Move from a dictionary.""" - return cls( - destination_path=d.get("destination_path", None), - source_path=d.get("source_path", None), - ) + return cls(destination_path=d.get("destination_path", None), source_path=d.get("source_path", None)) @dataclass class MoveResponse: - def as_dict(self) -> dict: """Serializes the MoveResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -666,16 +655,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Put: """Deserializes the Put from a dictionary.""" - return cls( - contents=d.get("contents", None), - overwrite=d.get("overwrite", None), - path=d.get("path", None), - ) + return cls(contents=d.get("contents", None), overwrite=d.get("overwrite", None), path=d.get("path", None)) @dataclass class PutResponse: - def as_dict(self) -> dict: """Serializes the PutResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -727,7 +711,6 @@ def from_dict(cls, d: Dict[str, any]) -> ReadResponse: @dataclass class UploadResponse: - def as_dict(self) -> dict: """Serializes the UploadResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -971,13 +954,7 @@ def move(self, source_path: str, destination_path: str): self._api.do("POST", "/api/2.0/dbfs/move", body=body, headers=headers) - def put( - self, - path: str, - *, - contents: Optional[str] = None, - overwrite: Optional[bool] = None, - ): + def put(self, path: str, *, contents: Optional[str] = None, overwrite: Optional[bool] = None): """Upload a file. Uploads a file through the use of multipart form post. It is mainly used for streaming uploads, but @@ -1014,13 +991,7 @@ def put( self._api.do("POST", "/api/2.0/dbfs/put", body=body, headers=headers) - def read( - self, - path: str, - *, - length: Optional[int] = None, - offset: Optional[int] = None, - ) -> ReadResponse: + def read(self, path: str, *, length: Optional[int] = None, offset: Optional[int] = None) -> ReadResponse: """Get the contents of a file. Returns the contents of a file. If the file does not exist, this call throws an exception with @@ -1074,8 +1045,7 @@ class FilesAPI: `enable_experimental_files_api_client = True` in your configuration profile or use the environment variable `DATABRICKS_ENABLE_EXPERIMENTAL_FILES_API_CLIENT=True`. - [Unity Catalog volumes]: https://docs.databricks.com/en/connect/unity-catalog/volumes.html - """ + [Unity Catalog volumes]: https://docs.databricks.com/en/connect/unity-catalog/volumes.html""" def __init__(self, api_client): self._api = api_client @@ -1096,9 +1066,7 @@ def create_directory(self, directory_path: str): headers = {} self._api.do( - "PUT", - f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", - headers=headers, + "PUT", f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", headers=headers ) def delete(self, file_path: str): @@ -1114,11 +1082,7 @@ def delete(self, file_path: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/fs/files{_escape_multi_segment_path_parameter(file_path)}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/fs/files{_escape_multi_segment_path_parameter(file_path)}", headers=headers) def delete_directory(self, directory_path: str): """Delete a directory. @@ -1137,9 +1101,7 @@ def delete_directory(self, directory_path: str): headers = {} self._api.do( - "DELETE", - f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", - headers=headers, + "DELETE", f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", headers=headers ) def download(self, file_path: str) -> DownloadResponse: @@ -1191,9 +1153,7 @@ def get_directory_metadata(self, directory_path: str): headers = {} self._api.do( - "HEAD", - f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", - headers=headers, + "HEAD", f"/api/2.0/fs/directories{_escape_multi_segment_path_parameter(directory_path)}", headers=headers ) def get_metadata(self, file_path: str) -> GetMetadataResponse: @@ -1222,11 +1182,7 @@ def get_metadata(self, file_path: str) -> GetMetadataResponse: return GetMetadataResponse.from_dict(res) def list_directory_contents( - self, - directory_path: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, directory_path: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[DirectoryEntry]: """List directory contents. @@ -1279,13 +1235,7 @@ def list_directory_contents( return query["page_token"] = json["next_page_token"] - def upload( - self, - file_path: str, - contents: BinaryIO, - *, - overwrite: Optional[bool] = None, - ): + def upload(self, file_path: str, contents: BinaryIO, *, overwrite: Optional[bool] = None): """Upload a file. Uploads a file of up to 5 GiB. The file contents should be sent as the request body as raw bytes (an diff --git a/databricks/sdk/service/iam.py b/databricks/sdk/service/iam.py index 6eac0b856..62dabb127 100755 --- a/databricks/sdk/service/iam.py +++ b/databricks/sdk/service/iam.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -127,8 +128,7 @@ def from_dict(cls, d: Dict[str, any]) -> AccessControlResponse: @dataclass class Actor: """represents an identity trying to access a resource - user or a service principal group can be a - principal of a permission set assignment but an actor is always a user or a service principal - """ + principal of a permission set assignment but an actor is always a user or a service principal""" actor_id: Optional[int] = None @@ -265,7 +265,6 @@ def from_dict(cls, d: Dict[str, any]) -> ConsistencyToken: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -284,7 +283,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteResponse: @dataclass class DeleteWorkspacePermissionAssignmentResponse: - def as_dict(self) -> dict: """Serializes the DeleteWorkspacePermissionAssignmentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -802,10 +800,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Name: """Deserializes the Name from a dictionary.""" - return cls( - family_name=d.get("familyName", None), - given_name=d.get("givenName", None), - ) + return cls(family_name=d.get("familyName", None), given_name=d.get("givenName", None)) @dataclass @@ -1181,11 +1176,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Patch: """Deserializes the Patch from a dictionary.""" - return cls( - op=_enum(d, "op", PatchOp), - path=d.get("path", None), - value=d.get("value", None), - ) + return cls(op=_enum(d, "op", PatchOp), path=d.get("path", None), value=d.get("value", None)) class PatchOp(Enum): @@ -1198,7 +1189,6 @@ class PatchOp(Enum): @dataclass class PatchResponse: - def as_dict(self) -> dict: """Serializes the PatchResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1383,8 +1373,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> PermissionOutput: """Deserializes the PermissionOutput from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", WorkspacePermission), + description=d.get("description", None), permission_level=_enum(d, "permission_level", WorkspacePermission) ) @@ -1417,8 +1406,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> PermissionsDescription: """Deserializes the PermissionsDescription from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", PermissionLevel), + description=d.get("description", None), permission_level=_enum(d, "permission_level", PermissionLevel) ) @@ -1665,9 +1653,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> RuleSetResponse: """Deserializes the RuleSetResponse from a dictionary.""" return cls( - etag=d.get("etag", None), - grant_rules=_repeated_dict(d, "grant_rules", GrantRule), - name=d.get("name", None), + etag=d.get("etag", None), grant_rules=_repeated_dict(d, "grant_rules", GrantRule), name=d.get("name", None) ) @@ -1708,9 +1694,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> RuleSetUpdateRequest: """Deserializes the RuleSetUpdateRequest from a dictionary.""" return cls( - etag=d.get("etag", None), - grant_rules=_repeated_dict(d, "grant_rules", GrantRule), - name=d.get("name", None), + etag=d.get("etag", None), grant_rules=_repeated_dict(d, "grant_rules", GrantRule), name=d.get("name", None) ) @@ -1813,7 +1797,6 @@ class ServicePrincipalSchema(Enum): @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1858,10 +1841,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateRuleSetRequest: """Deserializes the UpdateRuleSetRequest from a dictionary.""" - return cls( - name=d.get("name", None), - rule_set=_from_dict(d, "rule_set", RuleSetUpdateRequest), - ) + return cls(name=d.get("name", None), rule_set=_from_dict(d, "rule_set", RuleSetUpdateRequest)) @dataclass @@ -2111,12 +2091,7 @@ def check_policy( "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/access-control/check-policy-v2", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/access-control/check-policy-v2", query=query, headers=headers) return CheckPolicyResponse.from_dict(res) @@ -2225,8 +2200,7 @@ def update_rule_set(self, name: str, rule_set: RuleSetUpdateRequest) -> RuleSetR class AccountAccessControlProxyAPI: """These APIs manage access rules on resources in an account. Currently, only grant rules are supported. A grant rule specifies a role assigned to a set of principals. A list of rules attached to a resource is - called a rule set. A workspace must belong to an account for these APIs to work. - """ + called a rule set. A workspace must belong to an account for these APIs to work.""" def __init__(self, api_client): self._api = api_client @@ -2251,10 +2225,7 @@ def get_assignable_roles_for_resource(self, resource: str) -> GetAssignableRoles } res = self._api.do( - "GET", - "/api/2.0/preview/accounts/access-control/assignable-roles", - query=query, - headers=headers, + "GET", "/api/2.0/preview/accounts/access-control/assignable-roles", query=query, headers=headers ) return GetAssignableRolesForResourceResponse.from_dict(res) @@ -2286,12 +2257,7 @@ def get_rule_set(self, name: str, etag: str) -> RuleSetResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/preview/accounts/access-control/rule-sets", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/preview/accounts/access-control/rule-sets", query=query, headers=headers) return RuleSetResponse.from_dict(res) def update_rule_set(self, name: str, rule_set: RuleSetUpdateRequest) -> RuleSetResponse: @@ -2316,12 +2282,7 @@ def update_rule_set(self, name: str, rule_set: RuleSetUpdateRequest) -> RuleSetR "Content-Type": "application/json", } - res = self._api.do( - "PUT", - "/api/2.0/preview/accounts/access-control/rule-sets", - body=body, - headers=headers, - ) + res = self._api.do("PUT", "/api/2.0/preview/accounts/access-control/rule-sets", body=body, headers=headers) return RuleSetResponse.from_dict(res) @@ -2399,10 +2360,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups", body=body, headers=headers ) return Group.from_dict(res) @@ -2419,11 +2377,7 @@ def delete(self, id: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", headers=headers) def get(self, id: str) -> Group: """Get group details. @@ -2440,11 +2394,7 @@ def get(self, id: str) -> Group: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", headers=headers) return Group.from_dict(res) def list( @@ -2511,10 +2461,7 @@ def list( query["count"] = 100 while True: json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups", query=query, headers=headers ) if "Resources" in json: for v in json["Resources"]: @@ -2527,13 +2474,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update group details. Partially updates the details of a group. @@ -2557,10 +2498,7 @@ def patch( } self._api.do( - "PATCH", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", body=body, headers=headers ) def update( @@ -2623,12 +2561,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Groups/{id}", body=body, headers=headers) class AccountServicePrincipalsAPI: @@ -2705,10 +2638,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals", body=body, headers=headers ) return ServicePrincipal.from_dict(res) @@ -2726,9 +2656,7 @@ def delete(self, id: str): headers = {} self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals/{id}", - headers=headers, + "DELETE", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals/{id}", headers=headers ) def get(self, id: str) -> ServicePrincipal: @@ -2747,9 +2675,7 @@ def get(self, id: str) -> ServicePrincipal: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals/{id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/ServicePrincipals/{id}", headers=headers ) return ServicePrincipal.from_dict(res) @@ -2833,13 +2759,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update service principal details. Partially updates the details of a single service principal in the Databricks account. @@ -3033,10 +2953,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users", body=body, headers=headers ) return User.from_dict(res) @@ -3054,11 +2971,7 @@ def delete(self, id: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", headers=headers) def get( self, @@ -3122,10 +3035,7 @@ def get( } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", query=query, headers=headers ) return User.from_dict(res) @@ -3194,10 +3104,7 @@ def list( query["count"] = 100 while True: json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users", query=query, headers=headers ) if "Resources" in json: for v in json["Resources"]: @@ -3210,13 +3117,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update user details. Partially updates a user resource by applying the supplied operations on specific user attributes. @@ -3240,10 +3141,7 @@ def patch( } self._api.do( - "PATCH", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", body=body, headers=headers ) def update( @@ -3321,12 +3219,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/accounts/{self._api.account_id}/scim/v2/Users/{id}", body=body, headers=headers) class CurrentUserAPI: @@ -3357,8 +3250,7 @@ class GroupsAPI: It is best practice to assign access to workspaces and access-control policies in Unity Catalog to groups, instead of to users individually. All Databricks workspace identities can be assigned as members of - groups, and members inherit permissions that are assigned to their group. - """ + groups, and members inherit permissions that are assigned to their group.""" def __init__(self, api_client): self._api = api_client @@ -3425,12 +3317,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/preview/scim/v2/Groups", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/preview/scim/v2/Groups", body=body, headers=headers) return Group.from_dict(res) def delete(self, id: str): @@ -3529,12 +3416,7 @@ def list( if "count" not in query: query["count"] = 100 while True: - json = self._api.do( - "GET", - "/api/2.0/preview/scim/v2/Groups", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/preview/scim/v2/Groups", query=query, headers=headers) if "Resources" in json: for v in json["Resources"]: i = v["id"] @@ -3546,13 +3428,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update group details. Partially updates the details of a group. @@ -3575,12 +3451,7 @@ def patch( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/preview/scim/v2/Groups/{id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/preview/scim/v2/Groups/{id}", body=body, headers=headers) def update( self, @@ -3642,12 +3513,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/preview/scim/v2/Groups/{id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/preview/scim/v2/Groups/{id}", body=body, headers=headers) class PermissionMigrationAPI: @@ -3744,8 +3610,7 @@ class PermissionsAPI: Note that to manage access control on service principals, use **[Account Access Control Proxy](:service:accountaccesscontrolproxy)**. - [Access Control]: https://docs.databricks.com/security/auth-authz/access-control/index.html - """ + [Access Control]: https://docs.databricks.com/security/auth-authz/access-control/index.html""" def __init__(self, api_client): self._api = api_client @@ -3770,11 +3635,7 @@ def get(self, request_object_type: str, request_object_id: str) -> ObjectPermiss "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/{request_object_type}/{request_object_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/{request_object_type}/{request_object_id}", headers=headers) return ObjectPermissions.from_dict(res) def get_permission_levels(self, request_object_type: str, request_object_id: str) -> GetPermissionLevelsResponse: @@ -3795,9 +3656,7 @@ def get_permission_levels(self, request_object_type: str, request_object_id: str } res = self._api.do( - "GET", - f"/api/2.0/permissions/{request_object_type}/{request_object_id}/permissionLevels", - headers=headers, + "GET", f"/api/2.0/permissions/{request_object_type}/{request_object_id}/permissionLevels", headers=headers ) return GetPermissionLevelsResponse.from_dict(res) @@ -3833,10 +3692,7 @@ def set( } res = self._api.do( - "PUT", - f"/api/2.0/permissions/{request_object_type}/{request_object_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/permissions/{request_object_type}/{request_object_id}", body=body, headers=headers ) return ObjectPermissions.from_dict(res) @@ -3871,10 +3727,7 @@ def update( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/{request_object_type}/{request_object_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/{request_object_type}/{request_object_id}", body=body, headers=headers ) return ObjectPermissions.from_dict(res) @@ -3952,12 +3805,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/preview/scim/v2/ServicePrincipals", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/preview/scim/v2/ServicePrincipals", body=body, headers=headers) return ServicePrincipal.from_dict(res) def delete(self, id: str): @@ -3973,11 +3821,7 @@ def delete(self, id: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", headers=headers) def get(self, id: str) -> ServicePrincipal: """Get service principal details. @@ -3994,11 +3838,7 @@ def get(self, id: str) -> ServicePrincipal: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", headers=headers) return ServicePrincipal.from_dict(res) def list( @@ -4064,12 +3904,7 @@ def list( if "count" not in query: query["count"] = 100 while True: - json = self._api.do( - "GET", - "/api/2.0/preview/scim/v2/ServicePrincipals", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/preview/scim/v2/ServicePrincipals", query=query, headers=headers) if "Resources" in json: for v in json["Resources"]: i = v["id"] @@ -4081,13 +3916,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update service principal details. Partially updates the details of a single service principal in the Databricks workspace. @@ -4110,12 +3939,7 @@ def patch( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", body=body, headers=headers) def update( self, @@ -4180,12 +4004,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/preview/scim/v2/ServicePrincipals/{id}", body=body, headers=headers) class UsersAPI: @@ -4280,12 +4099,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/preview/scim/v2/Users", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/preview/scim/v2/Users", body=body, headers=headers) return User.from_dict(res) def delete(self, id: str): @@ -4365,12 +4179,7 @@ def get( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/preview/scim/v2/Users/{id}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/preview/scim/v2/Users/{id}", query=query, headers=headers) return User.from_dict(res) def get_permission_levels(self) -> GetPasswordPermissionLevelsResponse: @@ -4385,11 +4194,7 @@ def get_permission_levels(self) -> GetPasswordPermissionLevelsResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/permissions/authorization/passwords/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/permissions/authorization/passwords/permissionLevels", headers=headers) return GetPasswordPermissionLevelsResponse.from_dict(res) def get_permissions(self) -> PasswordPermissions: @@ -4404,11 +4209,7 @@ def get_permissions(self) -> PasswordPermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/permissions/authorization/passwords", - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/permissions/authorization/passwords", headers=headers) return PasswordPermissions.from_dict(res) def list( @@ -4475,12 +4276,7 @@ def list( if "count" not in query: query["count"] = 100 while True: - json = self._api.do( - "GET", - "/api/2.0/preview/scim/v2/Users", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/preview/scim/v2/Users", query=query, headers=headers) if "Resources" in json: for v in json["Resources"]: i = v["id"] @@ -4492,13 +4288,7 @@ def list( return query["startIndex"] += len(json["Resources"]) - def patch( - self, - id: str, - *, - operations: Optional[List[Patch]] = None, - schemas: Optional[List[PatchSchema]] = None, - ): + def patch(self, id: str, *, operations: Optional[List[Patch]] = None, schemas: Optional[List[PatchSchema]] = None): """Update user details. Partially updates a user resource by applying the supplied operations on specific user attributes. @@ -4521,17 +4311,10 @@ def patch( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/preview/scim/v2/Users/{id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/preview/scim/v2/Users/{id}", body=body, headers=headers) def set_permissions( - self, - *, - access_control_list: Optional[List[PasswordAccessControlRequest]] = None, + self, *, access_control_list: Optional[List[PasswordAccessControlRequest]] = None ) -> PasswordPermissions: """Set password permissions. @@ -4550,12 +4333,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - "/api/2.0/permissions/authorization/passwords", - body=body, - headers=headers, - ) + res = self._api.do("PUT", "/api/2.0/permissions/authorization/passwords", body=body, headers=headers) return PasswordPermissions.from_dict(res) def update( @@ -4633,17 +4411,10 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/preview/scim/v2/Users/{id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/preview/scim/v2/Users/{id}", body=body, headers=headers) def update_permissions( - self, - *, - access_control_list: Optional[List[PasswordAccessControlRequest]] = None, + self, *, access_control_list: Optional[List[PasswordAccessControlRequest]] = None ) -> PasswordPermissions: """Update password permissions. @@ -4661,12 +4432,7 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - "/api/2.0/permissions/authorization/passwords", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", "/api/2.0/permissions/authorization/passwords", body=body, headers=headers) return PasswordPermissions.from_dict(res) @@ -4747,11 +4513,7 @@ def list(self, workspace_id: int) -> Iterator[PermissionAssignment]: return parsed if parsed is not None else [] def update( - self, - workspace_id: int, - principal_id: int, - *, - permissions: Optional[List[WorkspacePermission]] = None, + self, workspace_id: int, principal_id: int, *, permissions: Optional[List[WorkspacePermission]] = None ) -> PermissionAssignment: """Create or update permissions assignment. diff --git a/databricks/sdk/service/jobs.py b/databricks/sdk/service/jobs.py index ea66f8ce6..6f0d595ed 100755 --- a/databricks/sdk/service/jobs.py +++ b/databricks/sdk/service/jobs.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import compute # all definitions in this file are in alphabetical order @@ -461,15 +462,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CancelAllRuns: """Deserializes the CancelAllRuns from a dictionary.""" - return cls( - all_queued_runs=d.get("all_queued_runs", None), - job_id=d.get("job_id", None), - ) + return cls(all_queued_runs=d.get("all_queued_runs", None), job_id=d.get("job_id", None)) @dataclass class CancelAllRunsResponse: - def as_dict(self) -> dict: """Serializes the CancelAllRunsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -513,7 +510,6 @@ def from_dict(cls, d: Dict[str, any]) -> CancelRun: @dataclass class CancelRunResponse: - def as_dict(self) -> dict: """Serializes the CancelRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -738,10 +734,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ClusterInstance: """Deserializes the ClusterInstance from a dictionary.""" - return cls( - cluster_id=d.get("cluster_id", None), - spark_context_id=d.get("spark_context_id", None), - ) + return cls(cluster_id=d.get("cluster_id", None), spark_context_id=d.get("spark_context_id", None)) @dataclass @@ -851,11 +844,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ConditionTask: """Deserializes the ConditionTask from a dictionary.""" - return cls( - left=d.get("left", None), - op=_enum(d, "op", ConditionTaskOp), - right=d.get("right", None), - ) + return cls(left=d.get("left", None), op=_enum(d, "op", ConditionTaskOp), right=d.get("right", None)) class ConditionTaskOp(Enum): @@ -1268,10 +1257,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DbtOutput: """Deserializes the DbtOutput from a dictionary.""" - return cls( - artifacts_headers=d.get("artifacts_headers", None), - artifacts_link=d.get("artifacts_link", None), - ) + return cls(artifacts_headers=d.get("artifacts_headers", None), artifacts_link=d.get("artifacts_link", None)) @dataclass @@ -1390,7 +1376,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteJob: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1434,7 +1419,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteRun: @dataclass class DeleteRunResponse: - def as_dict(self) -> dict: """Serializes the DeleteRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1495,9 +1479,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> EnforcePolicyComplianceForJobResponseJobClusterSettingsChange: """Deserializes the EnforcePolicyComplianceForJobResponseJobClusterSettingsChange from a dictionary.""" return cls( - field=d.get("field", None), - new_value=d.get("new_value", None), - previous_value=d.get("previous_value", None), + field=d.get("field", None), new_value=d.get("new_value", None), previous_value=d.get("previous_value", None) ) @@ -1530,10 +1512,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EnforcePolicyComplianceRequest: """Deserializes the EnforcePolicyComplianceRequest from a dictionary.""" - return cls( - job_id=d.get("job_id", None), - validate_only=d.get("validate_only", None), - ) + return cls(job_id=d.get("job_id", None), validate_only=d.get("validate_only", None)) @dataclass @@ -1580,9 +1559,7 @@ def from_dict(cls, d: Dict[str, any]) -> EnforcePolicyComplianceResponse: return cls( has_changes=d.get("has_changes", None), job_cluster_changes=_repeated_dict( - d, - "job_cluster_changes", - EnforcePolicyComplianceForJobResponseJobClusterSettingsChange, + d, "job_cluster_changes", EnforcePolicyComplianceForJobResponseJobClusterSettingsChange ), settings=_from_dict(d, "settings", JobSettings), ) @@ -1738,9 +1715,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ForEachTask: """Deserializes the ForEachTask from a dictionary.""" return cls( - concurrency=d.get("concurrency", None), - inputs=d.get("inputs", None), - task=_from_dict(d, "task", Task), + concurrency=d.get("concurrency", None), inputs=d.get("inputs", None), task=_from_dict(d, "task", Task) ) @@ -1919,10 +1894,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetPolicyComplianceResponse: """Deserializes the GetPolicyComplianceResponse from a dictionary.""" - return cls( - is_compliant=d.get("is_compliant", None), - violations=d.get("violations", None), - ) + return cls(is_compliant=d.get("is_compliant", None), violations=d.get("violations", None)) class GitProvider(Enum): @@ -2340,9 +2312,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> JobCompliance: """Deserializes the JobCompliance from a dictionary.""" return cls( - is_compliant=d.get("is_compliant", None), - job_id=d.get("job_id", None), - violations=d.get("violations", None), + is_compliant=d.get("is_compliant", None), job_id=d.get("job_id", None), violations=d.get("violations", None) ) @@ -2377,10 +2347,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> JobDeployment: """Deserializes the JobDeployment from a dictionary.""" - return cls( - kind=_enum(d, "kind", JobDeploymentKind), - metadata_file_path=d.get("metadata_file_path", None), - ) + return cls(kind=_enum(d, "kind", JobDeploymentKind), metadata_file_path=d.get("metadata_file_path", None)) class JobDeploymentKind(Enum): @@ -2511,10 +2478,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> JobEnvironment: """Deserializes the JobEnvironment from a dictionary.""" - return cls( - environment_key=d.get("environment_key", None), - spec=_from_dict(d, "spec", compute.Environment), - ) + return cls(environment_key=d.get("environment_key", None), spec=_from_dict(d, "spec", compute.Environment)) @dataclass @@ -2590,11 +2554,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> JobParameter: """Deserializes the JobParameter from a dictionary.""" - return cls( - default=d.get("default", None), - name=d.get("name", None), - value=d.get("value", None), - ) + return cls(default=d.get("default", None), name=d.get("name", None), value=d.get("value", None)) @dataclass @@ -2748,8 +2708,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> JobPermissionsDescription: """Deserializes the JobPermissionsDescription from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", JobPermissionLevel), + description=d.get("description", None), permission_level=_enum(d, "permission_level", JobPermissionLevel) ) @@ -2792,8 +2751,7 @@ class JobRunAs: """Write-only setting. Specifies the user or service principal that the job runs as. If not specified, the job runs as the user who created the job. - Either `user_name` or `service_principal_name` should be specified. If not, an error is thrown. - """ + Either `user_name` or `service_principal_name` should be specified. If not, an error is thrown.""" service_principal_name: Optional[str] = None """Application ID of an active service principal. Setting this field requires the @@ -2824,10 +2782,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> JobRunAs: """Deserializes the JobRunAs from a dictionary.""" - return cls( - service_principal_name=d.get("service_principal_name", None), - user_name=d.get("user_name", None), - ) + return cls(service_principal_name=d.get("service_principal_name", None), user_name=d.get("user_name", None)) @dataclass @@ -3564,8 +3519,7 @@ class PauseStatus(Enum): class PerformanceTarget(Enum): """PerformanceTarget defines how performant (lower latency) or cost efficient the execution of run on serverless compute should be. The performance mode on the job or pipeline should map to a - performance setting that is passed to Cluster Manager (see cluster-common PerformanceTarget). - """ + performance setting that is passed to Cluster Manager (see cluster-common PerformanceTarget).""" COST_OPTIMIZED = "COST_OPTIMIZED" PERFORMANCE_OPTIMIZED = "PERFORMANCE_OPTIMIZED" @@ -3600,10 +3554,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PeriodicTriggerConfiguration: """Deserializes the PeriodicTriggerConfiguration from a dictionary.""" - return cls( - interval=d.get("interval", None), - unit=_enum(d, "unit", PeriodicTriggerConfigurationTimeUnit), - ) + return cls(interval=d.get("interval", None), unit=_enum(d, "unit", PeriodicTriggerConfigurationTimeUnit)) class PeriodicTriggerConfigurationTimeUnit(Enum): @@ -3667,10 +3618,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PipelineTask: """Deserializes the PipelineTask from a dictionary.""" - return cls( - full_refresh=d.get("full_refresh", None), - pipeline_id=d.get("pipeline_id", None), - ) + return cls(full_refresh=d.get("full_refresh", None), pipeline_id=d.get("pipeline_id", None)) @dataclass @@ -3761,10 +3709,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> QueueDetails: """Deserializes the QueueDetails from a dictionary.""" - return cls( - code=_enum(d, "code", QueueDetailsCodeCode), - message=d.get("message", None), - ) + return cls(code=_enum(d, "code", QueueDetailsCodeCode), message=d.get("message", None)) class QueueDetailsCodeCode(Enum): @@ -4130,15 +4075,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResetJob: """Deserializes the ResetJob from a dictionary.""" - return cls( - job_id=d.get("job_id", None), - new_settings=_from_dict(d, "new_settings", JobSettings), - ) + return cls(job_id=d.get("job_id", None), new_settings=_from_dict(d, "new_settings", JobSettings)) @dataclass class ResetResponse: - def as_dict(self) -> dict: """Serializes the ResetResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4284,10 +4225,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResolvedPythonWheelTaskValues: """Deserializes the ResolvedPythonWheelTaskValues from a dictionary.""" - return cls( - named_parameters=d.get("named_parameters", None), - parameters=d.get("parameters", None), - ) + return cls(named_parameters=d.get("named_parameters", None), parameters=d.get("parameters", None)) @dataclass @@ -4317,10 +4255,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResolvedRunJobTaskValues: """Deserializes the ResolvedRunJobTaskValues from a dictionary.""" - return cls( - job_parameters=d.get("job_parameters", None), - parameters=d.get("parameters", None), - ) + return cls(job_parameters=d.get("job_parameters", None), parameters=d.get("parameters", None)) @dataclass @@ -5109,8 +5044,7 @@ class RunLifeCycleState(Enum): exceptional state that indicates a failure in the Jobs service, such as network failure over a long period. If a run on a new cluster ends in the `INTERNAL_ERROR` state, the Jobs service terminates the cluster as soon as possible. This state is terminal. * `BLOCKED`: The run is - blocked on an upstream dependency. * `WAITING_FOR_RETRY`: The run is waiting for a retry. - """ + blocked on an upstream dependency. * `WAITING_FOR_RETRY`: The run is waiting for a retry.""" BLOCKED = "BLOCKED" INTERNAL_ERROR = "INTERNAL_ERROR" @@ -5360,10 +5294,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RunNowResponse: """Deserializes the RunNowResponse from a dictionary.""" - return cls( - number_in_job=d.get("number_in_job", None), - run_id=d.get("run_id", None), - ) + return cls(number_in_job=d.get("number_in_job", None), run_id=d.get("run_id", None)) @dataclass @@ -5473,9 +5404,7 @@ def from_dict(cls, d: Dict[str, any]) -> RunOutput: """Deserializes the RunOutput from a dictionary.""" return cls( clean_rooms_notebook_output=_from_dict( - d, - "clean_rooms_notebook_output", - CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput, + d, "clean_rooms_notebook_output", CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput ), dbt_output=_from_dict(d, "dbt_output", DbtOutput), error=d.get("error", None), @@ -6182,8 +6111,7 @@ class RunType(Enum): `WORKFLOW_RUN`: Workflow run. A run created with [dbutils.notebook.run]. * `SUBMIT_RUN`: Submit run. A run created with :method:jobs/submit. - [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow - """ + [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow""" JOB_RUN = "JOB_RUN" SUBMIT_RUN = "SUBMIT_RUN" @@ -6452,8 +6380,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> SqlDashboardOutput: """Deserializes the SqlDashboardOutput from a dictionary.""" return cls( - warehouse_id=d.get("warehouse_id", None), - widgets=_repeated_dict(d, "widgets", SqlDashboardWidgetOutput), + warehouse_id=d.get("warehouse_id", None), widgets=_repeated_dict(d, "widgets", SqlDashboardWidgetOutput) ) @@ -6952,10 +6879,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SqlTaskSubscription: """Deserializes the SqlTaskSubscription from a dictionary.""" - return cls( - destination_id=d.get("destination_id", None), - user_name=d.get("user_name", None), - ) + return cls(destination_id=d.get("destination_id", None), user_name=d.get("user_name", None)) @dataclass @@ -7948,8 +7872,7 @@ class TerminationCodeCode(Enum): `MAX_JOB_QUEUE_SIZE_EXCEEDED`: The run was skipped due to reaching the job level queue size limit. - [Link]: https://kb.databricks.com/en_US/notebooks/too-many-execution-contexts-are-open-right-now - """ + [Link]: https://kb.databricks.com/en_US/notebooks/too-many-execution-contexts-are-open-right-now""" BUDGET_POLICY_LIMIT_EXCEEDED = "BUDGET_POLICY_LIMIT_EXCEEDED" CANCELED = "CANCELED" @@ -8235,7 +8158,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateJob: @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -8289,11 +8211,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ViewItem: """Deserializes the ViewItem from a dictionary.""" - return cls( - content=d.get("content", None), - name=d.get("name", None), - type=_enum(d, "type", ViewType), - ) + return cls(content=d.get("content", None), name=d.get("name", None), type=_enum(d, "type", ViewType)) class ViewType(Enum): @@ -8422,17 +8340,13 @@ class JobsAPI: [Databricks CLI]: https://docs.databricks.com/dev-tools/cli/index.html [Secrets CLI]: https://docs.databricks.com/dev-tools/cli/secrets-cli.html - [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets - """ + [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets""" def __init__(self, api_client): self._api = api_client def wait_get_run_job_terminated_or_skipped( - self, - run_id: int, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[Run], None]] = None, + self, run_id: int, timeout=timedelta(minutes=20), callback: Optional[Callable[[Run], None]] = None ) -> Run: deadline = time.time() + timeout.total_seconds() target_states = ( @@ -8465,12 +8379,7 @@ def wait_get_run_job_terminated_or_skipped( attempt += 1 raise TimeoutError(f"timed out after {timeout}: {status_message}") - def cancel_all_runs( - self, - *, - all_queued_runs: Optional[bool] = None, - job_id: Optional[int] = None, - ): + def cancel_all_runs(self, *, all_queued_runs: Optional[bool] = None, job_id: Optional[int] = None): """Cancel all runs of a job. Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs @@ -8494,7 +8403,7 @@ def cancel_all_runs( "Content-Type": "application/json", } - self._api.do("POST", "/api/2.1/jobs/runs/cancel-all", body=body, headers=headers) + self._api.do("POST", "/api/2.2/jobs/runs/cancel-all", body=body, headers=headers) def cancel_run(self, run_id: int) -> Wait[Run]: """Cancel a run. @@ -8517,7 +8426,7 @@ def cancel_run(self, run_id: int) -> Wait[Run]: "Content-Type": "application/json", } - op_response = self._api.do("POST", "/api/2.1/jobs/runs/cancel", body=body, headers=headers) + op_response = self._api.do("POST", "/api/2.2/jobs/runs/cancel", body=body, headers=headers) return Wait( self.wait_get_run_job_terminated_or_skipped, response=CancelRunResponse.from_dict(op_response), @@ -8708,7 +8617,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do("POST", "/api/2.1/jobs/create", body=body, headers=headers) + res = self._api.do("POST", "/api/2.2/jobs/create", body=body, headers=headers) return CreateResponse.from_dict(res) def delete(self, job_id: int): @@ -8729,7 +8638,7 @@ def delete(self, job_id: int): "Content-Type": "application/json", } - self._api.do("POST", "/api/2.1/jobs/delete", body=body, headers=headers) + self._api.do("POST", "/api/2.2/jobs/delete", body=body, headers=headers) def delete_run(self, run_id: int): """Delete a job run. @@ -8749,7 +8658,7 @@ def delete_run(self, run_id: int): "Content-Type": "application/json", } - self._api.do("POST", "/api/2.1/jobs/runs/delete", body=body, headers=headers) + self._api.do("POST", "/api/2.2/jobs/runs/delete", body=body, headers=headers) def export_run(self, run_id: int, *, views_to_export: Optional[ViewsToExport] = None) -> ExportRunOutput: """Export and retrieve a job run. @@ -8773,7 +8682,7 @@ def export_run(self, run_id: int, *, views_to_export: Optional[ViewsToExport] = "Accept": "application/json", } - res = self._api.do("GET", "/api/2.1/jobs/runs/export", query=query, headers=headers) + res = self._api.do("GET", "/api/2.2/jobs/runs/export", query=query, headers=headers) return ExportRunOutput.from_dict(res) def get(self, job_id: int, *, page_token: Optional[str] = None) -> Job: @@ -8804,7 +8713,7 @@ def get(self, job_id: int, *, page_token: Optional[str] = None) -> Job: "Accept": "application/json", } - res = self._api.do("GET", "/api/2.1/jobs/get", query=query, headers=headers) + res = self._api.do("GET", "/api/2.2/jobs/get", query=query, headers=headers) return Job.from_dict(res) def get_permission_levels(self, job_id: str) -> GetJobPermissionLevelsResponse: @@ -8822,11 +8731,7 @@ def get_permission_levels(self, job_id: str) -> GetJobPermissionLevelsResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/jobs/{job_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/jobs/{job_id}/permissionLevels", headers=headers) return GetJobPermissionLevelsResponse.from_dict(res) def get_permissions(self, job_id: str) -> JobPermissions: @@ -8890,7 +8795,7 @@ def get_run( "Accept": "application/json", } - res = self._api.do("GET", "/api/2.1/jobs/runs/get", query=query, headers=headers) + res = self._api.do("GET", "/api/2.2/jobs/runs/get", query=query, headers=headers) return Run.from_dict(res) def get_run_output(self, run_id: int) -> RunOutput: @@ -8918,12 +8823,7 @@ def get_run_output(self, run_id: int) -> RunOutput: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.1/jobs/runs/get-output", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.2/jobs/runs/get-output", query=query, headers=headers) return RunOutput.from_dict(res) def list( @@ -8973,7 +8873,7 @@ def list( } while True: - json = self._api.do("GET", "/api/2.1/jobs/list", query=query, headers=headers) + json = self._api.do("GET", "/api/2.2/jobs/list", query=query, headers=headers) if "jobs" in json: for v in json["jobs"]: yield BaseJob.from_dict(v) @@ -9058,7 +8958,7 @@ def list_runs( } while True: - json = self._api.do("GET", "/api/2.1/jobs/runs/list", query=query, headers=headers) + json = self._api.do("GET", "/api/2.2/jobs/runs/list", query=query, headers=headers) if "runs" in json: for v in json["runs"]: yield BaseRun.from_dict(v) @@ -9208,7 +9108,7 @@ def repair_run( "Content-Type": "application/json", } - op_response = self._api.do("POST", "/api/2.1/jobs/runs/repair", body=body, headers=headers) + op_response = self._api.do("POST", "/api/2.2/jobs/runs/repair", body=body, headers=headers) return Wait( self.wait_get_run_job_terminated_or_skipped, response=RepairRunResponse.from_dict(op_response), @@ -9277,7 +9177,7 @@ def reset(self, job_id: int, new_settings: JobSettings): "Content-Type": "application/json", } - self._api.do("POST", "/api/2.1/jobs/reset", body=body, headers=headers) + self._api.do("POST", "/api/2.2/jobs/reset", body=body, headers=headers) def run_now( self, @@ -9432,7 +9332,7 @@ def run_now( "Content-Type": "application/json", } - op_response = self._api.do("POST", "/api/2.1/jobs/run-now", body=body, headers=headers) + op_response = self._api.do("POST", "/api/2.2/jobs/run-now", body=body, headers=headers) return Wait( self.wait_get_run_job_terminated_or_skipped, response=RunNowResponse.from_dict(op_response), @@ -9476,10 +9376,7 @@ def run_now_and_wait( ).result(timeout=timeout) def set_permissions( - self, - job_id: str, - *, - access_control_list: Optional[List[JobAccessControlRequest]] = None, + self, job_id: str, *, access_control_list: Optional[List[JobAccessControlRequest]] = None ) -> JobPermissions: """Set job permissions. @@ -9500,12 +9397,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/jobs/{job_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/jobs/{job_id}", body=body, headers=headers) return JobPermissions.from_dict(res) def submit( @@ -9619,7 +9511,7 @@ def submit( "Content-Type": "application/json", } - op_response = self._api.do("POST", "/api/2.1/jobs/runs/submit", body=body, headers=headers) + op_response = self._api.do("POST", "/api/2.2/jobs/runs/submit", body=body, headers=headers) return Wait( self.wait_get_run_job_terminated_or_skipped, response=SubmitRunResponse.from_dict(op_response), @@ -9663,11 +9555,7 @@ def submit_and_wait( ).result(timeout=timeout) def update( - self, - job_id: int, - *, - fields_to_remove: Optional[List[str]] = None, - new_settings: Optional[JobSettings] = None, + self, job_id: int, *, fields_to_remove: Optional[List[str]] = None, new_settings: Optional[JobSettings] = None ): """Update job settings partially. @@ -9705,13 +9593,10 @@ def update( "Content-Type": "application/json", } - self._api.do("POST", "/api/2.1/jobs/update", body=body, headers=headers) + self._api.do("POST", "/api/2.2/jobs/update", body=body, headers=headers) def update_permissions( - self, - job_id: str, - *, - access_control_list: Optional[List[JobAccessControlRequest]] = None, + self, job_id: str, *, access_control_list: Optional[List[JobAccessControlRequest]] = None ) -> JobPermissions: """Update job permissions. @@ -9731,12 +9616,7 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/jobs/{job_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/jobs/{job_id}", body=body, headers=headers) return JobPermissions.from_dict(res) @@ -9750,8 +9630,7 @@ class PolicyComplianceForJobsAPI: policies. The get and list compliance APIs allow you to view the policy compliance status of a job. The enforce - compliance API allows you to update a job so that it becomes compliant with all of its policies. - """ + compliance API allows you to update a job so that it becomes compliant with all of its policies.""" def __init__(self, api_client): self._api = api_client @@ -9782,12 +9661,7 @@ def enforce_compliance( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/policies/jobs/enforce-compliance", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/policies/jobs/enforce-compliance", body=body, headers=headers) return EnforcePolicyComplianceResponse.from_dict(res) def get_compliance(self, job_id: int) -> GetPolicyComplianceResponse: @@ -9810,20 +9684,11 @@ def get_compliance(self, job_id: int) -> GetPolicyComplianceResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/policies/jobs/get-compliance", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/policies/jobs/get-compliance", query=query, headers=headers) return GetPolicyComplianceResponse.from_dict(res) def list_compliance( - self, - policy_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, policy_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[JobCompliance]: """List job policy compliance. @@ -9855,12 +9720,7 @@ def list_compliance( } while True: - json = self._api.do( - "GET", - "/api/2.0/policies/jobs/list-compliance", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/policies/jobs/list-compliance", query=query, headers=headers) if "jobs" in json: for v in json["jobs"]: yield JobCompliance.from_dict(v) diff --git a/databricks/sdk/service/marketplace.py b/databricks/sdk/service/marketplace.py index a8ae22e19..30fd8250f 100755 --- a/databricks/sdk/service/marketplace.py +++ b/databricks/sdk/service/marketplace.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -41,10 +42,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AddExchangeForListingRequest: """Deserializes the AddExchangeForListingRequest from a dictionary.""" - return cls( - exchange_id=d.get("exchange_id", None), - listing_id=d.get("listing_id", None), - ) + return cls(exchange_id=d.get("exchange_id", None), listing_id=d.get("listing_id", None)) @dataclass @@ -405,10 +403,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateFileResponse: """Deserializes the CreateFileResponse from a dictionary.""" - return cls( - file_info=_from_dict(d, "file_info", FileInfo), - upload_url=d.get("upload_url", None), - ) + return cls(file_info=_from_dict(d, "file_info", FileInfo), upload_url=d.get("upload_url", None)) @dataclass @@ -717,15 +712,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DataRefreshInfo: """Deserializes the DataRefreshInfo from a dictionary.""" - return cls( - interval=d.get("interval", None), - unit=_enum(d, "unit", DataRefresh), - ) + return cls(interval=d.get("interval", None), unit=_enum(d, "unit", DataRefresh)) @dataclass class DeleteExchangeFilterResponse: - def as_dict(self) -> dict: """Serializes the DeleteExchangeFilterResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -744,7 +735,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteExchangeFilterResponse: @dataclass class DeleteExchangeResponse: - def as_dict(self) -> dict: """Serializes the DeleteExchangeResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -763,7 +753,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteExchangeResponse: @dataclass class DeleteFileResponse: - def as_dict(self) -> dict: """Serializes the DeleteFileResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -782,7 +771,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteFileResponse: @dataclass class DeleteInstallationResponse: - def as_dict(self) -> dict: """Serializes the DeleteInstallationResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -801,7 +789,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteInstallationResponse: @dataclass class DeleteListingResponse: - def as_dict(self) -> dict: """Serializes the DeleteListingResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -820,7 +807,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteListingResponse: @dataclass class DeleteProviderResponse: - def as_dict(self) -> dict: """Serializes the DeleteProviderResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1199,10 +1185,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> FileParent: """Deserializes the FileParent from a dictionary.""" - return cls( - file_parent_type=_enum(d, "file_parent_type", FileParentType), - parent_id=d.get("parent_id", None), - ) + return cls(file_parent_type=_enum(d, "file_parent_type", FileParentType), parent_id=d.get("parent_id", None)) class FileParentType(Enum): @@ -1382,10 +1365,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetListingsResponse: """Deserializes the GetListingsResponse from a dictionary.""" - return cls( - listings=_repeated_dict(d, "listings", Listing), - next_page_token=d.get("next_page_token", None), - ) + return cls(listings=_repeated_dict(d, "listings", Listing), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1669,10 +1649,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListExchangeFiltersResponse: """Deserializes the ListExchangeFiltersResponse from a dictionary.""" - return cls( - filters=_repeated_dict(d, "filters", ExchangeFilter), - next_page_token=d.get("next_page_token", None), - ) + return cls(filters=_repeated_dict(d, "filters", ExchangeFilter), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1735,10 +1712,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListExchangesResponse: """Deserializes the ListExchangesResponse from a dictionary.""" - return cls( - exchanges=_repeated_dict(d, "exchanges", Exchange), - next_page_token=d.get("next_page_token", None), - ) + return cls(exchanges=_repeated_dict(d, "exchanges", Exchange), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1768,10 +1742,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListFilesResponse: """Deserializes the ListFilesResponse from a dictionary.""" - return cls( - file_infos=_repeated_dict(d, "file_infos", FileInfo), - next_page_token=d.get("next_page_token", None), - ) + return cls(file_infos=_repeated_dict(d, "file_infos", FileInfo), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1900,10 +1871,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListListingsResponse: """Deserializes the ListListingsResponse from a dictionary.""" - return cls( - listings=_repeated_dict(d, "listings", Listing), - next_page_token=d.get("next_page_token", None), - ) + return cls(listings=_repeated_dict(d, "listings", Listing), next_page_token=d.get("next_page_token", None)) @dataclass @@ -1940,11 +1908,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListProviderAnalyticsDashboardResponse: """Deserializes the ListProviderAnalyticsDashboardResponse from a dictionary.""" - return cls( - dashboard_id=d.get("dashboard_id", None), - id=d.get("id", None), - version=d.get("version", None), - ) + return cls(dashboard_id=d.get("dashboard_id", None), id=d.get("id", None), version=d.get("version", None)) @dataclass @@ -1975,8 +1939,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListProvidersResponse: """Deserializes the ListProvidersResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - providers=_repeated_dict(d, "providers", ProviderInfo), + next_page_token=d.get("next_page_token", None), providers=_repeated_dict(d, "providers", ProviderInfo) ) @@ -2471,10 +2434,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListingTag: """Deserializes the ListingTag from a dictionary.""" - return cls( - tag_name=_enum(d, "tag_name", ListingTagType), - tag_values=d.get("tag_values", None), - ) + return cls(tag_name=_enum(d, "tag_name", ListingTagType), tag_values=d.get("tag_values", None)) class ListingTagType(Enum): @@ -2810,7 +2770,6 @@ def from_dict(cls, d: Dict[str, any]) -> RegionInfo: @dataclass class RemoveExchangeForListingResponse: - def as_dict(self) -> dict: """Serializes the RemoveExchangeForListingResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2882,10 +2841,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RepoInstallation: """Deserializes the RepoInstallation from a dictionary.""" - return cls( - repo_name=d.get("repo_name", None), - repo_path=d.get("repo_path", None), - ) + return cls(repo_name=d.get("repo_name", None), repo_path=d.get("repo_path", None)) @dataclass @@ -2915,10 +2871,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SearchListingsResponse: """Deserializes the SearchListingsResponse from a dictionary.""" - return cls( - listings=_repeated_dict(d, "listings", Listing), - next_page_token=d.get("next_page_token", None), - ) + return cls(listings=_repeated_dict(d, "listings", Listing), next_page_token=d.get("next_page_token", None)) @dataclass @@ -2980,10 +2933,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SharedDataObject: """Deserializes the SharedDataObject from a dictionary.""" - return cls( - data_object_type=d.get("data_object_type", None), - name=d.get("name", None), - ) + return cls(data_object_type=d.get("data_object_type", None), name=d.get("name", None)) @dataclass @@ -3138,10 +3088,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateExchangeFilterRequest: """Deserializes the UpdateExchangeFilterRequest from a dictionary.""" - return cls( - filter=_from_dict(d, "filter", ExchangeFilter), - id=d.get("id", None), - ) + return cls(filter=_from_dict(d, "filter", ExchangeFilter), id=d.get("id", None)) @dataclass @@ -3493,11 +3440,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateProviderAnalyticsDashboardResponse: """Deserializes the UpdateProviderAnalyticsDashboardResponse from a dictionary.""" - return cls( - dashboard_id=d.get("dashboard_id", None), - id=d.get("id", None), - version=d.get("version", None), - ) + return cls(dashboard_id=d.get("dashboard_id", None), id=d.get("id", None), version=d.get("version", None)) @dataclass @@ -3527,10 +3470,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateProviderRequest: """Deserializes the UpdateProviderRequest from a dictionary.""" - return cls( - id=d.get("id", None), - provider=_from_dict(d, "provider", ProviderInfo), - ) + return cls(id=d.get("id", None), provider=_from_dict(d, "provider", ProviderInfo)) @dataclass @@ -3570,11 +3510,7 @@ def __init__(self, api_client): self._api = api_client def get( - self, - listing_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, listing_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[SharedDataObject]: """Get listing content metadata. @@ -3598,10 +3534,7 @@ def get( while True: json = self._api.do( - "GET", - f"/api/2.1/marketplace-consumer/listings/{listing_id}/content", - query=query, - headers=headers, + "GET", f"/api/2.1/marketplace-consumer/listings/{listing_id}/content", query=query, headers=headers ) if "shared_data_objects" in json: for v in json["shared_data_objects"]: @@ -3611,11 +3544,7 @@ def get( query["page_token"] = json["next_page_token"] def list( - self, - listing_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, listing_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ListingFulfillment]: """List all listing fulfillments. @@ -3642,10 +3571,7 @@ def list( while True: json = self._api.do( - "GET", - f"/api/2.1/marketplace-consumer/listings/{listing_id}/fulfillments", - query=query, - headers=headers, + "GET", f"/api/2.1/marketplace-consumer/listings/{listing_id}/fulfillments", query=query, headers=headers ) if "fulfillments" in json: for v in json["fulfillments"]: @@ -3702,10 +3628,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.1/marketplace-consumer/listings/{listing_id}/installations", - body=body, - headers=headers, + "POST", f"/api/2.1/marketplace-consumer/listings/{listing_id}/installations", body=body, headers=headers ) return Installation.from_dict(res) @@ -3731,10 +3654,7 @@ def delete(self, listing_id: str, installation_id: str): ) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[InstallationDetail]: """List all installations. @@ -3756,12 +3676,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/installations", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/marketplace-consumer/installations", query=query, headers=headers) if "installations" in json: for v in json["installations"]: yield InstallationDetail.from_dict(v) @@ -3770,11 +3685,7 @@ def list( query["page_token"] = json["next_page_token"] def list_listing_installations( - self, - listing_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, listing_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[InstallationDetail]: """List installations for a listing. @@ -3875,12 +3786,7 @@ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetListingsRespo "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/listings:batchGet", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.1/marketplace-consumer/listings:batchGet", query=query, headers=headers) return BatchGetListingsResponse.from_dict(res) def get(self, id: str) -> GetListingResponse: @@ -3897,11 +3803,7 @@ def get(self, id: str) -> GetListingResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/marketplace-consumer/listings/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/marketplace-consumer/listings/{id}", headers=headers) return GetListingResponse.from_dict(res) def list( @@ -3965,12 +3867,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/listings", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/marketplace-consumer/listings", query=query, headers=headers) if "listings" in json: for v in json["listings"]: yield Listing.from_dict(v) @@ -4033,12 +3930,7 @@ def search( } while True: - json = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/search-listings", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/marketplace-consumer/search-listings", query=query, headers=headers) if "listings" in json: for v in json["listings"]: yield Listing.from_dict(v) @@ -4128,17 +4020,12 @@ def get(self, listing_id: str) -> GetPersonalizationRequestResponse: } res = self._api.do( - "GET", - f"/api/2.1/marketplace-consumer/listings/{listing_id}/personalization-requests", - headers=headers, + "GET", f"/api/2.1/marketplace-consumer/listings/{listing_id}/personalization-requests", headers=headers ) return GetPersonalizationRequestResponse.from_dict(res) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[PersonalizationRequest]: """List all personalization requests. @@ -4161,10 +4048,7 @@ def list( while True: json = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/personalization-requests", - query=query, - headers=headers, + "GET", "/api/2.1/marketplace-consumer/personalization-requests", query=query, headers=headers ) if "personalization_requests" in json: for v in json["personalization_requests"]: @@ -4197,12 +4081,7 @@ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetProvidersResp "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/providers:batchGet", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.1/marketplace-consumer/providers:batchGet", query=query, headers=headers) return BatchGetProvidersResponse.from_dict(res) def get(self, id: str) -> GetProviderResponse: @@ -4219,19 +4098,11 @@ def get(self, id: str) -> GetProviderResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/marketplace-consumer/providers/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/marketplace-consumer/providers/{id}", headers=headers) return GetProviderResponse.from_dict(res) def list( - self, - *, - is_featured: Optional[bool] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, is_featured: Optional[bool] = None, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ProviderInfo]: """List providers. @@ -4256,12 +4127,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.1/marketplace-consumer/providers", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/marketplace-consumer/providers", query=query, headers=headers) if "providers" in json: for v in json["providers"]: yield ProviderInfo.from_dict(v) @@ -4293,12 +4159,7 @@ def create(self, filter: ExchangeFilter) -> CreateExchangeFilterResponse: "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-exchange/filters", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-exchange/filters", body=body, headers=headers) return CreateExchangeFilterResponse.from_dict(res) def delete(self, id: str): @@ -4315,18 +4176,10 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-exchange/filters/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-exchange/filters/{id}", headers=headers) def list( - self, - exchange_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, exchange_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ExchangeFilter]: """List exchange filters. @@ -4351,12 +4204,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/marketplace-exchange/filters", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/marketplace-exchange/filters", query=query, headers=headers) if "filters" in json: for v in json["filters"]: yield ExchangeFilter.from_dict(v) @@ -4382,12 +4230,7 @@ def update(self, id: str, filter: ExchangeFilter) -> UpdateExchangeFilterRespons "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/marketplace-exchange/filters/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/marketplace-exchange/filters/{id}", body=body, headers=headers) return UpdateExchangeFilterResponse.from_dict(res) @@ -4417,12 +4260,7 @@ def add_listing_to_exchange(self, listing_id: str, exchange_id: str) -> AddExcha "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-exchange/exchanges-for-listing", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-exchange/exchanges-for-listing", body=body, headers=headers) return AddExchangeForListingResponse.from_dict(res) def create(self, exchange: Exchange) -> CreateExchangeResponse: @@ -4442,12 +4280,7 @@ def create(self, exchange: Exchange) -> CreateExchangeResponse: "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-exchange/exchanges", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-exchange/exchanges", body=body, headers=headers) return CreateExchangeResponse.from_dict(res) def delete(self, id: str): @@ -4464,11 +4297,7 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-exchange/exchanges/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-exchange/exchanges/{id}", headers=headers) def delete_listing_from_exchange(self, id: str): """Remove an exchange for listing. @@ -4484,11 +4313,7 @@ def delete_listing_from_exchange(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-exchange/exchanges-for-listing/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-exchange/exchanges-for-listing/{id}", headers=headers) def get(self, id: str) -> GetExchangeResponse: """Get an exchange. @@ -4504,19 +4329,10 @@ def get(self, id: str) -> GetExchangeResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/marketplace-exchange/exchanges/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/marketplace-exchange/exchanges/{id}", headers=headers) return GetExchangeResponse.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[Exchange]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[Exchange]: """List exchanges. List exchanges visible to provider @@ -4537,12 +4353,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/marketplace-exchange/exchanges", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/marketplace-exchange/exchanges", query=query, headers=headers) if "exchanges" in json: for v in json["exchanges"]: yield Exchange.from_dict(v) @@ -4551,11 +4362,7 @@ def list( query["page_token"] = json["next_page_token"] def list_exchanges_for_listing( - self, - listing_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, listing_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ExchangeListing]: """List exchanges for listing. @@ -4581,10 +4388,7 @@ def list_exchanges_for_listing( while True: json = self._api.do( - "GET", - "/api/2.0/marketplace-exchange/exchanges-for-listing", - query=query, - headers=headers, + "GET", "/api/2.0/marketplace-exchange/exchanges-for-listing", query=query, headers=headers ) if "exchange_listing" in json: for v in json["exchange_listing"]: @@ -4594,11 +4398,7 @@ def list_exchanges_for_listing( query["page_token"] = json["next_page_token"] def list_listings_for_exchange( - self, - exchange_id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, exchange_id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ExchangeListing]: """List listings for exchange. @@ -4624,10 +4424,7 @@ def list_listings_for_exchange( while True: json = self._api.do( - "GET", - "/api/2.0/marketplace-exchange/listings-for-exchange", - query=query, - headers=headers, + "GET", "/api/2.0/marketplace-exchange/listings-for-exchange", query=query, headers=headers ) if "exchange_listings" in json: for v in json["exchange_listings"]: @@ -4654,12 +4451,7 @@ def update(self, id: str, exchange: Exchange) -> UpdateExchangeResponse: "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/marketplace-exchange/exchanges/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/marketplace-exchange/exchanges/{id}", body=body, headers=headers) return UpdateExchangeResponse.from_dict(res) @@ -4702,12 +4494,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-provider/files", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-provider/files", body=body, headers=headers) return CreateFileResponse.from_dict(res) def delete(self, file_id: str): @@ -4724,11 +4511,7 @@ def delete(self, file_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-provider/files/{file_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-provider/files/{file_id}", headers=headers) def get(self, file_id: str) -> GetFileResponse: """Get a file. @@ -4744,19 +4527,11 @@ def get(self, file_id: str) -> GetFileResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/marketplace-provider/files/{file_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/marketplace-provider/files/{file_id}", headers=headers) return GetFileResponse.from_dict(res) def list( - self, - file_parent: FileParent, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, file_parent: FileParent, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[FileInfo]: """List files. @@ -4781,12 +4556,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/marketplace-provider/files", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/marketplace-provider/files", query=query, headers=headers) if "file_infos" in json: for v in json["file_infos"]: yield FileInfo.from_dict(v) @@ -4819,12 +4589,7 @@ def create(self, listing: Listing) -> CreateListingResponse: "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-provider/listing", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-provider/listing", body=body, headers=headers) return CreateListingResponse.from_dict(res) def delete(self, id: str): @@ -4841,11 +4606,7 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-provider/listings/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-provider/listings/{id}", headers=headers) def get(self, id: str) -> GetListingResponse: """Get a listing. @@ -4861,19 +4622,10 @@ def get(self, id: str) -> GetListingResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/marketplace-provider/listings/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/marketplace-provider/listings/{id}", headers=headers) return GetListingResponse.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[Listing]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[Listing]: """List listings. List listings owned by this provider @@ -4894,12 +4646,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/marketplace-provider/listings", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/marketplace-provider/listings", query=query, headers=headers) if "listings" in json: for v in json["listings"]: yield Listing.from_dict(v) @@ -4925,12 +4672,7 @@ def update(self, id: str, listing: Listing) -> UpdateListingResponse: "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/marketplace-provider/listings/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/marketplace-provider/listings/{id}", body=body, headers=headers) return UpdateListingResponse.from_dict(res) @@ -4942,10 +4684,7 @@ def __init__(self, api_client): self._api = api_client def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[PersonalizationRequest]: """All personalization requests across all listings. @@ -4969,10 +4708,7 @@ def list( while True: json = self._api.do( - "GET", - "/api/2.0/marketplace-provider/personalization-requests", - query=query, - headers=headers, + "GET", "/api/2.0/marketplace-provider/personalization-requests", query=query, headers=headers ) if "personalization_requests" in json: for v in json["personalization_requests"]: @@ -5042,11 +4778,7 @@ def create(self) -> ProviderAnalyticsDashboard: "Accept": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-provider/analytics_dashboard", - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-provider/analytics_dashboard", headers=headers) return ProviderAnalyticsDashboard.from_dict(res) def get(self) -> ListProviderAnalyticsDashboardResponse: @@ -5061,16 +4793,10 @@ def get(self) -> ListProviderAnalyticsDashboardResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/marketplace-provider/analytics_dashboard", - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/marketplace-provider/analytics_dashboard", headers=headers) return ListProviderAnalyticsDashboardResponse.from_dict(res) - def get_latest_version( - self, - ) -> GetLatestVersionProviderAnalyticsDashboardResponse: + def get_latest_version(self) -> GetLatestVersionProviderAnalyticsDashboardResponse: """Get latest version of provider analytics dashboard. Get latest version of provider analytics dashboard. @@ -5082,11 +4808,7 @@ def get_latest_version( "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/marketplace-provider/analytics_dashboard/latest", - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/marketplace-provider/analytics_dashboard/latest", headers=headers) return GetLatestVersionProviderAnalyticsDashboardResponse.from_dict(res) def update(self, id: str, *, version: Optional[int] = None) -> UpdateProviderAnalyticsDashboardResponse: @@ -5110,12 +4832,7 @@ def update(self, id: str, *, version: Optional[int] = None) -> UpdateProviderAna "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/marketplace-provider/analytics_dashboard/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/marketplace-provider/analytics_dashboard/{id}", body=body, headers=headers) return UpdateProviderAnalyticsDashboardResponse.from_dict(res) @@ -5142,12 +4859,7 @@ def create(self, provider: ProviderInfo) -> CreateProviderResponse: "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/marketplace-provider/provider", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/marketplace-provider/provider", body=body, headers=headers) return CreateProviderResponse.from_dict(res) def delete(self, id: str): @@ -5164,11 +4876,7 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/marketplace-provider/providers/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/marketplace-provider/providers/{id}", headers=headers) def get(self, id: str) -> GetProviderResponse: """Get provider. @@ -5184,19 +4892,10 @@ def get(self, id: str) -> GetProviderResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/marketplace-provider/providers/{id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/marketplace-provider/providers/{id}", headers=headers) return GetProviderResponse.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[ProviderInfo]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[ProviderInfo]: """List providers. List provider profiles for account. @@ -5217,12 +4916,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/marketplace-provider/providers", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/marketplace-provider/providers", query=query, headers=headers) if "providers" in json: for v in json["providers"]: yield ProviderInfo.from_dict(v) @@ -5248,10 +4942,5 @@ def update(self, id: str, provider: ProviderInfo) -> UpdateProviderResponse: "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/marketplace-provider/providers/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/marketplace-provider/providers/{id}", body=body, headers=headers) return UpdateProviderResponse.from_dict(res) diff --git a/databricks/sdk/service/ml.py b/databricks/sdk/service/ml.py index 385641d4d..2a19e06b8 100755 --- a/databricks/sdk/service/ml.py +++ b/databricks/sdk/service/ml.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -381,11 +382,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateComment: """Deserializes the CreateComment from a dictionary.""" - return cls( - comment=d.get("comment", None), - name=d.get("name", None), - version=d.get("version", None), - ) + return cls(comment=d.get("comment", None), name=d.get("name", None), version=d.get("version", None)) @dataclass @@ -522,9 +519,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> CreateModelRequest: """Deserializes the CreateModelRequest from a dictionary.""" return cls( - description=d.get("description", None), - name=d.get("name", None), - tags=_repeated_dict(d, "tags", ModelTag), + description=d.get("description", None), name=d.get("name", None), tags=_repeated_dict(d, "tags", ModelTag) ) @@ -1029,15 +1024,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DatasetInput: """Deserializes the DatasetInput from a dictionary.""" - return cls( - dataset=_from_dict(d, "dataset", Dataset), - tags=_repeated_dict(d, "tags", InputTag), - ) + return cls(dataset=_from_dict(d, "dataset", Dataset), tags=_repeated_dict(d, "tags", InputTag)) @dataclass class DeleteCommentResponse: - def as_dict(self) -> dict: """Serializes the DeleteCommentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1081,7 +1072,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteExperiment: @dataclass class DeleteExperimentResponse: - def as_dict(self) -> dict: """Serializes the DeleteExperimentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1100,7 +1090,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteExperimentResponse: @dataclass class DeleteModelResponse: - def as_dict(self) -> dict: """Serializes the DeleteModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1119,7 +1108,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteModelResponse: @dataclass class DeleteModelTagResponse: - def as_dict(self) -> dict: """Serializes the DeleteModelTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1138,7 +1126,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteModelTagResponse: @dataclass class DeleteModelVersionResponse: - def as_dict(self) -> dict: """Serializes the DeleteModelVersionResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1157,7 +1144,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteModelVersionResponse: @dataclass class DeleteModelVersionTagResponse: - def as_dict(self) -> dict: """Serializes the DeleteModelVersionTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1201,7 +1187,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteRun: @dataclass class DeleteRunResponse: - def as_dict(self) -> dict: """Serializes the DeleteRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1322,7 +1307,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteTag: @dataclass class DeleteTagResponse: - def as_dict(self) -> dict: """Serializes the DeleteTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1341,7 +1325,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteTagResponse: @dataclass class DeleteTransitionRequestResponse: - def as_dict(self) -> dict: """Serializes the DeleteTransitionRequestResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1368,7 +1351,6 @@ class DeleteTransitionRequestStage(Enum): @dataclass class DeleteWebhookResponse: - def as_dict(self) -> dict: """Serializes the DeleteWebhookResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1796,11 +1778,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> FileInfo: """Deserializes the FileInfo from a dictionary.""" - return cls( - file_size=d.get("file_size", None), - is_dir=d.get("is_dir", None), - path=d.get("path", None), - ) + return cls(file_size=d.get("file_size", None), is_dir=d.get("is_dir", None), path=d.get("path", None)) @dataclass @@ -1940,10 +1918,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetMetricHistoryResponse: """Deserializes the GetMetricHistoryResponse from a dictionary.""" - return cls( - metrics=_repeated_dict(d, "metrics", Metric), - next_page_token=d.get("next_page_token", None), - ) + return cls(metrics=_repeated_dict(d, "metrics", Metric), next_page_token=d.get("next_page_token", None)) @dataclass @@ -2160,10 +2135,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> HttpUrlSpecWithoutSecret: """Deserializes the HttpUrlSpecWithoutSecret from a dictionary.""" - return cls( - enable_ssl_verification=d.get("enable_ssl_verification", None), - url=d.get("url", None), - ) + return cls(enable_ssl_verification=d.get("enable_ssl_verification", None), url=d.get("url", None)) @dataclass @@ -2273,10 +2245,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> JobSpecWithoutSecret: """Deserializes the JobSpecWithoutSecret from a dictionary.""" - return cls( - job_id=d.get("job_id", None), - workspace_url=d.get("workspace_url", None), - ) + return cls(job_id=d.get("job_id", None), workspace_url=d.get("workspace_url", None)) @dataclass @@ -2353,8 +2322,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListExperimentsResponse: """Deserializes the ListExperimentsResponse from a dictionary.""" return cls( - experiments=_repeated_dict(d, "experiments", Experiment), - next_page_token=d.get("next_page_token", None), + experiments=_repeated_dict(d, "experiments", Experiment), next_page_token=d.get("next_page_token", None) ) @@ -2422,8 +2390,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListRegistryWebhooks: """Deserializes the ListRegistryWebhooks from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - webhooks=_repeated_dict(d, "webhooks", RegistryWebhook), + next_page_token=d.get("next_page_token", None), webhooks=_repeated_dict(d, "webhooks", RegistryWebhook) ) @@ -2508,7 +2475,6 @@ def from_dict(cls, d: Dict[str, any]) -> LogBatch: @dataclass class LogBatchResponse: - def as_dict(self) -> dict: """Serializes the LogBatchResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2554,15 +2520,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> LogInputs: """Deserializes the LogInputs from a dictionary.""" - return cls( - datasets=_repeated_dict(d, "datasets", DatasetInput), - run_id=d.get("run_id", None), - ) + return cls(datasets=_repeated_dict(d, "datasets", DatasetInput), run_id=d.get("run_id", None)) @dataclass class LogInputsResponse: - def as_dict(self) -> dict: """Serializes the LogInputsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2649,7 +2611,6 @@ def from_dict(cls, d: Dict[str, any]) -> LogMetric: @dataclass class LogMetricResponse: - def as_dict(self) -> dict: """Serializes the LogMetricResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2700,7 +2661,6 @@ def from_dict(cls, d: Dict[str, any]) -> LogModel: @dataclass class LogModelResponse: - def as_dict(self) -> dict: """Serializes the LogModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2771,7 +2731,6 @@ def from_dict(cls, d: Dict[str, any]) -> LogParam: @dataclass class LogParamResponse: - def as_dict(self) -> dict: """Serializes the LogParamResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3982,7 +3941,6 @@ def from_dict(cls, d: Dict[str, any]) -> RestoreExperiment: @dataclass class RestoreExperimentResponse: - def as_dict(self) -> dict: """Serializes the RestoreExperimentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4026,7 +3984,6 @@ def from_dict(cls, d: Dict[str, any]) -> RestoreRun: @dataclass class RestoreRunResponse: - def as_dict(self) -> dict: """Serializes the RestoreRunResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4454,8 +4411,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> SearchExperimentsResponse: """Deserializes the SearchExperimentsResponse from a dictionary.""" return cls( - experiments=_repeated_dict(d, "experiments", Experiment), - next_page_token=d.get("next_page_token", None), + experiments=_repeated_dict(d, "experiments", Experiment), next_page_token=d.get("next_page_token", None) ) @@ -4647,10 +4603,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SearchRunsResponse: """Deserializes the SearchRunsResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - runs=_repeated_dict(d, "runs", Run), - ) + return cls(next_page_token=d.get("next_page_token", None), runs=_repeated_dict(d, "runs", Run)) class SearchRunsRunViewType(Enum): @@ -4699,16 +4652,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SetExperimentTag: """Deserializes the SetExperimentTag from a dictionary.""" - return cls( - experiment_id=d.get("experiment_id", None), - key=d.get("key", None), - value=d.get("value", None), - ) + return cls(experiment_id=d.get("experiment_id", None), key=d.get("key", None), value=d.get("value", None)) @dataclass class SetExperimentTagResponse: - def as_dict(self) -> dict: """Serializes the SetExperimentTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4764,16 +4712,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SetModelTagRequest: """Deserializes the SetModelTagRequest from a dictionary.""" - return cls( - key=d.get("key", None), - name=d.get("name", None), - value=d.get("value", None), - ) + return cls(key=d.get("key", None), name=d.get("name", None), value=d.get("value", None)) @dataclass class SetModelTagResponse: - def as_dict(self) -> dict: """Serializes the SetModelTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4837,16 +4780,12 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> SetModelVersionTagRequest: """Deserializes the SetModelVersionTagRequest from a dictionary.""" return cls( - key=d.get("key", None), - name=d.get("name", None), - value=d.get("value", None), - version=d.get("version", None), + key=d.get("key", None), name=d.get("name", None), value=d.get("value", None), version=d.get("version", None) ) @dataclass class SetModelVersionTagResponse: - def as_dict(self) -> dict: """Serializes the SetModelVersionTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4919,7 +4858,6 @@ def from_dict(cls, d: Dict[str, any]) -> SetTag: @dataclass class SetTagResponse: - def as_dict(self) -> dict: """Serializes the SetTagResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5304,15 +5242,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateExperiment: """Deserializes the UpdateExperiment from a dictionary.""" - return cls( - experiment_id=d.get("experiment_id", None), - new_name=d.get("new_name", None), - ) + return cls(experiment_id=d.get("experiment_id", None), new_name=d.get("new_name", None)) @dataclass class UpdateExperimentResponse: - def as_dict(self) -> dict: """Serializes the UpdateExperimentResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5363,7 +5297,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateModelRequest: @dataclass class UpdateModelResponse: - def as_dict(self) -> dict: """Serializes the UpdateModelResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5416,16 +5349,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpdateModelVersionRequest: """Deserializes the UpdateModelVersionRequest from a dictionary.""" - return cls( - description=d.get("description", None), - name=d.get("name", None), - version=d.get("version", None), - ) + return cls(description=d.get("description", None), name=d.get("name", None), version=d.get("version", None)) @dataclass class UpdateModelVersionResponse: - def as_dict(self) -> dict: """Serializes the UpdateModelVersionResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5629,7 +5557,6 @@ class UpdateRunStatus(Enum): @dataclass class UpdateWebhookResponse: - def as_dict(self) -> dict: """Serializes the UpdateWebhookResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5652,18 +5579,13 @@ class ExperimentsAPI: analysis in other tools. Experiments are maintained in a Databricks hosted MLflow tracking server. Experiments are located in the workspace file tree. You manage experiments using the same tools you use to - manage other workspace objects such as folders, notebooks, and libraries. - """ + manage other workspace objects such as folders, notebooks, and libraries.""" def __init__(self, api_client): self._api = api_client def create_experiment( - self, - name: str, - *, - artifact_location: Optional[str] = None, - tags: Optional[List[ExperimentTag]] = None, + self, name: str, *, artifact_location: Optional[str] = None, tags: Optional[List[ExperimentTag]] = None ) -> CreateExperimentResponse: """Create experiment. @@ -5698,12 +5620,7 @@ def create_experiment( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/experiments/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/experiments/create", body=body, headers=headers) return CreateExperimentResponse.from_dict(res) def create_run( @@ -5768,12 +5685,7 @@ def delete_experiment(self, experiment_id: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/experiments/delete", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/experiments/delete", body=body, headers=headers) def delete_run(self, run_id: str): """Delete a run. @@ -5796,11 +5708,7 @@ def delete_run(self, run_id: str): self._api.do("POST", "/api/2.0/mlflow/runs/delete", body=body, headers=headers) def delete_runs( - self, - experiment_id: str, - max_timestamp_millis: int, - *, - max_runs: Optional[int] = None, + self, experiment_id: str, max_timestamp_millis: int, *, max_runs: Optional[int] = None ) -> DeleteRunsResponse: """Delete runs by creation time. @@ -5831,12 +5739,7 @@ def delete_runs( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/databricks/runs/delete-runs", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/databricks/runs/delete-runs", body=body, headers=headers) return DeleteRunsResponse.from_dict(res) def delete_tag(self, run_id: str, key: str): @@ -5862,12 +5765,7 @@ def delete_tag(self, run_id: str, key: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/delete-tag", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/delete-tag", body=body, headers=headers) def get_by_name(self, experiment_name: str) -> GetExperimentResponse: """Get metadata. @@ -5893,12 +5791,7 @@ def get_by_name(self, experiment_name: str) -> GetExperimentResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/mlflow/experiments/get-by-name", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/mlflow/experiments/get-by-name", query=query, headers=headers) return GetExperimentResponse.from_dict(res) def get_experiment(self, experiment_id: str) -> GetExperimentResponse: @@ -5919,12 +5812,7 @@ def get_experiment(self, experiment_id: str) -> GetExperimentResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/mlflow/experiments/get", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/mlflow/experiments/get", query=query, headers=headers) return GetExperimentResponse.from_dict(res) def get_history( @@ -5972,12 +5860,7 @@ def get_history( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/metrics/get-history", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/metrics/get-history", query=query, headers=headers) if "metrics" in json: for v in json["metrics"]: yield Metric.from_dict(v) @@ -6000,11 +5883,7 @@ def get_permission_levels(self, experiment_id: str) -> GetExperimentPermissionLe "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/experiments/{experiment_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/experiments/{experiment_id}/permissionLevels", headers=headers) return GetExperimentPermissionLevelsResponse.from_dict(res) def get_permissions(self, experiment_id: str) -> ExperimentPermissions: @@ -6022,11 +5901,7 @@ def get_permissions(self, experiment_id: str) -> ExperimentPermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/experiments/{experiment_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/experiments/{experiment_id}", headers=headers) return ExperimentPermissions.from_dict(res) def get_run(self, run_id: str, *, run_uuid: Optional[str] = None) -> GetRunResponse: @@ -6104,12 +5979,7 @@ def list_artifacts( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/artifacts/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/artifacts/list", query=query, headers=headers) if "files" in json: for v in json["files"]: yield FileInfo.from_dict(v) @@ -6118,11 +5988,7 @@ def list_artifacts( query["page_token"] = json["next_page_token"] def list_experiments( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, - view_type: Optional[str] = None, + self, *, max_results: Optional[int] = None, page_token: Optional[str] = None, view_type: Optional[str] = None ) -> Iterator[Experiment]: """List experiments. @@ -6152,12 +6018,7 @@ def list_experiments( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/experiments/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/experiments/list", query=query, headers=headers) if "experiments" in json: for v in json["experiments"]: yield Experiment.from_dict(v) @@ -6238,19 +6099,9 @@ def log_batch( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/log-batch", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/log-batch", body=body, headers=headers) - def log_inputs( - self, - *, - datasets: Optional[List[DatasetInput]] = None, - run_id: Optional[str] = None, - ): + def log_inputs(self, *, datasets: Optional[List[DatasetInput]] = None, run_id: Optional[str] = None): """Log inputs to a run. **NOTE:** Experimental: This API may change or be removed in a future release without warning. @@ -6272,12 +6123,7 @@ def log_inputs( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/log-inputs", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/log-inputs", body=body, headers=headers) def log_metric( self, @@ -6329,12 +6175,7 @@ def log_metric( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/log-metric", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/log-metric", body=body, headers=headers) def log_model(self, *, model_json: Optional[str] = None, run_id: Optional[str] = None): """Log a model. @@ -6358,21 +6199,9 @@ def log_model(self, *, model_json: Optional[str] = None, run_id: Optional[str] = "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/log-model", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/log-model", body=body, headers=headers) - def log_param( - self, - key: str, - value: str, - *, - run_id: Optional[str] = None, - run_uuid: Optional[str] = None, - ): + def log_param(self, key: str, value: str, *, run_id: Optional[str] = None, run_uuid: Optional[str] = None): """Log a param. Logs a param used for a run. A param is a key-value pair (string key, string value). Examples include @@ -6405,12 +6234,7 @@ def log_param( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/runs/log-parameter", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/runs/log-parameter", body=body, headers=headers) def restore_experiment(self, experiment_id: str): """Restores an experiment. @@ -6434,12 +6258,7 @@ def restore_experiment(self, experiment_id: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/experiments/restore", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/experiments/restore", body=body, headers=headers) def restore_run(self, run_id: str): """Restore a run. @@ -6462,11 +6281,7 @@ def restore_run(self, run_id: str): self._api.do("POST", "/api/2.0/mlflow/runs/restore", body=body, headers=headers) def restore_runs( - self, - experiment_id: str, - min_timestamp_millis: int, - *, - max_runs: Optional[int] = None, + self, experiment_id: str, min_timestamp_millis: int, *, max_runs: Optional[int] = None ) -> RestoreRunsResponse: """Restore runs by deletion time. @@ -6497,12 +6312,7 @@ def restore_runs( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/databricks/runs/restore-runs", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/databricks/runs/restore-runs", body=body, headers=headers) return RestoreRunsResponse.from_dict(res) def search_experiments( @@ -6550,12 +6360,7 @@ def search_experiments( } while True: - json = self._api.do( - "POST", - "/api/2.0/mlflow/experiments/search", - body=body, - headers=headers, - ) + json = self._api.do("POST", "/api/2.0/mlflow/experiments/search", body=body, headers=headers) if "experiments" in json: for v in json["experiments"]: yield Experiment.from_dict(v) @@ -6626,12 +6431,7 @@ def search_runs( } while True: - json = self._api.do( - "POST", - "/api/2.0/mlflow/runs/search", - body=body, - headers=headers, - ) + json = self._api.do("POST", "/api/2.0/mlflow/runs/search", body=body, headers=headers) if "runs" in json: for v in json["runs"]: yield Run.from_dict(v) @@ -6667,18 +6467,10 @@ def set_experiment_tag(self, experiment_id: str, key: str, value: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/experiments/set-experiment-tag", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/experiments/set-experiment-tag", body=body, headers=headers) def set_permissions( - self, - experiment_id: str, - *, - access_control_list: Optional[List[ExperimentAccessControlRequest]] = None, + self, experiment_id: str, *, access_control_list: Optional[List[ExperimentAccessControlRequest]] = None ) -> ExperimentPermissions: """Set experiment permissions. @@ -6699,22 +6491,10 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/experiments/{experiment_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/experiments/{experiment_id}", body=body, headers=headers) return ExperimentPermissions.from_dict(res) - def set_tag( - self, - key: str, - value: str, - *, - run_id: Optional[str] = None, - run_uuid: Optional[str] = None, - ): + def set_tag(self, key: str, value: str, *, run_id: Optional[str] = None, run_uuid: Optional[str] = None): """Set a tag. Sets a tag on a run. Tags are run metadata that can be updated during a run and after a run completes. @@ -6771,18 +6551,10 @@ def update_experiment(self, experiment_id: str, *, new_name: Optional[str] = Non "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/experiments/update", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/experiments/update", body=body, headers=headers) def update_permissions( - self, - experiment_id: str, - *, - access_control_list: Optional[List[ExperimentAccessControlRequest]] = None, + self, experiment_id: str, *, access_control_list: Optional[List[ExperimentAccessControlRequest]] = None ) -> ExperimentPermissions: """Update experiment permissions. @@ -6802,12 +6574,7 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/experiments/{experiment_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/experiments/{experiment_id}", body=body, headers=headers) return ExperimentPermissions.from_dict(res) def update_run( @@ -6865,13 +6632,7 @@ def __init__(self, api_client): self._api = api_client def approve_transition_request( - self, - name: str, - version: str, - stage: Stage, - archive_existing_versions: bool, - *, - comment: Optional[str] = None, + self, name: str, version: str, stage: Stage, archive_existing_versions: bool, *, comment: Optional[str] = None ) -> ApproveTransitionRequestResponse: """Approve transition request. @@ -6914,12 +6675,7 @@ def approve_transition_request( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/transition-requests/approve", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/approve", body=body, headers=headers) return ApproveTransitionRequestResponse.from_dict(res) def create_comment(self, name: str, version: str, comment: str) -> CreateCommentResponse: @@ -6949,20 +6705,11 @@ def create_comment(self, name: str, version: str, comment: str) -> CreateComment "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/comments/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/comments/create", body=body, headers=headers) return CreateCommentResponse.from_dict(res) def create_model( - self, - name: str, - *, - description: Optional[str] = None, - tags: Optional[List[ModelTag]] = None, + self, name: str, *, description: Optional[str] = None, tags: Optional[List[ModelTag]] = None ) -> CreateModelResponse: """Create a model. @@ -6991,12 +6738,7 @@ def create_model( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/registered-models/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/registered-models/create", body=body, headers=headers) return CreateModelResponse.from_dict(res) def create_model_version( @@ -7048,21 +6790,11 @@ def create_model_version( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/model-versions/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/model-versions/create", body=body, headers=headers) return CreateModelVersionResponse.from_dict(res) def create_transition_request( - self, - name: str, - version: str, - stage: Stage, - *, - comment: Optional[str] = None, + self, name: str, version: str, stage: Stage, *, comment: Optional[str] = None ) -> CreateTransitionRequestResponse: """Make a transition request. @@ -7101,12 +6833,7 @@ def create_transition_request( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/transition-requests/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/create", body=body, headers=headers) return CreateTransitionRequestResponse.from_dict(res) def create_webhook( @@ -7189,12 +6916,7 @@ def create_webhook( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/registry-webhooks/create", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/registry-webhooks/create", body=body, headers=headers) return CreateWebhookResponse.from_dict(res) def delete_comment(self, id: str): @@ -7214,12 +6936,7 @@ def delete_comment(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/comments/delete", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/comments/delete", query=query, headers=headers) def delete_model(self, name: str): """Delete a model. @@ -7239,12 +6956,7 @@ def delete_model(self, name: str): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/registered-models/delete", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/registered-models/delete", query=query, headers=headers) def delete_model_tag(self, name: str, key: str): """Delete a model tag. @@ -7269,12 +6981,7 @@ def delete_model_tag(self, name: str, key: str): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/registered-models/delete-tag", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/registered-models/delete-tag", query=query, headers=headers) def delete_model_version(self, name: str, version: str): """Delete a model version. @@ -7298,12 +7005,7 @@ def delete_model_version(self, name: str, version: str): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/model-versions/delete", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/model-versions/delete", query=query, headers=headers) def delete_model_version_tag(self, name: str, version: str, key: str): """Delete a model version tag. @@ -7332,12 +7034,7 @@ def delete_model_version_tag(self, name: str, version: str, key: str): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/model-versions/delete-tag", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/model-versions/delete-tag", query=query, headers=headers) def delete_transition_request( self, @@ -7390,12 +7087,7 @@ def delete_transition_request( "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/transition-requests/delete", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/transition-requests/delete", query=query, headers=headers) def delete_webhook(self, *, id: Optional[str] = None): """Delete a webhook. @@ -7417,12 +7109,7 @@ def delete_webhook(self, *, id: Optional[str] = None): "Accept": "application/json", } - self._api.do( - "DELETE", - "/api/2.0/mlflow/registry-webhooks/delete", - query=query, - headers=headers, - ) + self._api.do("DELETE", "/api/2.0/mlflow/registry-webhooks/delete", query=query, headers=headers) def get_latest_versions(self, name: str, *, stages: Optional[List[str]] = None) -> Iterator[ModelVersion]: """Get the latest version. @@ -7446,12 +7133,7 @@ def get_latest_versions(self, name: str, *, stages: Optional[List[str]] = None) "Content-Type": "application/json", } - json = self._api.do( - "POST", - "/api/2.0/mlflow/registered-models/get-latest-versions", - body=body, - headers=headers, - ) + json = self._api.do("POST", "/api/2.0/mlflow/registered-models/get-latest-versions", body=body, headers=headers) parsed = GetLatestVersionsResponse.from_dict(json).model_versions return parsed if parsed is not None else [] @@ -7477,12 +7159,7 @@ def get_model(self, name: str) -> GetModelResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/mlflow/databricks/registered-models/get", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/mlflow/databricks/registered-models/get", query=query, headers=headers) return GetModelResponse.from_dict(res) def get_model_version(self, name: str, version: str) -> GetModelVersionResponse: @@ -7507,12 +7184,7 @@ def get_model_version(self, name: str, version: str) -> GetModelVersionResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/mlflow/model-versions/get", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/mlflow/model-versions/get", query=query, headers=headers) return GetModelVersionResponse.from_dict(res) def get_model_version_download_uri(self, name: str, version: str) -> GetModelVersionDownloadUriResponse: @@ -7537,12 +7209,7 @@ def get_model_version_download_uri(self, name: str, version: str) -> GetModelVer "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/mlflow/model-versions/get-download-uri", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/mlflow/model-versions/get-download-uri", query=query, headers=headers) return GetModelVersionDownloadUriResponse.from_dict(res) def get_permission_levels(self, registered_model_id: str) -> GetRegisteredModelPermissionLevelsResponse: @@ -7561,9 +7228,7 @@ def get_permission_levels(self, registered_model_id: str) -> GetRegisteredModelP } res = self._api.do( - "GET", - f"/api/2.0/permissions/registered-models/{registered_model_id}/permissionLevels", - headers=headers, + "GET", f"/api/2.0/permissions/registered-models/{registered_model_id}/permissionLevels", headers=headers ) return GetRegisteredModelPermissionLevelsResponse.from_dict(res) @@ -7583,19 +7248,10 @@ def get_permissions(self, registered_model_id: str) -> RegisteredModelPermission "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/registered-models/{registered_model_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/registered-models/{registered_model_id}", headers=headers) return RegisteredModelPermissions.from_dict(res) - def list_models( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[Model]: + def list_models(self, *, max_results: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[Model]: """List models. Lists all available registered models, up to the limit specified in __max_results__. @@ -7618,12 +7274,7 @@ def list_models( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/registered-models/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/registered-models/list", query=query, headers=headers) if "registered_models" in json: for v in json["registered_models"]: yield Model.from_dict(v) @@ -7653,12 +7304,7 @@ def list_transition_requests(self, name: str, version: str) -> Iterator[Activity "Accept": "application/json", } - json = self._api.do( - "GET", - "/api/2.0/mlflow/transition-requests/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/transition-requests/list", query=query, headers=headers) parsed = ListTransitionRequestsResponse.from_dict(json).requests return parsed if parsed is not None else [] @@ -7699,12 +7345,7 @@ def list_webhooks( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/registry-webhooks/list", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/registry-webhooks/list", query=query, headers=headers) if "webhooks" in json: for v in json["webhooks"]: yield RegistryWebhook.from_dict(v) @@ -7713,12 +7354,7 @@ def list_webhooks( query["page_token"] = json["next_page_token"] def reject_transition_request( - self, - name: str, - version: str, - stage: Stage, - *, - comment: Optional[str] = None, + self, name: str, version: str, stage: Stage, *, comment: Optional[str] = None ) -> RejectTransitionRequestResponse: """Reject a transition request. @@ -7757,12 +7393,7 @@ def reject_transition_request( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/transition-requests/reject", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/transition-requests/reject", body=body, headers=headers) return RejectTransitionRequestResponse.from_dict(res) def rename_model(self, name: str, *, new_name: Optional[str] = None) -> RenameModelResponse: @@ -7787,12 +7418,7 @@ def rename_model(self, name: str, *, new_name: Optional[str] = None) -> RenameMo "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/registered-models/rename", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/registered-models/rename", body=body, headers=headers) return RenameModelResponse.from_dict(res) def search_model_versions( @@ -7836,12 +7462,7 @@ def search_model_versions( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/model-versions/search", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/model-versions/search", query=query, headers=headers) if "model_versions" in json: for v in json["model_versions"]: yield ModelVersion.from_dict(v) @@ -7891,12 +7512,7 @@ def search_models( } while True: - json = self._api.do( - "GET", - "/api/2.0/mlflow/registered-models/search", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/mlflow/registered-models/search", query=query, headers=headers) if "registered_models" in json: for v in json["registered_models"]: yield Model.from_dict(v) @@ -7933,12 +7549,7 @@ def set_model_tag(self, name: str, key: str, value: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/registered-models/set-tag", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/registered-models/set-tag", body=body, headers=headers) def set_model_version_tag(self, name: str, version: str, key: str, value: str): """Set a version tag. @@ -7973,12 +7584,7 @@ def set_model_version_tag(self, name: str, version: str, key: str, value: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/mlflow/model-versions/set-tag", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/mlflow/model-versions/set-tag", body=body, headers=headers) def set_permissions( self, @@ -8006,10 +7612,7 @@ def set_permissions( } res = self._api.do( - "PUT", - f"/api/2.0/permissions/registered-models/{registered_model_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/permissions/registered-models/{registered_model_id}", body=body, headers=headers ) return RegisteredModelPermissions.from_dict(res) @@ -8040,22 +7643,11 @@ def test_registry_webhook( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/mlflow/registry-webhooks/test", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/mlflow/registry-webhooks/test", body=body, headers=headers) return TestRegistryWebhookResponse.from_dict(res) def transition_stage( - self, - name: str, - version: str, - stage: Stage, - archive_existing_versions: bool, - *, - comment: Optional[str] = None, + self, name: str, version: str, stage: Stage, archive_existing_versions: bool, *, comment: Optional[str] = None ) -> TransitionStageResponse: """Transition a stage. @@ -8102,10 +7694,7 @@ def transition_stage( } res = self._api.do( - "POST", - "/api/2.0/mlflow/databricks/model-versions/transition-stage", - body=body, - headers=headers, + "POST", "/api/2.0/mlflow/databricks/model-versions/transition-stage", body=body, headers=headers ) return TransitionStageResponse.from_dict(res) @@ -8131,12 +7720,7 @@ def update_comment(self, id: str, comment: str) -> UpdateCommentResponse: "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - "/api/2.0/mlflow/comments/update", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", "/api/2.0/mlflow/comments/update", body=body, headers=headers) return UpdateCommentResponse.from_dict(res) def update_model(self, name: str, *, description: Optional[str] = None): @@ -8161,12 +7745,7 @@ def update_model(self, name: str, *, description: Optional[str] = None): "Content-Type": "application/json", } - self._api.do( - "PATCH", - "/api/2.0/mlflow/registered-models/update", - body=body, - headers=headers, - ) + self._api.do("PATCH", "/api/2.0/mlflow/registered-models/update", body=body, headers=headers) def update_model_version(self, name: str, version: str, *, description: Optional[str] = None): """Update model version. @@ -8194,12 +7773,7 @@ def update_model_version(self, name: str, version: str, *, description: Optional "Content-Type": "application/json", } - self._api.do( - "PATCH", - "/api/2.0/mlflow/model-versions/update", - body=body, - headers=headers, - ) + self._api.do("PATCH", "/api/2.0/mlflow/model-versions/update", body=body, headers=headers) def update_permissions( self, @@ -8227,10 +7801,7 @@ def update_permissions( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/registered-models/{registered_model_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/registered-models/{registered_model_id}", body=body, headers=headers ) return RegisteredModelPermissions.from_dict(res) @@ -8314,9 +7885,4 @@ def update_webhook( "Content-Type": "application/json", } - self._api.do( - "PATCH", - "/api/2.0/mlflow/registry-webhooks/update", - body=body, - headers=headers, - ) + 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 92e7f6075..7933d29ae 100755 --- a/databricks/sdk/service/oauth2.py +++ b/databricks/sdk/service/oauth2.py @@ -10,6 +10,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -156,8 +157,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> CreatePublishedAppIntegration: """Deserializes the CreatePublishedAppIntegration from a dictionary.""" return cls( - app_id=d.get("app_id", None), - token_access_policy=_from_dict(d, "token_access_policy", TokenAccessPolicy), + app_id=d.get("app_id", None), token_access_policy=_from_dict(d, "token_access_policy", TokenAccessPolicy) ) @@ -255,7 +255,6 @@ def from_dict(cls, d: Dict[str, any]) -> CreateServicePrincipalSecretResponse: @dataclass class DeleteCustomAppIntegrationOutput: - def as_dict(self) -> dict: """Serializes the DeleteCustomAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} @@ -274,7 +273,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteCustomAppIntegrationOutput: @dataclass class DeletePublishedAppIntegrationOutput: - def as_dict(self) -> dict: """Serializes the DeletePublishedAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} @@ -293,7 +291,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeletePublishedAppIntegrationOutput: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -650,10 +647,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppsOutput: """Deserializes the GetPublishedAppsOutput from a dictionary.""" - return cls( - apps=_repeated_dict(d, "apps", PublishedAppOutput), - next_page_token=d.get("next_page_token", None), - ) + return cls(apps=_repeated_dict(d, "apps", PublishedAppOutput), next_page_token=d.get("next_page_token", None)) @dataclass @@ -684,8 +678,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListFederationPoliciesResponse: """Deserializes the ListFederationPoliciesResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - policies=_repeated_dict(d, "policies", FederationPolicy), + next_page_token=d.get("next_page_token", None), policies=_repeated_dict(d, "policies", FederationPolicy) ) @@ -718,10 +711,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListServicePrincipalSecretsResponse: """Deserializes the ListServicePrincipalSecretsResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - secrets=_repeated_dict(d, "secrets", SecretInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), secrets=_repeated_dict(d, "secrets", SecretInfo)) @dataclass @@ -1026,7 +1016,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateCustomAppIntegration: @dataclass class UpdateCustomAppIntegrationOutput: - def as_dict(self) -> dict: """Serializes the UpdateCustomAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1079,7 +1068,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdatePublishedAppIntegration: @dataclass class UpdatePublishedAppIntegrationOutput: - def as_dict(self) -> dict: """Serializes the UpdatePublishedAppIntegrationOutput into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1141,12 +1129,7 @@ class AccountFederationPolicyAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - *, - policy: Optional[FederationPolicy] = None, - policy_id: Optional[str] = None, - ) -> FederationPolicy: + def create(self, *, policy: Optional[FederationPolicy] = None, policy_id: Optional[str] = None) -> FederationPolicy: """Create account federation policy. :param policy: :class:`FederationPolicy` (optional) @@ -1188,9 +1171,7 @@ def delete(self, policy_id: str): } self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}", - headers=headers, + "DELETE", f"/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}", headers=headers ) def get(self, policy_id: str) -> FederationPolicy: @@ -1207,18 +1188,11 @@ def get(self, policy_id: str) -> FederationPolicy: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}", headers=headers ) return FederationPolicy.from_dict(res) - def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[FederationPolicy]: + def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[FederationPolicy]: """List account federation policies. :param page_size: int (optional) @@ -1238,10 +1212,7 @@ def list( while True: json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/federationPolicies", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/federationPolicies", query=query, headers=headers ) if "policies" in json: for v in json["policies"]: @@ -1251,11 +1222,7 @@ def list( query["page_token"] = json["next_page_token"] def update( - self, - policy_id: str, - *, - policy: Optional[FederationPolicy] = None, - update_mask: Optional[str] = None, + self, policy_id: str, *, policy: Optional[FederationPolicy] = None, update_mask: Optional[str] = None ) -> FederationPolicy: """Update account federation policy. @@ -1292,8 +1259,7 @@ def update( class CustomAppIntegrationAPI: """These APIs enable administrators to manage custom OAuth app integrations, which is required for - adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS cloud. - """ + adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS cloud.""" def __init__(self, api_client): self._api = api_client @@ -1502,10 +1468,7 @@ def __init__(self, api_client): self._api = api_client def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[PublishedAppOutput]: """Get all the published OAuth apps. @@ -1530,10 +1493,7 @@ def list( while True: json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/oauth2/published-apps", - query=query, - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/oauth2/published-apps", query=query, headers=headers ) if "apps" in json: for v in json["apps"]: @@ -1545,17 +1505,13 @@ def list( class PublishedAppIntegrationAPI: """These APIs enable administrators to manage published OAuth app integrations, which is required for - adding/using Published OAuth App Integration like Tableau Desktop for Databricks in AWS cloud. - """ + adding/using Published OAuth App Integration like Tableau Desktop for Databricks in AWS cloud.""" def __init__(self, api_client): self._api = api_client def create( - self, - *, - app_id: Optional[str] = None, - token_access_policy: Optional[TokenAccessPolicy] = None, + self, *, app_id: Optional[str] = None, token_access_policy: Optional[TokenAccessPolicy] = None ) -> CreatePublishedAppIntegrationOutput: """Create Published OAuth App Integration. @@ -1631,10 +1587,7 @@ def get(self, integration_id: str) -> GetPublishedAppIntegrationOutput: return GetPublishedAppIntegrationOutput.from_dict(res) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[GetPublishedAppIntegrationOutput]: """Get published oauth app integrations. @@ -1669,12 +1622,7 @@ def list( return query["page_token"] = json["next_page_token"] - def update( - self, - integration_id: str, - *, - token_access_policy: Optional[TokenAccessPolicy] = None, - ): + def update(self, integration_id: str, *, token_access_policy: Optional[TokenAccessPolicy] = None): """Updates Published OAuth App Integration. Updates an existing published OAuth App Integration. You can retrieve the published OAuth app @@ -1742,18 +1690,13 @@ class ServicePrincipalFederationPolicyAPI: You may also need to configure the workload runtime to generate tokens for your workloads. - You do not need to configure an OAuth application in Databricks to use token federation. - """ + You do not need to configure an OAuth application in Databricks to use token federation.""" def __init__(self, api_client): self._api = api_client def create( - self, - service_principal_id: int, - *, - policy: Optional[FederationPolicy] = None, - policy_id: Optional[str] = None, + self, service_principal_id: int, *, policy: Optional[FederationPolicy] = None, policy_id: Optional[str] = None ) -> FederationPolicy: """Create service principal federation policy. @@ -1828,11 +1771,7 @@ def get(self, service_principal_id: int, policy_id: str) -> FederationPolicy: return FederationPolicy.from_dict(res) def list( - self, - service_principal_id: int, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, service_principal_id: int, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[FederationPolicy]: """List service principal federation policies. diff --git a/databricks/sdk/service/pipelines.py b/databricks/sdk/service/pipelines.py index 7d84de54c..e1f89287b 100755 --- a/databricks/sdk/service/pipelines.py +++ b/databricks/sdk/service/pipelines.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import compute # all definitions in this file are in alphabetical order @@ -288,8 +289,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> CreatePipelineResponse: """Deserializes the CreatePipelineResponse from a dictionary.""" return cls( - effective_settings=_from_dict(d, "effective_settings", PipelineSpec), - pipeline_id=d.get("pipeline_id", None), + effective_settings=_from_dict(d, "effective_settings", PipelineSpec), pipeline_id=d.get("pipeline_id", None) ) @@ -320,10 +320,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CronTrigger: """Deserializes the CronTrigger from a dictionary.""" - return cls( - quartz_cron_schedule=d.get("quartz_cron_schedule", None), - timezone_id=d.get("timezone_id", None), - ) + return cls(quartz_cron_schedule=d.get("quartz_cron_schedule", None), timezone_id=d.get("timezone_id", None)) @dataclass @@ -373,7 +370,6 @@ class DayOfWeek(Enum): @dataclass class DeletePipelineResponse: - def as_dict(self) -> dict: """Serializes the DeletePipelineResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -647,7 +643,6 @@ def from_dict(cls, d: Dict[str, any]) -> EditPipeline: @dataclass class EditPipelineResponse: - def as_dict(self) -> dict: """Serializes the EditPipelineResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -693,10 +688,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ErrorDetail: """Deserializes the ErrorDetail from a dictionary.""" - return cls( - exceptions=_repeated_dict(d, "exceptions", SerializedException), - fatal=d.get("fatal", None), - ) + return cls(exceptions=_repeated_dict(d, "exceptions", SerializedException), fatal=d.get("fatal", None)) class EventLevel(Enum): @@ -1170,8 +1162,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListPipelinesResponse: """Deserializes the ListPipelinesResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - statuses=_repeated_dict(d, "statuses", PipelineStateInfo), + next_page_token=d.get("next_page_token", None), statuses=_repeated_dict(d, "statuses", PipelineStateInfo) ) @@ -1220,7 +1211,6 @@ def from_dict(cls, d: Dict[str, any]) -> ListUpdatesResponse: @dataclass class ManualTrigger: - def as_dict(self) -> dict: """Serializes the ManualTrigger into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1304,10 +1294,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Notifications: """Deserializes the Notifications from a dictionary.""" - return cls( - alerts=d.get("alerts", None), - email_recipients=d.get("email_recipients", None), - ) + return cls(alerts=d.get("alerts", None), email_recipients=d.get("email_recipients", None)) @dataclass @@ -1877,10 +1864,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PipelineDeployment: """Deserializes the PipelineDeployment from a dictionary.""" - return cls( - kind=_enum(d, "kind", DeploymentKind), - metadata_file_path=d.get("metadata_file_path", None), - ) + return cls(kind=_enum(d, "kind", DeploymentKind), metadata_file_path=d.get("metadata_file_path", None)) @dataclass @@ -2533,10 +2517,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PipelineTrigger: """Deserializes the PipelineTrigger from a dictionary.""" - return cls( - cron=_from_dict(d, "cron", CronTrigger), - manual=_from_dict(d, "manual", ManualTrigger), - ) + return cls(cron=_from_dict(d, "cron", CronTrigger), manual=_from_dict(d, "manual", ManualTrigger)) @dataclass @@ -2683,10 +2664,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> RunAs: """Deserializes the RunAs from a dictionary.""" - return cls( - service_principal_name=d.get("service_principal_name", None), - user_name=d.get("user_name", None), - ) + return cls(service_principal_name=d.get("service_principal_name", None), user_name=d.get("user_name", None)) @dataclass @@ -2987,7 +2965,6 @@ def from_dict(cls, d: Dict[str, any]) -> StartUpdateResponse: @dataclass class StopPipelineResponse: - def as_dict(self) -> dict: """Serializes the StopPipelineResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3346,8 +3323,7 @@ class PipelinesAPI: Instead of defining your data pipelines using a series of separate Apache Spark tasks, Delta Live Tables manages how your data is transformed based on a target schema you define for each processing step. You can also enforce data quality with Delta Live Tables expectations. Expectations allow you to define expected - data quality and specify how to handle records that fail those expectations. - """ + data quality and specify how to handle records that fail those expectations.""" def __init__(self, api_client): self._api = api_client @@ -3621,11 +3597,7 @@ def get_permission_levels(self, pipeline_id: str) -> GetPipelinePermissionLevels "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/pipelines/{pipeline_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/pipelines/{pipeline_id}/permissionLevels", headers=headers) return GetPipelinePermissionLevelsResponse.from_dict(res) def get_permissions(self, pipeline_id: str) -> PipelinePermissions: @@ -3643,11 +3615,7 @@ def get_permissions(self, pipeline_id: str) -> PipelinePermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/pipelines/{pipeline_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/pipelines/{pipeline_id}", headers=headers) return PipelinePermissions.from_dict(res) def get_update(self, pipeline_id: str, update_id: str) -> GetUpdateResponse: @@ -3667,11 +3635,7 @@ def get_update(self, pipeline_id: str, update_id: str) -> GetUpdateResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/pipelines/{pipeline_id}/updates/{update_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}/updates/{update_id}", headers=headers) return GetUpdateResponse.from_dict(res) def list_pipeline_events( @@ -3724,12 +3688,7 @@ def list_pipeline_events( } while True: - json = self._api.do( - "GET", - f"/api/2.0/pipelines/{pipeline_id}/events", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}/events", query=query, headers=headers) if "events" in json: for v in json["events"]: yield PipelineEvent.from_dict(v) @@ -3828,19 +3787,11 @@ def list_updates( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/pipelines/{pipeline_id}/updates", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/pipelines/{pipeline_id}/updates", query=query, headers=headers) return ListUpdatesResponse.from_dict(res) def set_permissions( - self, - pipeline_id: str, - *, - access_control_list: Optional[List[PipelineAccessControlRequest]] = None, + self, pipeline_id: str, *, access_control_list: Optional[List[PipelineAccessControlRequest]] = None ) -> PipelinePermissions: """Set pipeline permissions. @@ -3861,12 +3812,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/pipelines/{pipeline_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/pipelines/{pipeline_id}", body=body, headers=headers) return PipelinePermissions.from_dict(res) def start_update( @@ -3918,12 +3864,7 @@ def start_update( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/pipelines/{pipeline_id}/updates", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/pipelines/{pipeline_id}/updates", body=body, headers=headers) return StartUpdateResponse.from_dict(res) def stop(self, pipeline_id: str) -> Wait[GetPipelineResponse]: @@ -3945,9 +3886,7 @@ def stop(self, pipeline_id: str) -> Wait[GetPipelineResponse]: op_response = self._api.do("POST", f"/api/2.0/pipelines/{pipeline_id}/stop", headers=headers) return Wait( - self.wait_get_pipeline_idle, - response=StopPipelineResponse.from_dict(op_response), - pipeline_id=pipeline_id, + self.wait_get_pipeline_idle, response=StopPipelineResponse.from_dict(op_response), pipeline_id=pipeline_id ) def stop_and_wait(self, pipeline_id: str, timeout=timedelta(minutes=20)) -> GetPipelineResponse: @@ -4113,18 +4052,10 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/pipelines/{pipeline_id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/pipelines/{pipeline_id}", body=body, headers=headers) def update_permissions( - self, - pipeline_id: str, - *, - access_control_list: Optional[List[PipelineAccessControlRequest]] = None, + self, pipeline_id: str, *, access_control_list: Optional[List[PipelineAccessControlRequest]] = None ) -> PipelinePermissions: """Update pipeline permissions. @@ -4144,10 +4075,5 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/pipelines/{pipeline_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/pipelines/{pipeline_id}", body=body, headers=headers) return PipelinePermissions.from_dict(res) diff --git a/databricks/sdk/service/provisioning.py b/databricks/sdk/service/provisioning.py index c09aa5ed7..a58df14aa 100755 --- a/databricks/sdk/service/provisioning.py +++ b/databricks/sdk/service/provisioning.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -124,10 +125,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AzureWorkspaceInfo: """Deserializes the AzureWorkspaceInfo from a dictionary.""" - return cls( - resource_group=d.get("resource_group", None), - subscription_id=d.get("subscription_id", None), - ) + return cls(resource_group=d.get("resource_group", None), subscription_id=d.get("subscription_id", None)) @dataclass @@ -879,7 +877,6 @@ def from_dict(cls, d: Dict[str, any]) -> CustomerManagedKey: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -900,8 +897,7 @@ class EndpointUseCase(Enum): """This enumeration represents the type of Databricks VPC [endpoint service] that was used when creating this VPC endpoint. - [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html - """ + [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html""" DATAPLANE_RELAY_ACCESS = "DATAPLANE_RELAY_ACCESS" WORKSPACE_ACCESS = "WORKSPACE_ACCESS" @@ -1411,10 +1407,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> NetworkHealth: """Deserializes the NetworkHealth from a dictionary.""" - return cls( - error_message=d.get("error_message", None), - error_type=_enum(d, "error_type", ErrorType), - ) + return cls(error_message=d.get("error_message", None), error_type=_enum(d, "error_type", ErrorType)) @dataclass @@ -1452,10 +1445,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> NetworkVpcEndpoints: """Deserializes the NetworkVpcEndpoints from a dictionary.""" - return cls( - dataplane_relay=d.get("dataplane_relay", None), - rest_api=d.get("rest_api", None), - ) + return cls(dataplane_relay=d.get("dataplane_relay", None), rest_api=d.get("rest_api", None)) @dataclass @@ -1487,10 +1477,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> NetworkWarning: """Deserializes the NetworkWarning from a dictionary.""" - return cls( - warning_message=d.get("warning_message", None), - warning_type=_enum(d, "warning_type", WarningType), - ) + return cls(warning_message=d.get("warning_message", None), warning_type=_enum(d, "warning_type", WarningType)) class PricingTier(Enum): @@ -1601,7 +1588,6 @@ def from_dict(cls, d: Dict[str, any]) -> PrivateAccessSettings: @dataclass class ReplaceResponse: - def as_dict(self) -> dict: """Serializes the ReplaceResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1734,15 +1720,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> StsRole: """Deserializes the StsRole from a dictionary.""" - return cls( - external_id=d.get("external_id", None), - role_arn=d.get("role_arn", None), - ) + return cls(external_id=d.get("external_id", None), role_arn=d.get("role_arn", None)) @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2065,8 +2047,7 @@ def from_dict(cls, d: Dict[str, any]) -> VpcEndpoint: class VpcStatus(Enum): """The status of this network configuration object in terms of its use in a workspace: * - `UNATTACHED`: Unattached. * `VALID`: Valid. * `BROKEN`: Broken. * `WARNED`: Warned. - """ + `UNATTACHED`: Unattached. * `VALID`: Valid. * `BROKEN`: Broken. * `WARNED`: Warned.""" BROKEN = "BROKEN" UNATTACHED = "UNATTACHED" @@ -2347,11 +2328,7 @@ class CredentialsAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - credentials_name: str, - aws_credentials: CreateCredentialAwsCredentials, - ) -> Credential: + def create(self, credentials_name: str, aws_credentials: CreateCredentialAwsCredentials) -> Credential: """Create credential configuration. Creates a Databricks credential configuration that represents cloud cross-account credentials for a @@ -2383,12 +2360,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/credentials", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/credentials", body=body, headers=headers) return Credential.from_dict(res) def delete(self, credentials_id: str): @@ -2408,9 +2380,7 @@ def delete(self, credentials_id: str): } self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/credentials/{credentials_id}", - headers=headers, + "DELETE", f"/api/2.0/accounts/{self._api.account_id}/credentials/{credentials_id}", headers=headers ) def get(self, credentials_id: str) -> Credential: @@ -2429,9 +2399,7 @@ def get(self, credentials_id: str) -> Credential: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/credentials/{credentials_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/credentials/{credentials_id}", headers=headers ) return Credential.from_dict(res) @@ -2447,11 +2415,7 @@ def list(self) -> Iterator[Credential]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/credentials", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/credentials", headers=headers) return [Credential.from_dict(v) for v in res] @@ -2516,10 +2480,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/customer-managed-keys", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/customer-managed-keys", body=body, headers=headers ) return CustomerManagedKey.from_dict(res) @@ -2599,11 +2560,7 @@ def list(self) -> Iterator[CustomerManagedKey]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/customer-managed-keys", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/customer-managed-keys", headers=headers) return [CustomerManagedKey.from_dict(v) for v in res] @@ -2669,12 +2626,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/networks", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/networks", body=body, headers=headers) return Network.from_dict(res) def delete(self, network_id: str): @@ -2695,11 +2647,7 @@ def delete(self, network_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/networks/{network_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/networks/{network_id}", headers=headers) def get(self, network_id: str) -> Network: """Get a network configuration. @@ -2716,11 +2664,7 @@ def get(self, network_id: str) -> Network: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/networks/{network_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/networks/{network_id}", headers=headers) return Network.from_dict(res) def list(self) -> Iterator[Network]: @@ -2737,11 +2681,7 @@ def list(self) -> Iterator[Network]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/networks", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/networks", headers=headers) return [Network.from_dict(v) for v in res] @@ -2822,10 +2762,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/private-access-settings", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/private-access-settings", body=body, headers=headers ) return PrivateAccessSettings.from_dict(res) @@ -2896,11 +2833,7 @@ def list(self) -> Iterator[PrivateAccessSettings]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/private-access-settings", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/private-access-settings", headers=headers) return [PrivateAccessSettings.from_dict(v) for v in res] def replace( @@ -3029,10 +2962,7 @@ def create(self, storage_configuration_name: str, root_bucket_info: RootBucketIn } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/storage-configurations", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/storage-configurations", body=body, headers=headers ) return StorageConfiguration.from_dict(res) @@ -3092,11 +3022,7 @@ def list(self) -> Iterator[StorageConfiguration]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/storage-configurations", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/storage-configurations", headers=headers) return [StorageConfiguration.from_dict(v) for v in res] @@ -3155,10 +3081,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints", body=body, headers=headers ) return VpcEndpoint.from_dict(res) @@ -3185,9 +3108,7 @@ def delete(self, vpc_endpoint_id: str): } self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints/{vpc_endpoint_id}", - headers=headers, + "DELETE", f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints/{vpc_endpoint_id}", headers=headers ) def get(self, vpc_endpoint_id: str) -> VpcEndpoint: @@ -3210,9 +3131,7 @@ def get(self, vpc_endpoint_id: str) -> VpcEndpoint: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints/{vpc_endpoint_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints/{vpc_endpoint_id}", headers=headers ) return VpcEndpoint.from_dict(res) @@ -3232,11 +3151,7 @@ def list(self) -> Iterator[VpcEndpoint]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/vpc-endpoints", headers=headers) return [VpcEndpoint.from_dict(v) for v in res] @@ -3252,10 +3167,7 @@ def __init__(self, api_client): self._api = api_client def wait_get_workspace_running( - self, - workspace_id: int, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[Workspace], None]] = None, + self, workspace_id: int, timeout=timedelta(minutes=20), callback: Optional[Callable[[Workspace], None]] = None ) -> Workspace: deadline = time.time() + timeout.total_seconds() target_states = (WorkspaceStatus.RUNNING,) @@ -3452,10 +3364,7 @@ def create( } op_response = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/workspaces", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/workspaces", body=body, headers=headers ) return Wait( self.wait_get_workspace_running, @@ -3525,11 +3434,7 @@ def delete(self, workspace_id: int): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", headers=headers) def get(self, workspace_id: int) -> Workspace: """Get a workspace. @@ -3558,9 +3463,7 @@ def get(self, workspace_id: int) -> Workspace: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", headers=headers ) return Workspace.from_dict(res) @@ -3579,11 +3482,7 @@ def list(self) -> Iterator[Workspace]: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/workspaces", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/workspaces", headers=headers) return [Workspace.from_dict(v) for v in res] def update( @@ -3755,15 +3654,10 @@ def update( } op_response = self._api.do( - "PATCH", - f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", body=body, headers=headers ) return Wait( - self.wait_get_workspace_running, - response=UpdateResponse.from_dict(op_response), - workspace_id=workspace_id, + self.wait_get_workspace_running, response=UpdateResponse.from_dict(op_response), workspace_id=workspace_id ) def update_and_wait( diff --git a/databricks/sdk/service/serving.py b/databricks/sdk/service/serving.py index 6a8013f68..ec60e6847 100755 --- a/databricks/sdk/service/serving.py +++ b/databricks/sdk/service/serving.py @@ -17,6 +17,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -686,10 +687,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ChatMessage: """Deserializes the ChatMessage from a dictionary.""" - return cls( - content=d.get("content", None), - role=_enum(d, "role", ChatMessageRole), - ) + return cls(content=d.get("content", None), role=_enum(d, "role", ChatMessageRole)) class ChatMessageRole(Enum): @@ -849,10 +847,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DataPlaneInfo: """Deserializes the DataPlaneInfo from a dictionary.""" - return cls( - authorization_details=d.get("authorization_details", None), - endpoint_url=d.get("endpoint_url", None), - ) + return cls(authorization_details=d.get("authorization_details", None), endpoint_url=d.get("endpoint_url", None)) @dataclass @@ -940,16 +935,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DataframeSplitInput: """Deserializes the DataframeSplitInput from a dictionary.""" - return cls( - columns=d.get("columns", None), - data=d.get("data", None), - index=d.get("index", None), - ) + return cls(columns=d.get("columns", None), data=d.get("data", None), index=d.get("index", None)) @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1560,9 +1550,7 @@ def from_dict(cls, d: Dict[str, any]) -> ExternalModel: anthropic_config=_from_dict(d, "anthropic_config", AnthropicConfig), cohere_config=_from_dict(d, "cohere_config", CohereConfig), databricks_model_serving_config=_from_dict( - d, - "databricks_model_serving_config", - DatabricksModelServingConfig, + d, "databricks_model_serving_config", DatabricksModelServingConfig ), google_cloud_vertex_ai_config=_from_dict(d, "google_cloud_vertex_ai_config", GoogleCloudVertexAiConfig), name=d.get("name", None), @@ -2031,8 +2019,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> PaLmConfig: """Deserializes the PaLmConfig from a dictionary.""" return cls( - palm_api_key=d.get("palm_api_key", None), - palm_api_key_plaintext=d.get("palm_api_key_plaintext", None), + palm_api_key=d.get("palm_api_key", None), palm_api_key_plaintext=d.get("palm_api_key_plaintext", None) ) @@ -2112,11 +2099,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PayloadTable: """Deserializes the PayloadTable from a dictionary.""" - return cls( - name=d.get("name", None), - status=d.get("status", None), - status_message=d.get("status_message", None), - ) + return cls(name=d.get("name", None), status=d.get("status", None), status_message=d.get("status_message", None)) @dataclass @@ -2264,10 +2247,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PutRequest: """Deserializes the PutRequest from a dictionary.""" - return cls( - name=d.get("name", None), - rate_limits=_repeated_dict(d, "rate_limits", RateLimit), - ) + return cls(name=d.get("name", None), rate_limits=_repeated_dict(d, "rate_limits", RateLimit)) @dataclass @@ -2636,8 +2616,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> Route: """Deserializes the Route from a dictionary.""" return cls( - served_model_name=d.get("served_model_name", None), - traffic_percentage=d.get("traffic_percentage", None), + served_model_name=d.get("served_model_name", None), traffic_percentage=d.get("traffic_percentage", None) ) @@ -3270,9 +3249,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ServedModelSpec: """Deserializes the ServedModelSpec from a dictionary.""" return cls( - model_name=d.get("model_name", None), - model_version=d.get("model_version", None), - name=d.get("name", None), + model_name=d.get("model_name", None), model_version=d.get("model_version", None), name=d.get("name", None) ) @@ -4019,9 +3996,7 @@ def build_logs(self, name: str, served_model_name: str) -> BuildLogsResponse: } res = self._api.do( - "GET", - f"/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/build-logs", - headers=headers, + "GET", f"/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/build-logs", headers=headers ) return BuildLogsResponse.from_dict(res) @@ -4132,12 +4107,7 @@ def export_metrics(self, name: str) -> ExportMetricsResponse: "Accept": "text/plain", } - res = self._api.do( - "GET", - f"/api/2.0/serving-endpoints/{name}/metrics", - headers=headers, - raw=True, - ) + res = self._api.do("GET", f"/api/2.0/serving-endpoints/{name}/metrics", headers=headers, raw=True) return ExportMetricsResponse.from_dict(res) def get(self, name: str) -> ServingEndpointDetailed: @@ -4174,12 +4144,7 @@ def get_open_api(self, name: str) -> GetOpenApiResponse: "Accept": "text/plain", } - res = self._api.do( - "GET", - f"/api/2.0/serving-endpoints/{name}/openapi", - headers=headers, - raw=True, - ) + res = self._api.do("GET", f"/api/2.0/serving-endpoints/{name}/openapi", headers=headers, raw=True) return GetOpenApiResponse.from_dict(res) def get_permission_levels(self, serving_endpoint_id: str) -> GetServingEndpointPermissionLevelsResponse: @@ -4198,9 +4163,7 @@ def get_permission_levels(self, serving_endpoint_id: str) -> GetServingEndpointP } res = self._api.do( - "GET", - f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}/permissionLevels", - headers=headers, + "GET", f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}/permissionLevels", headers=headers ) return GetServingEndpointPermissionLevelsResponse.from_dict(res) @@ -4220,11 +4183,7 @@ def get_permissions(self, serving_endpoint_id: str) -> ServingEndpointPermission "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", headers=headers) return ServingEndpointPermissions.from_dict(res) def http_request( @@ -4273,13 +4232,7 @@ def http_request( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/external-function", - body=body, - headers=headers, - raw=True, - ) + res = self._api.do("POST", "/api/2.0/external-function", body=body, headers=headers, raw=True) return HttpRequestResponse.from_dict(res) def list(self) -> Iterator[ServingEndpoint]: @@ -4314,18 +4267,12 @@ def logs(self, name: str, served_model_name: str) -> ServerLogsResponse: } res = self._api.do( - "GET", - f"/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/logs", - headers=headers, + "GET", f"/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/logs", headers=headers ) return ServerLogsResponse.from_dict(res) def patch( - self, - name: str, - *, - add_tags: Optional[List[EndpointTag]] = None, - delete_tags: Optional[List[str]] = None, + self, name: str, *, add_tags: Optional[List[EndpointTag]] = None, delete_tags: Optional[List[str]] = None ) -> EndpointTags: """Update tags of a serving endpoint. @@ -4350,12 +4297,7 @@ def patch( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/serving-endpoints/{name}/tags", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/serving-endpoints/{name}/tags", body=body, headers=headers) return EndpointTags.from_dict(res) def put(self, name: str, *, rate_limits: Optional[List[RateLimit]] = None) -> PutResponse: @@ -4379,12 +4321,7 @@ def put(self, name: str, *, rate_limits: Optional[List[RateLimit]] = None) -> Pu "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/serving-endpoints/{name}/rate-limits", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/rate-limits", body=body, headers=headers) return PutResponse.from_dict(res) def put_ai_gateway( @@ -4430,12 +4367,7 @@ def put_ai_gateway( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/serving-endpoints/{name}/ai-gateway", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/ai-gateway", body=body, headers=headers) return PutAiGatewayResponse.from_dict(res) def query( @@ -4573,10 +4505,7 @@ def set_permissions( } res = self._api.do( - "PUT", - f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", body=body, headers=headers ) return ServingEndpointPermissions.from_dict(res) @@ -4628,12 +4557,7 @@ def update_config( "Content-Type": "application/json", } - op_response = self._api.do( - "PUT", - f"/api/2.0/serving-endpoints/{name}/config", - body=body, - headers=headers, - ) + op_response = self._api.do("PUT", f"/api/2.0/serving-endpoints/{name}/config", body=body, headers=headers) return Wait( self.wait_get_serving_endpoint_not_updating, response=ServingEndpointDetailed.from_dict(op_response), @@ -4684,10 +4608,7 @@ def update_permissions( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}", body=body, headers=headers ) return ServingEndpointPermissions.from_dict(res) diff --git a/databricks/sdk/service/settings.py b/databricks/sdk/service/settings.py index 8e8e81cd6..d7111c663 100755 --- a/databricks/sdk/service/settings.py +++ b/databricks/sdk/service/settings.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -86,11 +87,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> AibiDashboardEmbeddingAccessPolicy: """Deserializes the AibiDashboardEmbeddingAccessPolicy from a dictionary.""" return cls( - access_policy_type=_enum( - d, - "access_policy_type", - AibiDashboardEmbeddingAccessPolicyAccessPolicyType, - ) + access_policy_type=_enum(d, "access_policy_type", AibiDashboardEmbeddingAccessPolicyAccessPolicyType) ) @@ -146,9 +143,7 @@ def from_dict(cls, d: Dict[str, any]) -> AibiDashboardEmbeddingAccessPolicySetti """Deserializes the AibiDashboardEmbeddingAccessPolicySetting from a dictionary.""" return cls( aibi_dashboard_embedding_access_policy=_from_dict( - d, - "aibi_dashboard_embedding_access_policy", - AibiDashboardEmbeddingAccessPolicy, + d, "aibi_dashboard_embedding_access_policy", AibiDashboardEmbeddingAccessPolicy ), etag=d.get("etag", None), setting_name=d.get("setting_name", None), @@ -224,9 +219,7 @@ def from_dict(cls, d: Dict[str, any]) -> AibiDashboardEmbeddingApprovedDomainsSe """Deserializes the AibiDashboardEmbeddingApprovedDomainsSetting from a dictionary.""" return cls( aibi_dashboard_embedding_approved_domains=_from_dict( - d, - "aibi_dashboard_embedding_approved_domains", - AibiDashboardEmbeddingApprovedDomains, + d, "aibi_dashboard_embedding_approved_domains", AibiDashboardEmbeddingApprovedDomains ), etag=d.get("etag", None), setting_name=d.get("setting_name", None), @@ -278,9 +271,7 @@ def from_dict(cls, d: Dict[str, any]) -> AutomaticClusterUpdateSetting: """Deserializes the AutomaticClusterUpdateSetting from a dictionary.""" return cls( automatic_cluster_update_workspace=_from_dict( - d, - "automatic_cluster_update_workspace", - ClusterAutoRestartMessage, + d, "automatic_cluster_update_workspace", ClusterAutoRestartMessage ), etag=d.get("etag", None), setting_name=d.get("setting_name", None), @@ -364,16 +355,8 @@ def from_dict(cls, d: Dict[str, any]) -> ClusterAutoRestartMessage: return cls( can_toggle=d.get("can_toggle", None), enabled=d.get("enabled", None), - enablement_details=_from_dict( - d, - "enablement_details", - ClusterAutoRestartMessageEnablementDetails, - ), - maintenance_window=_from_dict( - d, - "maintenance_window", - ClusterAutoRestartMessageMaintenanceWindow, - ), + enablement_details=_from_dict(d, "enablement_details", ClusterAutoRestartMessageEnablementDetails), + maintenance_window=_from_dict(d, "maintenance_window", ClusterAutoRestartMessageMaintenanceWindow), restart_even_if_no_updates_available=d.get("restart_even_if_no_updates_available", None), ) @@ -451,9 +434,7 @@ def from_dict(cls, d: Dict[str, any]) -> ClusterAutoRestartMessageMaintenanceWin """Deserializes the ClusterAutoRestartMessageMaintenanceWindow from a dictionary.""" return cls( week_day_based_schedule=_from_dict( - d, - "week_day_based_schedule", - ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule, + d, "week_day_based_schedule", ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule ) ) @@ -503,20 +484,10 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule: """Deserializes the ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule from a dictionary.""" return cls( - day_of_week=_enum( - d, - "day_of_week", - ClusterAutoRestartMessageMaintenanceWindowDayOfWeek, - ), - frequency=_enum( - d, - "frequency", - ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency, - ), + day_of_week=_enum(d, "day_of_week", ClusterAutoRestartMessageMaintenanceWindowDayOfWeek), + frequency=_enum(d, "frequency", ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency), window_start_time=_from_dict( - d, - "window_start_time", - ClusterAutoRestartMessageMaintenanceWindowWindowStartTime, + d, "window_start_time", ClusterAutoRestartMessageMaintenanceWindowWindowStartTime ), ) @@ -644,9 +615,7 @@ def from_dict(cls, d: Dict[str, any]) -> ComplianceSecurityProfileSetting: """Deserializes the ComplianceSecurityProfileSetting from a dictionary.""" return cls( compliance_security_profile_workspace=_from_dict( - d, - "compliance_security_profile_workspace", - ComplianceSecurityProfile, + d, "compliance_security_profile_workspace", ComplianceSecurityProfile ), etag=d.get("etag", None), setting_name=d.get("setting_name", None), @@ -862,10 +831,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateNotificationDestinationRequest: """Deserializes the CreateNotificationDestinationRequest from a dictionary.""" - return cls( - config=_from_dict(d, "config", Config), - display_name=d.get("display_name", None), - ) + return cls(config=_from_dict(d, "config", Config), display_name=d.get("display_name", None)) @dataclass @@ -943,10 +909,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateOboTokenResponse: """Deserializes the CreateOboTokenResponse from a dictionary.""" - return cls( - token_info=_from_dict(d, "token_info", TokenInfo), - token_value=d.get("token_value", None), - ) + return cls(token_info=_from_dict(d, "token_info", TokenInfo), token_value=d.get("token_value", None)) @dataclass @@ -995,8 +958,7 @@ def from_dict(cls, d: Dict[str, any]) -> CreatePrivateEndpointRuleRequest: class CreatePrivateEndpointRuleRequestGroupId(Enum): """The sub-resource type (group ID) of the target resource. Note that to connect to workspace root - storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`. - """ + storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`.""" BLOB = "blob" DFS = "dfs" @@ -1035,10 +997,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateTokenRequest: """Deserializes the CreateTokenRequest from a dictionary.""" - return cls( - comment=d.get("comment", None), - lifetime_seconds=d.get("lifetime_seconds", None), - ) + return cls(comment=d.get("comment", None), lifetime_seconds=d.get("lifetime_seconds", None)) @dataclass @@ -1070,10 +1029,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateTokenResponse: """Deserializes the CreateTokenResponse from a dictionary.""" - return cls( - token_info=_from_dict(d, "token_info", PublicTokenInfo), - token_value=d.get("token_value", None), - ) + return cls(token_info=_from_dict(d, "token_info", PublicTokenInfo), token_value=d.get("token_value", None)) @dataclass @@ -1449,7 +1405,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteDisableLegacyFeaturesResponse: @dataclass class DeleteNetworkConnectivityConfigurationResponse: - def as_dict(self) -> dict: """Serializes the DeleteNetworkConnectivityConfigurationResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1500,7 +1455,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeletePersonalComputeSettingResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1784,25 +1738,13 @@ def from_dict(cls, d: Dict[str, any]) -> EgressNetworkPolicyInternetAccessPolicy """Deserializes the EgressNetworkPolicyInternetAccessPolicy from a dictionary.""" return cls( allowed_internet_destinations=_repeated_dict( - d, - "allowed_internet_destinations", - EgressNetworkPolicyInternetAccessPolicyInternetDestination, + d, "allowed_internet_destinations", EgressNetworkPolicyInternetAccessPolicyInternetDestination ), allowed_storage_destinations=_repeated_dict( - d, - "allowed_storage_destinations", - EgressNetworkPolicyInternetAccessPolicyStorageDestination, - ), - log_only_mode=_from_dict( - d, - "log_only_mode", - EgressNetworkPolicyInternetAccessPolicyLogOnlyMode, - ), - restriction_mode=_enum( - d, - "restriction_mode", - EgressNetworkPolicyInternetAccessPolicyRestrictionMode, + d, "allowed_storage_destinations", EgressNetworkPolicyInternetAccessPolicyStorageDestination ), + log_only_mode=_from_dict(d, "log_only_mode", EgressNetworkPolicyInternetAccessPolicyLogOnlyMode), + restriction_mode=_enum(d, "restriction_mode", EgressNetworkPolicyInternetAccessPolicyRestrictionMode), ) @@ -1856,11 +1798,7 @@ def from_dict(cls, d: Dict[str, any]) -> EgressNetworkPolicyInternetAccessPolicy "protocol", EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationFilteringProtocol, ), - type=_enum( - d, - "type", - EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationType, - ), + type=_enum(d, "type", EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationType), ) @@ -1907,15 +1845,9 @@ def from_dict(cls, d: Dict[str, any]) -> EgressNetworkPolicyInternetAccessPolicy """Deserializes the EgressNetworkPolicyInternetAccessPolicyLogOnlyMode from a dictionary.""" return cls( log_only_mode_type=_enum( - d, - "log_only_mode_type", - EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType, - ), - workloads=_repeated_enum( - d, - "workloads", - EgressNetworkPolicyInternetAccessPolicyLogOnlyModeWorkloadType, + d, "log_only_mode_type", EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType ), + workloads=_repeated_enum(d, "workloads", EgressNetworkPolicyInternetAccessPolicyLogOnlyModeWorkloadType), ) @@ -2017,11 +1949,7 @@ def from_dict(cls, d: Dict[str, any]) -> EgressNetworkPolicyInternetAccessPolicy azure_storage_service=d.get("azure_storage_service", None), bucket_name=d.get("bucket_name", None), region=d.get("region", None), - type=_enum( - d, - "type", - EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType, - ), + type=_enum(d, "type", EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType), ) @@ -2060,7 +1988,6 @@ def from_dict(cls, d: Dict[str, any]) -> EmailConfig: @dataclass class Empty: - def as_dict(self) -> dict: """Serializes the Empty into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2149,9 +2076,7 @@ def from_dict(cls, d: Dict[str, any]) -> EnhancedSecurityMonitoringSetting: """Deserializes the EnhancedSecurityMonitoringSetting from a dictionary.""" return cls( enhanced_security_monitoring_workspace=_from_dict( - d, - "enhanced_security_monitoring_workspace", - EnhancedSecurityMonitoring, + d, "enhanced_security_monitoring_workspace", EnhancedSecurityMonitoring ), etag=d.get("etag", None), setting_name=d.get("setting_name", None), @@ -2895,8 +2820,7 @@ class ListType(Enum): """Type of IP access list. Valid values are as follows and are case-sensitive: * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. Exclude this IP or - range. IP addresses in the block list are excluded even if they are included in an allow list. - """ + range. IP addresses in the block list are excluded even if they are included in an allow list.""" ALLOW = "ALLOW" BLOCK = "BLOCK" @@ -3060,11 +2984,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> NccAzurePrivateEndpointRule: """Deserializes the NccAzurePrivateEndpointRule from a dictionary.""" return cls( - connection_state=_enum( - d, - "connection_state", - NccAzurePrivateEndpointRuleConnectionState, - ), + connection_state=_enum(d, "connection_state", NccAzurePrivateEndpointRuleConnectionState), creation_time=d.get("creation_time", None), deactivated=d.get("deactivated", None), deactivated_at=d.get("deactivated_at", None), @@ -3098,8 +3018,7 @@ class NccAzurePrivateEndpointRuleConnectionState(Enum): class NccAzurePrivateEndpointRuleGroupId(Enum): """The sub-resource type (group ID) of the target resource. Note that to connect to workspace root - storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`. - """ + storage (root DBFS), you need two endpoints, one for `blob` and one for `dfs`.""" BLOB = "blob" DFS = "dfs" @@ -3426,8 +3345,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> PagerdutyConfig: """Deserializes the PagerdutyConfig from a dictionary.""" return cls( - integration_key=d.get("integration_key", None), - integration_key_set=d.get("integration_key_set", None), + integration_key=d.get("integration_key", None), integration_key_set=d.get("integration_key_set", None) ) @@ -3664,7 +3582,6 @@ def from_dict(cls, d: Dict[str, any]) -> ReplaceIpAccessList: @dataclass class ReplaceResponse: - def as_dict(self) -> dict: """Serializes the ReplaceResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3788,7 +3705,6 @@ def from_dict(cls, d: Dict[str, any]) -> RevokeTokenRequest: @dataclass class RevokeTokenResponse: - def as_dict(self) -> dict: """Serializes the RevokeTokenResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3807,7 +3723,6 @@ def from_dict(cls, d: Dict[str, any]) -> RevokeTokenResponse: @dataclass class SetStatusResponse: - def as_dict(self) -> dict: """Serializes the SetStatusResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -4198,8 +4113,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> TokenPermissionsDescription: """Deserializes the TokenPermissionsDescription from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", TokenPermissionLevel), + description=d.get("description", None), permission_level=_enum(d, "permission_level", TokenPermissionLevel) ) @@ -4966,9 +4880,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> UpdateNotificationDestinationRequest: """Deserializes the UpdateNotificationDestinationRequest from a dictionary.""" return cls( - config=_from_dict(d, "config", Config), - display_name=d.get("display_name", None), - id=d.get("id", None), + config=_from_dict(d, "config", Config), display_name=d.get("display_name", None), id=d.get("id", None) ) @@ -5026,7 +4938,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdatePersonalComputeSettingRequest: @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -5116,18 +5027,13 @@ class AccountIpAccessListsAPI: For all allow lists and block lists combined, the account supports a maximum of 1000 IP/CIDR values, where one CIDR counts as a single value. - After changes to the account-level IP access lists, it can take a few minutes for changes to take effect. - """ + After changes to the account-level IP access lists, it can take a few minutes for changes to take effect.""" def __init__(self, api_client): self._api = api_client def create( - self, - label: str, - list_type: ListType, - *, - ip_addresses: Optional[List[str]] = None, + self, label: str, list_type: ListType, *, ip_addresses: Optional[List[str]] = None ) -> CreateIpAccessListResponse: """Create access list. @@ -5169,10 +5075,7 @@ def create( } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists", body=body, headers=headers ) return CreateIpAccessListResponse.from_dict(res) @@ -5192,9 +5095,7 @@ def delete(self, ip_access_list_id: str): } self._api.do( - "DELETE", - f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists/{ip_access_list_id}", - headers=headers, + "DELETE", f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists/{ip_access_list_id}", headers=headers ) def get(self, ip_access_list_id: str) -> GetIpAccessListResponse: @@ -5213,9 +5114,7 @@ def get(self, ip_access_list_id: str) -> GetIpAccessListResponse: } res = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists/{ip_access_list_id}", - headers=headers, + "GET", f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists/{ip_access_list_id}", headers=headers ) return GetIpAccessListResponse.from_dict(res) @@ -5231,11 +5130,7 @@ def list(self) -> Iterator[IpAccessListInfo]: "Accept": "application/json", } - json = self._api.do( - "GET", - f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists", - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/ip-access-lists", headers=headers) parsed = GetIpAccessListsResponse.from_dict(json).ip_access_lists return parsed if parsed is not None else [] @@ -5398,8 +5293,7 @@ def personal_compute(self) -> PersonalComputeAPI: class AibiDashboardEmbeddingAccessPolicyAPI: """Controls whether AI/BI published dashboard embedding is enabled, conditionally enabled, or disabled at the - workspace level. By default, this setting is conditionally enabled (ALLOW_APPROVED_DOMAINS). - """ + workspace level. By default, this setting is conditionally enabled (ALLOW_APPROVED_DOMAINS).""" def __init__(self, api_client): self._api = api_client @@ -5458,18 +5352,12 @@ def get(self, *, etag: Optional[str] = None) -> AibiDashboardEmbeddingAccessPoli } res = self._api.do( - "GET", - "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default", query=query, headers=headers ) return AibiDashboardEmbeddingAccessPolicySetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: AibiDashboardEmbeddingAccessPolicySetting, - field_mask: str, + self, allow_missing: bool, setting: AibiDashboardEmbeddingAccessPolicySetting, field_mask: str ) -> AibiDashboardEmbeddingAccessPolicySetting: """Update the AI/BI dashboard embedding access policy. @@ -5504,18 +5392,14 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default", body=body, headers=headers ) return AibiDashboardEmbeddingAccessPolicySetting.from_dict(res) class AibiDashboardEmbeddingApprovedDomainsAPI: """Controls the list of domains approved to host the embedded AI/BI dashboards. The approved domains list - can't be mutated when the current access policy is not set to ALLOW_APPROVED_DOMAINS. - """ + can't be mutated when the current access policy is not set to ALLOW_APPROVED_DOMAINS.""" def __init__(self, api_client): self._api = api_client @@ -5582,10 +5466,7 @@ def get(self, *, etag: Optional[str] = None) -> AibiDashboardEmbeddingApprovedDo return AibiDashboardEmbeddingApprovedDomainsSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: AibiDashboardEmbeddingApprovedDomainsSetting, - field_mask: str, + self, allow_missing: bool, setting: AibiDashboardEmbeddingApprovedDomainsSetting, field_mask: str ) -> AibiDashboardEmbeddingApprovedDomainsSetting: """Update the list of domains approved to host embedded AI/BI dashboards. @@ -5659,18 +5540,12 @@ def get(self, *, etag: Optional[str] = None) -> AutomaticClusterUpdateSetting: } res = self._api.do( - "GET", - "/api/2.0/settings/types/automatic_cluster_update/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/automatic_cluster_update/names/default", query=query, headers=headers ) return AutomaticClusterUpdateSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: AutomaticClusterUpdateSetting, - field_mask: str, + self, allow_missing: bool, setting: AutomaticClusterUpdateSetting, field_mask: str ) -> AutomaticClusterUpdateSetting: """Update the automatic cluster update setting. @@ -5708,10 +5583,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/automatic_cluster_update/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/automatic_cluster_update/names/default", body=body, headers=headers ) return AutomaticClusterUpdateSetting.from_dict(res) @@ -5748,18 +5620,12 @@ def get(self, *, etag: Optional[str] = None) -> ComplianceSecurityProfileSetting } res = self._api.do( - "GET", - "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default", query=query, headers=headers ) return ComplianceSecurityProfileSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: ComplianceSecurityProfileSetting, - field_mask: str, + self, allow_missing: bool, setting: ComplianceSecurityProfileSetting, field_mask: str ) -> ComplianceSecurityProfileSetting: """Update the compliance security profile setting. @@ -5797,10 +5663,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default", body=body, headers=headers ) return ComplianceSecurityProfileSetting.from_dict(res) @@ -5813,10 +5676,7 @@ def __init__(self, api_client): self._api = api_client def exchange_token( - self, - partition_id: PartitionId, - token_type: List[TokenType], - scopes: List[str], + self, partition_id: PartitionId, token_type: List[TokenType], scopes: List[str] ) -> ExchangeTokenResponse: """Exchange token. @@ -5844,12 +5704,7 @@ def exchange_token( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/credentials-manager/exchange-tokens/token", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/credentials-manager/exchange-tokens/token", body=body, headers=headers) return ExchangeTokenResponse.from_dict(res) @@ -5895,10 +5750,7 @@ def get(self, *, etag: Optional[str] = None) -> CspEnablementAccountSetting: return CspEnablementAccountSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: CspEnablementAccountSetting, - field_mask: str, + self, allow_missing: bool, setting: CspEnablementAccountSetting, field_mask: str ) -> CspEnablementAccountSetting: """Update the compliance security profile setting for new workspaces. @@ -5982,10 +5834,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDefaultNamespaceSetting } res = self._api.do( - "DELETE", - "/api/2.0/settings/types/default_namespace_ws/names/default", - query=query, - headers=headers, + "DELETE", "/api/2.0/settings/types/default_namespace_ws/names/default", query=query, headers=headers ) return DeleteDefaultNamespaceSettingResponse.from_dict(res) @@ -6012,19 +5861,11 @@ def get(self, *, etag: Optional[str] = None) -> DefaultNamespaceSetting: } res = self._api.do( - "GET", - "/api/2.0/settings/types/default_namespace_ws/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/default_namespace_ws/names/default", query=query, headers=headers ) return DefaultNamespaceSetting.from_dict(res) - def update( - self, - allow_missing: bool, - setting: DefaultNamespaceSetting, - field_mask: str, - ) -> DefaultNamespaceSetting: + def update(self, allow_missing: bool, setting: DefaultNamespaceSetting, field_mask: str) -> DefaultNamespaceSetting: """Update the default namespace setting. Updates the default namespace setting for the workspace. A fresh etag needs to be provided in `PATCH` @@ -6070,10 +5911,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/default_namespace_ws/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/default_namespace_ws/names/default", body=body, headers=headers ) return DefaultNamespaceSetting.from_dict(res) @@ -6112,10 +5950,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDisableLegacyAccessResp } res = self._api.do( - "DELETE", - "/api/2.0/settings/types/disable_legacy_access/names/default", - query=query, - headers=headers, + "DELETE", "/api/2.0/settings/types/disable_legacy_access/names/default", query=query, headers=headers ) return DeleteDisableLegacyAccessResponse.from_dict(res) @@ -6142,19 +5977,11 @@ def get(self, *, etag: Optional[str] = None) -> DisableLegacyAccess: } res = self._api.do( - "GET", - "/api/2.0/settings/types/disable_legacy_access/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/disable_legacy_access/names/default", query=query, headers=headers ) return DisableLegacyAccess.from_dict(res) - def update( - self, - allow_missing: bool, - setting: DisableLegacyAccess, - field_mask: str, - ) -> DisableLegacyAccess: + def update(self, allow_missing: bool, setting: DisableLegacyAccess, field_mask: str) -> DisableLegacyAccess: """Update Legacy Access Disablement Status. Updates legacy access disablement status. @@ -6188,10 +6015,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/disable_legacy_access/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/disable_legacy_access/names/default", body=body, headers=headers ) return DisableLegacyAccess.from_dict(res) @@ -6226,10 +6050,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteDisableLegacyDbfsRespon } res = self._api.do( - "DELETE", - "/api/2.0/settings/types/disable_legacy_dbfs/names/default", - query=query, - headers=headers, + "DELETE", "/api/2.0/settings/types/disable_legacy_dbfs/names/default", query=query, headers=headers ) return DeleteDisableLegacyDbfsResponse.from_dict(res) @@ -6256,10 +6077,7 @@ def get(self, *, etag: Optional[str] = None) -> DisableLegacyDbfs: } res = self._api.do( - "GET", - "/api/2.0/settings/types/disable_legacy_dbfs/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/disable_legacy_dbfs/names/default", query=query, headers=headers ) return DisableLegacyDbfs.from_dict(res) @@ -6297,10 +6115,7 @@ def update(self, allow_missing: bool, setting: DisableLegacyDbfs, field_mask: st } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/disable_legacy_dbfs/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/disable_legacy_dbfs/names/default", body=body, headers=headers ) return DisableLegacyDbfs.from_dict(res) @@ -6375,12 +6190,7 @@ def get(self, *, etag: Optional[str] = None) -> DisableLegacyFeatures: ) return DisableLegacyFeatures.from_dict(res) - def update( - self, - allow_missing: bool, - setting: DisableLegacyFeatures, - field_mask: str, - ) -> DisableLegacyFeatures: + def update(self, allow_missing: bool, setting: DisableLegacyFeatures, field_mask: str) -> DisableLegacyFeatures: """Update the disable legacy features setting. Updates the value of the disable legacy features setting. @@ -6489,12 +6299,7 @@ def get(self, *, etag: Optional[str] = None) -> AccountIpAccessEnable: ) return AccountIpAccessEnable.from_dict(res) - def update( - self, - allow_missing: bool, - setting: AccountIpAccessEnable, - field_mask: str, - ) -> AccountIpAccessEnable: + def update(self, allow_missing: bool, setting: AccountIpAccessEnable, field_mask: str) -> AccountIpAccessEnable: """Update the account IP access toggle setting. Updates the value of the account IP access toggle setting. @@ -6570,18 +6375,12 @@ def get(self, *, etag: Optional[str] = None) -> EnhancedSecurityMonitoringSettin } res = self._api.do( - "GET", - "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default", query=query, headers=headers ) return EnhancedSecurityMonitoringSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: EnhancedSecurityMonitoringSetting, - field_mask: str, + self, allow_missing: bool, setting: EnhancedSecurityMonitoringSetting, field_mask: str ) -> EnhancedSecurityMonitoringSetting: """Update the enhanced security monitoring setting. @@ -6619,10 +6418,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default", body=body, headers=headers ) return EnhancedSecurityMonitoringSetting.from_dict(res) @@ -6630,8 +6426,7 @@ def update( class EsmEnablementAccountAPI: """The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces. By default, this account-level setting is disabled for new workspaces. After workspace - creation, account admins can enable enhanced security monitoring individually for each workspace. - """ + creation, account admins can enable enhanced security monitoring individually for each workspace.""" def __init__(self, api_client): self._api = api_client @@ -6667,10 +6462,7 @@ def get(self, *, etag: Optional[str] = None) -> EsmEnablementAccountSetting: return EsmEnablementAccountSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: EsmEnablementAccountSetting, - field_mask: str, + self, allow_missing: bool, setting: EsmEnablementAccountSetting, field_mask: str ) -> EsmEnablementAccountSetting: """Update the enhanced security monitoring setting for new workspaces. @@ -6730,18 +6522,13 @@ class IpAccessListsAPI: For all allow lists and block lists combined, the workspace supports a maximum of 1000 IP/CIDR values, where one CIDR counts as a single value. - After changes to the IP access list feature, it can take a few minutes for changes to take effect. - """ + After changes to the IP access list feature, it can take a few minutes for changes to take effect.""" def __init__(self, api_client): self._api = api_client def create( - self, - label: str, - list_type: ListType, - *, - ip_addresses: Optional[List[str]] = None, + self, label: str, list_type: ListType, *, ip_addresses: Optional[List[str]] = None ) -> CreateIpAccessListResponse: """Create access list. @@ -6801,11 +6588,7 @@ def delete(self, ip_access_list_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/ip-access-lists/{ip_access_list_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/ip-access-lists/{ip_access_list_id}", headers=headers) def get(self, ip_access_list_id: str) -> FetchIpAccessListResponse: """Get access list. @@ -6822,11 +6605,7 @@ def get(self, ip_access_list_id: str) -> FetchIpAccessListResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/ip-access-lists/{ip_access_list_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/ip-access-lists/{ip_access_list_id}", headers=headers) return FetchIpAccessListResponse.from_dict(res) def list(self) -> Iterator[IpAccessListInfo]: @@ -6896,12 +6675,7 @@ def replace( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/ip-access-lists/{ip_access_list_id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/ip-access-lists/{ip_access_list_id}", body=body, headers=headers) def update( self, @@ -6958,12 +6732,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/ip-access-lists/{ip_access_list_id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/ip-access-lists/{ip_access_list_id}", body=body, headers=headers) class NetworkConnectivityAPI: @@ -6997,18 +6766,12 @@ def create_network_connectivity_configuration(self, name: str, region: str) -> N } res = self._api.do( - "POST", - f"/api/2.0/accounts/{self._api.account_id}/network-connectivity-configs", - body=body, - headers=headers, + "POST", f"/api/2.0/accounts/{self._api.account_id}/network-connectivity-configs", body=body, headers=headers ) return NetworkConnectivityConfiguration.from_dict(res) def create_private_endpoint_rule( - self, - network_connectivity_config_id: str, - resource_id: str, - group_id: CreatePrivateEndpointRuleRequestGroupId, + self, network_connectivity_config_id: str, resource_id: str, group_id: CreatePrivateEndpointRuleRequestGroupId ) -> NccAzurePrivateEndpointRule: """Create a private endpoint rule. @@ -7072,9 +6835,7 @@ def delete_network_connectivity_configuration(self, network_connectivity_config_ ) def delete_private_endpoint_rule( - self, - network_connectivity_config_id: str, - private_endpoint_rule_id: str, + self, network_connectivity_config_id: str, private_endpoint_rule_id: str ) -> NccAzurePrivateEndpointRule: """Delete a private endpoint rule. @@ -7127,9 +6888,7 @@ def get_network_connectivity_configuration( return NetworkConnectivityConfiguration.from_dict(res) def get_private_endpoint_rule( - self, - network_connectivity_config_id: str, - private_endpoint_rule_id: str, + self, network_connectivity_config_id: str, private_endpoint_rule_id: str ) -> NccAzurePrivateEndpointRule: """Get a private endpoint rule. @@ -7189,10 +6948,7 @@ def list_network_connectivity_configurations( query["page_token"] = json["next_page_token"] def list_private_endpoint_rules( - self, - network_connectivity_config_id: str, - *, - page_token: Optional[str] = None, + self, network_connectivity_config_id: str, *, page_token: Optional[str] = None ) -> Iterator[NccAzurePrivateEndpointRule]: """List private endpoint rules. @@ -7237,12 +6993,7 @@ class NotificationDestinationsAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - *, - config: Optional[Config] = None, - display_name: Optional[str] = None, - ) -> NotificationDestination: + def create(self, *, config: Optional[Config] = None, display_name: Optional[str] = None) -> NotificationDestination: """Create a notification destination. Creates a notification destination. Requires workspace admin permissions. @@ -7264,12 +7015,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/notification-destinations", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/notification-destinations", body=body, headers=headers) return NotificationDestination.from_dict(res) def delete(self, id: str): @@ -7286,11 +7032,7 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/notification-destinations/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/notification-destinations/{id}", headers=headers) def get(self, id: str) -> NotificationDestination: """Get a notification destination. @@ -7310,10 +7052,7 @@ def get(self, id: str) -> NotificationDestination: return NotificationDestination.from_dict(res) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ListNotificationDestinationsResult]: """List notification destinations. @@ -7335,12 +7074,7 @@ def list( } while True: - json = self._api.do( - "GET", - "/api/2.0/notification-destinations", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/notification-destinations", query=query, headers=headers) if "results" in json: for v in json["results"]: yield ListNotificationDestinationsResult.from_dict(v) @@ -7349,11 +7083,7 @@ def list( query["page_token"] = json["next_page_token"] def update( - self, - id: str, - *, - config: Optional[Config] = None, - display_name: Optional[str] = None, + self, id: str, *, config: Optional[Config] = None, display_name: Optional[str] = None ) -> NotificationDestination: """Update a notification destination. @@ -7379,12 +7109,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/notification-destinations/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/notification-destinations/{id}", body=body, headers=headers) return NotificationDestination.from_dict(res) @@ -7460,12 +7185,7 @@ def get(self, *, etag: Optional[str] = None) -> PersonalComputeSetting: ) return PersonalComputeSetting.from_dict(res) - def update( - self, - allow_missing: bool, - setting: PersonalComputeSetting, - field_mask: str, - ) -> PersonalComputeSetting: + def update(self, allow_missing: bool, setting: PersonalComputeSetting, field_mask: str) -> PersonalComputeSetting: """Update Personal Compute setting. Updates the value of the Personal Compute setting. @@ -7547,10 +7267,7 @@ def delete(self, *, etag: Optional[str] = None) -> DeleteRestrictWorkspaceAdmins } res = self._api.do( - "DELETE", - "/api/2.0/settings/types/restrict_workspace_admins/names/default", - query=query, - headers=headers, + "DELETE", "/api/2.0/settings/types/restrict_workspace_admins/names/default", query=query, headers=headers ) return DeleteRestrictWorkspaceAdminsSettingResponse.from_dict(res) @@ -7577,18 +7294,12 @@ def get(self, *, etag: Optional[str] = None) -> RestrictWorkspaceAdminsSetting: } res = self._api.do( - "GET", - "/api/2.0/settings/types/restrict_workspace_admins/names/default", - query=query, - headers=headers, + "GET", "/api/2.0/settings/types/restrict_workspace_admins/names/default", query=query, headers=headers ) return RestrictWorkspaceAdminsSetting.from_dict(res) def update( - self, - allow_missing: bool, - setting: RestrictWorkspaceAdminsSetting, - field_mask: str, + self, allow_missing: bool, setting: RestrictWorkspaceAdminsSetting, field_mask: str ) -> RestrictWorkspaceAdminsSetting: """Update the restrict workspace admins setting. @@ -7626,10 +7337,7 @@ def update( } res = self._api.do( - "PATCH", - "/api/2.0/settings/types/restrict_workspace_admins/names/default", - body=body, - headers=headers, + "PATCH", "/api/2.0/settings/types/restrict_workspace_admins/names/default", body=body, headers=headers ) return RestrictWorkspaceAdminsSetting.from_dict(res) @@ -7651,16 +7359,12 @@ def __init__(self, api_client): self._restrict_workspace_admins = RestrictWorkspaceAdminsAPI(self._api) @property - def aibi_dashboard_embedding_access_policy( - self, - ) -> AibiDashboardEmbeddingAccessPolicyAPI: + def aibi_dashboard_embedding_access_policy(self) -> AibiDashboardEmbeddingAccessPolicyAPI: """Controls whether AI/BI published dashboard embedding is enabled, conditionally enabled, or disabled at the workspace level.""" return self._aibi_dashboard_embedding_access_policy @property - def aibi_dashboard_embedding_approved_domains( - self, - ) -> AibiDashboardEmbeddingApprovedDomainsAPI: + def aibi_dashboard_embedding_approved_domains(self) -> AibiDashboardEmbeddingApprovedDomainsAPI: """Controls the list of domains approved to host the embedded AI/BI dashboards.""" return self._aibi_dashboard_embedding_approved_domains @@ -7702,18 +7406,13 @@ def restrict_workspace_admins(self) -> RestrictWorkspaceAdminsAPI: class TokenManagementAPI: """Enables administrators to get all tokens and delete tokens for other users. Admins can either get every - token, get a specific token by ID, or get all tokens for a particular user. - """ + token, get a specific token by ID, or get all tokens for a particular user.""" def __init__(self, api_client): self._api = api_client def create_obo_token( - self, - application_id: str, - *, - comment: Optional[str] = None, - lifetime_seconds: Optional[int] = None, + self, application_id: str, *, comment: Optional[str] = None, lifetime_seconds: Optional[int] = None ) -> CreateOboTokenResponse: """Create on-behalf token. @@ -7740,12 +7439,7 @@ def create_obo_token( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/token-management/on-behalf-of/tokens", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/token-management/on-behalf-of/tokens", body=body, headers=headers) return CreateOboTokenResponse.from_dict(res) def delete(self, token_id: str): @@ -7763,11 +7457,7 @@ def delete(self, token_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/token-management/tokens/{token_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/token-management/tokens/{token_id}", headers=headers) def get(self, token_id: str) -> GetTokenResponse: """Get token info. @@ -7784,11 +7474,7 @@ def get(self, token_id: str) -> GetTokenResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/token-management/tokens/{token_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/token-management/tokens/{token_id}", headers=headers) return GetTokenResponse.from_dict(res) def get_permission_levels(self) -> GetTokenPermissionLevelsResponse: @@ -7803,11 +7489,7 @@ def get_permission_levels(self) -> GetTokenPermissionLevelsResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/permissions/authorization/tokens/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/permissions/authorization/tokens/permissionLevels", headers=headers) return GetTokenPermissionLevelsResponse.from_dict(res) def get_permissions(self) -> TokenPermissions: @@ -7826,10 +7508,7 @@ def get_permissions(self) -> TokenPermissions: return TokenPermissions.from_dict(res) def list( - self, - *, - created_by_id: Optional[int] = None, - created_by_username: Optional[str] = None, + self, *, created_by_id: Optional[int] = None, created_by_username: Optional[str] = None ) -> Iterator[TokenInfo]: """List all tokens. @@ -7852,19 +7531,12 @@ def list( "Accept": "application/json", } - json = self._api.do( - "GET", - "/api/2.0/token-management/tokens", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/token-management/tokens", query=query, headers=headers) parsed = ListTokensResponse.from_dict(json).token_infos return parsed if parsed is not None else [] def set_permissions( - self, - *, - access_control_list: Optional[List[TokenAccessControlRequest]] = None, + self, *, access_control_list: Optional[List[TokenAccessControlRequest]] = None ) -> TokenPermissions: """Set token permissions. @@ -7883,18 +7555,11 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - "/api/2.0/permissions/authorization/tokens", - body=body, - headers=headers, - ) + res = self._api.do("PUT", "/api/2.0/permissions/authorization/tokens", body=body, headers=headers) return TokenPermissions.from_dict(res) def update_permissions( - self, - *, - access_control_list: Optional[List[TokenAccessControlRequest]] = None, + self, *, access_control_list: Optional[List[TokenAccessControlRequest]] = None ) -> TokenPermissions: """Update token permissions. @@ -7912,12 +7577,7 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - "/api/2.0/permissions/authorization/tokens", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", "/api/2.0/permissions/authorization/tokens", body=body, headers=headers) return TokenPermissions.from_dict(res) @@ -7928,12 +7588,7 @@ class TokensAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - *, - comment: Optional[str] = None, - lifetime_seconds: Optional[int] = None, - ) -> CreateTokenResponse: + def create(self, *, comment: Optional[str] = None, lifetime_seconds: Optional[int] = None) -> CreateTokenResponse: """Create a user token. Creates and returns a token for a user. If this call is made through token authentication, it creates diff --git a/databricks/sdk/service/sharing.py b/databricks/sdk/service/sharing.py index ca62a5a42..1deaa23c6 100755 --- a/databricks/sdk/service/sharing.py +++ b/databricks/sdk/service/sharing.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + from databricks.sdk.service import catalog # all definitions in this file are in alphabetical order @@ -207,16 +208,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateShare: """Deserializes the CreateShare from a dictionary.""" - return cls( - comment=d.get("comment", None), - name=d.get("name", None), - storage_root=d.get("storage_root", None), - ) + return cls(comment=d.get("comment", None), name=d.get("name", None), storage_root=d.get("storage_root", None)) @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -235,7 +231,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteResponse: @dataclass class GetActivationUrlInfoResponse: - def as_dict(self) -> dict: """Serializes the GetActivationUrlInfoResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -343,10 +338,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListProviderSharesResponse: """Deserializes the ListProviderSharesResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - shares=_repeated_dict(d, "shares", ProviderShare), - ) + return cls(next_page_token=d.get("next_page_token", None), shares=_repeated_dict(d, "shares", ProviderShare)) @dataclass @@ -380,8 +372,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListProvidersResponse: """Deserializes the ListProvidersResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - providers=_repeated_dict(d, "providers", ProviderInfo), + next_page_token=d.get("next_page_token", None), providers=_repeated_dict(d, "providers", ProviderInfo) ) @@ -416,8 +407,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListRecipientsResponse: """Deserializes the ListRecipientsResponse from a dictionary.""" return cls( - next_page_token=d.get("next_page_token", None), - recipients=_repeated_dict(d, "recipients", RecipientInfo), + next_page_token=d.get("next_page_token", None), recipients=_repeated_dict(d, "recipients", RecipientInfo) ) @@ -451,10 +441,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListSharesResponse: """Deserializes the ListSharesResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - shares=_repeated_dict(d, "shares", ShareInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), shares=_repeated_dict(d, "shares", ShareInfo)) @dataclass @@ -644,10 +631,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> PrivilegeAssignment: """Deserializes the PrivilegeAssignment from a dictionary.""" - return cls( - principal=d.get("principal", None), - privileges=_repeated_enum(d, "privileges", Privilege), - ) + return cls(principal=d.get("principal", None), privileges=_repeated_enum(d, "privileges", Privilege)) @dataclass @@ -1195,8 +1179,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> RotateRecipientToken: """Deserializes the RotateRecipientToken from a dictionary.""" return cls( - existing_token_expire_in_seconds=d.get("existing_token_expire_in_seconds", None), - name=d.get("name", None), + existing_token_expire_in_seconds=d.get("existing_token_expire_in_seconds", None), name=d.get("name", None) ) @@ -1490,9 +1473,7 @@ def from_dict(cls, d: Dict[str, any]) -> SharedDataObject: content=d.get("content", None), data_object_type=_enum(d, "data_object_type", SharedDataObjectDataObjectType), history_data_sharing_status=_enum( - d, - "history_data_sharing_status", - SharedDataObjectHistoryDataSharingStatus, + d, "history_data_sharing_status", SharedDataObjectHistoryDataSharingStatus ), name=d.get("name", None), partitions=_repeated_dict(d, "partitions", Partition), @@ -1577,7 +1558,6 @@ class SharedDataObjectUpdateAction(Enum): @dataclass class UpdatePermissionsResponse: - def as_dict(self) -> dict: """Serializes the UpdatePermissionsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1901,12 +1881,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/providers", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/providers", body=body, headers=headers) return ProviderInfo.from_dict(res) def delete(self, name: str): @@ -1925,11 +1900,7 @@ def delete(self, name: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/providers/{name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/providers/{name}", headers=headers) def get(self, name: str) -> ProviderInfo: """Get a provider. @@ -1994,12 +1965,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/providers", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/providers", query=query, headers=headers) if "providers" in json: for v in json["providers"]: yield ProviderInfo.from_dict(v) @@ -2008,11 +1974,7 @@ def list( query["page_token"] = json["next_page_token"] def list_shares( - self, - name: str, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, name: str, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ProviderShare]: """List shares by Provider. @@ -2048,12 +2010,7 @@ def list_shares( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - f"/api/2.1/unity-catalog/providers/{name}/shares", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.1/unity-catalog/providers/{name}/shares", query=query, headers=headers) if "shares" in json: for v in json["shares"]: yield ProviderShare.from_dict(v) @@ -2104,12 +2061,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/providers/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/providers/{name}", body=body, headers=headers) return ProviderInfo.from_dict(res) @@ -2120,8 +2072,7 @@ class RecipientActivationAPI: credential file to establish a secure connection with the provider to receive the shared data. Note that you can download the credential file only once. Recipients should treat the downloaded - credential as a secret and must not share it outside of their organization. - """ + credential as a secret and must not share it outside of their organization.""" def __init__(self, api_client): self._api = api_client @@ -2142,9 +2093,7 @@ def get_activation_url_info(self, activation_url: str): } self._api.do( - "GET", - f"/api/2.1/unity-catalog/public/data_sharing_activation_info/{activation_url}", - headers=headers, + "GET", f"/api/2.1/unity-catalog/public/data_sharing_activation_info/{activation_url}", headers=headers ) def retrieve_token(self, activation_url: str) -> RetrieveTokenResponse: @@ -2163,9 +2112,7 @@ def retrieve_token(self, activation_url: str) -> RetrieveTokenResponse: } res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/public/data_sharing_activation/{activation_url}", - headers=headers, + "GET", f"/api/2.1/unity-catalog/public/data_sharing_activation/{activation_url}", headers=headers ) return RetrieveTokenResponse.from_dict(res) @@ -2183,8 +2130,7 @@ class RecipientsAPI: - For recipients without access to a Databricks workspace that is enabled for Unity Catalog, when you create a recipient object, Databricks generates an activation link you can send to the recipient. The recipient follows the activation link to download the credential file, and then uses the credential file - to establish a secure connection to receive the shared data. This sharing mode is called **open sharing**. - """ + to establish a secure connection to receive the shared data. This sharing mode is called **open sharing**.""" def __init__(self, api_client): self._api = api_client @@ -2257,12 +2203,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.1/unity-catalog/recipients", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.1/unity-catalog/recipients", body=body, headers=headers) return RecipientInfo.from_dict(res) def delete(self, name: str): @@ -2280,11 +2221,7 @@ def delete(self, name: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.1/unity-catalog/recipients/{name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.1/unity-catalog/recipients/{name}", headers=headers) def get(self, name: str) -> RecipientInfo: """Get a share recipient. @@ -2351,12 +2288,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/recipients", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/recipients", query=query, headers=headers) if "recipients" in json: for v in json["recipients"]: yield RecipientInfo.from_dict(v) @@ -2387,20 +2319,11 @@ def rotate_token(self, name: str, existing_token_expire_in_seconds: int) -> Reci "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.1/unity-catalog/recipients/{name}/rotate-token", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.1/unity-catalog/recipients/{name}/rotate-token", body=body, headers=headers) return RecipientInfo.from_dict(res) def share_permissions( - self, - name: str, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, name: str, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> GetRecipientSharePermissionsResponse: """Get recipient share permissions. @@ -2433,10 +2356,7 @@ def share_permissions( } res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/recipients/{name}/share-permissions", - query=query, - headers=headers, + "GET", f"/api/2.1/unity-catalog/recipients/{name}/share-permissions", query=query, headers=headers ) return GetRecipientSharePermissionsResponse.from_dict(res) @@ -2494,12 +2414,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/recipients/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/recipients/{name}", body=body, headers=headers) return RecipientInfo.from_dict(res) @@ -2512,13 +2427,7 @@ class SharesAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - name: str, - *, - comment: Optional[str] = None, - storage_root: Optional[str] = None, - ) -> ShareInfo: + def create(self, name: str, *, comment: Optional[str] = None, storage_root: Optional[str] = None) -> ShareInfo: """Create a share. Creates a new share for data objects. Data objects can be added after creation with **update**. The @@ -2586,20 +2495,10 @@ def get(self, name: str, *, include_shared_data: Optional[bool] = None) -> Share "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/shares/{name}", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/shares/{name}", query=query, headers=headers) return ShareInfo.from_dict(res) - def list( - self, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, - ) -> Iterator[ShareInfo]: + def list(self, *, max_results: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[ShareInfo]: """List shares. Gets an array of data object shares from the metastore. The caller must be a metastore admin or the @@ -2631,12 +2530,7 @@ def list( if "max_results" not in query: query["max_results"] = 0 while True: - json = self._api.do( - "GET", - "/api/2.1/unity-catalog/shares", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.1/unity-catalog/shares", query=query, headers=headers) if "shares" in json: for v in json["shares"]: yield ShareInfo.from_dict(v) @@ -2645,11 +2539,7 @@ def list( query["page_token"] = json["next_page_token"] def share_permissions( - self, - name: str, - *, - max_results: Optional[int] = None, - page_token: Optional[str] = None, + self, name: str, *, max_results: Optional[int] = None, page_token: Optional[str] = None ) -> catalog.PermissionsList: """Get permissions. @@ -2681,12 +2571,7 @@ def share_permissions( "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.1/unity-catalog/shares/{name}/permissions", - query=query, - headers=headers, - ) + res = self._api.do("GET", f"/api/2.1/unity-catalog/shares/{name}/permissions", query=query, headers=headers) return catalog.PermissionsList.from_dict(res) def update( @@ -2748,12 +2633,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/shares/{name}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.1/unity-catalog/shares/{name}", body=body, headers=headers) return ShareInfo.from_dict(res) def update_permissions( @@ -2803,9 +2683,5 @@ def update_permissions( } self._api.do( - "PATCH", - f"/api/2.1/unity-catalog/shares/{name}/permissions", - query=query, - body=body, - headers=headers, + "PATCH", f"/api/2.1/unity-catalog/shares/{name}/permissions", query=query, body=body, headers=headers ) diff --git a/databricks/sdk/service/sql.py b/databricks/sdk/service/sql.py index 5fd9fb6da..80ab0907f 100755 --- a/databricks/sdk/service/sql.py +++ b/databricks/sdk/service/sql.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -665,7 +666,6 @@ def from_dict(cls, d: Dict[str, any]) -> BaseChunkInfo: @dataclass class CancelExecutionResponse: - def as_dict(self) -> dict: """Serializes the CancelExecutionResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -712,10 +712,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> Channel: """Deserializes the Channel from a dictionary.""" - return cls( - dbsql_version=d.get("dbsql_version", None), - name=_enum(d, "name", ChannelName), - ) + return cls(dbsql_version=d.get("dbsql_version", None), name=_enum(d, "name", ChannelName)) @dataclass @@ -749,10 +746,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ChannelInfo: """Deserializes the ChannelInfo from a dictionary.""" - return cls( - dbsql_version=d.get("dbsql_version", None), - name=_enum(d, "name", ChannelName), - ) + return cls(dbsql_version=d.get("dbsql_version", None), name=_enum(d, "name", ChannelName)) class ChannelName(Enum): @@ -2156,7 +2150,6 @@ class DateValueDynamicDate(Enum): @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2175,7 +2168,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteResponse: @dataclass class DeleteWarehouseResponse: - def as_dict(self) -> dict: """Serializes the DeleteWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2428,7 +2420,6 @@ class EditWarehouseRequestWarehouseType(Enum): @dataclass class EditWarehouseResponse: - def as_dict(self) -> dict: """Serializes the EditWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -3552,11 +3543,7 @@ def from_dict(cls, d: Dict[str, any]) -> GetWorkspaceWarehouseConfigResponse: global_param=_from_dict(d, "global_param", RepeatedEndpointConfPairs), google_service_account=d.get("google_service_account", None), instance_profile_arn=d.get("instance_profile_arn", None), - security_policy=_enum( - d, - "security_policy", - GetWorkspaceWarehouseConfigResponseSecurityPolicy, - ), + security_policy=_enum(d, "security_policy", GetWorkspaceWarehouseConfigResponseSecurityPolicy), sql_configuration_parameters=_from_dict(d, "sql_configuration_parameters", RepeatedEndpointConfPairs), ) @@ -3678,8 +3665,7 @@ def from_dict(cls, d: Dict[str, any]) -> LegacyAlert: class LegacyAlertState(Enum): """State of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated - and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions). - """ + and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions).""" OK = "ok" TRIGGERED = "triggered" @@ -4472,10 +4458,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListVisualizationsForQueryResponse: """Deserializes the ListVisualizationsForQueryResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - results=_repeated_dict(d, "results", Visualization), - ) + return cls(next_page_token=d.get("next_page_token", None), results=_repeated_dict(d, "results", Visualization)) @dataclass @@ -4539,11 +4522,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> MultiValuesOptions: """Deserializes the MultiValuesOptions from a dictionary.""" - return cls( - prefix=d.get("prefix", None), - separator=d.get("separator", None), - suffix=d.get("suffix", None), - ) + return cls(prefix=d.get("prefix", None), separator=d.get("separator", None), suffix=d.get("suffix", None)) @dataclass @@ -5842,7 +5821,6 @@ def from_dict(cls, d: Dict[str, any]) -> RepeatedEndpointConfPairs: @dataclass class RestoreResponse: - def as_dict(self) -> dict: """Serializes the RestoreResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6053,10 +6031,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResultSchema: """Deserializes the ResultSchema from a dictionary.""" - return cls( - column_count=d.get("column_count", None), - columns=_repeated_dict(d, "columns", ColumnInfo), - ) + return cls(column_count=d.get("column_count", None), columns=_repeated_dict(d, "columns", ColumnInfo)) class RunAsMode(Enum): @@ -6101,10 +6076,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ServiceError: """Deserializes the ServiceError from a dictionary.""" - return cls( - error_code=_enum(d, "error_code", ServiceErrorCode), - message=d.get("message", None), - ) + return cls(error_code=_enum(d, "error_code", ServiceErrorCode), message=d.get("message", None)) class ServiceErrorCode(Enum): @@ -6258,11 +6230,7 @@ def from_dict(cls, d: Dict[str, any]) -> SetWorkspaceWarehouseConfigRequest: global_param=_from_dict(d, "global_param", RepeatedEndpointConfPairs), google_service_account=d.get("google_service_account", None), instance_profile_arn=d.get("instance_profile_arn", None), - security_policy=_enum( - d, - "security_policy", - SetWorkspaceWarehouseConfigRequestSecurityPolicy, - ), + security_policy=_enum(d, "security_policy", SetWorkspaceWarehouseConfigRequestSecurityPolicy), sql_configuration_parameters=_from_dict(d, "sql_configuration_parameters", RepeatedEndpointConfPairs), ) @@ -6277,7 +6245,6 @@ class SetWorkspaceWarehouseConfigRequestSecurityPolicy(Enum): @dataclass class SetWorkspaceWarehouseConfigResponse: - def as_dict(self) -> dict: """Serializes the SetWorkspaceWarehouseConfigResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6304,7 +6271,6 @@ class SpotInstancePolicy(Enum): @dataclass class StartWarehouseResponse: - def as_dict(self) -> dict: """Serializes the StartWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6373,11 +6339,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> StatementParameterListItem: """Deserializes the StatementParameterListItem from a dictionary.""" - return cls( - name=d.get("name", None), - type=d.get("type", None), - value=d.get("value", None), - ) + return cls(name=d.get("name", None), type=d.get("type", None), value=d.get("value", None)) @dataclass @@ -6436,8 +6398,7 @@ class StatementState(Enum): `SUCCEEDED`: execution was successful, result data available for fetch - `FAILED`: execution failed; reason for failure described in accomanying error message - `CANCELED`: user canceled; can come from explicit cancel call, or timeout with `on_wait_timeout=CANCEL` - `CLOSED`: - execution successful, and statement closed; result no longer available for fetch - """ + execution successful, and statement closed; result no longer available for fetch""" CANCELED = "CANCELED" CLOSED = "CLOSED" @@ -6481,10 +6442,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> StatementStatus: """Deserializes the StatementStatus from a dictionary.""" - return cls( - error=_from_dict(d, "error", ServiceError), - state=_enum(d, "state", StatementState), - ) + return cls(error=_from_dict(d, "error", ServiceError), state=_enum(d, "state", StatementState)) class Status(Enum): @@ -6498,7 +6456,6 @@ class Status(Enum): @dataclass class StopWarehouseResponse: - def as_dict(self) -> dict: """Serializes the StopWarehouseResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -6733,10 +6690,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> TimeRange: """Deserializes the TimeRange from a dictionary.""" - return cls( - end_time_ms=d.get("end_time_ms", None), - start_time_ms=d.get("start_time_ms", None), - ) + return cls(end_time_ms=d.get("end_time_ms", None), start_time_ms=d.get("start_time_ms", None)) @dataclass @@ -7059,7 +7013,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateQueryRequestQuery: @dataclass class UpdateResponse: - def as_dict(self) -> dict: """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -7211,11 +7164,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> User: """Deserializes the User from a dictionary.""" - return cls( - email=d.get("email", None), - id=d.get("id", None), - name=d.get("name", None), - ) + return cls(email=d.get("email", None), id=d.get("id", None), name=d.get("name", None)) @dataclass @@ -7602,8 +7551,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> WarehouseTypePair: """Deserializes the WarehouseTypePair from a dictionary.""" return cls( - enabled=d.get("enabled", None), - warehouse_type=_enum(d, "warehouse_type", WarehouseTypePairWarehouseType), + enabled=d.get("enabled", None), warehouse_type=_enum(d, "warehouse_type", WarehouseTypePairWarehouseType) ) @@ -7872,10 +7820,7 @@ def get(self, id: str) -> Alert: return Alert.from_dict(res) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ListAlertsResponseAlert]: """List alerts. @@ -7906,13 +7851,7 @@ def list( return query["page_token"] = json["next_page_token"] - def update( - self, - id: str, - update_mask: str, - *, - alert: Optional[UpdateAlertRequestAlert] = None, - ) -> Alert: + def update(self, id: str, update_mask: str, *, alert: Optional[UpdateAlertRequestAlert] = None) -> Alert: """Update an alert. Updates an alert. @@ -8032,11 +7971,7 @@ def delete(self, alert_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/preview/sql/alerts/{alert_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/preview/sql/alerts/{alert_id}", headers=headers) def get(self, alert_id: str) -> LegacyAlert: """Get an alert. @@ -8080,15 +8015,7 @@ def list(self) -> Iterator[LegacyAlert]: res = self._api.do("GET", "/api/2.0/preview/sql/alerts", headers=headers) return [LegacyAlert.from_dict(v) for v in res] - def update( - self, - alert_id: str, - name: str, - options: AlertOptions, - query_id: str, - *, - rearm: Optional[int] = None, - ): + def update(self, alert_id: str, name: str, options: AlertOptions, query_id: str, *, rearm: Optional[int] = None): """Update an alert. Updates an alert. @@ -8125,12 +8052,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PUT", - f"/api/2.0/preview/sql/alerts/{alert_id}", - body=body, - headers=headers, - ) + self._api.do("PUT", f"/api/2.0/preview/sql/alerts/{alert_id}", body=body, headers=headers) class DashboardWidgetsAPI: @@ -8241,12 +8163,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/preview/sql/widgets/{id}", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/preview/sql/widgets/{id}", body=body, headers=headers) return Widget.from_dict(res) @@ -8305,12 +8222,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/preview/sql/dashboards", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/preview/sql/dashboards", body=body, headers=headers) return Dashboard.from_dict(res) def delete(self, dashboard_id: str): @@ -8328,11 +8240,7 @@ def delete(self, dashboard_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/preview/sql/dashboards/{dashboard_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", headers=headers) def get(self, dashboard_id: str) -> Dashboard: """Retrieve a definition. @@ -8348,11 +8256,7 @@ def get(self, dashboard_id: str) -> Dashboard: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/preview/sql/dashboards/{dashboard_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", headers=headers) return Dashboard.from_dict(res) def list( @@ -8399,12 +8303,7 @@ def list( seen = set() query["page"] = 1 while True: - json = self._api.do( - "GET", - "/api/2.0/preview/sql/dashboards", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/preview/sql/dashboards", query=query, headers=headers) if "results" in json: for v in json["results"]: i = v["id"] @@ -8430,11 +8329,7 @@ def restore(self, dashboard_id: str): "Accept": "application/json", } - self._api.do( - "POST", - f"/api/2.0/preview/sql/dashboards/trash/{dashboard_id}", - headers=headers, - ) + self._api.do("POST", f"/api/2.0/preview/sql/dashboards/trash/{dashboard_id}", headers=headers) def update( self, @@ -8473,12 +8368,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/preview/sql/dashboards/{dashboard_id}", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/preview/sql/dashboards/{dashboard_id}", body=body, headers=headers) return Dashboard.from_dict(res) @@ -8563,11 +8453,7 @@ def get(self, object_type: ObjectTypePlural, object_id: str) -> GetResponse: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/preview/sql/permissions/{object_type.value}/{object_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/preview/sql/permissions/{object_type.value}/{object_id}", headers=headers) return GetResponse.from_dict(res) def set( @@ -8604,19 +8490,12 @@ def set( } res = self._api.do( - "POST", - f"/api/2.0/preview/sql/permissions/{object_type.value}/{object_id}", - body=body, - headers=headers, + "POST", f"/api/2.0/preview/sql/permissions/{object_type.value}/{object_id}", body=body, headers=headers ) return SetResponse.from_dict(res) def transfer_ownership( - self, - object_type: OwnableObjectType, - object_id: TransferOwnershipObjectId, - *, - new_owner: Optional[str] = None, + self, object_type: OwnableObjectType, object_id: TransferOwnershipObjectId, *, new_owner: Optional[str] = None ) -> Success: """Transfer object ownership. @@ -8656,8 +8535,7 @@ def transfer_ownership( class QueriesAPI: """The queries API can be used to perform CRUD operations on queries. A query is a Databricks SQL object that includes the target SQL warehouse, query text, name, description, tags, and parameters. Queries can be - scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create. - """ + scheduled using the `sql_task` type of the Jobs API, e.g. :method:jobs/create.""" def __init__(self, api_client): self._api = api_client @@ -8718,10 +8596,7 @@ def get(self, id: str) -> Query: return Query.from_dict(res) def list( - self, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[ListQueryObjectsResponseQuery]: """List queries. @@ -8753,11 +8628,7 @@ def list( query["page_token"] = json["next_page_token"] def list_visualizations( - self, - id: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + self, id: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None ) -> Iterator[Visualization]: """List visualizations on a query. @@ -8780,12 +8651,7 @@ def list_visualizations( } while True: - json = self._api.do( - "GET", - f"/api/2.0/sql/queries/{id}/visualizations", - query=query, - headers=headers, - ) + json = self._api.do("GET", f"/api/2.0/sql/queries/{id}/visualizations", query=query, headers=headers) if "results" in json: for v in json["results"]: yield Visualization.from_dict(v) @@ -8793,13 +8659,7 @@ def list_visualizations( return query["page_token"] = json["next_page_token"] - def update( - self, - id: str, - update_mask: str, - *, - query: Optional[UpdateQueryRequestQuery] = None, - ) -> Query: + def update(self, id: str, update_mask: str, *, query: Optional[UpdateQueryRequestQuery] = None) -> Query: """Update a query. Updates a query. @@ -8943,11 +8803,7 @@ def delete(self, query_id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/preview/sql/queries/{query_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/preview/sql/queries/{query_id}", headers=headers) def get(self, query_id: str) -> LegacyQuery: """Get a query definition. @@ -9033,12 +8889,7 @@ def list( seen = set() query["page"] = 1 while True: - json = self._api.do( - "GET", - "/api/2.0/preview/sql/queries", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/preview/sql/queries", query=query, headers=headers) if "results" in json: for v in json["results"]: i = v["id"] @@ -9070,11 +8921,7 @@ def restore(self, query_id: str): "Accept": "application/json", } - self._api.do( - "POST", - f"/api/2.0/preview/sql/queries/trash/{query_id}", - headers=headers, - ) + self._api.do("POST", f"/api/2.0/preview/sql/queries/trash/{query_id}", headers=headers) def update( self, @@ -9142,12 +8989,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/preview/sql/queries/{query_id}", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/preview/sql/queries/{query_id}", body=body, headers=headers) return LegacyQuery.from_dict(res) @@ -9213,11 +9055,7 @@ class QueryVisualizationsAPI: def __init__(self, api_client): self._api = api_client - def create( - self, - *, - visualization: Optional[CreateVisualizationRequestVisualization] = None, - ) -> Visualization: + def create(self, *, visualization: Optional[CreateVisualizationRequestVisualization] = None) -> Visualization: """Add a visualization to a query. Adds a visualization to a query. @@ -9254,11 +9092,7 @@ def delete(self, id: str): self._api.do("DELETE", f"/api/2.0/sql/visualizations/{id}", headers=headers) def update( - self, - id: str, - update_mask: str, - *, - visualization: Optional[UpdateVisualizationRequestVisualization] = None, + self, id: str, update_mask: str, *, visualization: Optional[UpdateVisualizationRequestVisualization] = None ) -> Visualization: """Update a visualization. @@ -9289,12 +9123,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/sql/visualizations/{id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/sql/visualizations/{id}", body=body, headers=headers) return Visualization.from_dict(res) @@ -9311,13 +9140,7 @@ def __init__(self, api_client): self._api = api_client def create( - self, - query_id: str, - type: str, - options: Any, - *, - description: Optional[str] = None, - name: Optional[str] = None, + self, query_id: str, type: str, options: Any, *, description: Optional[str] = None, name: Optional[str] = None ) -> LegacyVisualization: """Add visualization to a query. @@ -9358,12 +9181,7 @@ def create( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/preview/sql/visualizations", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/preview/sql/visualizations", body=body, headers=headers) return LegacyVisualization.from_dict(res) def delete(self, id: str): @@ -9386,11 +9204,7 @@ def delete(self, id: str): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/preview/sql/visualizations/{id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/preview/sql/visualizations/{id}", headers=headers) def update( self, @@ -9450,12 +9264,7 @@ def update( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/preview/sql/visualizations/{id}", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/preview/sql/visualizations/{id}", body=body, headers=headers) return LegacyVisualization.from_dict(res) @@ -9583,11 +9392,7 @@ def cancel_execution(self, statement_id: str): headers = {} - self._api.do( - "POST", - f"/api/2.0/sql/statements/{statement_id}/cancel", - headers=headers, - ) + self._api.do("POST", f"/api/2.0/sql/statements/{statement_id}/cancel", headers=headers) def execute_statement( self, @@ -9791,26 +9596,20 @@ def get_statement_result_chunk_n(self, statement_id: str, chunk_index: int) -> R } res = self._api.do( - "GET", - f"/api/2.0/sql/statements/{statement_id}/result/chunks/{chunk_index}", - headers=headers, + "GET", f"/api/2.0/sql/statements/{statement_id}/result/chunks/{chunk_index}", headers=headers ) return ResultData.from_dict(res) class WarehousesAPI: """A SQL warehouse is a compute resource that lets you run SQL commands on data objects within Databricks - SQL. Compute resources are infrastructure resources that provide processing capabilities in the cloud. - """ + SQL. Compute resources are infrastructure resources that provide processing capabilities in the cloud.""" def __init__(self, api_client): self._api = api_client def wait_get_warehouse_running( - self, - id: str, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[GetWarehouseResponse], None]] = None, + self, id: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[GetWarehouseResponse], None]] = None ) -> GetWarehouseResponse: deadline = time.time() + timeout.total_seconds() target_states = (State.RUNNING,) @@ -9844,10 +9643,7 @@ def wait_get_warehouse_running( raise TimeoutError(f"timed out after {timeout}: {status_message}") def wait_get_warehouse_stopped( - self, - id: str, - timeout=timedelta(minutes=20), - callback: Optional[Callable[[GetWarehouseResponse], None]] = None, + self, id: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[GetWarehouseResponse], None]] = None ) -> GetWarehouseResponse: deadline = time.time() + timeout.total_seconds() target_states = (State.STOPPED,) @@ -10159,17 +9955,8 @@ def edit( "Content-Type": "application/json", } - op_response = self._api.do( - "POST", - f"/api/2.0/sql/warehouses/{id}/edit", - body=body, - headers=headers, - ) - return Wait( - self.wait_get_warehouse_running, - response=EditWarehouseResponse.from_dict(op_response), - id=id, - ) + op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/edit", body=body, headers=headers) + return Wait(self.wait_get_warehouse_running, response=EditWarehouseResponse.from_dict(op_response), id=id) def edit_and_wait( self, @@ -10240,11 +10027,7 @@ def get_permission_levels(self, warehouse_id: str) -> GetWarehousePermissionLeve "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/warehouses/{warehouse_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/warehouses/{warehouse_id}/permissionLevels", headers=headers) return GetWarehousePermissionLevelsResponse.from_dict(res) def get_permissions(self, warehouse_id: str) -> WarehousePermissions: @@ -10263,16 +10046,10 @@ def get_permissions(self, warehouse_id: str) -> WarehousePermissions: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/warehouses/{warehouse_id}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/warehouses/{warehouse_id}", headers=headers) return WarehousePermissions.from_dict(res) - def get_workspace_warehouse_config( - self, - ) -> GetWorkspaceWarehouseConfigResponse: + def get_workspace_warehouse_config(self) -> GetWorkspaceWarehouseConfigResponse: """Get the workspace configuration. Gets the workspace level configuration that is shared by all SQL warehouses in a workspace. @@ -10311,10 +10088,7 @@ def list(self, *, run_as_user_id: Optional[int] = None) -> Iterator[EndpointInfo return parsed if parsed is not None else [] def set_permissions( - self, - warehouse_id: str, - *, - access_control_list: Optional[List[WarehouseAccessControlRequest]] = None, + self, warehouse_id: str, *, access_control_list: Optional[List[WarehouseAccessControlRequest]] = None ) -> WarehousePermissions: """Set SQL warehouse permissions. @@ -10335,12 +10109,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/warehouses/{warehouse_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/warehouses/{warehouse_id}", body=body, headers=headers) return WarehousePermissions.from_dict(res) def set_workspace_warehouse_config( @@ -10429,11 +10198,7 @@ def start(self, id: str) -> Wait[GetWarehouseResponse]: } op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/start", headers=headers) - return Wait( - self.wait_get_warehouse_running, - response=StartWarehouseResponse.from_dict(op_response), - id=id, - ) + return Wait(self.wait_get_warehouse_running, response=StartWarehouseResponse.from_dict(op_response), id=id) def start_and_wait(self, id: str, timeout=timedelta(minutes=20)) -> GetWarehouseResponse: return self.start(id=id).result(timeout=timeout) @@ -10456,20 +10221,13 @@ def stop(self, id: str) -> Wait[GetWarehouseResponse]: } op_response = self._api.do("POST", f"/api/2.0/sql/warehouses/{id}/stop", headers=headers) - return Wait( - self.wait_get_warehouse_stopped, - response=StopWarehouseResponse.from_dict(op_response), - id=id, - ) + return Wait(self.wait_get_warehouse_stopped, response=StopWarehouseResponse.from_dict(op_response), id=id) def stop_and_wait(self, id: str, timeout=timedelta(minutes=20)) -> GetWarehouseResponse: return self.stop(id=id).result(timeout=timeout) def update_permissions( - self, - warehouse_id: str, - *, - access_control_list: Optional[List[WarehouseAccessControlRequest]] = None, + self, warehouse_id: str, *, access_control_list: Optional[List[WarehouseAccessControlRequest]] = None ) -> WarehousePermissions: """Update SQL warehouse permissions. @@ -10490,10 +10248,5 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/warehouses/{warehouse_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/warehouses/{warehouse_id}", body=body, headers=headers) return WarehousePermissions.from_dict(res) diff --git a/databricks/sdk/service/vectorsearch.py b/databricks/sdk/service/vectorsearch.py index 126c00fc5..f6ed8ef00 100755 --- a/databricks/sdk/service/vectorsearch.py +++ b/databricks/sdk/service/vectorsearch.py @@ -15,6 +15,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -72,10 +73,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> CreateEndpoint: """Deserializes the CreateEndpoint from a dictionary.""" - return cls( - endpoint_type=_enum(d, "endpoint_type", EndpointType), - name=d.get("name", None), - ) + return cls(endpoint_type=_enum(d, "endpoint_type", EndpointType), name=d.get("name", None)) @dataclass @@ -206,8 +204,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> DeleteDataResult: """Deserializes the DeleteDataResult from a dictionary.""" return cls( - failed_primary_keys=d.get("failed_primary_keys", None), - success_row_count=d.get("success_row_count", None), + failed_primary_keys=d.get("failed_primary_keys", None), success_row_count=d.get("success_row_count", None) ) @@ -250,10 +247,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DeleteDataVectorIndexRequest: """Deserializes the DeleteDataVectorIndexRequest from a dictionary.""" - return cls( - index_name=d.get("index_name", None), - primary_keys=d.get("primary_keys", None), - ) + return cls(index_name=d.get("index_name", None), primary_keys=d.get("primary_keys", None)) @dataclass @@ -287,15 +281,11 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> DeleteDataVectorIndexResponse: """Deserializes the DeleteDataVectorIndexResponse from a dictionary.""" - return cls( - result=_from_dict(d, "result", DeleteDataResult), - status=_enum(d, "status", DeleteDataStatus), - ) + return cls(result=_from_dict(d, "result", DeleteDataResult), status=_enum(d, "status", DeleteDataStatus)) @dataclass class DeleteEndpointResponse: - def as_dict(self) -> dict: """Serializes the DeleteEndpointResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -314,7 +304,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteEndpointResponse: @dataclass class DeleteIndexResponse: - def as_dict(self) -> dict: """Serializes the DeleteIndexResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -556,10 +545,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EmbeddingSourceColumn: """Deserializes the EmbeddingSourceColumn from a dictionary.""" - return cls( - embedding_model_endpoint_name=d.get("embedding_model_endpoint_name", None), - name=d.get("name", None), - ) + return cls(embedding_model_endpoint_name=d.get("embedding_model_endpoint_name", None), name=d.get("name", None)) @dataclass @@ -591,10 +577,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EmbeddingVectorColumn: """Deserializes the EmbeddingVectorColumn from a dictionary.""" - return cls( - embedding_dimension=d.get("embedding_dimension", None), - name=d.get("name", None), - ) + return cls(embedding_dimension=d.get("embedding_dimension", None), name=d.get("name", None)) @dataclass @@ -719,10 +702,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> EndpointStatus: """Deserializes the EndpointStatus from a dictionary.""" - return cls( - message=d.get("message", None), - state=_enum(d, "state", EndpointStatusState), - ) + return cls(message=d.get("message", None), state=_enum(d, "state", EndpointStatusState)) class EndpointStatusState(Enum): @@ -770,8 +750,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> ListEndpointResponse: """Deserializes the ListEndpointResponse from a dictionary.""" return cls( - endpoints=_repeated_dict(d, "endpoints", EndpointInfo), - next_page_token=d.get("next_page_token", None), + endpoints=_repeated_dict(d, "endpoints", EndpointInfo), next_page_token=d.get("next_page_token", None) ) @@ -1154,10 +1133,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResultData: """Deserializes the ResultData from a dictionary.""" - return cls( - data_array=d.get("data_array", None), - row_count=d.get("row_count", None), - ) + return cls(data_array=d.get("data_array", None), row_count=d.get("row_count", None)) @dataclass @@ -1191,10 +1167,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ResultManifest: """Deserializes the ResultManifest from a dictionary.""" - return cls( - column_count=d.get("column_count", None), - columns=_repeated_dict(d, "columns", ColumnInfo), - ) + return cls(column_count=d.get("column_count", None), columns=_repeated_dict(d, "columns", ColumnInfo)) @dataclass @@ -1273,10 +1246,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ScanVectorIndexResponse: """Deserializes the ScanVectorIndexResponse from a dictionary.""" - return cls( - data=_repeated_dict(d, "data", Struct), - last_primary_key=d.get("last_primary_key", None), - ) + return cls(data=_repeated_dict(d, "data", Struct), last_primary_key=d.get("last_primary_key", None)) @dataclass @@ -1306,7 +1276,6 @@ def from_dict(cls, d: Dict[str, any]) -> Struct: @dataclass class SyncIndexResponse: - def as_dict(self) -> dict: """Serializes the SyncIndexResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1355,8 +1324,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> UpsertDataResult: """Deserializes the UpsertDataResult from a dictionary.""" return cls( - failed_primary_keys=d.get("failed_primary_keys", None), - success_row_count=d.get("success_row_count", None), + failed_primary_keys=d.get("failed_primary_keys", None), success_row_count=d.get("success_row_count", None) ) @@ -1399,10 +1367,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpsertDataVectorIndexRequest: """Deserializes the UpsertDataVectorIndexRequest from a dictionary.""" - return cls( - index_name=d.get("index_name", None), - inputs_json=d.get("inputs_json", None), - ) + return cls(index_name=d.get("index_name", None), inputs_json=d.get("inputs_json", None)) @dataclass @@ -1436,10 +1401,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> UpsertDataVectorIndexResponse: """Deserializes the UpsertDataVectorIndexResponse from a dictionary.""" - return cls( - result=_from_dict(d, "result", UpsertDataResult), - status=_enum(d, "status", UpsertDataStatus), - ) + return cls(result=_from_dict(d, "result", UpsertDataResult), status=_enum(d, "status", UpsertDataStatus)) @dataclass @@ -1715,12 +1677,7 @@ def create_endpoint(self, name: str, endpoint_type: EndpointType) -> Wait[Endpoi "Content-Type": "application/json", } - op_response = self._api.do( - "POST", - "/api/2.0/vector-search/endpoints", - body=body, - headers=headers, - ) + op_response = self._api.do("POST", "/api/2.0/vector-search/endpoints", body=body, headers=headers) return Wait( self.wait_get_endpoint_vector_search_endpoint_online, response=EndpointInfo.from_dict(op_response), @@ -1728,10 +1685,7 @@ def create_endpoint(self, name: str, endpoint_type: EndpointType) -> Wait[Endpoi ) def create_endpoint_and_wait( - self, - name: str, - endpoint_type: EndpointType, - timeout=timedelta(minutes=20), + self, name: str, endpoint_type: EndpointType, timeout=timedelta(minutes=20) ) -> EndpointInfo: return self.create_endpoint(endpoint_type=endpoint_type, name=name).result(timeout=timeout) @@ -1746,11 +1700,7 @@ def delete_endpoint(self, endpoint_name: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/vector-search/endpoints/{endpoint_name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers) def get_endpoint(self, endpoint_name: str) -> EndpointInfo: """Get an endpoint. @@ -1765,11 +1715,7 @@ def get_endpoint(self, endpoint_name: str) -> EndpointInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/vector-search/endpoints/{endpoint_name}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers) return EndpointInfo.from_dict(res) def list_endpoints(self, *, page_token: Optional[str] = None) -> Iterator[EndpointInfo]: @@ -1789,12 +1735,7 @@ def list_endpoints(self, *, page_token: Optional[str] = None) -> Iterator[Endpoi } while True: - json = self._api.do( - "GET", - "/api/2.0/vector-search/endpoints", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/vector-search/endpoints", query=query, headers=headers) if "endpoints" in json: for v in json["endpoints"]: yield EndpointInfo.from_dict(v) @@ -1810,8 +1751,7 @@ class VectorSearchIndexesAPI: There are 2 types of Vector Search indexes: * **Delta Sync Index**: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes. * **Direct Vector Access Index**: An index that supports direct read and write of - vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates. - """ + vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates.""" def __init__(self, api_client): self._api = api_client @@ -1868,12 +1808,7 @@ def create_index( "Content-Type": "application/json", } - res = self._api.do( - "POST", - "/api/2.0/vector-search/indexes", - body=body, - headers=headers, - ) + res = self._api.do("POST", "/api/2.0/vector-search/indexes", body=body, headers=headers) return CreateVectorIndexResponse.from_dict(res) def delete_data_vector_index(self, index_name: str, primary_keys: List[str]) -> DeleteDataVectorIndexResponse: @@ -1897,10 +1832,7 @@ def delete_data_vector_index(self, index_name: str, primary_keys: List[str]) -> } res = self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/delete-data", - body=body, - headers=headers, + "POST", f"/api/2.0/vector-search/indexes/{index_name}/delete-data", body=body, headers=headers ) return DeleteDataVectorIndexResponse.from_dict(res) @@ -1917,11 +1849,7 @@ def delete_index(self, index_name: str): headers = {} - self._api.do( - "DELETE", - f"/api/2.0/vector-search/indexes/{index_name}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/vector-search/indexes/{index_name}", headers=headers) def get_index(self, index_name: str) -> VectorIndex: """Get an index. @@ -1938,11 +1866,7 @@ def get_index(self, index_name: str) -> VectorIndex: "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/vector-search/indexes/{index_name}", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/vector-search/indexes/{index_name}", headers=headers) return VectorIndex.from_dict(res) def list_indexes(self, endpoint_name: str, *, page_token: Optional[str] = None) -> Iterator[MiniVectorIndex]: @@ -1968,12 +1892,7 @@ def list_indexes(self, endpoint_name: str, *, page_token: Optional[str] = None) } while True: - json = self._api.do( - "GET", - "/api/2.0/vector-search/indexes", - query=query, - headers=headers, - ) + json = self._api.do("GET", "/api/2.0/vector-search/indexes", query=query, headers=headers) if "vector_indexes" in json: for v in json["vector_indexes"]: yield MiniVectorIndex.from_dict(v) @@ -2041,20 +1960,11 @@ def query_index( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/query", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/query", body=body, headers=headers) return QueryVectorIndexResponse.from_dict(res) def query_next_page( - self, - index_name: str, - *, - endpoint_name: Optional[str] = None, - page_token: Optional[str] = None, + self, index_name: str, *, endpoint_name: Optional[str] = None, page_token: Optional[str] = None ) -> QueryVectorIndexResponse: """Query next page. @@ -2081,19 +1991,12 @@ def query_next_page( } res = self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/query-next-page", - body=body, - headers=headers, + "POST", f"/api/2.0/vector-search/indexes/{index_name}/query-next-page", body=body, headers=headers ) return QueryVectorIndexResponse.from_dict(res) def scan_index( - self, - index_name: str, - *, - last_primary_key: Optional[str] = None, - num_results: Optional[int] = None, + self, index_name: str, *, last_primary_key: Optional[str] = None, num_results: Optional[int] = None ) -> ScanVectorIndexResponse: """Scan an index. @@ -2119,12 +2022,7 @@ def scan_index( "Content-Type": "application/json", } - res = self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/scan", - body=body, - headers=headers, - ) + res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/scan", body=body, headers=headers) return ScanVectorIndexResponse.from_dict(res) def sync_index(self, index_name: str): @@ -2140,11 +2038,7 @@ def sync_index(self, index_name: str): headers = {} - self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/sync", - headers=headers, - ) + self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/sync", headers=headers) def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertDataVectorIndexResponse: """Upsert data into an index. @@ -2167,9 +2061,6 @@ def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertD } res = self._api.do( - "POST", - f"/api/2.0/vector-search/indexes/{index_name}/upsert-data", - body=body, - headers=headers, + "POST", f"/api/2.0/vector-search/indexes/{index_name}/upsert-data", body=body, headers=headers ) return UpsertDataVectorIndexResponse.from_dict(res) diff --git a/databricks/sdk/service/workspace.py b/databricks/sdk/service/workspace.py index 92cb563f2..957238a66 100755 --- a/databricks/sdk/service/workspace.py +++ b/databricks/sdk/service/workspace.py @@ -11,6 +11,7 @@ _LOG = logging.getLogger("databricks.sdk") + # all definitions in this file are in alphabetical order @@ -43,10 +44,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AclItem: """Deserializes the AclItem from a dictionary.""" - return cls( - permission=_enum(d, "permission", AclPermission), - principal=d.get("principal", None), - ) + return cls(permission=_enum(d, "permission", AclPermission), principal=d.get("principal", None)) class AclPermission(Enum): @@ -85,10 +83,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> AzureKeyVaultSecretScopeMetadata: """Deserializes the AzureKeyVaultSecretScopeMetadata from a dictionary.""" - return cls( - dns_name=d.get("dns_name", None), - resource_id=d.get("resource_id", None), - ) + return cls(dns_name=d.get("dns_name", None), resource_id=d.get("resource_id", None)) @dataclass @@ -370,7 +365,6 @@ def from_dict(cls, d: Dict[str, any]) -> CreateScope: @dataclass class CreateScopeResponse: - def as_dict(self) -> dict: """Serializes the CreateScopeResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -499,7 +493,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteAcl: @dataclass class DeleteAclResponse: - def as_dict(self) -> dict: """Serializes the DeleteAclResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -518,7 +511,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteAclResponse: @dataclass class DeleteCredentialsResponse: - def as_dict(self) -> dict: """Serializes the DeleteCredentialsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -537,7 +529,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteCredentialsResponse: @dataclass class DeleteRepoResponse: - def as_dict(self) -> dict: """Serializes the DeleteRepoResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -556,7 +547,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteRepoResponse: @dataclass class DeleteResponse: - def as_dict(self) -> dict: """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -600,7 +590,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteScope: @dataclass class DeleteScopeResponse: - def as_dict(self) -> dict: """Serializes the DeleteScopeResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -651,7 +640,6 @@ def from_dict(cls, d: Dict[str, any]) -> DeleteSecret: @dataclass class DeleteSecretResponse: - def as_dict(self) -> dict: """Serializes the DeleteSecretResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1010,7 +998,6 @@ class ImportFormat(Enum): @dataclass class ImportResponse: - def as_dict(self) -> dict: """Serializes the ImportResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1116,10 +1103,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> ListReposResponse: """Deserializes the ListReposResponse from a dictionary.""" - return cls( - next_page_token=d.get("next_page_token", None), - repos=_repeated_dict(d, "repos", RepoInfo), - ) + return cls(next_page_token=d.get("next_page_token", None), repos=_repeated_dict(d, "repos", RepoInfo)) @dataclass @@ -1225,7 +1209,6 @@ def from_dict(cls, d: Dict[str, any]) -> Mkdirs: @dataclass class MkdirsResponse: - def as_dict(self) -> dict: """Serializes the MkdirsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1389,7 +1372,6 @@ def from_dict(cls, d: Dict[str, any]) -> PutAcl: @dataclass class PutAclResponse: - def as_dict(self) -> dict: """Serializes the PutAclResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1459,7 +1441,6 @@ def from_dict(cls, d: Dict[str, any]) -> PutSecret: @dataclass class PutSecretResponse: - def as_dict(self) -> dict: """Serializes the PutSecretResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -1782,8 +1763,7 @@ def as_shallow_dict(self) -> dict: def from_dict(cls, d: Dict[str, any]) -> RepoPermissionsDescription: """Deserializes the RepoPermissionsDescription from a dictionary.""" return cls( - description=d.get("description", None), - permission_level=_enum(d, "permission_level", RepoPermissionLevel), + description=d.get("description", None), permission_level=_enum(d, "permission_level", RepoPermissionLevel) ) @@ -1856,10 +1836,7 @@ def as_shallow_dict(self) -> dict: @classmethod def from_dict(cls, d: Dict[str, any]) -> SecretMetadata: """Deserializes the SecretMetadata from a dictionary.""" - return cls( - key=d.get("key", None), - last_updated_timestamp=d.get("last_updated_timestamp", None), - ) + return cls(key=d.get("key", None), last_updated_timestamp=d.get("last_updated_timestamp", None)) @dataclass @@ -2025,7 +2002,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateCredentialsRequest: @dataclass class UpdateCredentialsResponse: - def as_dict(self) -> dict: """Serializes the UpdateCredentialsResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2098,7 +2074,6 @@ def from_dict(cls, d: Dict[str, any]) -> UpdateRepoRequest: @dataclass class UpdateRepoResponse: - def as_dict(self) -> dict: """Serializes the UpdateRepoResponse into a dictionary suitable for use as a JSON request body.""" body = {} @@ -2396,18 +2371,13 @@ class GitCredentialsAPI: See [more info]. - [more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html - """ + [more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html""" def __init__(self, api_client): self._api = api_client def create( - self, - git_provider: str, - *, - git_username: Optional[str] = None, - personal_access_token: Optional[str] = None, + self, git_provider: str, *, git_username: Optional[str] = None, personal_access_token: Optional[str] = None ) -> CreateCredentialsResponse: """Create a credential entry. @@ -2463,11 +2433,7 @@ def delete(self, credential_id: int): "Accept": "application/json", } - self._api.do( - "DELETE", - f"/api/2.0/git-credentials/{credential_id}", - headers=headers, - ) + self._api.do("DELETE", f"/api/2.0/git-credentials/{credential_id}", headers=headers) def get(self, credential_id: int) -> GetCredentialsResponse: """Get a credential entry. @@ -2547,12 +2513,7 @@ def update( "Content-Type": "application/json", } - self._api.do( - "PATCH", - f"/api/2.0/git-credentials/{credential_id}", - body=body, - headers=headers, - ) + self._api.do("PATCH", f"/api/2.0/git-credentials/{credential_id}", body=body, headers=headers) class ReposAPI: @@ -2564,19 +2525,13 @@ class ReposAPI: committing. Within Repos you can develop code in notebooks or other files and follow data science and engineering code - development best practices using Git for version control, collaboration, and CI/CD. - """ + development best practices using Git for version control, collaboration, and CI/CD.""" def __init__(self, api_client): self._api = api_client def create( - self, - url: str, - provider: str, - *, - path: Optional[str] = None, - sparse_checkout: Optional[SparseCheckout] = None, + self, url: str, provider: str, *, path: Optional[str] = None, sparse_checkout: Optional[SparseCheckout] = None ) -> CreateRepoResponse: """Create a repo. @@ -2665,11 +2620,7 @@ def get_permission_levels(self, repo_id: str) -> GetRepoPermissionLevelsResponse "Accept": "application/json", } - res = self._api.do( - "GET", - f"/api/2.0/permissions/repos/{repo_id}/permissionLevels", - headers=headers, - ) + res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}/permissionLevels", headers=headers) return GetRepoPermissionLevelsResponse.from_dict(res) def get_permissions(self, repo_id: str) -> RepoPermissions: @@ -2690,12 +2641,7 @@ def get_permissions(self, repo_id: str) -> RepoPermissions: res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}", headers=headers) return RepoPermissions.from_dict(res) - def list( - self, - *, - next_page_token: Optional[str] = None, - path_prefix: Optional[str] = None, - ) -> Iterator[RepoInfo]: + def list(self, *, next_page_token: Optional[str] = None, path_prefix: Optional[str] = None) -> Iterator[RepoInfo]: """Get repos. Returns repos that the calling user has Manage permissions on. Use `next_page_token` to iterate @@ -2731,10 +2677,7 @@ def list( query["next_page_token"] = json["next_page_token"] def set_permissions( - self, - repo_id: str, - *, - access_control_list: Optional[List[RepoAccessControlRequest]] = None, + self, repo_id: str, *, access_control_list: Optional[List[RepoAccessControlRequest]] = None ) -> RepoPermissions: """Set repo permissions. @@ -2755,12 +2698,7 @@ def set_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PUT", - f"/api/2.0/permissions/repos/{repo_id}", - body=body, - headers=headers, - ) + res = self._api.do("PUT", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers) return RepoPermissions.from_dict(res) def update( @@ -2805,10 +2743,7 @@ def update( self._api.do("PATCH", f"/api/2.0/repos/{repo_id}", body=body, headers=headers) def update_permissions( - self, - repo_id: str, - *, - access_control_list: Optional[List[RepoAccessControlRequest]] = None, + self, repo_id: str, *, access_control_list: Optional[List[RepoAccessControlRequest]] = None ) -> RepoPermissions: """Update repo permissions. @@ -2828,12 +2763,7 @@ def update_permissions( "Content-Type": "application/json", } - res = self._api.do( - "PATCH", - f"/api/2.0/permissions/repos/{repo_id}", - body=body, - headers=headers, - ) + res = self._api.do("PATCH", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers) return RepoPermissions.from_dict(res) @@ -2889,12 +2819,7 @@ def create_scope( "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/secrets/scopes/create", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/secrets/scopes/create", body=body, headers=headers) def delete_acl(self, scope: str, principal: str): """Delete an ACL. @@ -2945,12 +2870,7 @@ def delete_scope(self, scope: str): "Content-Type": "application/json", } - self._api.do( - "POST", - "/api/2.0/secrets/scopes/delete", - body=body, - headers=headers, - ) + self._api.do("POST", "/api/2.0/secrets/scopes/delete", body=body, headers=headers) def delete_secret(self, scope: str, key: str): """Delete a secret. @@ -3164,12 +3084,7 @@ def put_acl(self, scope: str, principal: str, permission: AclPermission): self._api.do("POST", "/api/2.0/secrets/acls/put", body=body, headers=headers) def put_secret( - self, - scope: str, - key: str, - *, - bytes_value: Optional[str] = None, - string_value: Optional[str] = None, + self, scope: str, key: str, *, bytes_value: Optional[str] = None, string_value: Optional[str] = None ): """Add a secret. @@ -3342,9 +3257,7 @@ def get_permissions(self, workspace_object_type: str, workspace_object_id: str) } res = self._api.do( - "GET", - f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", - headers=headers, + "GET", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", headers=headers ) return WorkspaceObjectPermissions.from_dict(res) @@ -3367,12 +3280,7 @@ def get_status(self, path: str) -> ObjectInfo: "Accept": "application/json", } - res = self._api.do( - "GET", - "/api/2.0/workspace/get-status", - query=query, - headers=headers, - ) + res = self._api.do("GET", "/api/2.0/workspace/get-status", query=query, headers=headers) return ObjectInfo.from_dict(res) def import_( @@ -3520,10 +3428,7 @@ def set_permissions( } res = self._api.do( - "PUT", - f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", - body=body, - headers=headers, + "PUT", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", body=body, headers=headers ) return WorkspaceObjectPermissions.from_dict(res) @@ -3556,9 +3461,6 @@ def update_permissions( } res = self._api.do( - "PATCH", - f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", - body=body, - headers=headers, + "PATCH", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", body=body, headers=headers ) return WorkspaceObjectPermissions.from_dict(res) diff --git a/tests/test_core.py b/tests/test_core.py index 7377bf2d7..cc8ed921d 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -284,7 +284,7 @@ def test_config_parsing_non_string_env_vars(monkeypatch): def test_access_control_list(config, requests_mock): requests_mock.post( - "http://localhost/api/2.1/jobs/create", + "http://localhost/api/2.2/jobs/create", request_headers={"User-Agent": config.user_agent}, ) diff --git a/tests/test_jobs.py b/tests/test_jobs.py deleted file mode 100644 index 5b8f5f182..000000000 --- a/tests/test_jobs.py +++ /dev/null @@ -1,106 +0,0 @@ -from databricks.sdk import WorkspaceClient - - -# Test cases below are checking that we pinned API 2.1 for certain endpoints, DO NOT REMOVE OR CHANGE THEM. https://databricks.atlassian.net/browse/JOBS-19298 -def test_jobs_create(config, requests_mock): - requests_mock.post( - "http://localhost/api/2.1/jobs/create", - request_headers={ - "Accept": "application/json", - "Content-Type": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - w.jobs.create() - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -def test_jobs_update(config, requests_mock): - requests_mock.post( - "http://localhost/api/2.1/jobs/update", - request_headers={ - "Accept": "application/json", - "Content-Type": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - w.jobs.update(job_id="job_id") - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -def test_jobs_list(config, requests_mock): - requests_mock.get( - "http://localhost/api/2.1/jobs/list", - request_headers={ - "Accept": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - for _ in w.jobs.list(): - pass - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -def test_jobs_get(config, requests_mock): - requests_mock.get( - "http://localhost/api/2.1/jobs/get", - request_headers={ - "Accept": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - w.jobs.get(job_id="job_id") - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -def test_jobs_reset(config, requests_mock): - requests_mock.post( - "http://localhost/api/2.1/jobs/reset", - request_headers={ - "Accept": "application/json", - "Content-Type": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - w.jobs.reset(job_id="job_id", new_settings=None) - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -def test_jobs_runs_list(config, requests_mock): - requests_mock.get( - "http://localhost/api/2.1/jobs/runs/list", - request_headers={ - "Accept": "application/json", - }, - text="null", - ) - - w = WorkspaceClient(config=config) - for _ in w.jobs.list_runs(job_id="job_id"): - pass - - assert requests_mock.call_count == 1 - assert requests_mock.called - - -# End of test cases for API 2.1 pinning