databricks-sdk 0.55.0__py3-none-any.whl → 0.57.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of databricks-sdk might be problematic. Click here for more details.

Files changed (31) hide show
  1. databricks/sdk/__init__.py +41 -24
  2. databricks/sdk/service/aibuilder.py +505 -0
  3. databricks/sdk/service/apps.py +14 -42
  4. databricks/sdk/service/billing.py +167 -220
  5. databricks/sdk/service/catalog.py +462 -1235
  6. databricks/sdk/service/cleanrooms.py +26 -43
  7. databricks/sdk/service/compute.py +75 -211
  8. databricks/sdk/service/dashboards.py +77 -511
  9. databricks/sdk/service/database.py +1271 -0
  10. databricks/sdk/service/files.py +20 -54
  11. databricks/sdk/service/iam.py +61 -171
  12. databricks/sdk/service/jobs.py +453 -68
  13. databricks/sdk/service/marketplace.py +46 -146
  14. databricks/sdk/service/ml.py +453 -477
  15. databricks/sdk/service/oauth2.py +17 -45
  16. databricks/sdk/service/pipelines.py +125 -40
  17. databricks/sdk/service/provisioning.py +30 -93
  18. databricks/sdk/service/qualitymonitorv2.py +265 -0
  19. databricks/sdk/service/serving.py +106 -46
  20. databricks/sdk/service/settings.py +1062 -390
  21. databricks/sdk/service/sharing.py +33 -88
  22. databricks/sdk/service/sql.py +292 -185
  23. databricks/sdk/service/vectorsearch.py +13 -43
  24. databricks/sdk/service/workspace.py +35 -105
  25. databricks/sdk/version.py +1 -1
  26. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/METADATA +1 -1
  27. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/RECORD +31 -28
  28. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/WHEEL +0 -0
  29. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/licenses/LICENSE +0 -0
  30. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/licenses/NOTICE +0 -0
  31. {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/top_level.txt +0 -0
@@ -779,9 +779,6 @@ class Credential:
779
779
  )
780
780
 
781
781
 
782
- CustomTags = Dict[str, str]
783
-
784
-
785
782
  @dataclass
786
783
  class CustomerFacingGcpCloudResourceContainer:
787
784
  """The general workspace configurations that are specific to Google Cloud."""
@@ -2329,9 +2326,7 @@ class CredentialsAPI:
2329
2326
  self._api = api_client
2330
2327
 
2331
2328
  def create(self, credentials_name: str, aws_credentials: CreateCredentialAwsCredentials) -> Credential:
2332
- """Create credential configuration.
2333
-
2334
- Creates a Databricks credential configuration that represents cloud cross-account credentials for a
2329
+ """Creates a Databricks credential configuration that represents cloud cross-account credentials for a
2335
2330
  specified account. Databricks uses this to set up network infrastructure properly to host Databricks
2336
2331
  clusters. For your AWS IAM role, you need to trust the External ID (the Databricks Account API account
2337
2332
  ID) in the returned credential object, and configure the required access policy.
@@ -2364,9 +2359,7 @@ class CredentialsAPI:
2364
2359
  return Credential.from_dict(res)
2365
2360
 
2366
2361
  def delete(self, credentials_id: str):
2367
- """Delete credential configuration.
2368
-
2369
- Deletes a Databricks credential configuration object for an account, both specified by ID. You cannot
2362
+ """Deletes a Databricks credential configuration object for an account, both specified by ID. You cannot
2370
2363
  delete a credential that is associated with any workspace.
2371
2364
 
2372
2365
  :param credentials_id: str
@@ -2384,9 +2377,7 @@ class CredentialsAPI:
2384
2377
  )
2385
2378
 
2386
2379
  def get(self, credentials_id: str) -> Credential:
2387
- """Get credential configuration.
2388
-
2389
- Gets a Databricks credential configuration object for an account, both specified by ID.
2380
+ """Gets a Databricks credential configuration object for an account, both specified by ID.
2390
2381
 
2391
2382
  :param credentials_id: str
2392
2383
  Databricks Account API credential configuration ID
@@ -2404,9 +2395,7 @@ class CredentialsAPI:
2404
2395
  return Credential.from_dict(res)
2405
2396
 
2406
2397
  def list(self) -> Iterator[Credential]:
2407
- """Get all credential configurations.
2408
-
2409
- Gets all Databricks credential configurations associated with an account specified by ID.
2398
+ """Gets all Databricks credential configurations associated with an account specified by ID.
2410
2399
 
2411
2400
  :returns: Iterator over :class:`Credential`
2412
2401
  """
@@ -2444,9 +2433,7 @@ class EncryptionKeysAPI:
2444
2433
  aws_key_info: Optional[CreateAwsKeyInfo] = None,
2445
2434
  gcp_key_info: Optional[CreateGcpKeyInfo] = None,
2446
2435
  ) -> CustomerManagedKey:
2447
- """Create encryption key configuration.
2448
-
2449
- Creates a customer-managed key configuration object for an account, specified by ID. This operation
2436
+ """Creates a customer-managed key configuration object for an account, specified by ID. This operation
2450
2437
  uploads a reference to a customer-managed key to Databricks. If the key is assigned as a workspace's
2451
2438
  customer-managed key for managed services, Databricks uses the key to encrypt the workspaces notebooks
2452
2439
  and secrets in the control plane, in addition to Databricks SQL queries and query history. If it is
@@ -2485,9 +2472,7 @@ class EncryptionKeysAPI:
2485
2472
  return CustomerManagedKey.from_dict(res)
2486
2473
 
2487
2474
  def delete(self, customer_managed_key_id: str):
2488
- """Delete encryption key configuration.
2489
-
2490
- Deletes a customer-managed key configuration object for an account. You cannot delete a configuration
2475
+ """Deletes a customer-managed key configuration object for an account. You cannot delete a configuration
2491
2476
  that is associated with a running workspace.
2492
2477
 
2493
2478
  :param customer_managed_key_id: str
@@ -2507,9 +2492,7 @@ class EncryptionKeysAPI:
2507
2492
  )
2508
2493
 
2509
2494
  def get(self, customer_managed_key_id: str) -> CustomerManagedKey:
2510
- """Get encryption key configuration.
2511
-
2512
- Gets a customer-managed key configuration object for an account, specified by ID. This operation
2495
+ """Gets a customer-managed key configuration object for an account, specified by ID. This operation
2513
2496
  uploads a reference to a customer-managed key to Databricks. If assigned as a workspace's
2514
2497
  customer-managed key for managed services, Databricks uses the key to encrypt the workspaces notebooks
2515
2498
  and secrets in the control plane, in addition to Databricks SQL queries and query history. If it is
@@ -2540,9 +2523,7 @@ class EncryptionKeysAPI:
2540
2523
  return CustomerManagedKey.from_dict(res)
2541
2524
 
2542
2525
  def list(self) -> Iterator[CustomerManagedKey]:
2543
- """Get all encryption key configurations.
2544
-
2545
- Gets all customer-managed key configuration objects for an account. If the key is specified as a
2526
+ """Gets all customer-managed key configuration objects for an account. If the key is specified as a
2546
2527
  workspace's managed services customer-managed key, Databricks uses the key to encrypt the workspace's
2547
2528
  notebooks and secrets in the control plane, in addition to Databricks SQL queries and query history.
2548
2529
  If the key is specified as a workspace's storage customer-managed key, the key is used to encrypt the
@@ -2581,9 +2562,7 @@ class NetworksAPI:
2581
2562
  vpc_endpoints: Optional[NetworkVpcEndpoints] = None,
2582
2563
  vpc_id: Optional[str] = None,
2583
2564
  ) -> Network:
2584
- """Create network configuration.
2585
-
2586
- Creates a Databricks network configuration that represents an VPC and its resources. The VPC will be
2565
+ """Creates a Databricks network configuration that represents an VPC and its resources. The VPC will be
2587
2566
  used for new Databricks clusters. This requires a pre-existing VPC and subnets.
2588
2567
 
2589
2568
  :param network_name: str
@@ -2630,9 +2609,7 @@ class NetworksAPI:
2630
2609
  return Network.from_dict(res)
2631
2610
 
2632
2611
  def delete(self, network_id: str):
2633
- """Delete a network configuration.
2634
-
2635
- Deletes a Databricks network configuration, which represents a cloud VPC and its resources. You cannot
2612
+ """Deletes a Databricks network configuration, which represents a cloud VPC and its resources. You cannot
2636
2613
  delete a network that is associated with a workspace.
2637
2614
 
2638
2615
  This operation is available only if your account is on the E2 version of the platform.
@@ -2650,9 +2627,7 @@ class NetworksAPI:
2650
2627
  self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/networks/{network_id}", headers=headers)
2651
2628
 
2652
2629
  def get(self, network_id: str) -> Network:
2653
- """Get a network configuration.
2654
-
2655
- Gets a Databricks network configuration, which represents a cloud VPC and its resources.
2630
+ """Gets a Databricks network configuration, which represents a cloud VPC and its resources.
2656
2631
 
2657
2632
  :param network_id: str
2658
2633
  Databricks Account API network configuration ID.
@@ -2668,9 +2643,7 @@ class NetworksAPI:
2668
2643
  return Network.from_dict(res)
2669
2644
 
2670
2645
  def list(self) -> Iterator[Network]:
2671
- """Get all network configurations.
2672
-
2673
- Gets a list of all Databricks network configurations for an account, specified by ID.
2646
+ """Gets a list of all Databricks network configurations for an account, specified by ID.
2674
2647
 
2675
2648
  This operation is available only if your account is on the E2 version of the platform.
2676
2649
 
@@ -2700,9 +2673,7 @@ class PrivateAccessAPI:
2700
2673
  private_access_level: Optional[PrivateAccessLevel] = None,
2701
2674
  public_access_enabled: Optional[bool] = None,
2702
2675
  ) -> PrivateAccessSettings:
2703
- """Create private access settings.
2704
-
2705
- Creates a private access settings object, which specifies how your workspace is accessed over [AWS
2676
+ """Creates a private access settings object, which specifies how your workspace is accessed over [AWS
2706
2677
  PrivateLink]. To use AWS PrivateLink, a workspace must have a private access settings object
2707
2678
  referenced by ID in the workspace's `private_access_settings_id` property.
2708
2679
 
@@ -2767,9 +2738,7 @@ class PrivateAccessAPI:
2767
2738
  return PrivateAccessSettings.from_dict(res)
2768
2739
 
2769
2740
  def delete(self, private_access_settings_id: str):
2770
- """Delete a private access settings object.
2771
-
2772
- Deletes a private access settings object, which determines how your workspace is accessed over [AWS
2741
+ """Deletes a private access settings object, which determines how your workspace is accessed over [AWS
2773
2742
  PrivateLink].
2774
2743
 
2775
2744
  Before configuring PrivateLink, read the [Databricks article about PrivateLink].",
@@ -2794,9 +2763,7 @@ class PrivateAccessAPI:
2794
2763
  )
2795
2764
 
2796
2765
  def get(self, private_access_settings_id: str) -> PrivateAccessSettings:
2797
- """Get a private access settings object.
2798
-
2799
- Gets a private access settings object, which specifies how your workspace is accessed over [AWS
2766
+ """Gets a private access settings object, which specifies how your workspace is accessed over [AWS
2800
2767
  PrivateLink].
2801
2768
 
2802
2769
  Before configuring PrivateLink, read the [Databricks article about PrivateLink].",
@@ -2822,9 +2789,7 @@ class PrivateAccessAPI:
2822
2789
  return PrivateAccessSettings.from_dict(res)
2823
2790
 
2824
2791
  def list(self) -> Iterator[PrivateAccessSettings]:
2825
- """Get all private access settings objects.
2826
-
2827
- Gets a list of all private access settings objects for an account, specified by ID.
2792
+ """Gets a list of all private access settings objects for an account, specified by ID.
2828
2793
 
2829
2794
  :returns: Iterator over :class:`PrivateAccessSettings`
2830
2795
  """
@@ -2846,9 +2811,7 @@ class PrivateAccessAPI:
2846
2811
  private_access_level: Optional[PrivateAccessLevel] = None,
2847
2812
  public_access_enabled: Optional[bool] = None,
2848
2813
  ):
2849
- """Replace private access settings.
2850
-
2851
- Updates an existing private access settings object, which specifies how your workspace is accessed
2814
+ """Updates an existing private access settings object, which specifies how your workspace is accessed
2852
2815
  over [AWS PrivateLink]. To use AWS PrivateLink, a workspace must have a private access settings object
2853
2816
  referenced by ID in the workspace's `private_access_settings_id` property.
2854
2817
 
@@ -2932,9 +2895,7 @@ class StorageAPI:
2932
2895
  self._api = api_client
2933
2896
 
2934
2897
  def create(self, storage_configuration_name: str, root_bucket_info: RootBucketInfo) -> StorageConfiguration:
2935
- """Create new storage configuration.
2936
-
2937
- Creates new storage configuration for an account, specified by ID. Uploads a storage configuration
2898
+ """Creates new storage configuration for an account, specified by ID. Uploads a storage configuration
2938
2899
  object that represents the root AWS S3 bucket in your account. Databricks stores related workspace
2939
2900
  assets including DBFS, cluster logs, and job results. For the AWS S3 bucket, you need to configure the
2940
2901
  required bucket policy.
@@ -2967,9 +2928,7 @@ class StorageAPI:
2967
2928
  return StorageConfiguration.from_dict(res)
2968
2929
 
2969
2930
  def delete(self, storage_configuration_id: str):
2970
- """Delete storage configuration.
2971
-
2972
- Deletes a Databricks storage configuration. You cannot delete a storage configuration that is
2931
+ """Deletes a Databricks storage configuration. You cannot delete a storage configuration that is
2973
2932
  associated with any workspace.
2974
2933
 
2975
2934
  :param storage_configuration_id: str
@@ -2989,9 +2948,7 @@ class StorageAPI:
2989
2948
  )
2990
2949
 
2991
2950
  def get(self, storage_configuration_id: str) -> StorageConfiguration:
2992
- """Get storage configuration.
2993
-
2994
- Gets a Databricks storage configuration for an account, both specified by ID.
2951
+ """Gets a Databricks storage configuration for an account, both specified by ID.
2995
2952
 
2996
2953
  :param storage_configuration_id: str
2997
2954
  Databricks Account API storage configuration ID.
@@ -3011,9 +2968,7 @@ class StorageAPI:
3011
2968
  return StorageConfiguration.from_dict(res)
3012
2969
 
3013
2970
  def list(self) -> Iterator[StorageConfiguration]:
3014
- """Get all storage configurations.
3015
-
3016
- Gets a list of all Databricks storage configurations for your account, specified by ID.
2971
+ """Gets a list of all Databricks storage configurations for your account, specified by ID.
3017
2972
 
3018
2973
  :returns: Iterator over :class:`StorageConfiguration`
3019
2974
  """
@@ -3040,9 +2995,7 @@ class VpcEndpointsAPI:
3040
2995
  gcp_vpc_endpoint_info: Optional[GcpVpcEndpointInfo] = None,
3041
2996
  region: Optional[str] = None,
3042
2997
  ) -> VpcEndpoint:
3043
- """Create VPC endpoint configuration.
3044
-
3045
- Creates a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to
2998
+ """Creates a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to
3046
2999
  communicate privately with Databricks over [AWS PrivateLink].
3047
3000
 
3048
3001
  After you create the VPC endpoint configuration, the Databricks [endpoint service] automatically
@@ -3086,9 +3039,7 @@ class VpcEndpointsAPI:
3086
3039
  return VpcEndpoint.from_dict(res)
3087
3040
 
3088
3041
  def delete(self, vpc_endpoint_id: str):
3089
- """Delete VPC endpoint configuration.
3090
-
3091
- Deletes a VPC endpoint configuration, which represents an [AWS VPC endpoint] that can communicate
3042
+ """Deletes a VPC endpoint configuration, which represents an [AWS VPC endpoint] that can communicate
3092
3043
  privately with Databricks over [AWS PrivateLink].
3093
3044
 
3094
3045
  Before configuring PrivateLink, read the [Databricks article about PrivateLink].
@@ -3112,9 +3063,7 @@ class VpcEndpointsAPI:
3112
3063
  )
3113
3064
 
3114
3065
  def get(self, vpc_endpoint_id: str) -> VpcEndpoint:
3115
- """Get a VPC endpoint configuration.
3116
-
3117
- Gets a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to communicate
3066
+ """Gets a VPC endpoint configuration, which represents a [VPC endpoint] object in AWS used to communicate
3118
3067
  privately with Databricks over [AWS PrivateLink].
3119
3068
 
3120
3069
  [AWS PrivateLink]: https://aws.amazon.com/privatelink
@@ -3136,9 +3085,7 @@ class VpcEndpointsAPI:
3136
3085
  return VpcEndpoint.from_dict(res)
3137
3086
 
3138
3087
  def list(self) -> Iterator[VpcEndpoint]:
3139
- """Get all VPC endpoint configurations.
3140
-
3141
- Gets a list of all VPC endpoints for an account, specified by ID.
3088
+ """Gets a list of all VPC endpoints for an account, specified by ID.
3142
3089
 
3143
3090
  Before configuring PrivateLink, read the [Databricks article about PrivateLink].
3144
3091
 
@@ -3219,9 +3166,7 @@ class WorkspacesAPI:
3219
3166
  storage_configuration_id: Optional[str] = None,
3220
3167
  storage_customer_managed_key_id: Optional[str] = None,
3221
3168
  ) -> Wait[Workspace]:
3222
- """Create a new workspace.
3223
-
3224
- Creates a new workspace.
3169
+ """Creates a new workspace.
3225
3170
 
3226
3171
  **Important**: This operation is asynchronous. A response with HTTP status code 200 means the request
3227
3172
  has been accepted and is in progress, but does not mean that the workspace deployed successfully and
@@ -3415,9 +3360,7 @@ class WorkspacesAPI:
3415
3360
  ).result(timeout=timeout)
3416
3361
 
3417
3362
  def delete(self, workspace_id: int):
3418
- """Delete a workspace.
3419
-
3420
- Terminates and deletes a Databricks workspace. From an API perspective, deletion is immediate.
3363
+ """Terminates and deletes a Databricks workspace. From an API perspective, deletion is immediate.
3421
3364
  However, it might take a few minutes for all workspaces resources to be deleted, depending on the size
3422
3365
  and number of workspace resources.
3423
3366
 
@@ -3437,9 +3380,7 @@ class WorkspacesAPI:
3437
3380
  self._api.do("DELETE", f"/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}", headers=headers)
3438
3381
 
3439
3382
  def get(self, workspace_id: int) -> Workspace:
3440
- """Get a workspace.
3441
-
3442
- Gets information including status for a Databricks workspace, specified by ID. In the response, the
3383
+ """Gets information including status for a Databricks workspace, specified by ID. In the response, the
3443
3384
  `workspace_status` field indicates the current status. After initial workspace creation (which is
3444
3385
  asynchronous), make repeated `GET` requests with the workspace ID and check its status. The workspace
3445
3386
  becomes available when the status changes to `RUNNING`.
@@ -3468,9 +3409,7 @@ class WorkspacesAPI:
3468
3409
  return Workspace.from_dict(res)
3469
3410
 
3470
3411
  def list(self) -> Iterator[Workspace]:
3471
- """Get all workspaces.
3472
-
3473
- Gets a list of all workspaces associated with an account, specified by ID.
3412
+ """Gets a list of all workspaces associated with an account, specified by ID.
3474
3413
 
3475
3414
  This operation is available only if your account is on the E2 version of the platform or on a select
3476
3415
  custom plan that allows multiple workspaces per account.
@@ -3499,9 +3438,7 @@ class WorkspacesAPI:
3499
3438
  storage_configuration_id: Optional[str] = None,
3500
3439
  storage_customer_managed_key_id: Optional[str] = None,
3501
3440
  ) -> Wait[Workspace]:
3502
- """Update workspace configuration.
3503
-
3504
- Updates a workspace configuration for either a running workspace or a failed workspace. The elements
3441
+ """Updates a workspace configuration for either a running workspace or a failed workspace. The elements
3505
3442
  that can be updated varies between these two use cases.
3506
3443
 
3507
3444
  ### Update a failed workspace You can update a Databricks workspace configuration for failed workspace
@@ -0,0 +1,265 @@
1
+ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from dataclasses import dataclass
7
+ from enum import Enum
8
+ from typing import Any, Dict, Iterator, List, Optional
9
+
10
+ from ._internal import _enum, _from_dict, _repeated_dict
11
+
12
+ _LOG = logging.getLogger("databricks.sdk")
13
+
14
+
15
+ # all definitions in this file are in alphabetical order
16
+
17
+
18
+ @dataclass
19
+ class AnomalyDetectionConfig:
20
+ last_run_id: Optional[str] = None
21
+ """Run id of the last run of the workflow"""
22
+
23
+ latest_run_status: Optional[AnomalyDetectionRunStatus] = None
24
+ """The status of the last run of the workflow."""
25
+
26
+ def as_dict(self) -> dict:
27
+ """Serializes the AnomalyDetectionConfig into a dictionary suitable for use as a JSON request body."""
28
+ body = {}
29
+ if self.last_run_id is not None:
30
+ body["last_run_id"] = self.last_run_id
31
+ if self.latest_run_status is not None:
32
+ body["latest_run_status"] = self.latest_run_status.value
33
+ return body
34
+
35
+ def as_shallow_dict(self) -> dict:
36
+ """Serializes the AnomalyDetectionConfig into a shallow dictionary of its immediate attributes."""
37
+ body = {}
38
+ if self.last_run_id is not None:
39
+ body["last_run_id"] = self.last_run_id
40
+ if self.latest_run_status is not None:
41
+ body["latest_run_status"] = self.latest_run_status
42
+ return body
43
+
44
+ @classmethod
45
+ def from_dict(cls, d: Dict[str, Any]) -> AnomalyDetectionConfig:
46
+ """Deserializes the AnomalyDetectionConfig from a dictionary."""
47
+ return cls(
48
+ last_run_id=d.get("last_run_id", None),
49
+ latest_run_status=_enum(d, "latest_run_status", AnomalyDetectionRunStatus),
50
+ )
51
+
52
+
53
+ class AnomalyDetectionRunStatus(Enum):
54
+ """Status of Anomaly Detection Job Run"""
55
+
56
+ ANOMALY_DETECTION_RUN_STATUS_CANCELED = "ANOMALY_DETECTION_RUN_STATUS_CANCELED"
57
+ ANOMALY_DETECTION_RUN_STATUS_FAILED = "ANOMALY_DETECTION_RUN_STATUS_FAILED"
58
+ ANOMALY_DETECTION_RUN_STATUS_JOB_DELETED = "ANOMALY_DETECTION_RUN_STATUS_JOB_DELETED"
59
+ ANOMALY_DETECTION_RUN_STATUS_PENDING = "ANOMALY_DETECTION_RUN_STATUS_PENDING"
60
+ ANOMALY_DETECTION_RUN_STATUS_RUNNING = "ANOMALY_DETECTION_RUN_STATUS_RUNNING"
61
+ ANOMALY_DETECTION_RUN_STATUS_SUCCESS = "ANOMALY_DETECTION_RUN_STATUS_SUCCESS"
62
+ ANOMALY_DETECTION_RUN_STATUS_UNKNOWN = "ANOMALY_DETECTION_RUN_STATUS_UNKNOWN"
63
+ ANOMALY_DETECTION_RUN_STATUS_WORKSPACE_MISMATCH_ERROR = "ANOMALY_DETECTION_RUN_STATUS_WORKSPACE_MISMATCH_ERROR"
64
+
65
+
66
+ @dataclass
67
+ class DeleteQualityMonitorResponse:
68
+ def as_dict(self) -> dict:
69
+ """Serializes the DeleteQualityMonitorResponse into a dictionary suitable for use as a JSON request body."""
70
+ body = {}
71
+ return body
72
+
73
+ def as_shallow_dict(self) -> dict:
74
+ """Serializes the DeleteQualityMonitorResponse into a shallow dictionary of its immediate attributes."""
75
+ body = {}
76
+ return body
77
+
78
+ @classmethod
79
+ def from_dict(cls, d: Dict[str, Any]) -> DeleteQualityMonitorResponse:
80
+ """Deserializes the DeleteQualityMonitorResponse from a dictionary."""
81
+ return cls()
82
+
83
+
84
+ @dataclass
85
+ class ListQualityMonitorResponse:
86
+ next_page_token: Optional[str] = None
87
+
88
+ quality_monitors: Optional[List[QualityMonitor]] = None
89
+
90
+ def as_dict(self) -> dict:
91
+ """Serializes the ListQualityMonitorResponse into a dictionary suitable for use as a JSON request body."""
92
+ body = {}
93
+ if self.next_page_token is not None:
94
+ body["next_page_token"] = self.next_page_token
95
+ if self.quality_monitors:
96
+ body["quality_monitors"] = [v.as_dict() for v in self.quality_monitors]
97
+ return body
98
+
99
+ def as_shallow_dict(self) -> dict:
100
+ """Serializes the ListQualityMonitorResponse into a shallow dictionary of its immediate attributes."""
101
+ body = {}
102
+ if self.next_page_token is not None:
103
+ body["next_page_token"] = self.next_page_token
104
+ if self.quality_monitors:
105
+ body["quality_monitors"] = self.quality_monitors
106
+ return body
107
+
108
+ @classmethod
109
+ def from_dict(cls, d: Dict[str, Any]) -> ListQualityMonitorResponse:
110
+ """Deserializes the ListQualityMonitorResponse from a dictionary."""
111
+ return cls(
112
+ next_page_token=d.get("next_page_token", None),
113
+ quality_monitors=_repeated_dict(d, "quality_monitors", QualityMonitor),
114
+ )
115
+
116
+
117
+ @dataclass
118
+ class QualityMonitor:
119
+ object_type: str
120
+ """The type of the monitored object. Can be one of the following: schema."""
121
+
122
+ object_id: str
123
+ """The uuid of the request object. For example, schema id."""
124
+
125
+ anomaly_detection_config: Optional[AnomalyDetectionConfig] = None
126
+
127
+ def as_dict(self) -> dict:
128
+ """Serializes the QualityMonitor into a dictionary suitable for use as a JSON request body."""
129
+ body = {}
130
+ if self.anomaly_detection_config:
131
+ body["anomaly_detection_config"] = self.anomaly_detection_config.as_dict()
132
+ if self.object_id is not None:
133
+ body["object_id"] = self.object_id
134
+ if self.object_type is not None:
135
+ body["object_type"] = self.object_type
136
+ return body
137
+
138
+ def as_shallow_dict(self) -> dict:
139
+ """Serializes the QualityMonitor into a shallow dictionary of its immediate attributes."""
140
+ body = {}
141
+ if self.anomaly_detection_config:
142
+ body["anomaly_detection_config"] = self.anomaly_detection_config
143
+ if self.object_id is not None:
144
+ body["object_id"] = self.object_id
145
+ if self.object_type is not None:
146
+ body["object_type"] = self.object_type
147
+ return body
148
+
149
+ @classmethod
150
+ def from_dict(cls, d: Dict[str, Any]) -> QualityMonitor:
151
+ """Deserializes the QualityMonitor from a dictionary."""
152
+ return cls(
153
+ anomaly_detection_config=_from_dict(d, "anomaly_detection_config", AnomalyDetectionConfig),
154
+ object_id=d.get("object_id", None),
155
+ object_type=d.get("object_type", None),
156
+ )
157
+
158
+
159
+ class QualityMonitorV2API:
160
+ """Manage data quality of UC objects (currently support `schema`)"""
161
+
162
+ def __init__(self, api_client):
163
+ self._api = api_client
164
+
165
+ def create_quality_monitor(self, quality_monitor: QualityMonitor) -> QualityMonitor:
166
+ """Create a quality monitor on UC object
167
+
168
+ :param quality_monitor: :class:`QualityMonitor`
169
+
170
+ :returns: :class:`QualityMonitor`
171
+ """
172
+ body = quality_monitor.as_dict()
173
+ headers = {
174
+ "Accept": "application/json",
175
+ "Content-Type": "application/json",
176
+ }
177
+
178
+ res = self._api.do("POST", "/api/2.0/quality-monitors", body=body, headers=headers)
179
+ return QualityMonitor.from_dict(res)
180
+
181
+ def delete_quality_monitor(self, object_type: str, object_id: str):
182
+ """Delete a quality monitor on UC object
183
+
184
+ :param object_type: str
185
+ The type of the monitored object. Can be one of the following: schema.
186
+ :param object_id: str
187
+ The uuid of the request object. For example, schema id.
188
+
189
+
190
+ """
191
+
192
+ headers = {
193
+ "Accept": "application/json",
194
+ }
195
+
196
+ self._api.do("DELETE", f"/api/2.0/quality-monitors/{object_type}/{object_id}", headers=headers)
197
+
198
+ def get_quality_monitor(self, object_type: str, object_id: str) -> QualityMonitor:
199
+ """Read a quality monitor on UC object
200
+
201
+ :param object_type: str
202
+ The type of the monitored object. Can be one of the following: schema.
203
+ :param object_id: str
204
+ The uuid of the request object. For example, schema id.
205
+
206
+ :returns: :class:`QualityMonitor`
207
+ """
208
+
209
+ headers = {
210
+ "Accept": "application/json",
211
+ }
212
+
213
+ res = self._api.do("GET", f"/api/2.0/quality-monitors/{object_type}/{object_id}", headers=headers)
214
+ return QualityMonitor.from_dict(res)
215
+
216
+ def list_quality_monitor(
217
+ self, *, page_size: Optional[int] = None, page_token: Optional[str] = None
218
+ ) -> Iterator[QualityMonitor]:
219
+ """(Unimplemented) List quality monitors
220
+
221
+ :param page_size: int (optional)
222
+ :param page_token: str (optional)
223
+
224
+ :returns: Iterator over :class:`QualityMonitor`
225
+ """
226
+
227
+ query = {}
228
+ if page_size is not None:
229
+ query["page_size"] = page_size
230
+ if page_token is not None:
231
+ query["page_token"] = page_token
232
+ headers = {
233
+ "Accept": "application/json",
234
+ }
235
+
236
+ while True:
237
+ json = self._api.do("GET", "/api/2.0/quality-monitors", query=query, headers=headers)
238
+ if "quality_monitors" in json:
239
+ for v in json["quality_monitors"]:
240
+ yield QualityMonitor.from_dict(v)
241
+ if "next_page_token" not in json or not json["next_page_token"]:
242
+ return
243
+ query["page_token"] = json["next_page_token"]
244
+
245
+ def update_quality_monitor(
246
+ self, object_type: str, object_id: str, quality_monitor: QualityMonitor
247
+ ) -> QualityMonitor:
248
+ """(Unimplemented) Update a quality monitor on UC object
249
+
250
+ :param object_type: str
251
+ The type of the monitored object. Can be one of the following: schema.
252
+ :param object_id: str
253
+ The uuid of the request object. For example, schema id.
254
+ :param quality_monitor: :class:`QualityMonitor`
255
+
256
+ :returns: :class:`QualityMonitor`
257
+ """
258
+ body = quality_monitor.as_dict()
259
+ headers = {
260
+ "Accept": "application/json",
261
+ "Content-Type": "application/json",
262
+ }
263
+
264
+ res = self._api.do("PUT", f"/api/2.0/quality-monitors/{object_type}/{object_id}", body=body, headers=headers)
265
+ return QualityMonitor.from_dict(res)