databricks-sdk 0.28.0__py3-none-any.whl → 0.29.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.

@@ -59,6 +59,38 @@ class AssetType(Enum):
59
59
  ASSET_TYPE_UNSPECIFIED = 'ASSET_TYPE_UNSPECIFIED'
60
60
 
61
61
 
62
+ @dataclass
63
+ class BatchGetListingsResponse:
64
+ listings: Optional[List[Listing]] = None
65
+
66
+ def as_dict(self) -> dict:
67
+ """Serializes the BatchGetListingsResponse into a dictionary suitable for use as a JSON request body."""
68
+ body = {}
69
+ if self.listings: body['listings'] = [v.as_dict() for v in self.listings]
70
+ return body
71
+
72
+ @classmethod
73
+ def from_dict(cls, d: Dict[str, any]) -> BatchGetListingsResponse:
74
+ """Deserializes the BatchGetListingsResponse from a dictionary."""
75
+ return cls(listings=_repeated_dict(d, 'listings', Listing))
76
+
77
+
78
+ @dataclass
79
+ class BatchGetProvidersResponse:
80
+ providers: Optional[List[ProviderInfo]] = None
81
+
82
+ def as_dict(self) -> dict:
83
+ """Serializes the BatchGetProvidersResponse into a dictionary suitable for use as a JSON request body."""
84
+ body = {}
85
+ if self.providers: body['providers'] = [v.as_dict() for v in self.providers]
86
+ return body
87
+
88
+ @classmethod
89
+ def from_dict(cls, d: Dict[str, any]) -> BatchGetProvidersResponse:
90
+ """Deserializes the BatchGetProvidersResponse from a dictionary."""
91
+ return cls(providers=_repeated_dict(d, 'providers', ProviderInfo))
92
+
93
+
62
94
  class Category(Enum):
63
95
 
64
96
  ADVERTISING_AND_MARKETING = 'ADVERTISING_AND_MARKETING'
@@ -1265,11 +1297,16 @@ class Listing:
1265
1297
 
1266
1298
  id: Optional[str] = None
1267
1299
 
1300
+ provider_summary: Optional[ProviderListingSummaryInfo] = None
1301
+ """we can not use just ProviderListingSummary since we already have same name on entity side of the
1302
+ state"""
1303
+
1268
1304
  def as_dict(self) -> dict:
1269
1305
  """Serializes the Listing into a dictionary suitable for use as a JSON request body."""
1270
1306
  body = {}
1271
1307
  if self.detail: body['detail'] = self.detail.as_dict()
1272
1308
  if self.id is not None: body['id'] = self.id
1309
+ if self.provider_summary: body['provider_summary'] = self.provider_summary.as_dict()
1273
1310
  if self.summary: body['summary'] = self.summary.as_dict()
1274
1311
  return body
1275
1312
 
@@ -1278,6 +1315,7 @@ class Listing:
1278
1315
  """Deserializes the Listing from a dictionary."""
1279
1316
  return cls(detail=_from_dict(d, 'detail', ListingDetail),
1280
1317
  id=d.get('id', None),
1318
+ provider_summary=_from_dict(d, 'provider_summary', ProviderListingSummaryInfo),
1281
1319
  summary=_from_dict(d, 'summary', ListingSummary))
1282
1320
 
1283
1321
 
@@ -1695,6 +1733,37 @@ class ProviderAnalyticsDashboard:
1695
1733
  return cls(id=d.get('id', None))
1696
1734
 
1697
1735
 
1736
+ @dataclass
1737
+ class ProviderIconFile:
1738
+ icon_file_id: Optional[str] = None
1739
+
1740
+ icon_file_path: Optional[str] = None
1741
+
1742
+ icon_type: Optional[ProviderIconType] = None
1743
+
1744
+ def as_dict(self) -> dict:
1745
+ """Serializes the ProviderIconFile into a dictionary suitable for use as a JSON request body."""
1746
+ body = {}
1747
+ if self.icon_file_id is not None: body['icon_file_id'] = self.icon_file_id
1748
+ if self.icon_file_path is not None: body['icon_file_path'] = self.icon_file_path
1749
+ if self.icon_type is not None: body['icon_type'] = self.icon_type.value
1750
+ return body
1751
+
1752
+ @classmethod
1753
+ def from_dict(cls, d: Dict[str, any]) -> ProviderIconFile:
1754
+ """Deserializes the ProviderIconFile from a dictionary."""
1755
+ return cls(icon_file_id=d.get('icon_file_id', None),
1756
+ icon_file_path=d.get('icon_file_path', None),
1757
+ icon_type=_enum(d, 'icon_type', ProviderIconType))
1758
+
1759
+
1760
+ class ProviderIconType(Enum):
1761
+
1762
+ DARK = 'DARK'
1763
+ PRIMARY = 'PRIMARY'
1764
+ PROVIDER_ICON_TYPE_UNSPECIFIED = 'PROVIDER_ICON_TYPE_UNSPECIFIED'
1765
+
1766
+
1698
1767
  @dataclass
1699
1768
  class ProviderInfo:
1700
1769
  name: str
@@ -1768,6 +1837,33 @@ class ProviderInfo:
1768
1837
  term_of_service_link=d.get('term_of_service_link', None))
1769
1838
 
1770
1839
 
1840
+ @dataclass
1841
+ class ProviderListingSummaryInfo:
1842
+ """we can not use just ProviderListingSummary since we already have same name on entity side of the
1843
+ state"""
1844
+
1845
+ description: Optional[str] = None
1846
+
1847
+ icon_files: Optional[List[ProviderIconFile]] = None
1848
+
1849
+ name: Optional[str] = None
1850
+
1851
+ def as_dict(self) -> dict:
1852
+ """Serializes the ProviderListingSummaryInfo into a dictionary suitable for use as a JSON request body."""
1853
+ body = {}
1854
+ if self.description is not None: body['description'] = self.description
1855
+ if self.icon_files: body['icon_files'] = [v.as_dict() for v in self.icon_files]
1856
+ if self.name is not None: body['name'] = self.name
1857
+ return body
1858
+
1859
+ @classmethod
1860
+ def from_dict(cls, d: Dict[str, any]) -> ProviderListingSummaryInfo:
1861
+ """Deserializes the ProviderListingSummaryInfo from a dictionary."""
1862
+ return cls(description=d.get('description', None),
1863
+ icon_files=_repeated_dict(d, 'icon_files', ProviderIconFile),
1864
+ name=d.get('name', None))
1865
+
1866
+
1771
1867
  @dataclass
1772
1868
  class RegionInfo:
1773
1869
  cloud: Optional[str] = None
@@ -2532,6 +2628,26 @@ class ConsumerListingsAPI:
2532
2628
  def __init__(self, api_client):
2533
2629
  self._api = api_client
2534
2630
 
2631
+ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetListingsResponse:
2632
+ """Get one batch of listings. One may specify up to 50 IDs per request.
2633
+
2634
+ Batch get a published listing in the Databricks Marketplace that the consumer has access to.
2635
+
2636
+ :param ids: List[str] (optional)
2637
+
2638
+ :returns: :class:`BatchGetListingsResponse`
2639
+ """
2640
+
2641
+ query = {}
2642
+ if ids is not None: query['ids'] = [v for v in ids]
2643
+ headers = {'Accept': 'application/json', }
2644
+
2645
+ res = self._api.do('GET',
2646
+ '/api/2.1/marketplace-consumer/listings:batchGet',
2647
+ query=query,
2648
+ headers=headers)
2649
+ return BatchGetListingsResponse.from_dict(res)
2650
+
2535
2651
  def get(self, id: str) -> GetListingResponse:
2536
2652
  """Get listing.
2537
2653
 
@@ -2780,6 +2896,26 @@ class ConsumerProvidersAPI:
2780
2896
  def __init__(self, api_client):
2781
2897
  self._api = api_client
2782
2898
 
2899
+ def batch_get(self, *, ids: Optional[List[str]] = None) -> BatchGetProvidersResponse:
2900
+ """Get one batch of providers. One may specify up to 50 IDs per request.
2901
+
2902
+ Batch get a provider in the Databricks Marketplace with at least one visible listing.
2903
+
2904
+ :param ids: List[str] (optional)
2905
+
2906
+ :returns: :class:`BatchGetProvidersResponse`
2907
+ """
2908
+
2909
+ query = {}
2910
+ if ids is not None: query['ids'] = [v for v in ids]
2911
+ headers = {'Accept': 'application/json', }
2912
+
2913
+ res = self._api.do('GET',
2914
+ '/api/2.1/marketplace-consumer/providers:batchGet',
2915
+ query=query,
2916
+ headers=headers)
2917
+ return BatchGetProvidersResponse.from_dict(res)
2918
+
2783
2919
  def get(self, id: str) -> GetProviderResponse:
2784
2920
  """Get a provider.
2785
2921
 
@@ -160,6 +160,28 @@ class CreateServicePrincipalSecretResponse:
160
160
  update_time=d.get('update_time', None))
161
161
 
162
162
 
163
+ @dataclass
164
+ class DataPlaneInfo:
165
+ authorization_details: Optional[str] = None
166
+ """Authorization details as a string."""
167
+
168
+ endpoint_url: Optional[str] = None
169
+ """The URL of the endpoint for this operation in the dataplane."""
170
+
171
+ def as_dict(self) -> dict:
172
+ """Serializes the DataPlaneInfo into a dictionary suitable for use as a JSON request body."""
173
+ body = {}
174
+ if self.authorization_details is not None: body['authorization_details'] = self.authorization_details
175
+ if self.endpoint_url is not None: body['endpoint_url'] = self.endpoint_url
176
+ return body
177
+
178
+ @classmethod
179
+ def from_dict(cls, d: Dict[str, any]) -> DataPlaneInfo:
180
+ """Deserializes the DataPlaneInfo from a dictionary."""
181
+ return cls(authorization_details=d.get('authorization_details', None),
182
+ endpoint_url=d.get('endpoint_url', None))
183
+
184
+
163
185
  @dataclass
164
186
  class DeleteCustomAppIntegrationOutput:
165
187
 
@@ -1242,7 +1242,7 @@ class PipelineLibrary:
1242
1242
  """Specification of a maven library to be installed."""
1243
1243
 
1244
1244
  notebook: Optional[NotebookLibrary] = None
1245
- """The path to a notebook that defines a pipeline and is stored in the <Databricks> workspace."""
1245
+ """The path to a notebook that defines a pipeline and is stored in the Databricks workspace."""
1246
1246
 
1247
1247
  def as_dict(self) -> dict:
1248
1248
  """Serializes the PipelineLibrary into a dictionary suitable for use as a JSON request body."""
@@ -15,6 +15,8 @@ from ._internal import Wait, _enum, _from_dict, _repeated_dict
15
15
 
16
16
  _LOG = logging.getLogger('databricks.sdk')
17
17
 
18
+ from databricks.sdk.service import oauth2
19
+
18
20
  # all definitions in this file are in alphabetical order
19
21
 
20
22
 
@@ -100,8 +102,8 @@ class AnthropicConfig:
100
102
  @dataclass
101
103
  class App:
102
104
  name: str
103
- """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
104
- and be between 2 and 30 characters long. It must be unique within the workspace."""
105
+ """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
106
+ It must be unique within the workspace."""
105
107
 
106
108
  active_deployment: Optional[AppDeployment] = None
107
109
  """The active deployment of the app."""
@@ -118,6 +120,10 @@ class App:
118
120
  pending_deployment: Optional[AppDeployment] = None
119
121
  """The pending deployment of the app."""
120
122
 
123
+ service_principal_id: Optional[int] = None
124
+
125
+ service_principal_name: Optional[str] = None
126
+
121
127
  status: Optional[AppStatus] = None
122
128
 
123
129
  update_time: Optional[str] = None
@@ -138,6 +144,9 @@ class App:
138
144
  if self.description is not None: body['description'] = self.description
139
145
  if self.name is not None: body['name'] = self.name
140
146
  if self.pending_deployment: body['pending_deployment'] = self.pending_deployment.as_dict()
147
+ if self.service_principal_id is not None: body['service_principal_id'] = self.service_principal_id
148
+ if self.service_principal_name is not None:
149
+ body['service_principal_name'] = self.service_principal_name
141
150
  if self.status: body['status'] = self.status.as_dict()
142
151
  if self.update_time is not None: body['update_time'] = self.update_time
143
152
  if self.updater is not None: body['updater'] = self.updater
@@ -153,6 +162,8 @@ class App:
153
162
  description=d.get('description', None),
154
163
  name=d.get('name', None),
155
164
  pending_deployment=_from_dict(d, 'pending_deployment', AppDeployment),
165
+ service_principal_id=d.get('service_principal_id', None),
166
+ service_principal_name=d.get('service_principal_name', None),
156
167
  status=_from_dict(d, 'status', AppStatus),
157
168
  update_time=d.get('update_time', None),
158
169
  updater=d.get('updater', None),
@@ -162,7 +173,14 @@ class App:
162
173
  @dataclass
163
174
  class AppDeployment:
164
175
  source_code_path: str
165
- """The source code path of the deployment."""
176
+ """The workspace file system path of the source code used to create the app deployment. This is
177
+ different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
178
+ app. The former refers to the original source code location of the app in the workspace during
179
+ deployment creation, whereas the latter provides a system generated stable snapshotted source
180
+ code path used by the deployment."""
181
+
182
+ mode: AppDeploymentMode
183
+ """The mode of which the deployment will manage the source code."""
166
184
 
167
185
  create_time: Optional[str] = None
168
186
  """The creation time of the deployment. Formatted timestamp in ISO 6801."""
@@ -189,6 +207,7 @@ class AppDeployment:
189
207
  if self.creator is not None: body['creator'] = self.creator
190
208
  if self.deployment_artifacts: body['deployment_artifacts'] = self.deployment_artifacts.as_dict()
191
209
  if self.deployment_id is not None: body['deployment_id'] = self.deployment_id
210
+ if self.mode is not None: body['mode'] = self.mode.value
192
211
  if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
193
212
  if self.status: body['status'] = self.status.as_dict()
194
213
  if self.update_time is not None: body['update_time'] = self.update_time
@@ -201,6 +220,7 @@ class AppDeployment:
201
220
  creator=d.get('creator', None),
202
221
  deployment_artifacts=_from_dict(d, 'deployment_artifacts', AppDeploymentArtifacts),
203
222
  deployment_id=d.get('deployment_id', None),
223
+ mode=_enum(d, 'mode', AppDeploymentMode),
204
224
  source_code_path=d.get('source_code_path', None),
205
225
  status=_from_dict(d, 'status', AppDeploymentStatus),
206
226
  update_time=d.get('update_time', None))
@@ -209,7 +229,7 @@ class AppDeployment:
209
229
  @dataclass
210
230
  class AppDeploymentArtifacts:
211
231
  source_code_path: Optional[str] = None
212
- """The source code of the deployment."""
232
+ """The snapshotted workspace file system path of the source code loaded by the deployed app."""
213
233
 
214
234
  def as_dict(self) -> dict:
215
235
  """Serializes the AppDeploymentArtifacts into a dictionary suitable for use as a JSON request body."""
@@ -223,9 +243,15 @@ class AppDeploymentArtifacts:
223
243
  return cls(source_code_path=d.get('source_code_path', None))
224
244
 
225
245
 
246
+ class AppDeploymentMode(Enum):
247
+
248
+ AUTO_SYNC = 'AUTO_SYNC'
249
+ MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
250
+ SNAPSHOT = 'SNAPSHOT'
251
+
252
+
226
253
  class AppDeploymentState(Enum):
227
254
 
228
- CANCELLED = 'CANCELLED'
229
255
  FAILED = 'FAILED'
230
256
  IN_PROGRESS = 'IN_PROGRESS'
231
257
  STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
@@ -275,15 +301,11 @@ class AppState(Enum):
275
301
  CREATING = 'CREATING'
276
302
  DELETED = 'DELETED'
277
303
  DELETING = 'DELETING'
278
- DEPLOYED = 'DEPLOYED'
279
- DEPLOYING = 'DEPLOYING'
280
304
  ERROR = 'ERROR'
281
305
  IDLE = 'IDLE'
282
- READY = 'READY'
283
306
  RUNNING = 'RUNNING'
284
307
  STARTING = 'STARTING'
285
308
  STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
286
- UPDATING = 'UPDATING'
287
309
 
288
310
 
289
311
  @dataclass
@@ -311,19 +333,18 @@ class AppStatus:
311
333
  class AutoCaptureConfigInput:
312
334
  catalog_name: Optional[str] = None
313
335
  """The name of the catalog in Unity Catalog. NOTE: On update, you cannot change the catalog name if
314
- it was already set."""
336
+ the inference table is already enabled."""
315
337
 
316
338
  enabled: Optional[bool] = None
317
- """If inference tables are enabled or not. NOTE: If you have already disabled payload logging once,
318
- you cannot enable again."""
339
+ """Indicates whether the inference table is enabled."""
319
340
 
320
341
  schema_name: Optional[str] = None
321
342
  """The name of the schema in Unity Catalog. NOTE: On update, you cannot change the schema name if
322
- it was already set."""
343
+ the inference table is already enabled."""
323
344
 
324
345
  table_name_prefix: Optional[str] = None
325
346
  """The prefix of the table in Unity Catalog. NOTE: On update, you cannot change the prefix name if
326
- it was already set."""
347
+ the inference table is already enabled."""
327
348
 
328
349
  def as_dict(self) -> dict:
329
350
  """Serializes the AutoCaptureConfigInput into a dictionary suitable for use as a JSON request body."""
@@ -349,7 +370,7 @@ class AutoCaptureConfigOutput:
349
370
  """The name of the catalog in Unity Catalog."""
350
371
 
351
372
  enabled: Optional[bool] = None
352
- """If inference tables are enabled or not."""
373
+ """Indicates whether the inference table is enabled."""
353
374
 
354
375
  schema_name: Optional[str] = None
355
376
  """The name of the schema in Unity Catalog."""
@@ -461,7 +482,14 @@ class CohereConfig:
461
482
  @dataclass
462
483
  class CreateAppDeploymentRequest:
463
484
  source_code_path: str
464
- """The source code path of the deployment."""
485
+ """The workspace file system path of the source code used to create the app deployment. This is
486
+ different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
487
+ app. The former refers to the original source code location of the app in the workspace during
488
+ deployment creation, whereas the latter provides a system generated stable snapshotted source
489
+ code path used by the deployment."""
490
+
491
+ mode: AppDeploymentMode
492
+ """The mode of which the deployment will manage the source code."""
465
493
 
466
494
  app_name: Optional[str] = None
467
495
  """The name of the app."""
@@ -470,20 +498,23 @@ class CreateAppDeploymentRequest:
470
498
  """Serializes the CreateAppDeploymentRequest into a dictionary suitable for use as a JSON request body."""
471
499
  body = {}
472
500
  if self.app_name is not None: body['app_name'] = self.app_name
501
+ if self.mode is not None: body['mode'] = self.mode.value
473
502
  if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
474
503
  return body
475
504
 
476
505
  @classmethod
477
506
  def from_dict(cls, d: Dict[str, any]) -> CreateAppDeploymentRequest:
478
507
  """Deserializes the CreateAppDeploymentRequest from a dictionary."""
479
- return cls(app_name=d.get('app_name', None), source_code_path=d.get('source_code_path', None))
508
+ return cls(app_name=d.get('app_name', None),
509
+ mode=_enum(d, 'mode', AppDeploymentMode),
510
+ source_code_path=d.get('source_code_path', None))
480
511
 
481
512
 
482
513
  @dataclass
483
514
  class CreateAppRequest:
484
515
  name: str
485
- """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
486
- and be between 2 and 30 characters long. It must be unique within the workspace."""
516
+ """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
517
+ It must be unique within the workspace."""
487
518
 
488
519
  description: Optional[str] = None
489
520
  """The description of the app."""
@@ -1118,6 +1149,23 @@ class ListEndpointsResponse:
1118
1149
  return cls(endpoints=_repeated_dict(d, 'endpoints', ServingEndpoint))
1119
1150
 
1120
1151
 
1152
+ @dataclass
1153
+ class ModelDataPlaneInfo:
1154
+ query_info: Optional[oauth2.DataPlaneInfo] = None
1155
+ """Information required to query DataPlane API 'query' endpoint."""
1156
+
1157
+ def as_dict(self) -> dict:
1158
+ """Serializes the ModelDataPlaneInfo into a dictionary suitable for use as a JSON request body."""
1159
+ body = {}
1160
+ if self.query_info: body['query_info'] = self.query_info.as_dict()
1161
+ return body
1162
+
1163
+ @classmethod
1164
+ def from_dict(cls, d: Dict[str, any]) -> ModelDataPlaneInfo:
1165
+ """Deserializes the ModelDataPlaneInfo from a dictionary."""
1166
+ return cls(query_info=_from_dict(d, 'query_info', oauth2.DataPlaneInfo))
1167
+
1168
+
1121
1169
  @dataclass
1122
1170
  class OpenAiConfig:
1123
1171
  microsoft_entra_client_id: Optional[str] = None
@@ -2172,6 +2220,9 @@ class ServingEndpointDetailed:
2172
2220
  creator: Optional[str] = None
2173
2221
  """The email of the user who created the serving endpoint."""
2174
2222
 
2223
+ data_plane_info: Optional[ModelDataPlaneInfo] = None
2224
+ """Information required to query DataPlane APIs."""
2225
+
2175
2226
  endpoint_url: Optional[str] = None
2176
2227
  """Endpoint invocation url if route optimization is enabled for endpoint"""
2177
2228
 
@@ -2209,6 +2260,7 @@ class ServingEndpointDetailed:
2209
2260
  if self.config: body['config'] = self.config.as_dict()
2210
2261
  if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp
2211
2262
  if self.creator is not None: body['creator'] = self.creator
2263
+ if self.data_plane_info: body['data_plane_info'] = self.data_plane_info.as_dict()
2212
2264
  if self.endpoint_url is not None: body['endpoint_url'] = self.endpoint_url
2213
2265
  if self.id is not None: body['id'] = self.id
2214
2266
  if self.last_updated_timestamp is not None:
@@ -2228,6 +2280,7 @@ class ServingEndpointDetailed:
2228
2280
  return cls(config=_from_dict(d, 'config', EndpointCoreConfigOutput),
2229
2281
  creation_timestamp=d.get('creation_timestamp', None),
2230
2282
  creator=d.get('creator', None),
2283
+ data_plane_info=_from_dict(d, 'data_plane_info', ModelDataPlaneInfo),
2231
2284
  endpoint_url=d.get('endpoint_url', None),
2232
2285
  id=d.get('id', None),
2233
2286
  last_updated_timestamp=d.get('last_updated_timestamp', None),
@@ -2351,6 +2404,12 @@ class ServingEndpointPermissionsRequest:
2351
2404
  serving_endpoint_id=d.get('serving_endpoint_id', None))
2352
2405
 
2353
2406
 
2407
+ @dataclass
2408
+ class StartAppRequest:
2409
+ name: Optional[str] = None
2410
+ """The name of the app."""
2411
+
2412
+
2354
2413
  @dataclass
2355
2414
  class StopAppRequest:
2356
2415
  name: Optional[str] = None
@@ -2391,8 +2450,8 @@ class TrafficConfig:
2391
2450
  @dataclass
2392
2451
  class UpdateAppRequest:
2393
2452
  name: str
2394
- """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
2395
- and be between 2 and 30 characters long. It must be unique within the workspace."""
2453
+ """The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
2454
+ It must be unique within the workspace."""
2396
2455
 
2397
2456
  description: Optional[str] = None
2398
2457
  """The description of the app."""
@@ -2521,13 +2580,13 @@ class AppsAPI:
2521
2580
  raise TimeoutError(f'timed out after {timeout}: {status_message}')
2522
2581
 
2523
2582
  def create(self, name: str, *, description: Optional[str] = None) -> Wait[App]:
2524
- """Create an App.
2583
+ """Create an app.
2525
2584
 
2526
2585
  Creates a new app.
2527
2586
 
2528
2587
  :param name: str
2529
- The name of the app. The name must contain only lowercase alphanumeric characters and hyphens and be
2530
- between 2 and 30 characters long. It must be unique within the workspace.
2588
+ The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
2589
+ must be unique within the workspace.
2531
2590
  :param description: str (optional)
2532
2591
  The description of the app.
2533
2592
 
@@ -2550,21 +2609,43 @@ class AppsAPI:
2550
2609
  timeout=timedelta(minutes=20)) -> App:
2551
2610
  return self.create(description=description, name=name).result(timeout=timeout)
2552
2611
 
2553
- def create_deployment(self, app_name: str, source_code_path: str) -> Wait[AppDeployment]:
2554
- """Create an App Deployment.
2612
+ def delete(self, name: str):
2613
+ """Delete an app.
2614
+
2615
+ Deletes an app.
2616
+
2617
+ :param name: str
2618
+ The name of the app.
2619
+
2620
+
2621
+ """
2622
+
2623
+ headers = {'Accept': 'application/json', }
2624
+
2625
+ self._api.do('DELETE', f'/api/2.0/preview/apps/{name}', headers=headers)
2626
+
2627
+ def deploy(self, app_name: str, source_code_path: str, mode: AppDeploymentMode) -> Wait[AppDeployment]:
2628
+ """Create an app deployment.
2555
2629
 
2556
2630
  Creates an app deployment for the app with the supplied name.
2557
2631
 
2558
2632
  :param app_name: str
2559
2633
  The name of the app.
2560
2634
  :param source_code_path: str
2561
- The source code path of the deployment.
2635
+ The workspace file system path of the source code used to create the app deployment. This is
2636
+ different from `deployment_artifacts.source_code_path`, which is the path used by the deployed app.
2637
+ The former refers to the original source code location of the app in the workspace during deployment
2638
+ creation, whereas the latter provides a system generated stable snapshotted source code path used by
2639
+ the deployment.
2640
+ :param mode: :class:`AppDeploymentMode`
2641
+ The mode of which the deployment will manage the source code.
2562
2642
 
2563
2643
  :returns:
2564
2644
  Long-running operation waiter for :class:`AppDeployment`.
2565
2645
  See :method:wait_get_deployment_app_succeeded for more details.
2566
2646
  """
2567
2647
  body = {}
2648
+ if mode is not None: body['mode'] = mode.value
2568
2649
  if source_code_path is not None: body['source_code_path'] = source_code_path
2569
2650
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2570
2651
 
@@ -2577,28 +2658,16 @@ class AppsAPI:
2577
2658
  app_name=app_name,
2578
2659
  deployment_id=op_response['deployment_id'])
2579
2660
 
2580
- def create_deployment_and_wait(self, app_name: str, source_code_path: str,
2581
- timeout=timedelta(minutes=20)) -> AppDeployment:
2582
- return self.create_deployment(app_name=app_name,
2583
- source_code_path=source_code_path).result(timeout=timeout)
2584
-
2585
- def delete(self, name: str):
2586
- """Delete an App.
2587
-
2588
- Deletes an app.
2589
-
2590
- :param name: str
2591
- The name of the app.
2592
-
2593
-
2594
- """
2595
-
2596
- headers = {'Accept': 'application/json', }
2597
-
2598
- self._api.do('DELETE', f'/api/2.0/preview/apps/{name}', headers=headers)
2661
+ def deploy_and_wait(self,
2662
+ app_name: str,
2663
+ source_code_path: str,
2664
+ mode: AppDeploymentMode,
2665
+ timeout=timedelta(minutes=20)) -> AppDeployment:
2666
+ return self.deploy(app_name=app_name, mode=mode,
2667
+ source_code_path=source_code_path).result(timeout=timeout)
2599
2668
 
2600
2669
  def get(self, name: str) -> App:
2601
- """Get an App.
2670
+ """Get an app.
2602
2671
 
2603
2672
  Retrieves information for the app with the supplied name.
2604
2673
 
@@ -2614,7 +2683,7 @@ class AppsAPI:
2614
2683
  return App.from_dict(res)
2615
2684
 
2616
2685
  def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment:
2617
- """Get an App Deployment.
2686
+ """Get an app deployment.
2618
2687
 
2619
2688
  Retrieves information for the app deployment with the supplied name and deployment id.
2620
2689
 
@@ -2634,7 +2703,7 @@ class AppsAPI:
2634
2703
  return AppDeployment.from_dict(res)
2635
2704
 
2636
2705
  def get_environment(self, name: str) -> AppEnvironment:
2637
- """Get App Environment.
2706
+ """Get app environment.
2638
2707
 
2639
2708
  Retrieves app environment.
2640
2709
 
@@ -2650,7 +2719,7 @@ class AppsAPI:
2650
2719
  return AppEnvironment.from_dict(res)
2651
2720
 
2652
2721
  def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]:
2653
- """List Apps.
2722
+ """List apps.
2654
2723
 
2655
2724
  Lists all apps in the workspace.
2656
2725
 
@@ -2681,7 +2750,7 @@ class AppsAPI:
2681
2750
  *,
2682
2751
  page_size: Optional[int] = None,
2683
2752
  page_token: Optional[str] = None) -> Iterator[AppDeployment]:
2684
- """List App Deployments.
2753
+ """List app deployments.
2685
2754
 
2686
2755
  Lists all app deployments for the app with the supplied name.
2687
2756
 
@@ -2712,8 +2781,24 @@ class AppsAPI:
2712
2781
  return
2713
2782
  query['page_token'] = json['next_page_token']
2714
2783
 
2784
+ def start(self, name: str) -> AppDeployment:
2785
+ """Start an app.
2786
+
2787
+ Start the last active deployment of the app in the workspace.
2788
+
2789
+ :param name: str
2790
+ The name of the app.
2791
+
2792
+ :returns: :class:`AppDeployment`
2793
+ """
2794
+
2795
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2796
+
2797
+ res = self._api.do('POST', f'/api/2.0/preview/apps/{name}/start', headers=headers)
2798
+ return AppDeployment.from_dict(res)
2799
+
2715
2800
  def stop(self, name: str):
2716
- """Stop an App.
2801
+ """Stop an app.
2717
2802
 
2718
2803
  Stops the active deployment of the app in the workspace.
2719
2804
 
@@ -2728,13 +2813,13 @@ class AppsAPI:
2728
2813
  self._api.do('POST', f'/api/2.0/preview/apps/{name}/stop', headers=headers)
2729
2814
 
2730
2815
  def update(self, name: str, *, description: Optional[str] = None) -> App:
2731
- """Update an App.
2816
+ """Update an app.
2732
2817
 
2733
2818
  Updates the app with the supplied name.
2734
2819
 
2735
2820
  :param name: str
2736
- The name of the app. The name must contain only lowercase alphanumeric characters and hyphens and be
2737
- between 2 and 30 characters long. It must be unique within the workspace.
2821
+ The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
2822
+ must be unique within the workspace.
2738
2823
  :param description: str (optional)
2739
2824
  The description of the app.
2740
2825