databricks-sdk 0.44.1__py3-none-any.whl → 0.46.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 (63) hide show
  1. databricks/sdk/__init__.py +135 -116
  2. databricks/sdk/_base_client.py +112 -88
  3. databricks/sdk/_property.py +12 -7
  4. databricks/sdk/_widgets/__init__.py +13 -2
  5. databricks/sdk/_widgets/default_widgets_utils.py +21 -15
  6. databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
  7. databricks/sdk/azure.py +8 -6
  8. databricks/sdk/casing.py +5 -5
  9. databricks/sdk/config.py +156 -99
  10. databricks/sdk/core.py +57 -47
  11. databricks/sdk/credentials_provider.py +306 -206
  12. databricks/sdk/data_plane.py +75 -50
  13. databricks/sdk/dbutils.py +123 -87
  14. databricks/sdk/environments.py +52 -35
  15. databricks/sdk/errors/base.py +61 -35
  16. databricks/sdk/errors/customizer.py +3 -3
  17. databricks/sdk/errors/deserializer.py +38 -25
  18. databricks/sdk/errors/details.py +417 -0
  19. databricks/sdk/errors/mapper.py +1 -1
  20. databricks/sdk/errors/overrides.py +27 -24
  21. databricks/sdk/errors/parser.py +26 -14
  22. databricks/sdk/errors/platform.py +10 -10
  23. databricks/sdk/errors/private_link.py +24 -24
  24. databricks/sdk/logger/round_trip_logger.py +28 -20
  25. databricks/sdk/mixins/compute.py +90 -60
  26. databricks/sdk/mixins/files.py +815 -145
  27. databricks/sdk/mixins/jobs.py +191 -16
  28. databricks/sdk/mixins/open_ai_client.py +26 -20
  29. databricks/sdk/mixins/workspace.py +45 -34
  30. databricks/sdk/oauth.py +379 -198
  31. databricks/sdk/retries.py +14 -12
  32. databricks/sdk/runtime/__init__.py +34 -17
  33. databricks/sdk/runtime/dbutils_stub.py +52 -39
  34. databricks/sdk/service/_internal.py +12 -7
  35. databricks/sdk/service/apps.py +618 -418
  36. databricks/sdk/service/billing.py +827 -604
  37. databricks/sdk/service/catalog.py +6552 -4474
  38. databricks/sdk/service/cleanrooms.py +550 -388
  39. databricks/sdk/service/compute.py +5263 -3536
  40. databricks/sdk/service/dashboards.py +1331 -924
  41. databricks/sdk/service/files.py +446 -309
  42. databricks/sdk/service/iam.py +2115 -1483
  43. databricks/sdk/service/jobs.py +4151 -2588
  44. databricks/sdk/service/marketplace.py +2210 -1517
  45. databricks/sdk/service/ml.py +3839 -2256
  46. databricks/sdk/service/oauth2.py +910 -584
  47. databricks/sdk/service/pipelines.py +1865 -1203
  48. databricks/sdk/service/provisioning.py +1435 -1029
  49. databricks/sdk/service/serving.py +2060 -1290
  50. databricks/sdk/service/settings.py +2846 -1929
  51. databricks/sdk/service/sharing.py +2201 -877
  52. databricks/sdk/service/sql.py +4650 -3103
  53. databricks/sdk/service/vectorsearch.py +816 -550
  54. databricks/sdk/service/workspace.py +1330 -906
  55. databricks/sdk/useragent.py +36 -22
  56. databricks/sdk/version.py +1 -1
  57. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/METADATA +31 -31
  58. databricks_sdk-0.46.0.dist-info/RECORD +70 -0
  59. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/WHEEL +1 -1
  60. databricks_sdk-0.44.1.dist-info/RECORD +0 -69
  61. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/LICENSE +0 -0
  62. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/NOTICE +0 -0
  63. {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.46.0.dist-info}/top_level.txt +0 -0
@@ -8,12 +8,13 @@ import time
8
8
  from dataclasses import dataclass
9
9
  from datetime import timedelta
10
10
  from enum import Enum
11
- from typing import Callable, Dict, Iterator, List, Optional
11
+ from typing import Any, Callable, Dict, Iterator, List, Optional
12
12
 
13
13
  from ..errors import OperationFailed
14
14
  from ._internal import Wait, _enum, _from_dict, _repeated_dict
15
15
 
16
- _LOG = logging.getLogger('databricks.sdk')
16
+ _LOG = logging.getLogger("databricks.sdk")
17
+
17
18
 
18
19
  # all definitions in this file are in alphabetical order
19
20
 
@@ -30,6 +31,8 @@ class App:
30
31
 
31
32
  app_status: Optional[ApplicationStatus] = None
32
33
 
34
+ budget_policy_id: Optional[str] = None
35
+
33
36
  compute_status: Optional[ComputeStatus] = None
34
37
 
35
38
  create_time: Optional[str] = None
@@ -45,6 +48,8 @@ class App:
45
48
  description: Optional[str] = None
46
49
  """The description of the app."""
47
50
 
51
+ effective_budget_policy_id: Optional[str] = None
52
+
48
53
  id: Optional[str] = None
49
54
  """The unique identifier of the app."""
50
55
 
@@ -73,73 +78,113 @@ class App:
73
78
  def as_dict(self) -> dict:
74
79
  """Serializes the App into a dictionary suitable for use as a JSON request body."""
75
80
  body = {}
76
- if self.active_deployment: body['active_deployment'] = self.active_deployment.as_dict()
77
- if self.app_status: body['app_status'] = self.app_status.as_dict()
78
- if self.compute_status: body['compute_status'] = self.compute_status.as_dict()
79
- if self.create_time is not None: body['create_time'] = self.create_time
80
- if self.creator is not None: body['creator'] = self.creator
81
+ if self.active_deployment:
82
+ body["active_deployment"] = self.active_deployment.as_dict()
83
+ if self.app_status:
84
+ body["app_status"] = self.app_status.as_dict()
85
+ if self.budget_policy_id is not None:
86
+ body["budget_policy_id"] = self.budget_policy_id
87
+ if self.compute_status:
88
+ body["compute_status"] = self.compute_status.as_dict()
89
+ if self.create_time is not None:
90
+ body["create_time"] = self.create_time
91
+ if self.creator is not None:
92
+ body["creator"] = self.creator
81
93
  if self.default_source_code_path is not None:
82
- body['default_source_code_path'] = self.default_source_code_path
83
- if self.description is not None: body['description'] = self.description
84
- if self.id is not None: body['id'] = self.id
85
- if self.name is not None: body['name'] = self.name
86
- if self.pending_deployment: body['pending_deployment'] = self.pending_deployment.as_dict()
87
- if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
94
+ body["default_source_code_path"] = self.default_source_code_path
95
+ if self.description is not None:
96
+ body["description"] = self.description
97
+ if self.effective_budget_policy_id is not None:
98
+ body["effective_budget_policy_id"] = self.effective_budget_policy_id
99
+ if self.id is not None:
100
+ body["id"] = self.id
101
+ if self.name is not None:
102
+ body["name"] = self.name
103
+ if self.pending_deployment:
104
+ body["pending_deployment"] = self.pending_deployment.as_dict()
105
+ if self.resources:
106
+ body["resources"] = [v.as_dict() for v in self.resources]
88
107
  if self.service_principal_client_id is not None:
89
- body['service_principal_client_id'] = self.service_principal_client_id
90
- if self.service_principal_id is not None: body['service_principal_id'] = self.service_principal_id
108
+ body["service_principal_client_id"] = self.service_principal_client_id
109
+ if self.service_principal_id is not None:
110
+ body["service_principal_id"] = self.service_principal_id
91
111
  if self.service_principal_name is not None:
92
- body['service_principal_name'] = self.service_principal_name
93
- if self.update_time is not None: body['update_time'] = self.update_time
94
- if self.updater is not None: body['updater'] = self.updater
95
- if self.url is not None: body['url'] = self.url
112
+ body["service_principal_name"] = self.service_principal_name
113
+ if self.update_time is not None:
114
+ body["update_time"] = self.update_time
115
+ if self.updater is not None:
116
+ body["updater"] = self.updater
117
+ if self.url is not None:
118
+ body["url"] = self.url
96
119
  return body
97
120
 
98
121
  def as_shallow_dict(self) -> dict:
99
122
  """Serializes the App into a shallow dictionary of its immediate attributes."""
100
123
  body = {}
101
- if self.active_deployment: body['active_deployment'] = self.active_deployment
102
- if self.app_status: body['app_status'] = self.app_status
103
- if self.compute_status: body['compute_status'] = self.compute_status
104
- if self.create_time is not None: body['create_time'] = self.create_time
105
- if self.creator is not None: body['creator'] = self.creator
124
+ if self.active_deployment:
125
+ body["active_deployment"] = self.active_deployment
126
+ if self.app_status:
127
+ body["app_status"] = self.app_status
128
+ if self.budget_policy_id is not None:
129
+ body["budget_policy_id"] = self.budget_policy_id
130
+ if self.compute_status:
131
+ body["compute_status"] = self.compute_status
132
+ if self.create_time is not None:
133
+ body["create_time"] = self.create_time
134
+ if self.creator is not None:
135
+ body["creator"] = self.creator
106
136
  if self.default_source_code_path is not None:
107
- body['default_source_code_path'] = self.default_source_code_path
108
- if self.description is not None: body['description'] = self.description
109
- if self.id is not None: body['id'] = self.id
110
- if self.name is not None: body['name'] = self.name
111
- if self.pending_deployment: body['pending_deployment'] = self.pending_deployment
112
- if self.resources: body['resources'] = self.resources
137
+ body["default_source_code_path"] = self.default_source_code_path
138
+ if self.description is not None:
139
+ body["description"] = self.description
140
+ if self.effective_budget_policy_id is not None:
141
+ body["effective_budget_policy_id"] = self.effective_budget_policy_id
142
+ if self.id is not None:
143
+ body["id"] = self.id
144
+ if self.name is not None:
145
+ body["name"] = self.name
146
+ if self.pending_deployment:
147
+ body["pending_deployment"] = self.pending_deployment
148
+ if self.resources:
149
+ body["resources"] = self.resources
113
150
  if self.service_principal_client_id is not None:
114
- body['service_principal_client_id'] = self.service_principal_client_id
115
- if self.service_principal_id is not None: body['service_principal_id'] = self.service_principal_id
151
+ body["service_principal_client_id"] = self.service_principal_client_id
152
+ if self.service_principal_id is not None:
153
+ body["service_principal_id"] = self.service_principal_id
116
154
  if self.service_principal_name is not None:
117
- body['service_principal_name'] = self.service_principal_name
118
- if self.update_time is not None: body['update_time'] = self.update_time
119
- if self.updater is not None: body['updater'] = self.updater
120
- if self.url is not None: body['url'] = self.url
155
+ body["service_principal_name"] = self.service_principal_name
156
+ if self.update_time is not None:
157
+ body["update_time"] = self.update_time
158
+ if self.updater is not None:
159
+ body["updater"] = self.updater
160
+ if self.url is not None:
161
+ body["url"] = self.url
121
162
  return body
122
163
 
123
164
  @classmethod
124
- def from_dict(cls, d: Dict[str, any]) -> App:
165
+ def from_dict(cls, d: Dict[str, Any]) -> App:
125
166
  """Deserializes the App from a dictionary."""
126
- return cls(active_deployment=_from_dict(d, 'active_deployment', AppDeployment),
127
- app_status=_from_dict(d, 'app_status', ApplicationStatus),
128
- compute_status=_from_dict(d, 'compute_status', ComputeStatus),
129
- create_time=d.get('create_time', None),
130
- creator=d.get('creator', None),
131
- default_source_code_path=d.get('default_source_code_path', None),
132
- description=d.get('description', None),
133
- id=d.get('id', None),
134
- name=d.get('name', None),
135
- pending_deployment=_from_dict(d, 'pending_deployment', AppDeployment),
136
- resources=_repeated_dict(d, 'resources', AppResource),
137
- service_principal_client_id=d.get('service_principal_client_id', None),
138
- service_principal_id=d.get('service_principal_id', None),
139
- service_principal_name=d.get('service_principal_name', None),
140
- update_time=d.get('update_time', None),
141
- updater=d.get('updater', None),
142
- url=d.get('url', None))
167
+ return cls(
168
+ active_deployment=_from_dict(d, "active_deployment", AppDeployment),
169
+ app_status=_from_dict(d, "app_status", ApplicationStatus),
170
+ budget_policy_id=d.get("budget_policy_id", None),
171
+ compute_status=_from_dict(d, "compute_status", ComputeStatus),
172
+ create_time=d.get("create_time", None),
173
+ creator=d.get("creator", None),
174
+ default_source_code_path=d.get("default_source_code_path", None),
175
+ description=d.get("description", None),
176
+ effective_budget_policy_id=d.get("effective_budget_policy_id", None),
177
+ id=d.get("id", None),
178
+ name=d.get("name", None),
179
+ pending_deployment=_from_dict(d, "pending_deployment", AppDeployment),
180
+ resources=_repeated_dict(d, "resources", AppResource),
181
+ service_principal_client_id=d.get("service_principal_client_id", None),
182
+ service_principal_id=d.get("service_principal_id", None),
183
+ service_principal_name=d.get("service_principal_name", None),
184
+ update_time=d.get("update_time", None),
185
+ updater=d.get("updater", None),
186
+ url=d.get("url", None),
187
+ )
143
188
 
144
189
 
145
190
  @dataclass
@@ -159,30 +204,38 @@ class AppAccessControlRequest:
159
204
  def as_dict(self) -> dict:
160
205
  """Serializes the AppAccessControlRequest into a dictionary suitable for use as a JSON request body."""
161
206
  body = {}
162
- if self.group_name is not None: body['group_name'] = self.group_name
163
- if self.permission_level is not None: body['permission_level'] = self.permission_level.value
207
+ if self.group_name is not None:
208
+ body["group_name"] = self.group_name
209
+ if self.permission_level is not None:
210
+ body["permission_level"] = self.permission_level.value
164
211
  if self.service_principal_name is not None:
165
- body['service_principal_name'] = self.service_principal_name
166
- if self.user_name is not None: body['user_name'] = self.user_name
212
+ body["service_principal_name"] = self.service_principal_name
213
+ if self.user_name is not None:
214
+ body["user_name"] = self.user_name
167
215
  return body
168
216
 
169
217
  def as_shallow_dict(self) -> dict:
170
218
  """Serializes the AppAccessControlRequest into a shallow dictionary of its immediate attributes."""
171
219
  body = {}
172
- if self.group_name is not None: body['group_name'] = self.group_name
173
- if self.permission_level is not None: body['permission_level'] = self.permission_level
220
+ if self.group_name is not None:
221
+ body["group_name"] = self.group_name
222
+ if self.permission_level is not None:
223
+ body["permission_level"] = self.permission_level
174
224
  if self.service_principal_name is not None:
175
- body['service_principal_name'] = self.service_principal_name
176
- if self.user_name is not None: body['user_name'] = self.user_name
225
+ body["service_principal_name"] = self.service_principal_name
226
+ if self.user_name is not None:
227
+ body["user_name"] = self.user_name
177
228
  return body
178
229
 
179
230
  @classmethod
180
- def from_dict(cls, d: Dict[str, any]) -> AppAccessControlRequest:
231
+ def from_dict(cls, d: Dict[str, Any]) -> AppAccessControlRequest:
181
232
  """Deserializes the AppAccessControlRequest from a dictionary."""
182
- return cls(group_name=d.get('group_name', None),
183
- permission_level=_enum(d, 'permission_level', AppPermissionLevel),
184
- service_principal_name=d.get('service_principal_name', None),
185
- user_name=d.get('user_name', None))
233
+ return cls(
234
+ group_name=d.get("group_name", None),
235
+ permission_level=_enum(d, "permission_level", AppPermissionLevel),
236
+ service_principal_name=d.get("service_principal_name", None),
237
+ user_name=d.get("user_name", None),
238
+ )
186
239
 
187
240
 
188
241
  @dataclass
@@ -205,33 +258,43 @@ class AppAccessControlResponse:
205
258
  def as_dict(self) -> dict:
206
259
  """Serializes the AppAccessControlResponse into a dictionary suitable for use as a JSON request body."""
207
260
  body = {}
208
- if self.all_permissions: body['all_permissions'] = [v.as_dict() for v in self.all_permissions]
209
- if self.display_name is not None: body['display_name'] = self.display_name
210
- if self.group_name is not None: body['group_name'] = self.group_name
261
+ if self.all_permissions:
262
+ body["all_permissions"] = [v.as_dict() for v in self.all_permissions]
263
+ if self.display_name is not None:
264
+ body["display_name"] = self.display_name
265
+ if self.group_name is not None:
266
+ body["group_name"] = self.group_name
211
267
  if self.service_principal_name is not None:
212
- body['service_principal_name'] = self.service_principal_name
213
- if self.user_name is not None: body['user_name'] = self.user_name
268
+ body["service_principal_name"] = self.service_principal_name
269
+ if self.user_name is not None:
270
+ body["user_name"] = self.user_name
214
271
  return body
215
272
 
216
273
  def as_shallow_dict(self) -> dict:
217
274
  """Serializes the AppAccessControlResponse into a shallow dictionary of its immediate attributes."""
218
275
  body = {}
219
- if self.all_permissions: body['all_permissions'] = self.all_permissions
220
- if self.display_name is not None: body['display_name'] = self.display_name
221
- if self.group_name is not None: body['group_name'] = self.group_name
276
+ if self.all_permissions:
277
+ body["all_permissions"] = self.all_permissions
278
+ if self.display_name is not None:
279
+ body["display_name"] = self.display_name
280
+ if self.group_name is not None:
281
+ body["group_name"] = self.group_name
222
282
  if self.service_principal_name is not None:
223
- body['service_principal_name'] = self.service_principal_name
224
- if self.user_name is not None: body['user_name'] = self.user_name
283
+ body["service_principal_name"] = self.service_principal_name
284
+ if self.user_name is not None:
285
+ body["user_name"] = self.user_name
225
286
  return body
226
287
 
227
288
  @classmethod
228
- def from_dict(cls, d: Dict[str, any]) -> AppAccessControlResponse:
289
+ def from_dict(cls, d: Dict[str, Any]) -> AppAccessControlResponse:
229
290
  """Deserializes the AppAccessControlResponse from a dictionary."""
230
- return cls(all_permissions=_repeated_dict(d, 'all_permissions', AppPermission),
231
- display_name=d.get('display_name', None),
232
- group_name=d.get('group_name', None),
233
- service_principal_name=d.get('service_principal_name', None),
234
- user_name=d.get('user_name', None))
291
+ return cls(
292
+ all_permissions=_repeated_dict(d, "all_permissions", AppPermission),
293
+ display_name=d.get("display_name", None),
294
+ group_name=d.get("group_name", None),
295
+ service_principal_name=d.get("service_principal_name", None),
296
+ user_name=d.get("user_name", None),
297
+ )
235
298
 
236
299
 
237
300
  @dataclass
@@ -267,40 +330,58 @@ class AppDeployment:
267
330
  def as_dict(self) -> dict:
268
331
  """Serializes the AppDeployment into a dictionary suitable for use as a JSON request body."""
269
332
  body = {}
270
- if self.create_time is not None: body['create_time'] = self.create_time
271
- if self.creator is not None: body['creator'] = self.creator
272
- if self.deployment_artifacts: body['deployment_artifacts'] = self.deployment_artifacts.as_dict()
273
- if self.deployment_id is not None: body['deployment_id'] = self.deployment_id
274
- if self.mode is not None: body['mode'] = self.mode.value
275
- if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
276
- if self.status: body['status'] = self.status.as_dict()
277
- if self.update_time is not None: body['update_time'] = self.update_time
333
+ if self.create_time is not None:
334
+ body["create_time"] = self.create_time
335
+ if self.creator is not None:
336
+ body["creator"] = self.creator
337
+ if self.deployment_artifacts:
338
+ body["deployment_artifacts"] = self.deployment_artifacts.as_dict()
339
+ if self.deployment_id is not None:
340
+ body["deployment_id"] = self.deployment_id
341
+ if self.mode is not None:
342
+ body["mode"] = self.mode.value
343
+ if self.source_code_path is not None:
344
+ body["source_code_path"] = self.source_code_path
345
+ if self.status:
346
+ body["status"] = self.status.as_dict()
347
+ if self.update_time is not None:
348
+ body["update_time"] = self.update_time
278
349
  return body
279
350
 
280
351
  def as_shallow_dict(self) -> dict:
281
352
  """Serializes the AppDeployment into a shallow dictionary of its immediate attributes."""
282
353
  body = {}
283
- if self.create_time is not None: body['create_time'] = self.create_time
284
- if self.creator is not None: body['creator'] = self.creator
285
- if self.deployment_artifacts: body['deployment_artifacts'] = self.deployment_artifacts
286
- if self.deployment_id is not None: body['deployment_id'] = self.deployment_id
287
- if self.mode is not None: body['mode'] = self.mode
288
- if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
289
- if self.status: body['status'] = self.status
290
- if self.update_time is not None: body['update_time'] = self.update_time
354
+ if self.create_time is not None:
355
+ body["create_time"] = self.create_time
356
+ if self.creator is not None:
357
+ body["creator"] = self.creator
358
+ if self.deployment_artifacts:
359
+ body["deployment_artifacts"] = self.deployment_artifacts
360
+ if self.deployment_id is not None:
361
+ body["deployment_id"] = self.deployment_id
362
+ if self.mode is not None:
363
+ body["mode"] = self.mode
364
+ if self.source_code_path is not None:
365
+ body["source_code_path"] = self.source_code_path
366
+ if self.status:
367
+ body["status"] = self.status
368
+ if self.update_time is not None:
369
+ body["update_time"] = self.update_time
291
370
  return body
292
371
 
293
372
  @classmethod
294
- def from_dict(cls, d: Dict[str, any]) -> AppDeployment:
373
+ def from_dict(cls, d: Dict[str, Any]) -> AppDeployment:
295
374
  """Deserializes the AppDeployment from a dictionary."""
296
- return cls(create_time=d.get('create_time', None),
297
- creator=d.get('creator', None),
298
- deployment_artifacts=_from_dict(d, 'deployment_artifacts', AppDeploymentArtifacts),
299
- deployment_id=d.get('deployment_id', None),
300
- mode=_enum(d, 'mode', AppDeploymentMode),
301
- source_code_path=d.get('source_code_path', None),
302
- status=_from_dict(d, 'status', AppDeploymentStatus),
303
- update_time=d.get('update_time', None))
375
+ return cls(
376
+ create_time=d.get("create_time", None),
377
+ creator=d.get("creator", None),
378
+ deployment_artifacts=_from_dict(d, "deployment_artifacts", AppDeploymentArtifacts),
379
+ deployment_id=d.get("deployment_id", None),
380
+ mode=_enum(d, "mode", AppDeploymentMode),
381
+ source_code_path=d.get("source_code_path", None),
382
+ status=_from_dict(d, "status", AppDeploymentStatus),
383
+ update_time=d.get("update_time", None),
384
+ )
304
385
 
305
386
 
306
387
  @dataclass
@@ -311,33 +392,35 @@ class AppDeploymentArtifacts:
311
392
  def as_dict(self) -> dict:
312
393
  """Serializes the AppDeploymentArtifacts into a dictionary suitable for use as a JSON request body."""
313
394
  body = {}
314
- if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
395
+ if self.source_code_path is not None:
396
+ body["source_code_path"] = self.source_code_path
315
397
  return body
316
398
 
317
399
  def as_shallow_dict(self) -> dict:
318
400
  """Serializes the AppDeploymentArtifacts into a shallow dictionary of its immediate attributes."""
319
401
  body = {}
320
- if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
402
+ if self.source_code_path is not None:
403
+ body["source_code_path"] = self.source_code_path
321
404
  return body
322
405
 
323
406
  @classmethod
324
- def from_dict(cls, d: Dict[str, any]) -> AppDeploymentArtifacts:
407
+ def from_dict(cls, d: Dict[str, Any]) -> AppDeploymentArtifacts:
325
408
  """Deserializes the AppDeploymentArtifacts from a dictionary."""
326
- return cls(source_code_path=d.get('source_code_path', None))
409
+ return cls(source_code_path=d.get("source_code_path", None))
327
410
 
328
411
 
329
412
  class AppDeploymentMode(Enum):
330
413
 
331
- AUTO_SYNC = 'AUTO_SYNC'
332
- SNAPSHOT = 'SNAPSHOT'
414
+ AUTO_SYNC = "AUTO_SYNC"
415
+ SNAPSHOT = "SNAPSHOT"
333
416
 
334
417
 
335
418
  class AppDeploymentState(Enum):
336
419
 
337
- CANCELLED = 'CANCELLED'
338
- FAILED = 'FAILED'
339
- IN_PROGRESS = 'IN_PROGRESS'
340
- SUCCEEDED = 'SUCCEEDED'
420
+ CANCELLED = "CANCELLED"
421
+ FAILED = "FAILED"
422
+ IN_PROGRESS = "IN_PROGRESS"
423
+ SUCCEEDED = "SUCCEEDED"
341
424
 
342
425
 
343
426
  @dataclass
@@ -351,21 +434,25 @@ class AppDeploymentStatus:
351
434
  def as_dict(self) -> dict:
352
435
  """Serializes the AppDeploymentStatus into a dictionary suitable for use as a JSON request body."""
353
436
  body = {}
354
- if self.message is not None: body['message'] = self.message
355
- if self.state is not None: body['state'] = self.state.value
437
+ if self.message is not None:
438
+ body["message"] = self.message
439
+ if self.state is not None:
440
+ body["state"] = self.state.value
356
441
  return body
357
442
 
358
443
  def as_shallow_dict(self) -> dict:
359
444
  """Serializes the AppDeploymentStatus into a shallow dictionary of its immediate attributes."""
360
445
  body = {}
361
- if self.message is not None: body['message'] = self.message
362
- if self.state is not None: body['state'] = self.state
446
+ if self.message is not None:
447
+ body["message"] = self.message
448
+ if self.state is not None:
449
+ body["state"] = self.state
363
450
  return body
364
451
 
365
452
  @classmethod
366
- def from_dict(cls, d: Dict[str, any]) -> AppDeploymentStatus:
453
+ def from_dict(cls, d: Dict[str, Any]) -> AppDeploymentStatus:
367
454
  """Deserializes the AppDeploymentStatus from a dictionary."""
368
- return cls(message=d.get('message', None), state=_enum(d, 'state', AppDeploymentState))
455
+ return cls(message=d.get("message", None), state=_enum(d, "state", AppDeploymentState))
369
456
 
370
457
 
371
458
  @dataclass
@@ -380,32 +467,40 @@ class AppPermission:
380
467
  def as_dict(self) -> dict:
381
468
  """Serializes the AppPermission into a dictionary suitable for use as a JSON request body."""
382
469
  body = {}
383
- if self.inherited is not None: body['inherited'] = self.inherited
384
- if self.inherited_from_object: body['inherited_from_object'] = [v for v in self.inherited_from_object]
385
- if self.permission_level is not None: body['permission_level'] = self.permission_level.value
470
+ if self.inherited is not None:
471
+ body["inherited"] = self.inherited
472
+ if self.inherited_from_object:
473
+ body["inherited_from_object"] = [v for v in self.inherited_from_object]
474
+ if self.permission_level is not None:
475
+ body["permission_level"] = self.permission_level.value
386
476
  return body
387
477
 
388
478
  def as_shallow_dict(self) -> dict:
389
479
  """Serializes the AppPermission into a shallow dictionary of its immediate attributes."""
390
480
  body = {}
391
- if self.inherited is not None: body['inherited'] = self.inherited
392
- if self.inherited_from_object: body['inherited_from_object'] = self.inherited_from_object
393
- if self.permission_level is not None: body['permission_level'] = self.permission_level
481
+ if self.inherited is not None:
482
+ body["inherited"] = self.inherited
483
+ if self.inherited_from_object:
484
+ body["inherited_from_object"] = self.inherited_from_object
485
+ if self.permission_level is not None:
486
+ body["permission_level"] = self.permission_level
394
487
  return body
395
488
 
396
489
  @classmethod
397
- def from_dict(cls, d: Dict[str, any]) -> AppPermission:
490
+ def from_dict(cls, d: Dict[str, Any]) -> AppPermission:
398
491
  """Deserializes the AppPermission from a dictionary."""
399
- return cls(inherited=d.get('inherited', None),
400
- inherited_from_object=d.get('inherited_from_object', None),
401
- permission_level=_enum(d, 'permission_level', AppPermissionLevel))
492
+ return cls(
493
+ inherited=d.get("inherited", None),
494
+ inherited_from_object=d.get("inherited_from_object", None),
495
+ permission_level=_enum(d, "permission_level", AppPermissionLevel),
496
+ )
402
497
 
403
498
 
404
499
  class AppPermissionLevel(Enum):
405
500
  """Permission level"""
406
501
 
407
- CAN_MANAGE = 'CAN_MANAGE'
408
- CAN_USE = 'CAN_USE'
502
+ CAN_MANAGE = "CAN_MANAGE"
503
+ CAN_USE = "CAN_USE"
409
504
 
410
505
 
411
506
  @dataclass
@@ -420,25 +515,32 @@ class AppPermissions:
420
515
  """Serializes the AppPermissions into a dictionary suitable for use as a JSON request body."""
421
516
  body = {}
422
517
  if self.access_control_list:
423
- body['access_control_list'] = [v.as_dict() for v in self.access_control_list]
424
- if self.object_id is not None: body['object_id'] = self.object_id
425
- if self.object_type is not None: body['object_type'] = self.object_type
518
+ body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
519
+ if self.object_id is not None:
520
+ body["object_id"] = self.object_id
521
+ if self.object_type is not None:
522
+ body["object_type"] = self.object_type
426
523
  return body
427
524
 
428
525
  def as_shallow_dict(self) -> dict:
429
526
  """Serializes the AppPermissions into a shallow dictionary of its immediate attributes."""
430
527
  body = {}
431
- if self.access_control_list: body['access_control_list'] = self.access_control_list
432
- if self.object_id is not None: body['object_id'] = self.object_id
433
- if self.object_type is not None: body['object_type'] = self.object_type
528
+ if self.access_control_list:
529
+ body["access_control_list"] = self.access_control_list
530
+ if self.object_id is not None:
531
+ body["object_id"] = self.object_id
532
+ if self.object_type is not None:
533
+ body["object_type"] = self.object_type
434
534
  return body
435
535
 
436
536
  @classmethod
437
- def from_dict(cls, d: Dict[str, any]) -> AppPermissions:
537
+ def from_dict(cls, d: Dict[str, Any]) -> AppPermissions:
438
538
  """Deserializes the AppPermissions from a dictionary."""
439
- return cls(access_control_list=_repeated_dict(d, 'access_control_list', AppAccessControlResponse),
440
- object_id=d.get('object_id', None),
441
- object_type=d.get('object_type', None))
539
+ return cls(
540
+ access_control_list=_repeated_dict(d, "access_control_list", AppAccessControlResponse),
541
+ object_id=d.get("object_id", None),
542
+ object_type=d.get("object_type", None),
543
+ )
442
544
 
443
545
 
444
546
  @dataclass
@@ -451,22 +553,27 @@ class AppPermissionsDescription:
451
553
  def as_dict(self) -> dict:
452
554
  """Serializes the AppPermissionsDescription into a dictionary suitable for use as a JSON request body."""
453
555
  body = {}
454
- if self.description is not None: body['description'] = self.description
455
- if self.permission_level is not None: body['permission_level'] = self.permission_level.value
556
+ if self.description is not None:
557
+ body["description"] = self.description
558
+ if self.permission_level is not None:
559
+ body["permission_level"] = self.permission_level.value
456
560
  return body
457
561
 
458
562
  def as_shallow_dict(self) -> dict:
459
563
  """Serializes the AppPermissionsDescription into a shallow dictionary of its immediate attributes."""
460
564
  body = {}
461
- if self.description is not None: body['description'] = self.description
462
- if self.permission_level is not None: body['permission_level'] = self.permission_level
565
+ if self.description is not None:
566
+ body["description"] = self.description
567
+ if self.permission_level is not None:
568
+ body["permission_level"] = self.permission_level
463
569
  return body
464
570
 
465
571
  @classmethod
466
- def from_dict(cls, d: Dict[str, any]) -> AppPermissionsDescription:
572
+ def from_dict(cls, d: Dict[str, Any]) -> AppPermissionsDescription:
467
573
  """Deserializes the AppPermissionsDescription from a dictionary."""
468
- return cls(description=d.get('description', None),
469
- permission_level=_enum(d, 'permission_level', AppPermissionLevel))
574
+ return cls(
575
+ description=d.get("description", None), permission_level=_enum(d, "permission_level", AppPermissionLevel)
576
+ )
470
577
 
471
578
 
472
579
  @dataclass
@@ -480,22 +587,27 @@ class AppPermissionsRequest:
480
587
  """Serializes the AppPermissionsRequest into a dictionary suitable for use as a JSON request body."""
481
588
  body = {}
482
589
  if self.access_control_list:
483
- body['access_control_list'] = [v.as_dict() for v in self.access_control_list]
484
- if self.app_name is not None: body['app_name'] = self.app_name
590
+ body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
591
+ if self.app_name is not None:
592
+ body["app_name"] = self.app_name
485
593
  return body
486
594
 
487
595
  def as_shallow_dict(self) -> dict:
488
596
  """Serializes the AppPermissionsRequest into a shallow dictionary of its immediate attributes."""
489
597
  body = {}
490
- if self.access_control_list: body['access_control_list'] = self.access_control_list
491
- if self.app_name is not None: body['app_name'] = self.app_name
598
+ if self.access_control_list:
599
+ body["access_control_list"] = self.access_control_list
600
+ if self.app_name is not None:
601
+ body["app_name"] = self.app_name
492
602
  return body
493
603
 
494
604
  @classmethod
495
- def from_dict(cls, d: Dict[str, any]) -> AppPermissionsRequest:
605
+ def from_dict(cls, d: Dict[str, Any]) -> AppPermissionsRequest:
496
606
  """Deserializes the AppPermissionsRequest from a dictionary."""
497
- return cls(access_control_list=_repeated_dict(d, 'access_control_list', AppAccessControlRequest),
498
- app_name=d.get('app_name', None))
607
+ return cls(
608
+ access_control_list=_repeated_dict(d, "access_control_list", AppAccessControlRequest),
609
+ app_name=d.get("app_name", None),
610
+ )
499
611
 
500
612
 
501
613
  @dataclass
@@ -517,34 +629,48 @@ class AppResource:
517
629
  def as_dict(self) -> dict:
518
630
  """Serializes the AppResource into a dictionary suitable for use as a JSON request body."""
519
631
  body = {}
520
- if self.description is not None: body['description'] = self.description
521
- if self.job: body['job'] = self.job.as_dict()
522
- if self.name is not None: body['name'] = self.name
523
- if self.secret: body['secret'] = self.secret.as_dict()
524
- if self.serving_endpoint: body['serving_endpoint'] = self.serving_endpoint.as_dict()
525
- if self.sql_warehouse: body['sql_warehouse'] = self.sql_warehouse.as_dict()
632
+ if self.description is not None:
633
+ body["description"] = self.description
634
+ if self.job:
635
+ body["job"] = self.job.as_dict()
636
+ if self.name is not None:
637
+ body["name"] = self.name
638
+ if self.secret:
639
+ body["secret"] = self.secret.as_dict()
640
+ if self.serving_endpoint:
641
+ body["serving_endpoint"] = self.serving_endpoint.as_dict()
642
+ if self.sql_warehouse:
643
+ body["sql_warehouse"] = self.sql_warehouse.as_dict()
526
644
  return body
527
645
 
528
646
  def as_shallow_dict(self) -> dict:
529
647
  """Serializes the AppResource into a shallow dictionary of its immediate attributes."""
530
648
  body = {}
531
- if self.description is not None: body['description'] = self.description
532
- if self.job: body['job'] = self.job
533
- if self.name is not None: body['name'] = self.name
534
- if self.secret: body['secret'] = self.secret
535
- if self.serving_endpoint: body['serving_endpoint'] = self.serving_endpoint
536
- if self.sql_warehouse: body['sql_warehouse'] = self.sql_warehouse
649
+ if self.description is not None:
650
+ body["description"] = self.description
651
+ if self.job:
652
+ body["job"] = self.job
653
+ if self.name is not None:
654
+ body["name"] = self.name
655
+ if self.secret:
656
+ body["secret"] = self.secret
657
+ if self.serving_endpoint:
658
+ body["serving_endpoint"] = self.serving_endpoint
659
+ if self.sql_warehouse:
660
+ body["sql_warehouse"] = self.sql_warehouse
537
661
  return body
538
662
 
539
663
  @classmethod
540
- def from_dict(cls, d: Dict[str, any]) -> AppResource:
664
+ def from_dict(cls, d: Dict[str, Any]) -> AppResource:
541
665
  """Deserializes the AppResource from a dictionary."""
542
- return cls(description=d.get('description', None),
543
- job=_from_dict(d, 'job', AppResourceJob),
544
- name=d.get('name', None),
545
- secret=_from_dict(d, 'secret', AppResourceSecret),
546
- serving_endpoint=_from_dict(d, 'serving_endpoint', AppResourceServingEndpoint),
547
- sql_warehouse=_from_dict(d, 'sql_warehouse', AppResourceSqlWarehouse))
666
+ return cls(
667
+ description=d.get("description", None),
668
+ job=_from_dict(d, "job", AppResourceJob),
669
+ name=d.get("name", None),
670
+ secret=_from_dict(d, "secret", AppResourceSecret),
671
+ serving_endpoint=_from_dict(d, "serving_endpoint", AppResourceServingEndpoint),
672
+ sql_warehouse=_from_dict(d, "sql_warehouse", AppResourceSqlWarehouse),
673
+ )
548
674
 
549
675
 
550
676
  @dataclass
@@ -559,29 +685,33 @@ class AppResourceJob:
559
685
  def as_dict(self) -> dict:
560
686
  """Serializes the AppResourceJob into a dictionary suitable for use as a JSON request body."""
561
687
  body = {}
562
- if self.id is not None: body['id'] = self.id
563
- if self.permission is not None: body['permission'] = self.permission.value
688
+ if self.id is not None:
689
+ body["id"] = self.id
690
+ if self.permission is not None:
691
+ body["permission"] = self.permission.value
564
692
  return body
565
693
 
566
694
  def as_shallow_dict(self) -> dict:
567
695
  """Serializes the AppResourceJob into a shallow dictionary of its immediate attributes."""
568
696
  body = {}
569
- if self.id is not None: body['id'] = self.id
570
- if self.permission is not None: body['permission'] = self.permission
697
+ if self.id is not None:
698
+ body["id"] = self.id
699
+ if self.permission is not None:
700
+ body["permission"] = self.permission
571
701
  return body
572
702
 
573
703
  @classmethod
574
- def from_dict(cls, d: Dict[str, any]) -> AppResourceJob:
704
+ def from_dict(cls, d: Dict[str, Any]) -> AppResourceJob:
575
705
  """Deserializes the AppResourceJob from a dictionary."""
576
- return cls(id=d.get('id', None), permission=_enum(d, 'permission', AppResourceJobJobPermission))
706
+ return cls(id=d.get("id", None), permission=_enum(d, "permission", AppResourceJobJobPermission))
577
707
 
578
708
 
579
709
  class AppResourceJobJobPermission(Enum):
580
710
 
581
- CAN_MANAGE = 'CAN_MANAGE'
582
- CAN_MANAGE_RUN = 'CAN_MANAGE_RUN'
583
- CAN_VIEW = 'CAN_VIEW'
584
- IS_OWNER = 'IS_OWNER'
711
+ CAN_MANAGE = "CAN_MANAGE"
712
+ CAN_MANAGE_RUN = "CAN_MANAGE_RUN"
713
+ CAN_VIEW = "CAN_VIEW"
714
+ IS_OWNER = "IS_OWNER"
585
715
 
586
716
 
587
717
  @dataclass
@@ -599,33 +729,41 @@ class AppResourceSecret:
599
729
  def as_dict(self) -> dict:
600
730
  """Serializes the AppResourceSecret into a dictionary suitable for use as a JSON request body."""
601
731
  body = {}
602
- if self.key is not None: body['key'] = self.key
603
- if self.permission is not None: body['permission'] = self.permission.value
604
- if self.scope is not None: body['scope'] = self.scope
732
+ if self.key is not None:
733
+ body["key"] = self.key
734
+ if self.permission is not None:
735
+ body["permission"] = self.permission.value
736
+ if self.scope is not None:
737
+ body["scope"] = self.scope
605
738
  return body
606
739
 
607
740
  def as_shallow_dict(self) -> dict:
608
741
  """Serializes the AppResourceSecret into a shallow dictionary of its immediate attributes."""
609
742
  body = {}
610
- if self.key is not None: body['key'] = self.key
611
- if self.permission is not None: body['permission'] = self.permission
612
- if self.scope is not None: body['scope'] = self.scope
743
+ if self.key is not None:
744
+ body["key"] = self.key
745
+ if self.permission is not None:
746
+ body["permission"] = self.permission
747
+ if self.scope is not None:
748
+ body["scope"] = self.scope
613
749
  return body
614
750
 
615
751
  @classmethod
616
- def from_dict(cls, d: Dict[str, any]) -> AppResourceSecret:
752
+ def from_dict(cls, d: Dict[str, Any]) -> AppResourceSecret:
617
753
  """Deserializes the AppResourceSecret from a dictionary."""
618
- return cls(key=d.get('key', None),
619
- permission=_enum(d, 'permission', AppResourceSecretSecretPermission),
620
- scope=d.get('scope', None))
754
+ return cls(
755
+ key=d.get("key", None),
756
+ permission=_enum(d, "permission", AppResourceSecretSecretPermission),
757
+ scope=d.get("scope", None),
758
+ )
621
759
 
622
760
 
623
761
  class AppResourceSecretSecretPermission(Enum):
624
762
  """Permission to grant on the secret scope. Supported permissions are: "READ", "WRITE", "MANAGE"."""
625
763
 
626
- MANAGE = 'MANAGE'
627
- READ = 'READ'
628
- WRITE = 'WRITE'
764
+ MANAGE = "MANAGE"
765
+ READ = "READ"
766
+ WRITE = "WRITE"
629
767
 
630
768
 
631
769
  @dataclass
@@ -640,29 +778,35 @@ class AppResourceServingEndpoint:
640
778
  def as_dict(self) -> dict:
641
779
  """Serializes the AppResourceServingEndpoint into a dictionary suitable for use as a JSON request body."""
642
780
  body = {}
643
- if self.name is not None: body['name'] = self.name
644
- if self.permission is not None: body['permission'] = self.permission.value
781
+ if self.name is not None:
782
+ body["name"] = self.name
783
+ if self.permission is not None:
784
+ body["permission"] = self.permission.value
645
785
  return body
646
786
 
647
787
  def as_shallow_dict(self) -> dict:
648
788
  """Serializes the AppResourceServingEndpoint into a shallow dictionary of its immediate attributes."""
649
789
  body = {}
650
- if self.name is not None: body['name'] = self.name
651
- if self.permission is not None: body['permission'] = self.permission
790
+ if self.name is not None:
791
+ body["name"] = self.name
792
+ if self.permission is not None:
793
+ body["permission"] = self.permission
652
794
  return body
653
795
 
654
796
  @classmethod
655
- def from_dict(cls, d: Dict[str, any]) -> AppResourceServingEndpoint:
797
+ def from_dict(cls, d: Dict[str, Any]) -> AppResourceServingEndpoint:
656
798
  """Deserializes the AppResourceServingEndpoint from a dictionary."""
657
- return cls(name=d.get('name', None),
658
- permission=_enum(d, 'permission', AppResourceServingEndpointServingEndpointPermission))
799
+ return cls(
800
+ name=d.get("name", None),
801
+ permission=_enum(d, "permission", AppResourceServingEndpointServingEndpointPermission),
802
+ )
659
803
 
660
804
 
661
805
  class AppResourceServingEndpointServingEndpointPermission(Enum):
662
806
 
663
- CAN_MANAGE = 'CAN_MANAGE'
664
- CAN_QUERY = 'CAN_QUERY'
665
- CAN_VIEW = 'CAN_VIEW'
807
+ CAN_MANAGE = "CAN_MANAGE"
808
+ CAN_QUERY = "CAN_QUERY"
809
+ CAN_VIEW = "CAN_VIEW"
666
810
 
667
811
 
668
812
  @dataclass
@@ -677,37 +821,42 @@ class AppResourceSqlWarehouse:
677
821
  def as_dict(self) -> dict:
678
822
  """Serializes the AppResourceSqlWarehouse into a dictionary suitable for use as a JSON request body."""
679
823
  body = {}
680
- if self.id is not None: body['id'] = self.id
681
- if self.permission is not None: body['permission'] = self.permission.value
824
+ if self.id is not None:
825
+ body["id"] = self.id
826
+ if self.permission is not None:
827
+ body["permission"] = self.permission.value
682
828
  return body
683
829
 
684
830
  def as_shallow_dict(self) -> dict:
685
831
  """Serializes the AppResourceSqlWarehouse into a shallow dictionary of its immediate attributes."""
686
832
  body = {}
687
- if self.id is not None: body['id'] = self.id
688
- if self.permission is not None: body['permission'] = self.permission
833
+ if self.id is not None:
834
+ body["id"] = self.id
835
+ if self.permission is not None:
836
+ body["permission"] = self.permission
689
837
  return body
690
838
 
691
839
  @classmethod
692
- def from_dict(cls, d: Dict[str, any]) -> AppResourceSqlWarehouse:
840
+ def from_dict(cls, d: Dict[str, Any]) -> AppResourceSqlWarehouse:
693
841
  """Deserializes the AppResourceSqlWarehouse from a dictionary."""
694
- return cls(id=d.get('id', None),
695
- permission=_enum(d, 'permission', AppResourceSqlWarehouseSqlWarehousePermission))
842
+ return cls(
843
+ id=d.get("id", None), permission=_enum(d, "permission", AppResourceSqlWarehouseSqlWarehousePermission)
844
+ )
696
845
 
697
846
 
698
847
  class AppResourceSqlWarehouseSqlWarehousePermission(Enum):
699
848
 
700
- CAN_MANAGE = 'CAN_MANAGE'
701
- CAN_USE = 'CAN_USE'
702
- IS_OWNER = 'IS_OWNER'
849
+ CAN_MANAGE = "CAN_MANAGE"
850
+ CAN_USE = "CAN_USE"
851
+ IS_OWNER = "IS_OWNER"
703
852
 
704
853
 
705
854
  class ApplicationState(Enum):
706
855
 
707
- CRASHED = 'CRASHED'
708
- DEPLOYING = 'DEPLOYING'
709
- RUNNING = 'RUNNING'
710
- UNAVAILABLE = 'UNAVAILABLE'
856
+ CRASHED = "CRASHED"
857
+ DEPLOYING = "DEPLOYING"
858
+ RUNNING = "RUNNING"
859
+ UNAVAILABLE = "UNAVAILABLE"
711
860
 
712
861
 
713
862
  @dataclass
@@ -721,32 +870,36 @@ class ApplicationStatus:
721
870
  def as_dict(self) -> dict:
722
871
  """Serializes the ApplicationStatus into a dictionary suitable for use as a JSON request body."""
723
872
  body = {}
724
- if self.message is not None: body['message'] = self.message
725
- if self.state is not None: body['state'] = self.state.value
873
+ if self.message is not None:
874
+ body["message"] = self.message
875
+ if self.state is not None:
876
+ body["state"] = self.state.value
726
877
  return body
727
878
 
728
879
  def as_shallow_dict(self) -> dict:
729
880
  """Serializes the ApplicationStatus into a shallow dictionary of its immediate attributes."""
730
881
  body = {}
731
- if self.message is not None: body['message'] = self.message
732
- if self.state is not None: body['state'] = self.state
882
+ if self.message is not None:
883
+ body["message"] = self.message
884
+ if self.state is not None:
885
+ body["state"] = self.state
733
886
  return body
734
887
 
735
888
  @classmethod
736
- def from_dict(cls, d: Dict[str, any]) -> ApplicationStatus:
889
+ def from_dict(cls, d: Dict[str, Any]) -> ApplicationStatus:
737
890
  """Deserializes the ApplicationStatus from a dictionary."""
738
- return cls(message=d.get('message', None), state=_enum(d, 'state', ApplicationState))
891
+ return cls(message=d.get("message", None), state=_enum(d, "state", ApplicationState))
739
892
 
740
893
 
741
894
  class ComputeState(Enum):
742
895
 
743
- ACTIVE = 'ACTIVE'
744
- DELETING = 'DELETING'
745
- ERROR = 'ERROR'
746
- STARTING = 'STARTING'
747
- STOPPED = 'STOPPED'
748
- STOPPING = 'STOPPING'
749
- UPDATING = 'UPDATING'
896
+ ACTIVE = "ACTIVE"
897
+ DELETING = "DELETING"
898
+ ERROR = "ERROR"
899
+ STARTING = "STARTING"
900
+ STOPPED = "STOPPED"
901
+ STOPPING = "STOPPING"
902
+ UPDATING = "UPDATING"
750
903
 
751
904
 
752
905
  @dataclass
@@ -760,21 +913,25 @@ class ComputeStatus:
760
913
  def as_dict(self) -> dict:
761
914
  """Serializes the ComputeStatus into a dictionary suitable for use as a JSON request body."""
762
915
  body = {}
763
- if self.message is not None: body['message'] = self.message
764
- if self.state is not None: body['state'] = self.state.value
916
+ if self.message is not None:
917
+ body["message"] = self.message
918
+ if self.state is not None:
919
+ body["state"] = self.state.value
765
920
  return body
766
921
 
767
922
  def as_shallow_dict(self) -> dict:
768
923
  """Serializes the ComputeStatus into a shallow dictionary of its immediate attributes."""
769
924
  body = {}
770
- if self.message is not None: body['message'] = self.message
771
- if self.state is not None: body['state'] = self.state
925
+ if self.message is not None:
926
+ body["message"] = self.message
927
+ if self.state is not None:
928
+ body["state"] = self.state
772
929
  return body
773
930
 
774
931
  @classmethod
775
- def from_dict(cls, d: Dict[str, any]) -> ComputeStatus:
932
+ def from_dict(cls, d: Dict[str, Any]) -> ComputeStatus:
776
933
  """Deserializes the ComputeStatus from a dictionary."""
777
- return cls(message=d.get('message', None), state=_enum(d, 'state', ComputeState))
934
+ return cls(message=d.get("message", None), state=_enum(d, "state", ComputeState))
778
935
 
779
936
 
780
937
  @dataclass
@@ -785,19 +942,21 @@ class GetAppPermissionLevelsResponse:
785
942
  def as_dict(self) -> dict:
786
943
  """Serializes the GetAppPermissionLevelsResponse into a dictionary suitable for use as a JSON request body."""
787
944
  body = {}
788
- if self.permission_levels: body['permission_levels'] = [v.as_dict() for v in self.permission_levels]
945
+ if self.permission_levels:
946
+ body["permission_levels"] = [v.as_dict() for v in self.permission_levels]
789
947
  return body
790
948
 
791
949
  def as_shallow_dict(self) -> dict:
792
950
  """Serializes the GetAppPermissionLevelsResponse into a shallow dictionary of its immediate attributes."""
793
951
  body = {}
794
- if self.permission_levels: body['permission_levels'] = self.permission_levels
952
+ if self.permission_levels:
953
+ body["permission_levels"] = self.permission_levels
795
954
  return body
796
955
 
797
956
  @classmethod
798
- def from_dict(cls, d: Dict[str, any]) -> GetAppPermissionLevelsResponse:
957
+ def from_dict(cls, d: Dict[str, Any]) -> GetAppPermissionLevelsResponse:
799
958
  """Deserializes the GetAppPermissionLevelsResponse from a dictionary."""
800
- return cls(permission_levels=_repeated_dict(d, 'permission_levels', AppPermissionsDescription))
959
+ return cls(permission_levels=_repeated_dict(d, "permission_levels", AppPermissionsDescription))
801
960
 
802
961
 
803
962
  @dataclass
@@ -811,22 +970,28 @@ class ListAppDeploymentsResponse:
811
970
  def as_dict(self) -> dict:
812
971
  """Serializes the ListAppDeploymentsResponse into a dictionary suitable for use as a JSON request body."""
813
972
  body = {}
814
- if self.app_deployments: body['app_deployments'] = [v.as_dict() for v in self.app_deployments]
815
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
973
+ if self.app_deployments:
974
+ body["app_deployments"] = [v.as_dict() for v in self.app_deployments]
975
+ if self.next_page_token is not None:
976
+ body["next_page_token"] = self.next_page_token
816
977
  return body
817
978
 
818
979
  def as_shallow_dict(self) -> dict:
819
980
  """Serializes the ListAppDeploymentsResponse into a shallow dictionary of its immediate attributes."""
820
981
  body = {}
821
- if self.app_deployments: body['app_deployments'] = self.app_deployments
822
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
982
+ if self.app_deployments:
983
+ body["app_deployments"] = self.app_deployments
984
+ if self.next_page_token is not None:
985
+ body["next_page_token"] = self.next_page_token
823
986
  return body
824
987
 
825
988
  @classmethod
826
- def from_dict(cls, d: Dict[str, any]) -> ListAppDeploymentsResponse:
989
+ def from_dict(cls, d: Dict[str, Any]) -> ListAppDeploymentsResponse:
827
990
  """Deserializes the ListAppDeploymentsResponse from a dictionary."""
828
- return cls(app_deployments=_repeated_dict(d, 'app_deployments', AppDeployment),
829
- next_page_token=d.get('next_page_token', None))
991
+ return cls(
992
+ app_deployments=_repeated_dict(d, "app_deployments", AppDeployment),
993
+ next_page_token=d.get("next_page_token", None),
994
+ )
830
995
 
831
996
 
832
997
  @dataclass
@@ -839,21 +1004,25 @@ class ListAppsResponse:
839
1004
  def as_dict(self) -> dict:
840
1005
  """Serializes the ListAppsResponse into a dictionary suitable for use as a JSON request body."""
841
1006
  body = {}
842
- if self.apps: body['apps'] = [v.as_dict() for v in self.apps]
843
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
1007
+ if self.apps:
1008
+ body["apps"] = [v.as_dict() for v in self.apps]
1009
+ if self.next_page_token is not None:
1010
+ body["next_page_token"] = self.next_page_token
844
1011
  return body
845
1012
 
846
1013
  def as_shallow_dict(self) -> dict:
847
1014
  """Serializes the ListAppsResponse into a shallow dictionary of its immediate attributes."""
848
1015
  body = {}
849
- if self.apps: body['apps'] = self.apps
850
- if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
1016
+ if self.apps:
1017
+ body["apps"] = self.apps
1018
+ if self.next_page_token is not None:
1019
+ body["next_page_token"] = self.next_page_token
851
1020
  return body
852
1021
 
853
1022
  @classmethod
854
- def from_dict(cls, d: Dict[str, any]) -> ListAppsResponse:
1023
+ def from_dict(cls, d: Dict[str, Any]) -> ListAppsResponse:
855
1024
  """Deserializes the ListAppsResponse from a dictionary."""
856
- return cls(apps=_repeated_dict(d, 'apps', App), next_page_token=d.get('next_page_token', None))
1025
+ return cls(apps=_repeated_dict(d, "apps", App), next_page_token=d.get("next_page_token", None))
857
1026
 
858
1027
 
859
1028
  @dataclass
@@ -875,19 +1044,21 @@ class AppsAPI:
875
1044
  def __init__(self, api_client):
876
1045
  self._api = api_client
877
1046
 
878
- def wait_get_app_active(self,
879
- name: str,
880
- timeout=timedelta(minutes=20),
881
- callback: Optional[Callable[[App], None]] = None) -> App:
1047
+ def wait_get_app_active(
1048
+ self, name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[App], None]] = None
1049
+ ) -> App:
882
1050
  deadline = time.time() + timeout.total_seconds()
883
- target_states = (ComputeState.ACTIVE, )
884
- failure_states = (ComputeState.ERROR, ComputeState.STOPPED, )
885
- status_message = 'polling...'
1051
+ target_states = (ComputeState.ACTIVE,)
1052
+ failure_states = (
1053
+ ComputeState.ERROR,
1054
+ ComputeState.STOPPED,
1055
+ )
1056
+ status_message = "polling..."
886
1057
  attempt = 1
887
1058
  while time.time() < deadline:
888
1059
  poll = self.get(name=name)
889
1060
  status = poll.compute_status.state
890
- status_message = f'current status: {status}'
1061
+ status_message = f"current status: {status}"
891
1062
  if poll.compute_status:
892
1063
  status_message = poll.compute_status.message
893
1064
  if status in target_states:
@@ -895,33 +1066,34 @@ class AppsAPI:
895
1066
  if callback:
896
1067
  callback(poll)
897
1068
  if status in failure_states:
898
- msg = f'failed to reach ACTIVE, got {status}: {status_message}'
1069
+ msg = f"failed to reach ACTIVE, got {status}: {status_message}"
899
1070
  raise OperationFailed(msg)
900
1071
  prefix = f"name={name}"
901
1072
  sleep = attempt
902
1073
  if sleep > 10:
903
1074
  # sleep 10s max per attempt
904
1075
  sleep = 10
905
- _LOG.debug(f'{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)')
1076
+ _LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
906
1077
  time.sleep(sleep + random.random())
907
1078
  attempt += 1
908
- raise TimeoutError(f'timed out after {timeout}: {status_message}')
1079
+ raise TimeoutError(f"timed out after {timeout}: {status_message}")
909
1080
 
910
1081
  def wait_get_deployment_app_succeeded(
911
- self,
912
- app_name: str,
913
- deployment_id: str,
914
- timeout=timedelta(minutes=20),
915
- callback: Optional[Callable[[AppDeployment], None]] = None) -> AppDeployment:
1082
+ self,
1083
+ app_name: str,
1084
+ deployment_id: str,
1085
+ timeout=timedelta(minutes=20),
1086
+ callback: Optional[Callable[[AppDeployment], None]] = None,
1087
+ ) -> AppDeployment:
916
1088
  deadline = time.time() + timeout.total_seconds()
917
- target_states = (AppDeploymentState.SUCCEEDED, )
918
- failure_states = (AppDeploymentState.FAILED, )
919
- status_message = 'polling...'
1089
+ target_states = (AppDeploymentState.SUCCEEDED,)
1090
+ failure_states = (AppDeploymentState.FAILED,)
1091
+ status_message = "polling..."
920
1092
  attempt = 1
921
1093
  while time.time() < deadline:
922
1094
  poll = self.get_deployment(app_name=app_name, deployment_id=deployment_id)
923
1095
  status = poll.status.state
924
- status_message = f'current status: {status}'
1096
+ status_message = f"current status: {status}"
925
1097
  if poll.status:
926
1098
  status_message = poll.status.message
927
1099
  if status in target_states:
@@ -929,31 +1101,30 @@ class AppsAPI:
929
1101
  if callback:
930
1102
  callback(poll)
931
1103
  if status in failure_states:
932
- msg = f'failed to reach SUCCEEDED, got {status}: {status_message}'
1104
+ msg = f"failed to reach SUCCEEDED, got {status}: {status_message}"
933
1105
  raise OperationFailed(msg)
934
1106
  prefix = f"app_name={app_name}, deployment_id={deployment_id}"
935
1107
  sleep = attempt
936
1108
  if sleep > 10:
937
1109
  # sleep 10s max per attempt
938
1110
  sleep = 10
939
- _LOG.debug(f'{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)')
1111
+ _LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
940
1112
  time.sleep(sleep + random.random())
941
1113
  attempt += 1
942
- raise TimeoutError(f'timed out after {timeout}: {status_message}')
1114
+ raise TimeoutError(f"timed out after {timeout}: {status_message}")
943
1115
 
944
- def wait_get_app_stopped(self,
945
- name: str,
946
- timeout=timedelta(minutes=20),
947
- callback: Optional[Callable[[App], None]] = None) -> App:
1116
+ def wait_get_app_stopped(
1117
+ self, name: str, timeout=timedelta(minutes=20), callback: Optional[Callable[[App], None]] = None
1118
+ ) -> App:
948
1119
  deadline = time.time() + timeout.total_seconds()
949
- target_states = (ComputeState.STOPPED, )
950
- failure_states = (ComputeState.ERROR, )
951
- status_message = 'polling...'
1120
+ target_states = (ComputeState.STOPPED,)
1121
+ failure_states = (ComputeState.ERROR,)
1122
+ status_message = "polling..."
952
1123
  attempt = 1
953
1124
  while time.time() < deadline:
954
1125
  poll = self.get(name=name)
955
1126
  status = poll.compute_status.state
956
- status_message = f'current status: {status}'
1127
+ status_message = f"current status: {status}"
957
1128
  if poll.compute_status:
958
1129
  status_message = poll.compute_status.message
959
1130
  if status in target_states:
@@ -961,323 +1132,352 @@ class AppsAPI:
961
1132
  if callback:
962
1133
  callback(poll)
963
1134
  if status in failure_states:
964
- msg = f'failed to reach STOPPED, got {status}: {status_message}'
1135
+ msg = f"failed to reach STOPPED, got {status}: {status_message}"
965
1136
  raise OperationFailed(msg)
966
1137
  prefix = f"name={name}"
967
1138
  sleep = attempt
968
1139
  if sleep > 10:
969
1140
  # sleep 10s max per attempt
970
1141
  sleep = 10
971
- _LOG.debug(f'{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)')
1142
+ _LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
972
1143
  time.sleep(sleep + random.random())
973
1144
  attempt += 1
974
- raise TimeoutError(f'timed out after {timeout}: {status_message}')
1145
+ raise TimeoutError(f"timed out after {timeout}: {status_message}")
975
1146
 
976
1147
  def create(self, *, app: Optional[App] = None, no_compute: Optional[bool] = None) -> Wait[App]:
977
1148
  """Create an app.
978
-
1149
+
979
1150
  Creates a new app.
980
-
1151
+
981
1152
  :param app: :class:`App` (optional)
982
1153
  :param no_compute: bool (optional)
983
1154
  If true, the app will not be started after creation.
984
-
1155
+
985
1156
  :returns:
986
1157
  Long-running operation waiter for :class:`App`.
987
1158
  See :method:wait_get_app_active for more details.
988
1159
  """
989
1160
  body = app.as_dict()
990
1161
  query = {}
991
- if no_compute is not None: query['no_compute'] = no_compute
992
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
993
-
994
- op_response = self._api.do('POST', '/api/2.0/apps', query=query, body=body, headers=headers)
995
- return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response['name'])
996
-
997
- def create_and_wait(self,
998
- *,
999
- app: Optional[App] = None,
1000
- no_compute: Optional[bool] = None,
1001
- timeout=timedelta(minutes=20)) -> App:
1162
+ if no_compute is not None:
1163
+ query["no_compute"] = no_compute
1164
+ headers = {
1165
+ "Accept": "application/json",
1166
+ "Content-Type": "application/json",
1167
+ }
1168
+
1169
+ op_response = self._api.do("POST", "/api/2.0/apps", query=query, body=body, headers=headers)
1170
+ return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response["name"])
1171
+
1172
+ def create_and_wait(
1173
+ self, *, app: Optional[App] = None, no_compute: Optional[bool] = None, timeout=timedelta(minutes=20)
1174
+ ) -> App:
1002
1175
  return self.create(app=app, no_compute=no_compute).result(timeout=timeout)
1003
1176
 
1004
1177
  def delete(self, name: str) -> App:
1005
1178
  """Delete an app.
1006
-
1179
+
1007
1180
  Deletes an app.
1008
-
1181
+
1009
1182
  :param name: str
1010
1183
  The name of the app.
1011
-
1184
+
1012
1185
  :returns: :class:`App`
1013
1186
  """
1014
1187
 
1015
- headers = {'Accept': 'application/json', }
1188
+ headers = {
1189
+ "Accept": "application/json",
1190
+ }
1016
1191
 
1017
- res = self._api.do('DELETE', f'/api/2.0/apps/{name}', headers=headers)
1192
+ res = self._api.do("DELETE", f"/api/2.0/apps/{name}", headers=headers)
1018
1193
  return App.from_dict(res)
1019
1194
 
1020
1195
  def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = None) -> Wait[AppDeployment]:
1021
1196
  """Create an app deployment.
1022
-
1197
+
1023
1198
  Creates an app deployment for the app with the supplied name.
1024
-
1199
+
1025
1200
  :param app_name: str
1026
1201
  The name of the app.
1027
1202
  :param app_deployment: :class:`AppDeployment` (optional)
1028
-
1203
+
1029
1204
  :returns:
1030
1205
  Long-running operation waiter for :class:`AppDeployment`.
1031
1206
  See :method:wait_get_deployment_app_succeeded for more details.
1032
1207
  """
1033
1208
  body = app_deployment.as_dict()
1034
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1035
-
1036
- op_response = self._api.do('POST',
1037
- f'/api/2.0/apps/{app_name}/deployments',
1038
- body=body,
1039
- headers=headers)
1040
- return Wait(self.wait_get_deployment_app_succeeded,
1041
- response=AppDeployment.from_dict(op_response),
1042
- app_name=app_name,
1043
- deployment_id=op_response['deployment_id'])
1044
-
1045
- def deploy_and_wait(self,
1046
- app_name: str,
1047
- *,
1048
- app_deployment: Optional[AppDeployment] = None,
1049
- timeout=timedelta(minutes=20)) -> AppDeployment:
1209
+ headers = {
1210
+ "Accept": "application/json",
1211
+ "Content-Type": "application/json",
1212
+ }
1213
+
1214
+ op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/deployments", body=body, headers=headers)
1215
+ return Wait(
1216
+ self.wait_get_deployment_app_succeeded,
1217
+ response=AppDeployment.from_dict(op_response),
1218
+ app_name=app_name,
1219
+ deployment_id=op_response["deployment_id"],
1220
+ )
1221
+
1222
+ def deploy_and_wait(
1223
+ self, app_name: str, *, app_deployment: Optional[AppDeployment] = None, timeout=timedelta(minutes=20)
1224
+ ) -> AppDeployment:
1050
1225
  return self.deploy(app_deployment=app_deployment, app_name=app_name).result(timeout=timeout)
1051
1226
 
1052
1227
  def get(self, name: str) -> App:
1053
1228
  """Get an app.
1054
-
1229
+
1055
1230
  Retrieves information for the app with the supplied name.
1056
-
1231
+
1057
1232
  :param name: str
1058
1233
  The name of the app.
1059
-
1234
+
1060
1235
  :returns: :class:`App`
1061
1236
  """
1062
1237
 
1063
- headers = {'Accept': 'application/json', }
1238
+ headers = {
1239
+ "Accept": "application/json",
1240
+ }
1064
1241
 
1065
- res = self._api.do('GET', f'/api/2.0/apps/{name}', headers=headers)
1242
+ res = self._api.do("GET", f"/api/2.0/apps/{name}", headers=headers)
1066
1243
  return App.from_dict(res)
1067
1244
 
1068
1245
  def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment:
1069
1246
  """Get an app deployment.
1070
-
1247
+
1071
1248
  Retrieves information for the app deployment with the supplied name and deployment id.
1072
-
1249
+
1073
1250
  :param app_name: str
1074
1251
  The name of the app.
1075
1252
  :param deployment_id: str
1076
1253
  The unique id of the deployment.
1077
-
1254
+
1078
1255
  :returns: :class:`AppDeployment`
1079
1256
  """
1080
1257
 
1081
- headers = {'Accept': 'application/json', }
1258
+ headers = {
1259
+ "Accept": "application/json",
1260
+ }
1082
1261
 
1083
- res = self._api.do('GET', f'/api/2.0/apps/{app_name}/deployments/{deployment_id}', headers=headers)
1262
+ res = self._api.do("GET", f"/api/2.0/apps/{app_name}/deployments/{deployment_id}", headers=headers)
1084
1263
  return AppDeployment.from_dict(res)
1085
1264
 
1086
1265
  def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse:
1087
1266
  """Get app permission levels.
1088
-
1267
+
1089
1268
  Gets the permission levels that a user can have on an object.
1090
-
1269
+
1091
1270
  :param app_name: str
1092
1271
  The app for which to get or manage permissions.
1093
-
1272
+
1094
1273
  :returns: :class:`GetAppPermissionLevelsResponse`
1095
1274
  """
1096
1275
 
1097
- headers = {'Accept': 'application/json', }
1276
+ headers = {
1277
+ "Accept": "application/json",
1278
+ }
1098
1279
 
1099
- res = self._api.do('GET', f'/api/2.0/permissions/apps/{app_name}/permissionLevels', headers=headers)
1280
+ res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}/permissionLevels", headers=headers)
1100
1281
  return GetAppPermissionLevelsResponse.from_dict(res)
1101
1282
 
1102
1283
  def get_permissions(self, app_name: str) -> AppPermissions:
1103
1284
  """Get app permissions.
1104
-
1285
+
1105
1286
  Gets the permissions of an app. Apps can inherit permissions from their root object.
1106
-
1287
+
1107
1288
  :param app_name: str
1108
1289
  The app for which to get or manage permissions.
1109
-
1290
+
1110
1291
  :returns: :class:`AppPermissions`
1111
1292
  """
1112
1293
 
1113
- headers = {'Accept': 'application/json', }
1294
+ headers = {
1295
+ "Accept": "application/json",
1296
+ }
1114
1297
 
1115
- res = self._api.do('GET', f'/api/2.0/permissions/apps/{app_name}', headers=headers)
1298
+ res = self._api.do("GET", f"/api/2.0/permissions/apps/{app_name}", headers=headers)
1116
1299
  return AppPermissions.from_dict(res)
1117
1300
 
1118
1301
  def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]:
1119
1302
  """List apps.
1120
-
1303
+
1121
1304
  Lists all apps in the workspace.
1122
-
1305
+
1123
1306
  :param page_size: int (optional)
1124
1307
  Upper bound for items returned.
1125
1308
  :param page_token: str (optional)
1126
1309
  Pagination token to go to the next page of apps. Requests first page if absent.
1127
-
1310
+
1128
1311
  :returns: Iterator over :class:`App`
1129
1312
  """
1130
1313
 
1131
1314
  query = {}
1132
- if page_size is not None: query['page_size'] = page_size
1133
- if page_token is not None: query['page_token'] = page_token
1134
- headers = {'Accept': 'application/json', }
1315
+ if page_size is not None:
1316
+ query["page_size"] = page_size
1317
+ if page_token is not None:
1318
+ query["page_token"] = page_token
1319
+ headers = {
1320
+ "Accept": "application/json",
1321
+ }
1135
1322
 
1136
1323
  while True:
1137
- json = self._api.do('GET', '/api/2.0/apps', query=query, headers=headers)
1138
- if 'apps' in json:
1139
- for v in json['apps']:
1324
+ json = self._api.do("GET", "/api/2.0/apps", query=query, headers=headers)
1325
+ if "apps" in json:
1326
+ for v in json["apps"]:
1140
1327
  yield App.from_dict(v)
1141
- if 'next_page_token' not in json or not json['next_page_token']:
1328
+ if "next_page_token" not in json or not json["next_page_token"]:
1142
1329
  return
1143
- query['page_token'] = json['next_page_token']
1330
+ query["page_token"] = json["next_page_token"]
1144
1331
 
1145
- def list_deployments(self,
1146
- app_name: str,
1147
- *,
1148
- page_size: Optional[int] = None,
1149
- page_token: Optional[str] = None) -> Iterator[AppDeployment]:
1332
+ def list_deployments(
1333
+ self, app_name: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None
1334
+ ) -> Iterator[AppDeployment]:
1150
1335
  """List app deployments.
1151
-
1336
+
1152
1337
  Lists all app deployments for the app with the supplied name.
1153
-
1338
+
1154
1339
  :param app_name: str
1155
1340
  The name of the app.
1156
1341
  :param page_size: int (optional)
1157
1342
  Upper bound for items returned.
1158
1343
  :param page_token: str (optional)
1159
1344
  Pagination token to go to the next page of apps. Requests first page if absent.
1160
-
1345
+
1161
1346
  :returns: Iterator over :class:`AppDeployment`
1162
1347
  """
1163
1348
 
1164
1349
  query = {}
1165
- if page_size is not None: query['page_size'] = page_size
1166
- if page_token is not None: query['page_token'] = page_token
1167
- headers = {'Accept': 'application/json', }
1350
+ if page_size is not None:
1351
+ query["page_size"] = page_size
1352
+ if page_token is not None:
1353
+ query["page_token"] = page_token
1354
+ headers = {
1355
+ "Accept": "application/json",
1356
+ }
1168
1357
 
1169
1358
  while True:
1170
- json = self._api.do('GET', f'/api/2.0/apps/{app_name}/deployments', query=query, headers=headers)
1171
- if 'app_deployments' in json:
1172
- for v in json['app_deployments']:
1359
+ json = self._api.do("GET", f"/api/2.0/apps/{app_name}/deployments", query=query, headers=headers)
1360
+ if "app_deployments" in json:
1361
+ for v in json["app_deployments"]:
1173
1362
  yield AppDeployment.from_dict(v)
1174
- if 'next_page_token' not in json or not json['next_page_token']:
1363
+ if "next_page_token" not in json or not json["next_page_token"]:
1175
1364
  return
1176
- query['page_token'] = json['next_page_token']
1365
+ query["page_token"] = json["next_page_token"]
1177
1366
 
1178
1367
  def set_permissions(
1179
- self,
1180
- app_name: str,
1181
- *,
1182
- access_control_list: Optional[List[AppAccessControlRequest]] = None) -> AppPermissions:
1368
+ self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None
1369
+ ) -> AppPermissions:
1183
1370
  """Set app permissions.
1184
-
1371
+
1185
1372
  Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
1186
1373
  permissions if none are specified. Objects can inherit permissions from their root object.
1187
-
1374
+
1188
1375
  :param app_name: str
1189
1376
  The app for which to get or manage permissions.
1190
1377
  :param access_control_list: List[:class:`AppAccessControlRequest`] (optional)
1191
-
1378
+
1192
1379
  :returns: :class:`AppPermissions`
1193
1380
  """
1194
1381
  body = {}
1195
1382
  if access_control_list is not None:
1196
- body['access_control_list'] = [v.as_dict() for v in access_control_list]
1197
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1383
+ body["access_control_list"] = [v.as_dict() for v in access_control_list]
1384
+ headers = {
1385
+ "Accept": "application/json",
1386
+ "Content-Type": "application/json",
1387
+ }
1198
1388
 
1199
- res = self._api.do('PUT', f'/api/2.0/permissions/apps/{app_name}', body=body, headers=headers)
1389
+ res = self._api.do("PUT", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers)
1200
1390
  return AppPermissions.from_dict(res)
1201
1391
 
1202
1392
  def start(self, name: str) -> Wait[App]:
1203
1393
  """Start an app.
1204
-
1394
+
1205
1395
  Start the last active deployment of the app in the workspace.
1206
-
1396
+
1207
1397
  :param name: str
1208
1398
  The name of the app.
1209
-
1399
+
1210
1400
  :returns:
1211
1401
  Long-running operation waiter for :class:`App`.
1212
1402
  See :method:wait_get_app_active for more details.
1213
1403
  """
1214
1404
 
1215
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1405
+ headers = {
1406
+ "Accept": "application/json",
1407
+ "Content-Type": "application/json",
1408
+ }
1216
1409
 
1217
- op_response = self._api.do('POST', f'/api/2.0/apps/{name}/start', headers=headers)
1218
- return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response['name'])
1410
+ op_response = self._api.do("POST", f"/api/2.0/apps/{name}/start", headers=headers)
1411
+ return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response["name"])
1219
1412
 
1220
1413
  def start_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
1221
1414
  return self.start(name=name).result(timeout=timeout)
1222
1415
 
1223
1416
  def stop(self, name: str) -> Wait[App]:
1224
1417
  """Stop an app.
1225
-
1418
+
1226
1419
  Stops the active deployment of the app in the workspace.
1227
-
1420
+
1228
1421
  :param name: str
1229
1422
  The name of the app.
1230
-
1423
+
1231
1424
  :returns:
1232
1425
  Long-running operation waiter for :class:`App`.
1233
1426
  See :method:wait_get_app_stopped for more details.
1234
1427
  """
1235
1428
 
1236
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1429
+ headers = {
1430
+ "Accept": "application/json",
1431
+ "Content-Type": "application/json",
1432
+ }
1237
1433
 
1238
- op_response = self._api.do('POST', f'/api/2.0/apps/{name}/stop', headers=headers)
1239
- return Wait(self.wait_get_app_stopped, response=App.from_dict(op_response), name=op_response['name'])
1434
+ op_response = self._api.do("POST", f"/api/2.0/apps/{name}/stop", headers=headers)
1435
+ return Wait(self.wait_get_app_stopped, response=App.from_dict(op_response), name=op_response["name"])
1240
1436
 
1241
1437
  def stop_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
1242
1438
  return self.stop(name=name).result(timeout=timeout)
1243
1439
 
1244
1440
  def update(self, name: str, *, app: Optional[App] = None) -> App:
1245
1441
  """Update an app.
1246
-
1442
+
1247
1443
  Updates the app with the supplied name.
1248
-
1444
+
1249
1445
  :param name: str
1250
1446
  The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
1251
1447
  must be unique within the workspace.
1252
1448
  :param app: :class:`App` (optional)
1253
-
1449
+
1254
1450
  :returns: :class:`App`
1255
1451
  """
1256
1452
  body = app.as_dict()
1257
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1453
+ headers = {
1454
+ "Accept": "application/json",
1455
+ "Content-Type": "application/json",
1456
+ }
1258
1457
 
1259
- res = self._api.do('PATCH', f'/api/2.0/apps/{name}', body=body, headers=headers)
1458
+ res = self._api.do("PATCH", f"/api/2.0/apps/{name}", body=body, headers=headers)
1260
1459
  return App.from_dict(res)
1261
1460
 
1262
1461
  def update_permissions(
1263
- self,
1264
- app_name: str,
1265
- *,
1266
- access_control_list: Optional[List[AppAccessControlRequest]] = None) -> AppPermissions:
1462
+ self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None
1463
+ ) -> AppPermissions:
1267
1464
  """Update app permissions.
1268
-
1465
+
1269
1466
  Updates the permissions on an app. Apps can inherit permissions from their root object.
1270
-
1467
+
1271
1468
  :param app_name: str
1272
1469
  The app for which to get or manage permissions.
1273
1470
  :param access_control_list: List[:class:`AppAccessControlRequest`] (optional)
1274
-
1471
+
1275
1472
  :returns: :class:`AppPermissions`
1276
1473
  """
1277
1474
  body = {}
1278
1475
  if access_control_list is not None:
1279
- body['access_control_list'] = [v.as_dict() for v in access_control_list]
1280
- headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
1476
+ body["access_control_list"] = [v.as_dict() for v in access_control_list]
1477
+ headers = {
1478
+ "Accept": "application/json",
1479
+ "Content-Type": "application/json",
1480
+ }
1281
1481
 
1282
- res = self._api.do('PATCH', f'/api/2.0/permissions/apps/{app_name}', body=body, headers=headers)
1482
+ res = self._api.do("PATCH", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers)
1283
1483
  return AppPermissions.from_dict(res)