databricks-sdk 0.32.3__tar.gz → 0.33.0__tar.gz

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 (91) hide show
  1. {databricks_sdk-0.32.3/databricks_sdk.egg-info → databricks_sdk-0.33.0}/PKG-INFO +1 -1
  2. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/__init__.py +9 -0
  3. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/apps.py +154 -106
  4. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/catalog.py +266 -7
  5. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/compute.py +68 -18
  6. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/dashboards.py +32 -9
  7. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/jobs.py +98 -86
  8. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/pipelines.py +58 -1
  9. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/serving.py +326 -10
  10. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/settings.py +394 -1
  11. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/sql.py +3 -243
  12. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/workspace.py +266 -105
  13. databricks_sdk-0.33.0/databricks/sdk/version.py +1 -0
  14. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0/databricks_sdk.egg-info}/PKG-INFO +1 -1
  15. databricks_sdk-0.32.3/databricks/sdk/version.py +0 -1
  16. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/LICENSE +0 -0
  17. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/NOTICE +0 -0
  18. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/README.md +0 -0
  19. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/__init__.py +0 -0
  20. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/_property.py +0 -0
  21. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/_widgets/__init__.py +0 -0
  22. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/_widgets/default_widgets_utils.py +0 -0
  23. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/_widgets/ipywidgets_utils.py +0 -0
  24. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/azure.py +0 -0
  25. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/casing.py +0 -0
  26. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/clock.py +0 -0
  27. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/config.py +0 -0
  28. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/core.py +0 -0
  29. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/credentials_provider.py +0 -0
  30. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/data_plane.py +0 -0
  31. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/dbutils.py +0 -0
  32. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/environments.py +0 -0
  33. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/__init__.py +0 -0
  34. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/base.py +0 -0
  35. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/customizer.py +0 -0
  36. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/deserializer.py +0 -0
  37. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/mapper.py +0 -0
  38. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/overrides.py +0 -0
  39. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/parser.py +0 -0
  40. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/platform.py +0 -0
  41. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/private_link.py +0 -0
  42. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/errors/sdk.py +0 -0
  43. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/logger/__init__.py +0 -0
  44. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/logger/round_trip_logger.py +0 -0
  45. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/mixins/__init__.py +0 -0
  46. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/mixins/compute.py +0 -0
  47. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/mixins/files.py +0 -0
  48. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/mixins/workspace.py +0 -0
  49. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/oauth.py +0 -0
  50. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/py.typed +0 -0
  51. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/retries.py +0 -0
  52. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/runtime/__init__.py +0 -0
  53. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/runtime/dbutils_stub.py +0 -0
  54. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/__init__.py +0 -0
  55. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/_internal.py +0 -0
  56. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/billing.py +0 -0
  57. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/files.py +0 -0
  58. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/iam.py +0 -0
  59. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/marketplace.py +0 -0
  60. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/ml.py +0 -0
  61. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/oauth2.py +0 -0
  62. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/provisioning.py +0 -0
  63. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/sharing.py +0 -0
  64. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/service/vectorsearch.py +0 -0
  65. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks/sdk/useragent.py +0 -0
  66. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks_sdk.egg-info/SOURCES.txt +0 -0
  67. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks_sdk.egg-info/dependency_links.txt +0 -0
  68. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks_sdk.egg-info/requires.txt +0 -0
  69. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/databricks_sdk.egg-info/top_level.txt +0 -0
  70. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/setup.cfg +0 -0
  71. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/setup.py +0 -0
  72. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_auth.py +0 -0
  73. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_auth_manual_tests.py +0 -0
  74. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_client.py +0 -0
  75. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_compute_mixins.py +0 -0
  76. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_config.py +0 -0
  77. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_core.py +0 -0
  78. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_data_plane.py +0 -0
  79. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_dbfs_mixins.py +0 -0
  80. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_dbutils.py +0 -0
  81. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_environments.py +0 -0
  82. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_errors.py +0 -0
  83. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_init_file.py +0 -0
  84. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_internal.py +0 -0
  85. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_jobs.py +0 -0
  86. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_metadata_service_auth.py +0 -0
  87. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_misc.py +0 -0
  88. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_model_serving_auth.py +0 -0
  89. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_oauth.py +0 -0
  90. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_retries.py +0 -0
  91. {databricks_sdk-0.32.3 → databricks_sdk-0.33.0}/tests/test_user_agent.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: databricks-sdk
3
- Version: 0.32.3
3
+ Version: 0.33.0
4
4
  Summary: Databricks SDK for Python (Beta)
5
5
  Home-page: https://databricks-sdk-py.readthedocs.io
6
6
  Author: Serge Smertin
@@ -24,6 +24,7 @@ from databricks.sdk.service.catalog import (AccountMetastoreAssignmentsAPI,
24
24
  StorageCredentialsAPI,
25
25
  SystemSchemasAPI,
26
26
  TableConstraintsAPI, TablesAPI,
27
+ TemporaryTableCredentialsAPI,
27
28
  VolumesAPI, WorkspaceBindingsAPI)
28
29
  from databricks.sdk.service.compute import (ClusterPoliciesAPI, ClustersAPI,
29
30
  CommandExecutionAPI,
@@ -69,6 +70,8 @@ from databricks.sdk.service.settings import (AccountIpAccessListsAPI,
69
70
  CredentialsManagerAPI,
70
71
  CspEnablementAccountAPI,
71
72
  DefaultNamespaceAPI,
73
+ DisableLegacyAccessAPI,
74
+ DisableLegacyFeaturesAPI,
72
75
  EnhancedSecurityMonitoringAPI,
73
76
  EsmEnablementAccountAPI,
74
77
  IpAccessListsAPI,
@@ -253,6 +256,7 @@ class WorkspaceClient:
253
256
  self._system_schemas = SystemSchemasAPI(self._api_client)
254
257
  self._table_constraints = TableConstraintsAPI(self._api_client)
255
258
  self._tables = TablesAPI(self._api_client)
259
+ self._temporary_table_credentials = TemporaryTableCredentialsAPI(self._api_client)
256
260
  self._token_management = TokenManagementAPI(self._api_client)
257
261
  self._tokens = TokensAPI(self._api_client)
258
262
  self._users = UsersAPI(self._api_client)
@@ -676,6 +680,11 @@ class WorkspaceClient:
676
680
  """A table resides in the third layer of Unity Catalog’s three-level namespace."""
677
681
  return self._tables
678
682
 
683
+ @property
684
+ def temporary_table_credentials(self) -> TemporaryTableCredentialsAPI:
685
+ """Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage locationswhere table data is stored in Databricks."""
686
+ return self._temporary_table_credentials
687
+
679
688
  @property
680
689
  def token_management(self) -> TokenManagementAPI:
681
690
  """Enables administrators to get all tokens and delete tokens for other users."""
@@ -27,6 +27,10 @@ class App:
27
27
  active_deployment: Optional[AppDeployment] = None
28
28
  """The active deployment of the app."""
29
29
 
30
+ app_status: Optional[ApplicationStatus] = None
31
+
32
+ compute_status: Optional[ComputeStatus] = None
33
+
30
34
  create_time: Optional[str] = None
31
35
  """The creation time of the app. Formatted timestamp in ISO 6801."""
32
36
 
@@ -43,8 +47,6 @@ class App:
43
47
 
44
48
  service_principal_name: Optional[str] = None
45
49
 
46
- status: Optional[AppStatus] = None
47
-
48
50
  update_time: Optional[str] = None
49
51
  """The update time of the app. Formatted timestamp in ISO 6801."""
50
52
 
@@ -58,6 +60,8 @@ class App:
58
60
  """Serializes the App into a dictionary suitable for use as a JSON request body."""
59
61
  body = {}
60
62
  if self.active_deployment: body['active_deployment'] = self.active_deployment.as_dict()
63
+ if self.app_status: body['app_status'] = self.app_status.as_dict()
64
+ if self.compute_status: body['compute_status'] = self.compute_status.as_dict()
61
65
  if self.create_time is not None: body['create_time'] = self.create_time
62
66
  if self.creator is not None: body['creator'] = self.creator
63
67
  if self.description is not None: body['description'] = self.description
@@ -66,7 +70,6 @@ class App:
66
70
  if self.service_principal_id is not None: body['service_principal_id'] = self.service_principal_id
67
71
  if self.service_principal_name is not None:
68
72
  body['service_principal_name'] = self.service_principal_name
69
- if self.status: body['status'] = self.status.as_dict()
70
73
  if self.update_time is not None: body['update_time'] = self.update_time
71
74
  if self.updater is not None: body['updater'] = self.updater
72
75
  if self.url is not None: body['url'] = self.url
@@ -76,6 +79,8 @@ class App:
76
79
  def from_dict(cls, d: Dict[str, any]) -> App:
77
80
  """Deserializes the App from a dictionary."""
78
81
  return cls(active_deployment=_from_dict(d, 'active_deployment', AppDeployment),
82
+ app_status=_from_dict(d, 'app_status', ApplicationStatus),
83
+ compute_status=_from_dict(d, 'compute_status', ComputeStatus),
79
84
  create_time=d.get('create_time', None),
80
85
  creator=d.get('creator', None),
81
86
  description=d.get('description', None),
@@ -83,7 +88,6 @@ class App:
83
88
  pending_deployment=_from_dict(d, 'pending_deployment', AppDeployment),
84
89
  service_principal_id=d.get('service_principal_id', None),
85
90
  service_principal_name=d.get('service_principal_name', None),
86
- status=_from_dict(d, 'status', AppStatus),
87
91
  update_time=d.get('update_time', None),
88
92
  updater=d.get('updater', None),
89
93
  url=d.get('url', None))
@@ -162,13 +166,6 @@ class AppAccessControlResponse:
162
166
 
163
167
  @dataclass
164
168
  class AppDeployment:
165
- source_code_path: str
166
- """The workspace file system path of the source code used to create the app deployment. This is
167
- different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
168
- app. The former refers to the original source code location of the app in the workspace during
169
- deployment creation, whereas the latter provides a system generated stable snapshotted source
170
- code path used by the deployment."""
171
-
172
169
  create_time: Optional[str] = None
173
170
  """The creation time of the deployment. Formatted timestamp in ISO 6801."""
174
171
 
@@ -184,6 +181,13 @@ class AppDeployment:
184
181
  mode: Optional[AppDeploymentMode] = None
185
182
  """The mode of which the deployment will manage the source code."""
186
183
 
184
+ source_code_path: Optional[str] = None
185
+ """The workspace file system path of the source code used to create the app deployment. This is
186
+ different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
187
+ app. The former refers to the original source code location of the app in the workspace during
188
+ deployment creation, whereas the latter provides a system generated stable snapshotted source
189
+ code path used by the deployment."""
190
+
187
191
  status: Optional[AppDeploymentStatus] = None
188
192
  """Status and status message of the deployment"""
189
193
 
@@ -241,9 +245,9 @@ class AppDeploymentMode(Enum):
241
245
 
242
246
  class AppDeploymentState(Enum):
243
247
 
248
+ CANCELLED = 'CANCELLED'
244
249
  FAILED = 'FAILED'
245
250
  IN_PROGRESS = 'IN_PROGRESS'
246
- STOPPED = 'STOPPED'
247
251
  SUCCEEDED = 'SUCCEEDED'
248
252
 
249
253
 
@@ -368,57 +372,90 @@ class AppPermissionsRequest:
368
372
  app_name=d.get('app_name', None))
369
373
 
370
374
 
371
- class AppState(Enum):
375
+ class ApplicationState(Enum):
376
+
377
+ CRASHED = 'CRASHED'
378
+ DEPLOYING = 'DEPLOYING'
379
+ RUNNING = 'RUNNING'
380
+ UNAVAILABLE = 'UNAVAILABLE'
381
+
382
+
383
+ @dataclass
384
+ class ApplicationStatus:
385
+ message: Optional[str] = None
386
+ """Application status message"""
387
+
388
+ state: Optional[ApplicationState] = None
389
+ """State of the application."""
390
+
391
+ def as_dict(self) -> dict:
392
+ """Serializes the ApplicationStatus into a dictionary suitable for use as a JSON request body."""
393
+ body = {}
394
+ if self.message is not None: body['message'] = self.message
395
+ if self.state is not None: body['state'] = self.state.value
396
+ return body
397
+
398
+ @classmethod
399
+ def from_dict(cls, d: Dict[str, any]) -> ApplicationStatus:
400
+ """Deserializes the ApplicationStatus from a dictionary."""
401
+ return cls(message=d.get('message', None), state=_enum(d, 'state', ApplicationState))
402
+
403
+
404
+ class ComputeState(Enum):
372
405
 
373
- CREATING = 'CREATING'
374
- DELETED = 'DELETED'
406
+ ACTIVE = 'ACTIVE'
375
407
  DELETING = 'DELETING'
376
408
  ERROR = 'ERROR'
377
- IDLE = 'IDLE'
378
- RUNNING = 'RUNNING'
379
409
  STARTING = 'STARTING'
410
+ STOPPED = 'STOPPED'
411
+ STOPPING = 'STOPPING'
412
+ UPDATING = 'UPDATING'
380
413
 
381
414
 
382
415
  @dataclass
383
- class AppStatus:
416
+ class ComputeStatus:
384
417
  message: Optional[str] = None
385
- """Message corresponding with the app state."""
418
+ """Compute status message"""
386
419
 
387
- state: Optional[AppState] = None
388
- """State of the app."""
420
+ state: Optional[ComputeState] = None
421
+ """State of the app compute."""
389
422
 
390
423
  def as_dict(self) -> dict:
391
- """Serializes the AppStatus into a dictionary suitable for use as a JSON request body."""
424
+ """Serializes the ComputeStatus into a dictionary suitable for use as a JSON request body."""
392
425
  body = {}
393
426
  if self.message is not None: body['message'] = self.message
394
427
  if self.state is not None: body['state'] = self.state.value
395
428
  return body
396
429
 
397
430
  @classmethod
398
- def from_dict(cls, d: Dict[str, any]) -> AppStatus:
399
- """Deserializes the AppStatus from a dictionary."""
400
- return cls(message=d.get('message', None), state=_enum(d, 'state', AppState))
431
+ def from_dict(cls, d: Dict[str, any]) -> ComputeStatus:
432
+ """Deserializes the ComputeStatus from a dictionary."""
433
+ return cls(message=d.get('message', None), state=_enum(d, 'state', ComputeState))
401
434
 
402
435
 
403
436
  @dataclass
404
437
  class CreateAppDeploymentRequest:
405
- source_code_path: str
406
- """The workspace file system path of the source code used to create the app deployment. This is
407
- different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
408
- app. The former refers to the original source code location of the app in the workspace during
409
- deployment creation, whereas the latter provides a system generated stable snapshotted source
410
- code path used by the deployment."""
411
-
412
438
  app_name: Optional[str] = None
413
439
  """The name of the app."""
414
440
 
441
+ deployment_id: Optional[str] = None
442
+ """The unique id of the deployment."""
443
+
415
444
  mode: Optional[AppDeploymentMode] = None
416
445
  """The mode of which the deployment will manage the source code."""
417
446
 
447
+ source_code_path: Optional[str] = None
448
+ """The workspace file system path of the source code used to create the app deployment. This is
449
+ different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
450
+ app. The former refers to the original source code location of the app in the workspace during
451
+ deployment creation, whereas the latter provides a system generated stable snapshotted source
452
+ code path used by the deployment."""
453
+
418
454
  def as_dict(self) -> dict:
419
455
  """Serializes the CreateAppDeploymentRequest into a dictionary suitable for use as a JSON request body."""
420
456
  body = {}
421
457
  if self.app_name is not None: body['app_name'] = self.app_name
458
+ if self.deployment_id is not None: body['deployment_id'] = self.deployment_id
422
459
  if self.mode is not None: body['mode'] = self.mode.value
423
460
  if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
424
461
  return body
@@ -427,6 +464,7 @@ class CreateAppDeploymentRequest:
427
464
  def from_dict(cls, d: Dict[str, any]) -> CreateAppDeploymentRequest:
428
465
  """Deserializes the CreateAppDeploymentRequest from a dictionary."""
429
466
  return cls(app_name=d.get('app_name', None),
467
+ deployment_id=d.get('deployment_id', None),
430
468
  mode=_enum(d, 'mode', AppDeploymentMode),
431
469
  source_code_path=d.get('source_code_path', None))
432
470
 
@@ -453,20 +491,6 @@ class CreateAppRequest:
453
491
  return cls(description=d.get('description', None), name=d.get('name', None))
454
492
 
455
493
 
456
- @dataclass
457
- class DeleteResponse:
458
-
459
- def as_dict(self) -> dict:
460
- """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
461
- body = {}
462
- return body
463
-
464
- @classmethod
465
- def from_dict(cls, d: Dict[str, any]) -> DeleteResponse:
466
- """Deserializes the DeleteResponse from a dictionary."""
467
- return cls()
468
-
469
-
470
494
  @dataclass
471
495
  class GetAppPermissionLevelsResponse:
472
496
  permission_levels: Optional[List[AppPermissionsDescription]] = None
@@ -538,20 +562,6 @@ class StopAppRequest:
538
562
  """The name of the app."""
539
563
 
540
564
 
541
- @dataclass
542
- class StopAppResponse:
543
-
544
- def as_dict(self) -> dict:
545
- """Serializes the StopAppResponse into a dictionary suitable for use as a JSON request body."""
546
- body = {}
547
- return body
548
-
549
- @classmethod
550
- def from_dict(cls, d: Dict[str, any]) -> StopAppResponse:
551
- """Deserializes the StopAppResponse from a dictionary."""
552
- return cls()
553
-
554
-
555
565
  @dataclass
556
566
  class UpdateAppRequest:
557
567
  name: str
@@ -581,27 +591,59 @@ class AppsAPI:
581
591
  def __init__(self, api_client):
582
592
  self._api = api_client
583
593
 
584
- def wait_get_app_idle(self,
585
- name: str,
586
- timeout=timedelta(minutes=20),
587
- callback: Optional[Callable[[App], None]] = None) -> App:
594
+ def wait_get_app_active(self,
595
+ name: str,
596
+ timeout=timedelta(minutes=20),
597
+ callback: Optional[Callable[[App], None]] = None) -> App:
588
598
  deadline = time.time() + timeout.total_seconds()
589
- target_states = (AppState.IDLE, )
590
- failure_states = (AppState.ERROR, )
599
+ target_states = (ComputeState.ACTIVE, )
600
+ failure_states = (ComputeState.ERROR, )
591
601
  status_message = 'polling...'
592
602
  attempt = 1
593
603
  while time.time() < deadline:
594
604
  poll = self.get(name=name)
595
- status = poll.status.state
605
+ status = poll.compute_status.state
596
606
  status_message = f'current status: {status}'
597
- if poll.status:
598
- status_message = poll.status.message
607
+ if poll.compute_status:
608
+ status_message = poll.compute_status.message
609
+ if status in target_states:
610
+ return poll
611
+ if callback:
612
+ callback(poll)
613
+ if status in failure_states:
614
+ msg = f'failed to reach ACTIVE, got {status}: {status_message}'
615
+ raise OperationFailed(msg)
616
+ prefix = f"name={name}"
617
+ sleep = attempt
618
+ if sleep > 10:
619
+ # sleep 10s max per attempt
620
+ sleep = 10
621
+ _LOG.debug(f'{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)')
622
+ time.sleep(sleep + random.random())
623
+ attempt += 1
624
+ raise TimeoutError(f'timed out after {timeout}: {status_message}')
625
+
626
+ def wait_get_app_stopped(self,
627
+ name: str,
628
+ timeout=timedelta(minutes=20),
629
+ callback: Optional[Callable[[App], None]] = None) -> App:
630
+ deadline = time.time() + timeout.total_seconds()
631
+ target_states = (ComputeState.STOPPED, )
632
+ failure_states = (ComputeState.ERROR, )
633
+ status_message = 'polling...'
634
+ attempt = 1
635
+ while time.time() < deadline:
636
+ poll = self.get(name=name)
637
+ status = poll.compute_status.state
638
+ status_message = f'current status: {status}'
639
+ if poll.compute_status:
640
+ status_message = poll.compute_status.message
599
641
  if status in target_states:
600
642
  return poll
601
643
  if callback:
602
644
  callback(poll)
603
645
  if status in failure_states:
604
- msg = f'failed to reach IDLE, got {status}: {status_message}'
646
+ msg = f'failed to reach STOPPED, got {status}: {status_message}'
605
647
  raise OperationFailed(msg)
606
648
  prefix = f"name={name}"
607
649
  sleep = attempt
@@ -660,15 +702,15 @@ class AppsAPI:
660
702
 
661
703
  :returns:
662
704
  Long-running operation waiter for :class:`App`.
663
- See :method:wait_get_app_idle for more details.
705
+ See :method:wait_get_app_active for more details.
664
706
  """
665
707
  body = {}
666
708
  if description is not None: body['description'] = description
667
709
  if name is not None: body['name'] = name
668
710
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
669
711
 
670
- op_response = self._api.do('POST', '/api/2.0/preview/apps', body=body, headers=headers)
671
- return Wait(self.wait_get_app_idle, response=App.from_dict(op_response), name=op_response['name'])
712
+ op_response = self._api.do('POST', '/api/2.0/apps', body=body, headers=headers)
713
+ return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response['name'])
672
714
 
673
715
  def create_and_wait(self,
674
716
  name: str,
@@ -677,7 +719,7 @@ class AppsAPI:
677
719
  timeout=timedelta(minutes=20)) -> App:
678
720
  return self.create(description=description, name=name).result(timeout=timeout)
679
721
 
680
- def delete(self, name: str):
722
+ def delete(self, name: str) -> App:
681
723
  """Delete an app.
682
724
 
683
725
  Deletes an app.
@@ -685,44 +727,49 @@ class AppsAPI:
685
727
  :param name: str
686
728
  The name of the app.
687
729
 
688
-
730
+ :returns: :class:`App`
689
731
  """
690
732
 
691
733
  headers = {'Accept': 'application/json', }
692
734
 
693
- self._api.do('DELETE', f'/api/2.0/preview/apps/{name}', headers=headers)
735
+ res = self._api.do('DELETE', f'/api/2.0/apps/{name}', headers=headers)
736
+ return App.from_dict(res)
694
737
 
695
738
  def deploy(self,
696
739
  app_name: str,
697
- source_code_path: str,
698
740
  *,
699
- mode: Optional[AppDeploymentMode] = None) -> Wait[AppDeployment]:
741
+ deployment_id: Optional[str] = None,
742
+ mode: Optional[AppDeploymentMode] = None,
743
+ source_code_path: Optional[str] = None) -> Wait[AppDeployment]:
700
744
  """Create an app deployment.
701
745
 
702
746
  Creates an app deployment for the app with the supplied name.
703
747
 
704
748
  :param app_name: str
705
749
  The name of the app.
706
- :param source_code_path: str
750
+ :param deployment_id: str (optional)
751
+ The unique id of the deployment.
752
+ :param mode: :class:`AppDeploymentMode` (optional)
753
+ The mode of which the deployment will manage the source code.
754
+ :param source_code_path: str (optional)
707
755
  The workspace file system path of the source code used to create the app deployment. This is
708
756
  different from `deployment_artifacts.source_code_path`, which is the path used by the deployed app.
709
757
  The former refers to the original source code location of the app in the workspace during deployment
710
758
  creation, whereas the latter provides a system generated stable snapshotted source code path used by
711
759
  the deployment.
712
- :param mode: :class:`AppDeploymentMode` (optional)
713
- The mode of which the deployment will manage the source code.
714
760
 
715
761
  :returns:
716
762
  Long-running operation waiter for :class:`AppDeployment`.
717
763
  See :method:wait_get_deployment_app_succeeded for more details.
718
764
  """
719
765
  body = {}
766
+ if deployment_id is not None: body['deployment_id'] = deployment_id
720
767
  if mode is not None: body['mode'] = mode.value
721
768
  if source_code_path is not None: body['source_code_path'] = source_code_path
722
769
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
723
770
 
724
771
  op_response = self._api.do('POST',
725
- f'/api/2.0/preview/apps/{app_name}/deployments',
772
+ f'/api/2.0/apps/{app_name}/deployments',
726
773
  body=body,
727
774
  headers=headers)
728
775
  return Wait(self.wait_get_deployment_app_succeeded,
@@ -733,11 +780,14 @@ class AppsAPI:
733
780
  def deploy_and_wait(
734
781
  self,
735
782
  app_name: str,
736
- source_code_path: str,
737
783
  *,
784
+ deployment_id: Optional[str] = None,
738
785
  mode: Optional[AppDeploymentMode] = None,
786
+ source_code_path: Optional[str] = None,
739
787
  timeout=timedelta(minutes=20)) -> AppDeployment:
740
- return self.deploy(app_name=app_name, mode=mode,
788
+ return self.deploy(app_name=app_name,
789
+ deployment_id=deployment_id,
790
+ mode=mode,
741
791
  source_code_path=source_code_path).result(timeout=timeout)
742
792
 
743
793
  def get(self, name: str) -> App:
@@ -753,7 +803,7 @@ class AppsAPI:
753
803
 
754
804
  headers = {'Accept': 'application/json', }
755
805
 
756
- res = self._api.do('GET', f'/api/2.0/preview/apps/{name}', headers=headers)
806
+ res = self._api.do('GET', f'/api/2.0/apps/{name}', headers=headers)
757
807
  return App.from_dict(res)
758
808
 
759
809
  def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment:
@@ -771,9 +821,7 @@ class AppsAPI:
771
821
 
772
822
  headers = {'Accept': 'application/json', }
773
823
 
774
- res = self._api.do('GET',
775
- f'/api/2.0/preview/apps/{app_name}/deployments/{deployment_id}',
776
- headers=headers)
824
+ res = self._api.do('GET', f'/api/2.0/apps/{app_name}/deployments/{deployment_id}', headers=headers)
777
825
  return AppDeployment.from_dict(res)
778
826
 
779
827
  def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse:
@@ -827,7 +875,7 @@ class AppsAPI:
827
875
  headers = {'Accept': 'application/json', }
828
876
 
829
877
  while True:
830
- json = self._api.do('GET', '/api/2.0/preview/apps', query=query, headers=headers)
878
+ json = self._api.do('GET', '/api/2.0/apps', query=query, headers=headers)
831
879
  if 'apps' in json:
832
880
  for v in json['apps']:
833
881
  yield App.from_dict(v)
@@ -860,10 +908,7 @@ class AppsAPI:
860
908
  headers = {'Accept': 'application/json', }
861
909
 
862
910
  while True:
863
- json = self._api.do('GET',
864
- f'/api/2.0/preview/apps/{app_name}/deployments',
865
- query=query,
866
- headers=headers)
911
+ json = self._api.do('GET', f'/api/2.0/apps/{app_name}/deployments', query=query, headers=headers)
867
912
  if 'app_deployments' in json:
868
913
  for v in json['app_deployments']:
869
914
  yield AppDeployment.from_dict(v)
@@ -894,7 +939,7 @@ class AppsAPI:
894
939
  res = self._api.do('PUT', f'/api/2.0/permissions/apps/{app_name}', body=body, headers=headers)
895
940
  return AppPermissions.from_dict(res)
896
941
 
897
- def start(self, name: str) -> Wait[AppDeployment]:
942
+ def start(self, name: str) -> Wait[App]:
898
943
  """Start an app.
899
944
 
900
945
  Start the last active deployment of the app in the workspace.
@@ -903,22 +948,19 @@ class AppsAPI:
903
948
  The name of the app.
904
949
 
905
950
  :returns:
906
- Long-running operation waiter for :class:`AppDeployment`.
907
- See :method:wait_get_deployment_app_succeeded for more details.
951
+ Long-running operation waiter for :class:`App`.
952
+ See :method:wait_get_app_active for more details.
908
953
  """
909
954
 
910
955
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
911
956
 
912
- op_response = self._api.do('POST', f'/api/2.0/preview/apps/{name}/start', headers=headers)
913
- return Wait(self.wait_get_deployment_app_succeeded,
914
- response=AppDeployment.from_dict(op_response),
915
- app_name=name,
916
- deployment_id=op_response['deployment_id'])
957
+ op_response = self._api.do('POST', f'/api/2.0/apps/{name}/start', headers=headers)
958
+ return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response['name'])
917
959
 
918
- def start_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> AppDeployment:
960
+ def start_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
919
961
  return self.start(name=name).result(timeout=timeout)
920
962
 
921
- def stop(self, name: str):
963
+ def stop(self, name: str) -> Wait[App]:
922
964
  """Stop an app.
923
965
 
924
966
  Stops the active deployment of the app in the workspace.
@@ -926,12 +968,18 @@ class AppsAPI:
926
968
  :param name: str
927
969
  The name of the app.
928
970
 
929
-
971
+ :returns:
972
+ Long-running operation waiter for :class:`App`.
973
+ See :method:wait_get_app_stopped for more details.
930
974
  """
931
975
 
932
976
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
933
977
 
934
- self._api.do('POST', f'/api/2.0/preview/apps/{name}/stop', headers=headers)
978
+ op_response = self._api.do('POST', f'/api/2.0/apps/{name}/stop', headers=headers)
979
+ return Wait(self.wait_get_app_stopped, response=App.from_dict(op_response), name=op_response['name'])
980
+
981
+ def stop_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
982
+ return self.stop(name=name).result(timeout=timeout)
935
983
 
936
984
  def update(self, name: str, *, description: Optional[str] = None) -> App:
937
985
  """Update an app.
@@ -950,7 +998,7 @@ class AppsAPI:
950
998
  if description is not None: body['description'] = description
951
999
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
952
1000
 
953
- res = self._api.do('PATCH', f'/api/2.0/preview/apps/{name}', body=body, headers=headers)
1001
+ res = self._api.do('PATCH', f'/api/2.0/apps/{name}', body=body, headers=headers)
954
1002
  return App.from_dict(res)
955
1003
 
956
1004
  def update_permissions(