databricks-sdk 0.27.1__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.
- databricks/sdk/__init__.py +16 -12
- databricks/sdk/azure.py +0 -27
- databricks/sdk/config.py +71 -19
- databricks/sdk/core.py +27 -0
- databricks/sdk/credentials_provider.py +121 -44
- databricks/sdk/dbutils.py +81 -3
- databricks/sdk/environments.py +34 -1
- databricks/sdk/errors/__init__.py +1 -0
- databricks/sdk/errors/mapper.py +4 -0
- databricks/sdk/errors/private_link.py +60 -0
- databricks/sdk/oauth.py +8 -6
- databricks/sdk/service/catalog.py +774 -632
- databricks/sdk/service/compute.py +91 -116
- databricks/sdk/service/dashboards.py +707 -2
- databricks/sdk/service/jobs.py +126 -163
- databricks/sdk/service/marketplace.py +145 -31
- databricks/sdk/service/oauth2.py +22 -0
- databricks/sdk/service/pipelines.py +119 -4
- databricks/sdk/service/serving.py +217 -64
- databricks/sdk/service/settings.py +1 -0
- databricks/sdk/service/sharing.py +36 -2
- databricks/sdk/service/sql.py +103 -24
- databricks/sdk/service/vectorsearch.py +263 -1
- databricks/sdk/service/workspace.py +8 -4
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.27.1.dist-info → databricks_sdk-0.29.0.dist-info}/METADATA +2 -1
- databricks_sdk-0.29.0.dist-info/RECORD +57 -0
- databricks_sdk-0.27.1.dist-info/RECORD +0 -56
- {databricks_sdk-0.27.1.dist-info → databricks_sdk-0.29.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.27.1.dist-info → databricks_sdk-0.29.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.27.1.dist-info → databricks_sdk-0.29.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.27.1.dist-info → databricks_sdk-0.29.0.dist-info}/top_level.txt +0 -0
|
@@ -8,13 +8,15 @@ import time
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
9
|
from datetime import timedelta
|
|
10
10
|
from enum import Enum
|
|
11
|
-
from typing import Any, Callable, Dict, Iterator, List, Optional
|
|
11
|
+
from typing import Any, BinaryIO, 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
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
|
-
|
|
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
|
|
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."""
|
|
@@ -170,6 +188,9 @@ class AppDeployment:
|
|
|
170
188
|
creator: Optional[str] = None
|
|
171
189
|
"""The email of the user creates the deployment."""
|
|
172
190
|
|
|
191
|
+
deployment_artifacts: Optional[AppDeploymentArtifacts] = None
|
|
192
|
+
"""The deployment artifacts for an app."""
|
|
193
|
+
|
|
173
194
|
deployment_id: Optional[str] = None
|
|
174
195
|
"""The unique id of the deployment."""
|
|
175
196
|
|
|
@@ -184,7 +205,9 @@ class AppDeployment:
|
|
|
184
205
|
body = {}
|
|
185
206
|
if self.create_time is not None: body['create_time'] = self.create_time
|
|
186
207
|
if self.creator is not None: body['creator'] = self.creator
|
|
208
|
+
if self.deployment_artifacts: body['deployment_artifacts'] = self.deployment_artifacts.as_dict()
|
|
187
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
|
|
188
211
|
if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
|
|
189
212
|
if self.status: body['status'] = self.status.as_dict()
|
|
190
213
|
if self.update_time is not None: body['update_time'] = self.update_time
|
|
@@ -195,18 +218,44 @@ class AppDeployment:
|
|
|
195
218
|
"""Deserializes the AppDeployment from a dictionary."""
|
|
196
219
|
return cls(create_time=d.get('create_time', None),
|
|
197
220
|
creator=d.get('creator', None),
|
|
221
|
+
deployment_artifacts=_from_dict(d, 'deployment_artifacts', AppDeploymentArtifacts),
|
|
198
222
|
deployment_id=d.get('deployment_id', None),
|
|
223
|
+
mode=_enum(d, 'mode', AppDeploymentMode),
|
|
199
224
|
source_code_path=d.get('source_code_path', None),
|
|
200
225
|
status=_from_dict(d, 'status', AppDeploymentStatus),
|
|
201
226
|
update_time=d.get('update_time', None))
|
|
202
227
|
|
|
203
228
|
|
|
229
|
+
@dataclass
|
|
230
|
+
class AppDeploymentArtifacts:
|
|
231
|
+
source_code_path: Optional[str] = None
|
|
232
|
+
"""The snapshotted workspace file system path of the source code loaded by the deployed app."""
|
|
233
|
+
|
|
234
|
+
def as_dict(self) -> dict:
|
|
235
|
+
"""Serializes the AppDeploymentArtifacts into a dictionary suitable for use as a JSON request body."""
|
|
236
|
+
body = {}
|
|
237
|
+
if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
|
|
238
|
+
return body
|
|
239
|
+
|
|
240
|
+
@classmethod
|
|
241
|
+
def from_dict(cls, d: Dict[str, any]) -> AppDeploymentArtifacts:
|
|
242
|
+
"""Deserializes the AppDeploymentArtifacts from a dictionary."""
|
|
243
|
+
return cls(source_code_path=d.get('source_code_path', None))
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class AppDeploymentMode(Enum):
|
|
247
|
+
|
|
248
|
+
AUTO_SYNC = 'AUTO_SYNC'
|
|
249
|
+
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
|
|
250
|
+
SNAPSHOT = 'SNAPSHOT'
|
|
251
|
+
|
|
252
|
+
|
|
204
253
|
class AppDeploymentState(Enum):
|
|
205
254
|
|
|
206
|
-
CANCELLED = 'CANCELLED'
|
|
207
255
|
FAILED = 'FAILED'
|
|
208
256
|
IN_PROGRESS = 'IN_PROGRESS'
|
|
209
257
|
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
|
|
258
|
+
STOPPED = 'STOPPED'
|
|
210
259
|
SUCCEEDED = 'SUCCEEDED'
|
|
211
260
|
|
|
212
261
|
|
|
@@ -252,15 +301,11 @@ class AppState(Enum):
|
|
|
252
301
|
CREATING = 'CREATING'
|
|
253
302
|
DELETED = 'DELETED'
|
|
254
303
|
DELETING = 'DELETING'
|
|
255
|
-
DEPLOYED = 'DEPLOYED'
|
|
256
|
-
DEPLOYING = 'DEPLOYING'
|
|
257
304
|
ERROR = 'ERROR'
|
|
258
305
|
IDLE = 'IDLE'
|
|
259
|
-
READY = 'READY'
|
|
260
306
|
RUNNING = 'RUNNING'
|
|
261
307
|
STARTING = 'STARTING'
|
|
262
308
|
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
|
|
263
|
-
UPDATING = 'UPDATING'
|
|
264
309
|
|
|
265
310
|
|
|
266
311
|
@dataclass
|
|
@@ -288,19 +333,18 @@ class AppStatus:
|
|
|
288
333
|
class AutoCaptureConfigInput:
|
|
289
334
|
catalog_name: Optional[str] = None
|
|
290
335
|
"""The name of the catalog in Unity Catalog. NOTE: On update, you cannot change the catalog name if
|
|
291
|
-
|
|
336
|
+
the inference table is already enabled."""
|
|
292
337
|
|
|
293
338
|
enabled: Optional[bool] = None
|
|
294
|
-
"""
|
|
295
|
-
you cannot enable again."""
|
|
339
|
+
"""Indicates whether the inference table is enabled."""
|
|
296
340
|
|
|
297
341
|
schema_name: Optional[str] = None
|
|
298
342
|
"""The name of the schema in Unity Catalog. NOTE: On update, you cannot change the schema name if
|
|
299
|
-
|
|
343
|
+
the inference table is already enabled."""
|
|
300
344
|
|
|
301
345
|
table_name_prefix: Optional[str] = None
|
|
302
346
|
"""The prefix of the table in Unity Catalog. NOTE: On update, you cannot change the prefix name if
|
|
303
|
-
|
|
347
|
+
the inference table is already enabled."""
|
|
304
348
|
|
|
305
349
|
def as_dict(self) -> dict:
|
|
306
350
|
"""Serializes the AutoCaptureConfigInput into a dictionary suitable for use as a JSON request body."""
|
|
@@ -326,7 +370,7 @@ class AutoCaptureConfigOutput:
|
|
|
326
370
|
"""The name of the catalog in Unity Catalog."""
|
|
327
371
|
|
|
328
372
|
enabled: Optional[bool] = None
|
|
329
|
-
"""
|
|
373
|
+
"""Indicates whether the inference table is enabled."""
|
|
330
374
|
|
|
331
375
|
schema_name: Optional[str] = None
|
|
332
376
|
"""The name of the schema in Unity Catalog."""
|
|
@@ -438,7 +482,14 @@ class CohereConfig:
|
|
|
438
482
|
@dataclass
|
|
439
483
|
class CreateAppDeploymentRequest:
|
|
440
484
|
source_code_path: str
|
|
441
|
-
"""The
|
|
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."""
|
|
442
493
|
|
|
443
494
|
app_name: Optional[str] = None
|
|
444
495
|
"""The name of the app."""
|
|
@@ -447,20 +498,23 @@ class CreateAppDeploymentRequest:
|
|
|
447
498
|
"""Serializes the CreateAppDeploymentRequest into a dictionary suitable for use as a JSON request body."""
|
|
448
499
|
body = {}
|
|
449
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
|
|
450
502
|
if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
|
|
451
503
|
return body
|
|
452
504
|
|
|
453
505
|
@classmethod
|
|
454
506
|
def from_dict(cls, d: Dict[str, any]) -> CreateAppDeploymentRequest:
|
|
455
507
|
"""Deserializes the CreateAppDeploymentRequest from a dictionary."""
|
|
456
|
-
return cls(app_name=d.get('app_name', 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))
|
|
457
511
|
|
|
458
512
|
|
|
459
513
|
@dataclass
|
|
460
514
|
class CreateAppRequest:
|
|
461
515
|
name: str
|
|
462
|
-
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
|
|
463
|
-
|
|
516
|
+
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
|
|
517
|
+
It must be unique within the workspace."""
|
|
464
518
|
|
|
465
519
|
description: Optional[str] = None
|
|
466
520
|
"""The description of the app."""
|
|
@@ -491,6 +545,9 @@ class CreateServingEndpoint:
|
|
|
491
545
|
"""Rate limits to be applied to the serving endpoint. NOTE: only external and foundation model
|
|
492
546
|
endpoints are supported as of now."""
|
|
493
547
|
|
|
548
|
+
route_optimized: Optional[bool] = None
|
|
549
|
+
"""Enable route optimization for the serving endpoint."""
|
|
550
|
+
|
|
494
551
|
tags: Optional[List[EndpointTag]] = None
|
|
495
552
|
"""Tags to be attached to the serving endpoint and automatically propagated to billing logs."""
|
|
496
553
|
|
|
@@ -500,6 +557,7 @@ class CreateServingEndpoint:
|
|
|
500
557
|
if self.config: body['config'] = self.config.as_dict()
|
|
501
558
|
if self.name is not None: body['name'] = self.name
|
|
502
559
|
if self.rate_limits: body['rate_limits'] = [v.as_dict() for v in self.rate_limits]
|
|
560
|
+
if self.route_optimized is not None: body['route_optimized'] = self.route_optimized
|
|
503
561
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
504
562
|
return body
|
|
505
563
|
|
|
@@ -509,6 +567,7 @@ class CreateServingEndpoint:
|
|
|
509
567
|
return cls(config=_from_dict(d, 'config', EndpointCoreConfigInput),
|
|
510
568
|
name=d.get('name', None),
|
|
511
569
|
rate_limits=_repeated_dict(d, 'rate_limits', RateLimit),
|
|
570
|
+
route_optimized=d.get('route_optimized', None),
|
|
512
571
|
tags=_repeated_dict(d, 'tags', EndpointTag))
|
|
513
572
|
|
|
514
573
|
|
|
@@ -844,16 +903,18 @@ class EnvVariable:
|
|
|
844
903
|
|
|
845
904
|
@dataclass
|
|
846
905
|
class ExportMetricsResponse:
|
|
906
|
+
contents: Optional[BinaryIO] = None
|
|
847
907
|
|
|
848
908
|
def as_dict(self) -> dict:
|
|
849
909
|
"""Serializes the ExportMetricsResponse into a dictionary suitable for use as a JSON request body."""
|
|
850
910
|
body = {}
|
|
911
|
+
if self.contents: body['contents'] = self.contents
|
|
851
912
|
return body
|
|
852
913
|
|
|
853
914
|
@classmethod
|
|
854
915
|
def from_dict(cls, d: Dict[str, any]) -> ExportMetricsResponse:
|
|
855
916
|
"""Deserializes the ExportMetricsResponse from a dictionary."""
|
|
856
|
-
return cls()
|
|
917
|
+
return cls(contents=d.get('contents', None))
|
|
857
918
|
|
|
858
919
|
|
|
859
920
|
@dataclass
|
|
@@ -1088,16 +1149,43 @@ class ListEndpointsResponse:
|
|
|
1088
1149
|
return cls(endpoints=_repeated_dict(d, 'endpoints', ServingEndpoint))
|
|
1089
1150
|
|
|
1090
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
|
+
|
|
1091
1169
|
@dataclass
|
|
1092
1170
|
class OpenAiConfig:
|
|
1093
|
-
|
|
1094
|
-
"""
|
|
1171
|
+
microsoft_entra_client_id: Optional[str] = None
|
|
1172
|
+
"""This field is only required for Azure AD OpenAI and is the Microsoft Entra Client ID."""
|
|
1173
|
+
|
|
1174
|
+
microsoft_entra_client_secret: Optional[str] = None
|
|
1175
|
+
"""The Databricks secret key reference for the Microsoft Entra Client Secret that is only required
|
|
1176
|
+
for Azure AD OpenAI."""
|
|
1177
|
+
|
|
1178
|
+
microsoft_entra_tenant_id: Optional[str] = None
|
|
1179
|
+
"""This field is only required for Azure AD OpenAI and is the Microsoft Entra Tenant ID."""
|
|
1095
1180
|
|
|
1096
1181
|
openai_api_base: Optional[str] = None
|
|
1097
1182
|
"""This is the base URL for the OpenAI API (default: "https://api.openai.com/v1"). For Azure
|
|
1098
1183
|
OpenAI, this field is required, and is the base URL for the Azure OpenAI API service provided by
|
|
1099
1184
|
Azure."""
|
|
1100
1185
|
|
|
1186
|
+
openai_api_key: Optional[str] = None
|
|
1187
|
+
"""The Databricks secret key reference for an OpenAI or Azure OpenAI API key."""
|
|
1188
|
+
|
|
1101
1189
|
openai_api_type: Optional[str] = None
|
|
1102
1190
|
"""This is an optional field to specify the type of OpenAI API to use. For Azure OpenAI, this field
|
|
1103
1191
|
is required, and adjust this parameter to represent the preferred security access validation
|
|
@@ -1118,6 +1206,12 @@ class OpenAiConfig:
|
|
|
1118
1206
|
def as_dict(self) -> dict:
|
|
1119
1207
|
"""Serializes the OpenAiConfig into a dictionary suitable for use as a JSON request body."""
|
|
1120
1208
|
body = {}
|
|
1209
|
+
if self.microsoft_entra_client_id is not None:
|
|
1210
|
+
body['microsoft_entra_client_id'] = self.microsoft_entra_client_id
|
|
1211
|
+
if self.microsoft_entra_client_secret is not None:
|
|
1212
|
+
body['microsoft_entra_client_secret'] = self.microsoft_entra_client_secret
|
|
1213
|
+
if self.microsoft_entra_tenant_id is not None:
|
|
1214
|
+
body['microsoft_entra_tenant_id'] = self.microsoft_entra_tenant_id
|
|
1121
1215
|
if self.openai_api_base is not None: body['openai_api_base'] = self.openai_api_base
|
|
1122
1216
|
if self.openai_api_key is not None: body['openai_api_key'] = self.openai_api_key
|
|
1123
1217
|
if self.openai_api_type is not None: body['openai_api_type'] = self.openai_api_type
|
|
@@ -1130,7 +1224,10 @@ class OpenAiConfig:
|
|
|
1130
1224
|
@classmethod
|
|
1131
1225
|
def from_dict(cls, d: Dict[str, any]) -> OpenAiConfig:
|
|
1132
1226
|
"""Deserializes the OpenAiConfig from a dictionary."""
|
|
1133
|
-
return cls(
|
|
1227
|
+
return cls(microsoft_entra_client_id=d.get('microsoft_entra_client_id', None),
|
|
1228
|
+
microsoft_entra_client_secret=d.get('microsoft_entra_client_secret', None),
|
|
1229
|
+
microsoft_entra_tenant_id=d.get('microsoft_entra_tenant_id', None),
|
|
1230
|
+
openai_api_base=d.get('openai_api_base', None),
|
|
1134
1231
|
openai_api_key=d.get('openai_api_key', None),
|
|
1135
1232
|
openai_api_type=d.get('openai_api_type', None),
|
|
1136
1233
|
openai_api_version=d.get('openai_api_version', None),
|
|
@@ -2123,6 +2220,12 @@ class ServingEndpointDetailed:
|
|
|
2123
2220
|
creator: Optional[str] = None
|
|
2124
2221
|
"""The email of the user who created the serving endpoint."""
|
|
2125
2222
|
|
|
2223
|
+
data_plane_info: Optional[ModelDataPlaneInfo] = None
|
|
2224
|
+
"""Information required to query DataPlane APIs."""
|
|
2225
|
+
|
|
2226
|
+
endpoint_url: Optional[str] = None
|
|
2227
|
+
"""Endpoint invocation url if route optimization is enabled for endpoint"""
|
|
2228
|
+
|
|
2126
2229
|
id: Optional[str] = None
|
|
2127
2230
|
"""System-generated ID of the endpoint. This is used to refer to the endpoint in the Permissions
|
|
2128
2231
|
API"""
|
|
@@ -2139,6 +2242,9 @@ class ServingEndpointDetailed:
|
|
|
2139
2242
|
permission_level: Optional[ServingEndpointDetailedPermissionLevel] = None
|
|
2140
2243
|
"""The permission level of the principal making the request."""
|
|
2141
2244
|
|
|
2245
|
+
route_optimized: Optional[bool] = None
|
|
2246
|
+
"""Boolean representing if route optimization has been enabled for the endpoint"""
|
|
2247
|
+
|
|
2142
2248
|
state: Optional[EndpointState] = None
|
|
2143
2249
|
"""Information corresponding to the state of the serving endpoint."""
|
|
2144
2250
|
|
|
@@ -2154,12 +2260,15 @@ class ServingEndpointDetailed:
|
|
|
2154
2260
|
if self.config: body['config'] = self.config.as_dict()
|
|
2155
2261
|
if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp
|
|
2156
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()
|
|
2264
|
+
if self.endpoint_url is not None: body['endpoint_url'] = self.endpoint_url
|
|
2157
2265
|
if self.id is not None: body['id'] = self.id
|
|
2158
2266
|
if self.last_updated_timestamp is not None:
|
|
2159
2267
|
body['last_updated_timestamp'] = self.last_updated_timestamp
|
|
2160
2268
|
if self.name is not None: body['name'] = self.name
|
|
2161
2269
|
if self.pending_config: body['pending_config'] = self.pending_config.as_dict()
|
|
2162
2270
|
if self.permission_level is not None: body['permission_level'] = self.permission_level.value
|
|
2271
|
+
if self.route_optimized is not None: body['route_optimized'] = self.route_optimized
|
|
2163
2272
|
if self.state: body['state'] = self.state.as_dict()
|
|
2164
2273
|
if self.tags: body['tags'] = [v.as_dict() for v in self.tags]
|
|
2165
2274
|
if self.task is not None: body['task'] = self.task
|
|
@@ -2171,11 +2280,14 @@ class ServingEndpointDetailed:
|
|
|
2171
2280
|
return cls(config=_from_dict(d, 'config', EndpointCoreConfigOutput),
|
|
2172
2281
|
creation_timestamp=d.get('creation_timestamp', None),
|
|
2173
2282
|
creator=d.get('creator', None),
|
|
2283
|
+
data_plane_info=_from_dict(d, 'data_plane_info', ModelDataPlaneInfo),
|
|
2284
|
+
endpoint_url=d.get('endpoint_url', None),
|
|
2174
2285
|
id=d.get('id', None),
|
|
2175
2286
|
last_updated_timestamp=d.get('last_updated_timestamp', None),
|
|
2176
2287
|
name=d.get('name', None),
|
|
2177
2288
|
pending_config=_from_dict(d, 'pending_config', EndpointPendingConfig),
|
|
2178
2289
|
permission_level=_enum(d, 'permission_level', ServingEndpointDetailedPermissionLevel),
|
|
2290
|
+
route_optimized=d.get('route_optimized', None),
|
|
2179
2291
|
state=_from_dict(d, 'state', EndpointState),
|
|
2180
2292
|
tags=_repeated_dict(d, 'tags', EndpointTag),
|
|
2181
2293
|
task=d.get('task', None))
|
|
@@ -2292,6 +2404,12 @@ class ServingEndpointPermissionsRequest:
|
|
|
2292
2404
|
serving_endpoint_id=d.get('serving_endpoint_id', None))
|
|
2293
2405
|
|
|
2294
2406
|
|
|
2407
|
+
@dataclass
|
|
2408
|
+
class StartAppRequest:
|
|
2409
|
+
name: Optional[str] = None
|
|
2410
|
+
"""The name of the app."""
|
|
2411
|
+
|
|
2412
|
+
|
|
2295
2413
|
@dataclass
|
|
2296
2414
|
class StopAppRequest:
|
|
2297
2415
|
name: Optional[str] = None
|
|
@@ -2332,8 +2450,8 @@ class TrafficConfig:
|
|
|
2332
2450
|
@dataclass
|
|
2333
2451
|
class UpdateAppRequest:
|
|
2334
2452
|
name: str
|
|
2335
|
-
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
|
|
2336
|
-
|
|
2453
|
+
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
|
|
2454
|
+
It must be unique within the workspace."""
|
|
2337
2455
|
|
|
2338
2456
|
description: Optional[str] = None
|
|
2339
2457
|
"""The description of the app."""
|
|
@@ -2462,13 +2580,13 @@ class AppsAPI:
|
|
|
2462
2580
|
raise TimeoutError(f'timed out after {timeout}: {status_message}')
|
|
2463
2581
|
|
|
2464
2582
|
def create(self, name: str, *, description: Optional[str] = None) -> Wait[App]:
|
|
2465
|
-
"""Create an
|
|
2583
|
+
"""Create an app.
|
|
2466
2584
|
|
|
2467
2585
|
Creates a new app.
|
|
2468
2586
|
|
|
2469
2587
|
:param name: str
|
|
2470
|
-
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
|
|
2471
|
-
|
|
2588
|
+
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
|
|
2589
|
+
must be unique within the workspace.
|
|
2472
2590
|
:param description: str (optional)
|
|
2473
2591
|
The description of the app.
|
|
2474
2592
|
|
|
@@ -2491,21 +2609,43 @@ class AppsAPI:
|
|
|
2491
2609
|
timeout=timedelta(minutes=20)) -> App:
|
|
2492
2610
|
return self.create(description=description, name=name).result(timeout=timeout)
|
|
2493
2611
|
|
|
2494
|
-
def
|
|
2495
|
-
"""
|
|
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.
|
|
2496
2629
|
|
|
2497
2630
|
Creates an app deployment for the app with the supplied name.
|
|
2498
2631
|
|
|
2499
2632
|
:param app_name: str
|
|
2500
2633
|
The name of the app.
|
|
2501
2634
|
:param source_code_path: str
|
|
2502
|
-
The
|
|
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.
|
|
2503
2642
|
|
|
2504
2643
|
:returns:
|
|
2505
2644
|
Long-running operation waiter for :class:`AppDeployment`.
|
|
2506
2645
|
See :method:wait_get_deployment_app_succeeded for more details.
|
|
2507
2646
|
"""
|
|
2508
2647
|
body = {}
|
|
2648
|
+
if mode is not None: body['mode'] = mode.value
|
|
2509
2649
|
if source_code_path is not None: body['source_code_path'] = source_code_path
|
|
2510
2650
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2511
2651
|
|
|
@@ -2518,28 +2658,16 @@ class AppsAPI:
|
|
|
2518
2658
|
app_name=app_name,
|
|
2519
2659
|
deployment_id=op_response['deployment_id'])
|
|
2520
2660
|
|
|
2521
|
-
def
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
Deletes an app.
|
|
2530
|
-
|
|
2531
|
-
:param name: str
|
|
2532
|
-
The name of the app.
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
"""
|
|
2536
|
-
|
|
2537
|
-
headers = {'Accept': 'application/json', }
|
|
2538
|
-
|
|
2539
|
-
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)
|
|
2540
2668
|
|
|
2541
2669
|
def get(self, name: str) -> App:
|
|
2542
|
-
"""Get an
|
|
2670
|
+
"""Get an app.
|
|
2543
2671
|
|
|
2544
2672
|
Retrieves information for the app with the supplied name.
|
|
2545
2673
|
|
|
@@ -2555,7 +2683,7 @@ class AppsAPI:
|
|
|
2555
2683
|
return App.from_dict(res)
|
|
2556
2684
|
|
|
2557
2685
|
def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment:
|
|
2558
|
-
"""Get an
|
|
2686
|
+
"""Get an app deployment.
|
|
2559
2687
|
|
|
2560
2688
|
Retrieves information for the app deployment with the supplied name and deployment id.
|
|
2561
2689
|
|
|
@@ -2575,7 +2703,7 @@ class AppsAPI:
|
|
|
2575
2703
|
return AppDeployment.from_dict(res)
|
|
2576
2704
|
|
|
2577
2705
|
def get_environment(self, name: str) -> AppEnvironment:
|
|
2578
|
-
"""Get
|
|
2706
|
+
"""Get app environment.
|
|
2579
2707
|
|
|
2580
2708
|
Retrieves app environment.
|
|
2581
2709
|
|
|
@@ -2591,7 +2719,7 @@ class AppsAPI:
|
|
|
2591
2719
|
return AppEnvironment.from_dict(res)
|
|
2592
2720
|
|
|
2593
2721
|
def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]:
|
|
2594
|
-
"""List
|
|
2722
|
+
"""List apps.
|
|
2595
2723
|
|
|
2596
2724
|
Lists all apps in the workspace.
|
|
2597
2725
|
|
|
@@ -2622,7 +2750,7 @@ class AppsAPI:
|
|
|
2622
2750
|
*,
|
|
2623
2751
|
page_size: Optional[int] = None,
|
|
2624
2752
|
page_token: Optional[str] = None) -> Iterator[AppDeployment]:
|
|
2625
|
-
"""List
|
|
2753
|
+
"""List app deployments.
|
|
2626
2754
|
|
|
2627
2755
|
Lists all app deployments for the app with the supplied name.
|
|
2628
2756
|
|
|
@@ -2653,8 +2781,24 @@ class AppsAPI:
|
|
|
2653
2781
|
return
|
|
2654
2782
|
query['page_token'] = json['next_page_token']
|
|
2655
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
|
+
|
|
2656
2800
|
def stop(self, name: str):
|
|
2657
|
-
"""Stop an
|
|
2801
|
+
"""Stop an app.
|
|
2658
2802
|
|
|
2659
2803
|
Stops the active deployment of the app in the workspace.
|
|
2660
2804
|
|
|
@@ -2669,13 +2813,13 @@ class AppsAPI:
|
|
|
2669
2813
|
self._api.do('POST', f'/api/2.0/preview/apps/{name}/stop', headers=headers)
|
|
2670
2814
|
|
|
2671
2815
|
def update(self, name: str, *, description: Optional[str] = None) -> App:
|
|
2672
|
-
"""Update an
|
|
2816
|
+
"""Update an app.
|
|
2673
2817
|
|
|
2674
2818
|
Updates the app with the supplied name.
|
|
2675
2819
|
|
|
2676
2820
|
:param name: str
|
|
2677
|
-
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens
|
|
2678
|
-
|
|
2821
|
+
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
|
|
2822
|
+
must be unique within the workspace.
|
|
2679
2823
|
:param description: str (optional)
|
|
2680
2824
|
The description of the app.
|
|
2681
2825
|
|
|
@@ -2760,6 +2904,7 @@ class ServingEndpointsAPI:
|
|
|
2760
2904
|
config: EndpointCoreConfigInput,
|
|
2761
2905
|
*,
|
|
2762
2906
|
rate_limits: Optional[List[RateLimit]] = None,
|
|
2907
|
+
route_optimized: Optional[bool] = None,
|
|
2763
2908
|
tags: Optional[List[EndpointTag]] = None) -> Wait[ServingEndpointDetailed]:
|
|
2764
2909
|
"""Create a new serving endpoint.
|
|
2765
2910
|
|
|
@@ -2771,6 +2916,8 @@ class ServingEndpointsAPI:
|
|
|
2771
2916
|
:param rate_limits: List[:class:`RateLimit`] (optional)
|
|
2772
2917
|
Rate limits to be applied to the serving endpoint. NOTE: only external and foundation model
|
|
2773
2918
|
endpoints are supported as of now.
|
|
2919
|
+
:param route_optimized: bool (optional)
|
|
2920
|
+
Enable route optimization for the serving endpoint.
|
|
2774
2921
|
:param tags: List[:class:`EndpointTag`] (optional)
|
|
2775
2922
|
Tags to be attached to the serving endpoint and automatically propagated to billing logs.
|
|
2776
2923
|
|
|
@@ -2782,6 +2929,7 @@ class ServingEndpointsAPI:
|
|
|
2782
2929
|
if config is not None: body['config'] = config.as_dict()
|
|
2783
2930
|
if name is not None: body['name'] = name
|
|
2784
2931
|
if rate_limits is not None: body['rate_limits'] = [v.as_dict() for v in rate_limits]
|
|
2932
|
+
if route_optimized is not None: body['route_optimized'] = route_optimized
|
|
2785
2933
|
if tags is not None: body['tags'] = [v.as_dict() for v in tags]
|
|
2786
2934
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2787
2935
|
|
|
@@ -2796,9 +2944,13 @@ class ServingEndpointsAPI:
|
|
|
2796
2944
|
config: EndpointCoreConfigInput,
|
|
2797
2945
|
*,
|
|
2798
2946
|
rate_limits: Optional[List[RateLimit]] = None,
|
|
2947
|
+
route_optimized: Optional[bool] = None,
|
|
2799
2948
|
tags: Optional[List[EndpointTag]] = None,
|
|
2800
2949
|
timeout=timedelta(minutes=20)) -> ServingEndpointDetailed:
|
|
2801
|
-
return self.create(config=config,
|
|
2950
|
+
return self.create(config=config,
|
|
2951
|
+
name=name,
|
|
2952
|
+
rate_limits=rate_limits,
|
|
2953
|
+
route_optimized=route_optimized,
|
|
2802
2954
|
tags=tags).result(timeout=timeout)
|
|
2803
2955
|
|
|
2804
2956
|
def delete(self, name: str):
|
|
@@ -2814,7 +2966,7 @@ class ServingEndpointsAPI:
|
|
|
2814
2966
|
|
|
2815
2967
|
self._api.do('DELETE', f'/api/2.0/serving-endpoints/{name}', headers=headers)
|
|
2816
2968
|
|
|
2817
|
-
def export_metrics(self, name: str):
|
|
2969
|
+
def export_metrics(self, name: str) -> ExportMetricsResponse:
|
|
2818
2970
|
"""Get metrics of a serving endpoint.
|
|
2819
2971
|
|
|
2820
2972
|
Retrieves the metrics associated with the provided serving endpoint in either Prometheus or
|
|
@@ -2823,12 +2975,13 @@ class ServingEndpointsAPI:
|
|
|
2823
2975
|
:param name: str
|
|
2824
2976
|
The name of the serving endpoint to retrieve metrics for. This field is required.
|
|
2825
2977
|
|
|
2826
|
-
|
|
2978
|
+
:returns: :class:`ExportMetricsResponse`
|
|
2827
2979
|
"""
|
|
2828
2980
|
|
|
2829
|
-
headers = {}
|
|
2981
|
+
headers = {'Accept': 'text/plain', }
|
|
2830
2982
|
|
|
2831
|
-
self._api.do('GET', f'/api/2.0/serving-endpoints/{name}/metrics', headers=headers)
|
|
2983
|
+
res = self._api.do('GET', f'/api/2.0/serving-endpoints/{name}/metrics', headers=headers, raw=True)
|
|
2984
|
+
return ExportMetricsResponse.from_dict(res)
|
|
2832
2985
|
|
|
2833
2986
|
def get(self, name: str) -> ServingEndpointDetailed:
|
|
2834
2987
|
"""Get a single serving endpoint.
|
|
@@ -282,6 +282,7 @@ class ComplianceStandard(Enum):
|
|
|
282
282
|
"""Compliance stardard for SHIELD customers"""
|
|
283
283
|
|
|
284
284
|
COMPLIANCE_STANDARD_UNSPECIFIED = 'COMPLIANCE_STANDARD_UNSPECIFIED'
|
|
285
|
+
CYBER_ESSENTIAL_PLUS = 'CYBER_ESSENTIAL_PLUS'
|
|
285
286
|
FEDRAMP_HIGH = 'FEDRAMP_HIGH'
|
|
286
287
|
FEDRAMP_IL5 = 'FEDRAMP_IL5'
|
|
287
288
|
FEDRAMP_MODERATE = 'FEDRAMP_MODERATE'
|