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.
- databricks/sdk/__init__.py +7 -3
- databricks/sdk/config.py +65 -10
- databricks/sdk/core.py +22 -0
- databricks/sdk/credentials_provider.py +121 -44
- databricks/sdk/dbutils.py +81 -3
- databricks/sdk/oauth.py +8 -6
- databricks/sdk/service/catalog.py +132 -28
- databricks/sdk/service/compute.py +21 -13
- databricks/sdk/service/dashboards.py +707 -2
- databricks/sdk/service/jobs.py +126 -152
- databricks/sdk/service/marketplace.py +136 -0
- databricks/sdk/service/oauth2.py +22 -0
- databricks/sdk/service/pipelines.py +1 -1
- databricks/sdk/service/serving.py +140 -55
- databricks/sdk/service/settings.py +1 -0
- databricks/sdk/service/sharing.py +0 -1
- databricks/sdk/service/sql.py +103 -23
- databricks/sdk/service/vectorsearch.py +75 -0
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/METADATA +2 -1
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/RECORD +25 -25
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.29.0.dist-info}/top_level.txt +0 -0
|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
|
5
5
|
import logging
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from enum import Enum
|
|
8
|
-
from typing import Dict, Optional
|
|
8
|
+
from typing import Dict, Iterator, List, Optional
|
|
9
9
|
|
|
10
|
-
from ._internal import _enum
|
|
10
|
+
from ._internal import _enum, _from_dict, _repeated_dict
|
|
11
11
|
|
|
12
12
|
_LOG = logging.getLogger('databricks.sdk')
|
|
13
13
|
|
|
@@ -47,6 +47,94 @@ class CreateDashboardRequest:
|
|
|
47
47
|
warehouse_id=d.get('warehouse_id', None))
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
@dataclass
|
|
51
|
+
class CreateScheduleRequest:
|
|
52
|
+
cron_schedule: CronSchedule
|
|
53
|
+
"""The cron expression describing the frequency of the periodic refresh for this schedule."""
|
|
54
|
+
|
|
55
|
+
dashboard_id: Optional[str] = None
|
|
56
|
+
"""UUID identifying the dashboard to which the schedule belongs."""
|
|
57
|
+
|
|
58
|
+
display_name: Optional[str] = None
|
|
59
|
+
"""The display name for schedule."""
|
|
60
|
+
|
|
61
|
+
pause_status: Optional[SchedulePauseStatus] = None
|
|
62
|
+
"""The status indicates whether this schedule is paused or not."""
|
|
63
|
+
|
|
64
|
+
def as_dict(self) -> dict:
|
|
65
|
+
"""Serializes the CreateScheduleRequest into a dictionary suitable for use as a JSON request body."""
|
|
66
|
+
body = {}
|
|
67
|
+
if self.cron_schedule: body['cron_schedule'] = self.cron_schedule.as_dict()
|
|
68
|
+
if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
|
|
69
|
+
if self.display_name is not None: body['display_name'] = self.display_name
|
|
70
|
+
if self.pause_status is not None: body['pause_status'] = self.pause_status.value
|
|
71
|
+
return body
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, d: Dict[str, any]) -> CreateScheduleRequest:
|
|
75
|
+
"""Deserializes the CreateScheduleRequest from a dictionary."""
|
|
76
|
+
return cls(cron_schedule=_from_dict(d, 'cron_schedule', CronSchedule),
|
|
77
|
+
dashboard_id=d.get('dashboard_id', None),
|
|
78
|
+
display_name=d.get('display_name', None),
|
|
79
|
+
pause_status=_enum(d, 'pause_status', SchedulePauseStatus))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass
|
|
83
|
+
class CreateSubscriptionRequest:
|
|
84
|
+
subscriber: Subscriber
|
|
85
|
+
"""Subscriber details for users and destinations to be added as subscribers to the schedule."""
|
|
86
|
+
|
|
87
|
+
dashboard_id: Optional[str] = None
|
|
88
|
+
"""UUID identifying the dashboard to which the subscription belongs."""
|
|
89
|
+
|
|
90
|
+
schedule_id: Optional[str] = None
|
|
91
|
+
"""UUID identifying the schedule to which the subscription belongs."""
|
|
92
|
+
|
|
93
|
+
def as_dict(self) -> dict:
|
|
94
|
+
"""Serializes the CreateSubscriptionRequest into a dictionary suitable for use as a JSON request body."""
|
|
95
|
+
body = {}
|
|
96
|
+
if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
|
|
97
|
+
if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
|
|
98
|
+
if self.subscriber: body['subscriber'] = self.subscriber.as_dict()
|
|
99
|
+
return body
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def from_dict(cls, d: Dict[str, any]) -> CreateSubscriptionRequest:
|
|
103
|
+
"""Deserializes the CreateSubscriptionRequest from a dictionary."""
|
|
104
|
+
return cls(dashboard_id=d.get('dashboard_id', None),
|
|
105
|
+
schedule_id=d.get('schedule_id', None),
|
|
106
|
+
subscriber=_from_dict(d, 'subscriber', Subscriber))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass
|
|
110
|
+
class CronSchedule:
|
|
111
|
+
quartz_cron_expression: str
|
|
112
|
+
"""A cron expression using quartz syntax. EX: `0 0 8 * * ?` represents everyday at 8am. See [Cron
|
|
113
|
+
Trigger] for details.
|
|
114
|
+
|
|
115
|
+
[Cron Trigger]: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html"""
|
|
116
|
+
|
|
117
|
+
timezone_id: str
|
|
118
|
+
"""A Java timezone id. The schedule will be resolved with respect to this timezone. See [Java
|
|
119
|
+
TimeZone] for details.
|
|
120
|
+
|
|
121
|
+
[Java TimeZone]: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html"""
|
|
122
|
+
|
|
123
|
+
def as_dict(self) -> dict:
|
|
124
|
+
"""Serializes the CronSchedule into a dictionary suitable for use as a JSON request body."""
|
|
125
|
+
body = {}
|
|
126
|
+
if self.quartz_cron_expression is not None:
|
|
127
|
+
body['quartz_cron_expression'] = self.quartz_cron_expression
|
|
128
|
+
if self.timezone_id is not None: body['timezone_id'] = self.timezone_id
|
|
129
|
+
return body
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def from_dict(cls, d: Dict[str, any]) -> CronSchedule:
|
|
133
|
+
"""Deserializes the CronSchedule from a dictionary."""
|
|
134
|
+
return cls(quartz_cron_expression=d.get('quartz_cron_expression', None),
|
|
135
|
+
timezone_id=d.get('timezone_id', None))
|
|
136
|
+
|
|
137
|
+
|
|
50
138
|
@dataclass
|
|
51
139
|
class Dashboard:
|
|
52
140
|
create_time: Optional[str] = None
|
|
@@ -111,12 +199,112 @@ class Dashboard:
|
|
|
111
199
|
warehouse_id=d.get('warehouse_id', None))
|
|
112
200
|
|
|
113
201
|
|
|
202
|
+
class DashboardView(Enum):
|
|
203
|
+
|
|
204
|
+
DASHBOARD_VIEW_BASIC = 'DASHBOARD_VIEW_BASIC'
|
|
205
|
+
DASHBOARD_VIEW_FULL = 'DASHBOARD_VIEW_FULL'
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@dataclass
|
|
209
|
+
class DeleteScheduleResponse:
|
|
210
|
+
|
|
211
|
+
def as_dict(self) -> dict:
|
|
212
|
+
"""Serializes the DeleteScheduleResponse into a dictionary suitable for use as a JSON request body."""
|
|
213
|
+
body = {}
|
|
214
|
+
return body
|
|
215
|
+
|
|
216
|
+
@classmethod
|
|
217
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteScheduleResponse:
|
|
218
|
+
"""Deserializes the DeleteScheduleResponse from a dictionary."""
|
|
219
|
+
return cls()
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@dataclass
|
|
223
|
+
class DeleteSubscriptionResponse:
|
|
224
|
+
|
|
225
|
+
def as_dict(self) -> dict:
|
|
226
|
+
"""Serializes the DeleteSubscriptionResponse into a dictionary suitable for use as a JSON request body."""
|
|
227
|
+
body = {}
|
|
228
|
+
return body
|
|
229
|
+
|
|
230
|
+
@classmethod
|
|
231
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteSubscriptionResponse:
|
|
232
|
+
"""Deserializes the DeleteSubscriptionResponse from a dictionary."""
|
|
233
|
+
return cls()
|
|
234
|
+
|
|
235
|
+
|
|
114
236
|
class LifecycleState(Enum):
|
|
115
237
|
|
|
116
238
|
ACTIVE = 'ACTIVE'
|
|
117
239
|
TRASHED = 'TRASHED'
|
|
118
240
|
|
|
119
241
|
|
|
242
|
+
@dataclass
|
|
243
|
+
class ListDashboardsResponse:
|
|
244
|
+
dashboards: Optional[List[Dashboard]] = None
|
|
245
|
+
|
|
246
|
+
next_page_token: Optional[str] = None
|
|
247
|
+
"""A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted,
|
|
248
|
+
there are no subsequent dashboards."""
|
|
249
|
+
|
|
250
|
+
def as_dict(self) -> dict:
|
|
251
|
+
"""Serializes the ListDashboardsResponse into a dictionary suitable for use as a JSON request body."""
|
|
252
|
+
body = {}
|
|
253
|
+
if self.dashboards: body['dashboards'] = [v.as_dict() for v in self.dashboards]
|
|
254
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
255
|
+
return body
|
|
256
|
+
|
|
257
|
+
@classmethod
|
|
258
|
+
def from_dict(cls, d: Dict[str, any]) -> ListDashboardsResponse:
|
|
259
|
+
"""Deserializes the ListDashboardsResponse from a dictionary."""
|
|
260
|
+
return cls(dashboards=_repeated_dict(d, 'dashboards', Dashboard),
|
|
261
|
+
next_page_token=d.get('next_page_token', None))
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@dataclass
|
|
265
|
+
class ListSchedulesResponse:
|
|
266
|
+
next_page_token: Optional[str] = None
|
|
267
|
+
"""A token that can be used as a `page_token` in subsequent requests to retrieve the next page of
|
|
268
|
+
results. If this field is omitted, there are no subsequent schedules."""
|
|
269
|
+
|
|
270
|
+
schedules: Optional[List[Schedule]] = None
|
|
271
|
+
|
|
272
|
+
def as_dict(self) -> dict:
|
|
273
|
+
"""Serializes the ListSchedulesResponse into a dictionary suitable for use as a JSON request body."""
|
|
274
|
+
body = {}
|
|
275
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
276
|
+
if self.schedules: body['schedules'] = [v.as_dict() for v in self.schedules]
|
|
277
|
+
return body
|
|
278
|
+
|
|
279
|
+
@classmethod
|
|
280
|
+
def from_dict(cls, d: Dict[str, any]) -> ListSchedulesResponse:
|
|
281
|
+
"""Deserializes the ListSchedulesResponse from a dictionary."""
|
|
282
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
283
|
+
schedules=_repeated_dict(d, 'schedules', Schedule))
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
@dataclass
|
|
287
|
+
class ListSubscriptionsResponse:
|
|
288
|
+
next_page_token: Optional[str] = None
|
|
289
|
+
"""A token that can be used as a `page_token` in subsequent requests to retrieve the next page of
|
|
290
|
+
results. If this field is omitted, there are no subsequent subscriptions."""
|
|
291
|
+
|
|
292
|
+
subscriptions: Optional[List[Subscription]] = None
|
|
293
|
+
|
|
294
|
+
def as_dict(self) -> dict:
|
|
295
|
+
"""Serializes the ListSubscriptionsResponse into a dictionary suitable for use as a JSON request body."""
|
|
296
|
+
body = {}
|
|
297
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
298
|
+
if self.subscriptions: body['subscriptions'] = [v.as_dict() for v in self.subscriptions]
|
|
299
|
+
return body
|
|
300
|
+
|
|
301
|
+
@classmethod
|
|
302
|
+
def from_dict(cls, d: Dict[str, any]) -> ListSubscriptionsResponse:
|
|
303
|
+
"""Deserializes the ListSubscriptionsResponse from a dictionary."""
|
|
304
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
305
|
+
subscriptions=_repeated_dict(d, 'subscriptions', Subscription))
|
|
306
|
+
|
|
307
|
+
|
|
120
308
|
@dataclass
|
|
121
309
|
class MigrateDashboardRequest:
|
|
122
310
|
source_dashboard_id: str
|
|
@@ -204,6 +392,179 @@ class PublishedDashboard:
|
|
|
204
392
|
warehouse_id=d.get('warehouse_id', None))
|
|
205
393
|
|
|
206
394
|
|
|
395
|
+
@dataclass
|
|
396
|
+
class Schedule:
|
|
397
|
+
cron_schedule: CronSchedule
|
|
398
|
+
"""The cron expression describing the frequency of the periodic refresh for this schedule."""
|
|
399
|
+
|
|
400
|
+
create_time: Optional[str] = None
|
|
401
|
+
"""A timestamp indicating when the schedule was created."""
|
|
402
|
+
|
|
403
|
+
dashboard_id: Optional[str] = None
|
|
404
|
+
"""UUID identifying the dashboard to which the schedule belongs."""
|
|
405
|
+
|
|
406
|
+
display_name: Optional[str] = None
|
|
407
|
+
"""The display name for schedule."""
|
|
408
|
+
|
|
409
|
+
etag: Optional[str] = None
|
|
410
|
+
"""The etag for the schedule. Must be left empty on create, must be provided on updates to ensure
|
|
411
|
+
that the schedule has not been modified since the last read, and can be optionally provided on
|
|
412
|
+
delete."""
|
|
413
|
+
|
|
414
|
+
pause_status: Optional[SchedulePauseStatus] = None
|
|
415
|
+
"""The status indicates whether this schedule is paused or not."""
|
|
416
|
+
|
|
417
|
+
schedule_id: Optional[str] = None
|
|
418
|
+
"""UUID identifying the schedule."""
|
|
419
|
+
|
|
420
|
+
update_time: Optional[str] = None
|
|
421
|
+
"""A timestamp indicating when the schedule was last updated."""
|
|
422
|
+
|
|
423
|
+
def as_dict(self) -> dict:
|
|
424
|
+
"""Serializes the Schedule into a dictionary suitable for use as a JSON request body."""
|
|
425
|
+
body = {}
|
|
426
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
427
|
+
if self.cron_schedule: body['cron_schedule'] = self.cron_schedule.as_dict()
|
|
428
|
+
if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
|
|
429
|
+
if self.display_name is not None: body['display_name'] = self.display_name
|
|
430
|
+
if self.etag is not None: body['etag'] = self.etag
|
|
431
|
+
if self.pause_status is not None: body['pause_status'] = self.pause_status.value
|
|
432
|
+
if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
|
|
433
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
434
|
+
return body
|
|
435
|
+
|
|
436
|
+
@classmethod
|
|
437
|
+
def from_dict(cls, d: Dict[str, any]) -> Schedule:
|
|
438
|
+
"""Deserializes the Schedule from a dictionary."""
|
|
439
|
+
return cls(create_time=d.get('create_time', None),
|
|
440
|
+
cron_schedule=_from_dict(d, 'cron_schedule', CronSchedule),
|
|
441
|
+
dashboard_id=d.get('dashboard_id', None),
|
|
442
|
+
display_name=d.get('display_name', None),
|
|
443
|
+
etag=d.get('etag', None),
|
|
444
|
+
pause_status=_enum(d, 'pause_status', SchedulePauseStatus),
|
|
445
|
+
schedule_id=d.get('schedule_id', None),
|
|
446
|
+
update_time=d.get('update_time', None))
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
class SchedulePauseStatus(Enum):
|
|
450
|
+
|
|
451
|
+
PAUSED = 'PAUSED'
|
|
452
|
+
UNPAUSED = 'UNPAUSED'
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
@dataclass
|
|
456
|
+
class Subscriber:
|
|
457
|
+
destination_subscriber: Optional[SubscriptionSubscriberDestination] = None
|
|
458
|
+
"""The destination to receive the subscription email. This parameter is mutually exclusive with
|
|
459
|
+
`user_subscriber`."""
|
|
460
|
+
|
|
461
|
+
user_subscriber: Optional[SubscriptionSubscriberUser] = None
|
|
462
|
+
"""The user to receive the subscription email. This parameter is mutually exclusive with
|
|
463
|
+
`destination_subscriber`."""
|
|
464
|
+
|
|
465
|
+
def as_dict(self) -> dict:
|
|
466
|
+
"""Serializes the Subscriber into a dictionary suitable for use as a JSON request body."""
|
|
467
|
+
body = {}
|
|
468
|
+
if self.destination_subscriber: body['destination_subscriber'] = self.destination_subscriber.as_dict()
|
|
469
|
+
if self.user_subscriber: body['user_subscriber'] = self.user_subscriber.as_dict()
|
|
470
|
+
return body
|
|
471
|
+
|
|
472
|
+
@classmethod
|
|
473
|
+
def from_dict(cls, d: Dict[str, any]) -> Subscriber:
|
|
474
|
+
"""Deserializes the Subscriber from a dictionary."""
|
|
475
|
+
return cls(destination_subscriber=_from_dict(d, 'destination_subscriber',
|
|
476
|
+
SubscriptionSubscriberDestination),
|
|
477
|
+
user_subscriber=_from_dict(d, 'user_subscriber', SubscriptionSubscriberUser))
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
@dataclass
|
|
481
|
+
class Subscription:
|
|
482
|
+
subscriber: Subscriber
|
|
483
|
+
"""Subscriber details for users and destinations to be added as subscribers to the schedule."""
|
|
484
|
+
|
|
485
|
+
create_time: Optional[str] = None
|
|
486
|
+
"""A timestamp indicating when the subscription was created."""
|
|
487
|
+
|
|
488
|
+
created_by_user_id: Optional[int] = None
|
|
489
|
+
"""UserId of the user who adds subscribers (users or notification destinations) to the dashboard's
|
|
490
|
+
schedule."""
|
|
491
|
+
|
|
492
|
+
dashboard_id: Optional[str] = None
|
|
493
|
+
"""UUID identifying the dashboard to which the subscription belongs."""
|
|
494
|
+
|
|
495
|
+
etag: Optional[str] = None
|
|
496
|
+
"""The etag for the subscription. Must be left empty on create, can be optionally provided on
|
|
497
|
+
delete to ensure that the subscription has not been deleted since the last read."""
|
|
498
|
+
|
|
499
|
+
schedule_id: Optional[str] = None
|
|
500
|
+
"""UUID identifying the schedule to which the subscription belongs."""
|
|
501
|
+
|
|
502
|
+
subscription_id: Optional[str] = None
|
|
503
|
+
"""UUID identifying the subscription."""
|
|
504
|
+
|
|
505
|
+
update_time: Optional[str] = None
|
|
506
|
+
"""A timestamp indicating when the subscription was last updated."""
|
|
507
|
+
|
|
508
|
+
def as_dict(self) -> dict:
|
|
509
|
+
"""Serializes the Subscription into a dictionary suitable for use as a JSON request body."""
|
|
510
|
+
body = {}
|
|
511
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
512
|
+
if self.created_by_user_id is not None: body['created_by_user_id'] = self.created_by_user_id
|
|
513
|
+
if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
|
|
514
|
+
if self.etag is not None: body['etag'] = self.etag
|
|
515
|
+
if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
|
|
516
|
+
if self.subscriber: body['subscriber'] = self.subscriber.as_dict()
|
|
517
|
+
if self.subscription_id is not None: body['subscription_id'] = self.subscription_id
|
|
518
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
519
|
+
return body
|
|
520
|
+
|
|
521
|
+
@classmethod
|
|
522
|
+
def from_dict(cls, d: Dict[str, any]) -> Subscription:
|
|
523
|
+
"""Deserializes the Subscription from a dictionary."""
|
|
524
|
+
return cls(create_time=d.get('create_time', None),
|
|
525
|
+
created_by_user_id=d.get('created_by_user_id', None),
|
|
526
|
+
dashboard_id=d.get('dashboard_id', None),
|
|
527
|
+
etag=d.get('etag', None),
|
|
528
|
+
schedule_id=d.get('schedule_id', None),
|
|
529
|
+
subscriber=_from_dict(d, 'subscriber', Subscriber),
|
|
530
|
+
subscription_id=d.get('subscription_id', None),
|
|
531
|
+
update_time=d.get('update_time', None))
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
@dataclass
|
|
535
|
+
class SubscriptionSubscriberDestination:
|
|
536
|
+
destination_id: str
|
|
537
|
+
"""The canonical identifier of the destination to receive email notification."""
|
|
538
|
+
|
|
539
|
+
def as_dict(self) -> dict:
|
|
540
|
+
"""Serializes the SubscriptionSubscriberDestination into a dictionary suitable for use as a JSON request body."""
|
|
541
|
+
body = {}
|
|
542
|
+
if self.destination_id is not None: body['destination_id'] = self.destination_id
|
|
543
|
+
return body
|
|
544
|
+
|
|
545
|
+
@classmethod
|
|
546
|
+
def from_dict(cls, d: Dict[str, any]) -> SubscriptionSubscriberDestination:
|
|
547
|
+
"""Deserializes the SubscriptionSubscriberDestination from a dictionary."""
|
|
548
|
+
return cls(destination_id=d.get('destination_id', None))
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
@dataclass
|
|
552
|
+
class SubscriptionSubscriberUser:
|
|
553
|
+
user_id: int
|
|
554
|
+
"""UserId of the subscriber."""
|
|
555
|
+
|
|
556
|
+
def as_dict(self) -> dict:
|
|
557
|
+
"""Serializes the SubscriptionSubscriberUser into a dictionary suitable for use as a JSON request body."""
|
|
558
|
+
body = {}
|
|
559
|
+
if self.user_id is not None: body['user_id'] = self.user_id
|
|
560
|
+
return body
|
|
561
|
+
|
|
562
|
+
@classmethod
|
|
563
|
+
def from_dict(cls, d: Dict[str, any]) -> SubscriptionSubscriberUser:
|
|
564
|
+
"""Deserializes the SubscriptionSubscriberUser from a dictionary."""
|
|
565
|
+
return cls(user_id=d.get('user_id', None))
|
|
566
|
+
|
|
567
|
+
|
|
207
568
|
@dataclass
|
|
208
569
|
class TrashDashboardResponse:
|
|
209
570
|
|
|
@@ -270,6 +631,50 @@ class UpdateDashboardRequest:
|
|
|
270
631
|
warehouse_id=d.get('warehouse_id', None))
|
|
271
632
|
|
|
272
633
|
|
|
634
|
+
@dataclass
|
|
635
|
+
class UpdateScheduleRequest:
|
|
636
|
+
cron_schedule: CronSchedule
|
|
637
|
+
"""The cron expression describing the frequency of the periodic refresh for this schedule."""
|
|
638
|
+
|
|
639
|
+
dashboard_id: Optional[str] = None
|
|
640
|
+
"""UUID identifying the dashboard to which the schedule belongs."""
|
|
641
|
+
|
|
642
|
+
display_name: Optional[str] = None
|
|
643
|
+
"""The display name for schedule."""
|
|
644
|
+
|
|
645
|
+
etag: Optional[str] = None
|
|
646
|
+
"""The etag for the schedule. Must be left empty on create, must be provided on updates to ensure
|
|
647
|
+
that the schedule has not been modified since the last read, and can be optionally provided on
|
|
648
|
+
delete."""
|
|
649
|
+
|
|
650
|
+
pause_status: Optional[SchedulePauseStatus] = None
|
|
651
|
+
"""The status indicates whether this schedule is paused or not."""
|
|
652
|
+
|
|
653
|
+
schedule_id: Optional[str] = None
|
|
654
|
+
"""UUID identifying the schedule."""
|
|
655
|
+
|
|
656
|
+
def as_dict(self) -> dict:
|
|
657
|
+
"""Serializes the UpdateScheduleRequest into a dictionary suitable for use as a JSON request body."""
|
|
658
|
+
body = {}
|
|
659
|
+
if self.cron_schedule: body['cron_schedule'] = self.cron_schedule.as_dict()
|
|
660
|
+
if self.dashboard_id is not None: body['dashboard_id'] = self.dashboard_id
|
|
661
|
+
if self.display_name is not None: body['display_name'] = self.display_name
|
|
662
|
+
if self.etag is not None: body['etag'] = self.etag
|
|
663
|
+
if self.pause_status is not None: body['pause_status'] = self.pause_status.value
|
|
664
|
+
if self.schedule_id is not None: body['schedule_id'] = self.schedule_id
|
|
665
|
+
return body
|
|
666
|
+
|
|
667
|
+
@classmethod
|
|
668
|
+
def from_dict(cls, d: Dict[str, any]) -> UpdateScheduleRequest:
|
|
669
|
+
"""Deserializes the UpdateScheduleRequest from a dictionary."""
|
|
670
|
+
return cls(cron_schedule=_from_dict(d, 'cron_schedule', CronSchedule),
|
|
671
|
+
dashboard_id=d.get('dashboard_id', None),
|
|
672
|
+
display_name=d.get('display_name', None),
|
|
673
|
+
etag=d.get('etag', None),
|
|
674
|
+
pause_status=_enum(d, 'pause_status', SchedulePauseStatus),
|
|
675
|
+
schedule_id=d.get('schedule_id', None))
|
|
676
|
+
|
|
677
|
+
|
|
273
678
|
class LakeviewAPI:
|
|
274
679
|
"""These APIs provide specific management operations for Lakeview dashboards. Generic resource management can
|
|
275
680
|
be done with Workspace API (import, export, get-status, list, delete)."""
|
|
@@ -309,6 +714,115 @@ class LakeviewAPI:
|
|
|
309
714
|
res = self._api.do('POST', '/api/2.0/lakeview/dashboards', body=body, headers=headers)
|
|
310
715
|
return Dashboard.from_dict(res)
|
|
311
716
|
|
|
717
|
+
def create_schedule(self,
|
|
718
|
+
dashboard_id: str,
|
|
719
|
+
cron_schedule: CronSchedule,
|
|
720
|
+
*,
|
|
721
|
+
display_name: Optional[str] = None,
|
|
722
|
+
pause_status: Optional[SchedulePauseStatus] = None) -> Schedule:
|
|
723
|
+
"""Create dashboard schedule.
|
|
724
|
+
|
|
725
|
+
:param dashboard_id: str
|
|
726
|
+
UUID identifying the dashboard to which the schedule belongs.
|
|
727
|
+
:param cron_schedule: :class:`CronSchedule`
|
|
728
|
+
The cron expression describing the frequency of the periodic refresh for this schedule.
|
|
729
|
+
:param display_name: str (optional)
|
|
730
|
+
The display name for schedule.
|
|
731
|
+
:param pause_status: :class:`SchedulePauseStatus` (optional)
|
|
732
|
+
The status indicates whether this schedule is paused or not.
|
|
733
|
+
|
|
734
|
+
:returns: :class:`Schedule`
|
|
735
|
+
"""
|
|
736
|
+
body = {}
|
|
737
|
+
if cron_schedule is not None: body['cron_schedule'] = cron_schedule.as_dict()
|
|
738
|
+
if display_name is not None: body['display_name'] = display_name
|
|
739
|
+
if pause_status is not None: body['pause_status'] = pause_status.value
|
|
740
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
741
|
+
|
|
742
|
+
res = self._api.do('POST',
|
|
743
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules',
|
|
744
|
+
body=body,
|
|
745
|
+
headers=headers)
|
|
746
|
+
return Schedule.from_dict(res)
|
|
747
|
+
|
|
748
|
+
def create_subscription(self, dashboard_id: str, schedule_id: str,
|
|
749
|
+
subscriber: Subscriber) -> Subscription:
|
|
750
|
+
"""Create schedule subscription.
|
|
751
|
+
|
|
752
|
+
:param dashboard_id: str
|
|
753
|
+
UUID identifying the dashboard to which the subscription belongs.
|
|
754
|
+
:param schedule_id: str
|
|
755
|
+
UUID identifying the schedule to which the subscription belongs.
|
|
756
|
+
:param subscriber: :class:`Subscriber`
|
|
757
|
+
Subscriber details for users and destinations to be added as subscribers to the schedule.
|
|
758
|
+
|
|
759
|
+
:returns: :class:`Subscription`
|
|
760
|
+
"""
|
|
761
|
+
body = {}
|
|
762
|
+
if subscriber is not None: body['subscriber'] = subscriber.as_dict()
|
|
763
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
764
|
+
|
|
765
|
+
res = self._api.do(
|
|
766
|
+
'POST',
|
|
767
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions',
|
|
768
|
+
body=body,
|
|
769
|
+
headers=headers)
|
|
770
|
+
return Subscription.from_dict(res)
|
|
771
|
+
|
|
772
|
+
def delete_schedule(self, dashboard_id: str, schedule_id: str, *, etag: Optional[str] = None):
|
|
773
|
+
"""Delete dashboard schedule.
|
|
774
|
+
|
|
775
|
+
:param dashboard_id: str
|
|
776
|
+
UUID identifying the dashboard to which the schedule belongs.
|
|
777
|
+
:param schedule_id: str
|
|
778
|
+
UUID identifying the schedule.
|
|
779
|
+
:param etag: str (optional)
|
|
780
|
+
The etag for the schedule. Optionally, it can be provided to verify that the schedule has not been
|
|
781
|
+
modified from its last retrieval.
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
"""
|
|
785
|
+
|
|
786
|
+
query = {}
|
|
787
|
+
if etag is not None: query['etag'] = etag
|
|
788
|
+
headers = {'Accept': 'application/json', }
|
|
789
|
+
|
|
790
|
+
self._api.do('DELETE',
|
|
791
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
|
|
792
|
+
query=query,
|
|
793
|
+
headers=headers)
|
|
794
|
+
|
|
795
|
+
def delete_subscription(self,
|
|
796
|
+
dashboard_id: str,
|
|
797
|
+
schedule_id: str,
|
|
798
|
+
subscription_id: str,
|
|
799
|
+
*,
|
|
800
|
+
etag: Optional[str] = None):
|
|
801
|
+
"""Delete schedule subscription.
|
|
802
|
+
|
|
803
|
+
:param dashboard_id: str
|
|
804
|
+
UUID identifying the dashboard which the subscription belongs.
|
|
805
|
+
:param schedule_id: str
|
|
806
|
+
UUID identifying the schedule which the subscription belongs.
|
|
807
|
+
:param subscription_id: str
|
|
808
|
+
UUID identifying the subscription.
|
|
809
|
+
:param etag: str (optional)
|
|
810
|
+
The etag for the subscription. Can be optionally provided to ensure that the subscription has not
|
|
811
|
+
been modified since the last read.
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
"""
|
|
815
|
+
|
|
816
|
+
query = {}
|
|
817
|
+
if etag is not None: query['etag'] = etag
|
|
818
|
+
headers = {'Accept': 'application/json', }
|
|
819
|
+
|
|
820
|
+
self._api.do(
|
|
821
|
+
'DELETE',
|
|
822
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}',
|
|
823
|
+
query=query,
|
|
824
|
+
headers=headers)
|
|
825
|
+
|
|
312
826
|
def get(self, dashboard_id: str) -> Dashboard:
|
|
313
827
|
"""Get dashboard.
|
|
314
828
|
|
|
@@ -341,6 +855,158 @@ class LakeviewAPI:
|
|
|
341
855
|
res = self._api.do('GET', f'/api/2.0/lakeview/dashboards/{dashboard_id}/published', headers=headers)
|
|
342
856
|
return PublishedDashboard.from_dict(res)
|
|
343
857
|
|
|
858
|
+
def get_schedule(self, dashboard_id: str, schedule_id: str) -> Schedule:
|
|
859
|
+
"""Get dashboard schedule.
|
|
860
|
+
|
|
861
|
+
:param dashboard_id: str
|
|
862
|
+
UUID identifying the dashboard to which the schedule belongs.
|
|
863
|
+
:param schedule_id: str
|
|
864
|
+
UUID identifying the schedule.
|
|
865
|
+
|
|
866
|
+
:returns: :class:`Schedule`
|
|
867
|
+
"""
|
|
868
|
+
|
|
869
|
+
headers = {'Accept': 'application/json', }
|
|
870
|
+
|
|
871
|
+
res = self._api.do('GET',
|
|
872
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
|
|
873
|
+
headers=headers)
|
|
874
|
+
return Schedule.from_dict(res)
|
|
875
|
+
|
|
876
|
+
def get_subscription(self, dashboard_id: str, schedule_id: str, subscription_id: str) -> Subscription:
|
|
877
|
+
"""Get schedule subscription.
|
|
878
|
+
|
|
879
|
+
:param dashboard_id: str
|
|
880
|
+
UUID identifying the dashboard which the subscription belongs.
|
|
881
|
+
:param schedule_id: str
|
|
882
|
+
UUID identifying the schedule which the subscription belongs.
|
|
883
|
+
:param subscription_id: str
|
|
884
|
+
UUID identifying the subscription.
|
|
885
|
+
|
|
886
|
+
:returns: :class:`Subscription`
|
|
887
|
+
"""
|
|
888
|
+
|
|
889
|
+
headers = {'Accept': 'application/json', }
|
|
890
|
+
|
|
891
|
+
res = self._api.do(
|
|
892
|
+
'GET',
|
|
893
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions/{subscription_id}',
|
|
894
|
+
headers=headers)
|
|
895
|
+
return Subscription.from_dict(res)
|
|
896
|
+
|
|
897
|
+
def list(self,
|
|
898
|
+
*,
|
|
899
|
+
page_size: Optional[int] = None,
|
|
900
|
+
page_token: Optional[str] = None,
|
|
901
|
+
show_trashed: Optional[bool] = None,
|
|
902
|
+
view: Optional[DashboardView] = None) -> Iterator[Dashboard]:
|
|
903
|
+
"""List dashboards.
|
|
904
|
+
|
|
905
|
+
:param page_size: int (optional)
|
|
906
|
+
The number of dashboards to return per page.
|
|
907
|
+
:param page_token: str (optional)
|
|
908
|
+
A page token, received from a previous `ListDashboards` call. This token can be used to retrieve the
|
|
909
|
+
subsequent page.
|
|
910
|
+
:param show_trashed: bool (optional)
|
|
911
|
+
The flag to include dashboards located in the trash. If unspecified, only active dashboards will be
|
|
912
|
+
returned.
|
|
913
|
+
:param view: :class:`DashboardView` (optional)
|
|
914
|
+
Indicates whether to include all metadata from the dashboard in the response. If unset, the response
|
|
915
|
+
defaults to `DASHBOARD_VIEW_BASIC` which only includes summary metadata from the dashboard.
|
|
916
|
+
|
|
917
|
+
:returns: Iterator over :class:`Dashboard`
|
|
918
|
+
"""
|
|
919
|
+
|
|
920
|
+
query = {}
|
|
921
|
+
if page_size is not None: query['page_size'] = page_size
|
|
922
|
+
if page_token is not None: query['page_token'] = page_token
|
|
923
|
+
if show_trashed is not None: query['show_trashed'] = show_trashed
|
|
924
|
+
if view is not None: query['view'] = view.value
|
|
925
|
+
headers = {'Accept': 'application/json', }
|
|
926
|
+
|
|
927
|
+
while True:
|
|
928
|
+
json = self._api.do('GET', '/api/2.0/lakeview/dashboards', query=query, headers=headers)
|
|
929
|
+
if 'dashboards' in json:
|
|
930
|
+
for v in json['dashboards']:
|
|
931
|
+
yield Dashboard.from_dict(v)
|
|
932
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
933
|
+
return
|
|
934
|
+
query['page_token'] = json['next_page_token']
|
|
935
|
+
|
|
936
|
+
def list_schedules(self,
|
|
937
|
+
dashboard_id: str,
|
|
938
|
+
*,
|
|
939
|
+
page_size: Optional[int] = None,
|
|
940
|
+
page_token: Optional[str] = None) -> Iterator[Schedule]:
|
|
941
|
+
"""List dashboard schedules.
|
|
942
|
+
|
|
943
|
+
:param dashboard_id: str
|
|
944
|
+
UUID identifying the dashboard to which the schedule belongs.
|
|
945
|
+
:param page_size: int (optional)
|
|
946
|
+
The number of schedules to return per page.
|
|
947
|
+
:param page_token: str (optional)
|
|
948
|
+
A page token, received from a previous `ListSchedules` call. Use this to retrieve the subsequent
|
|
949
|
+
page.
|
|
950
|
+
|
|
951
|
+
:returns: Iterator over :class:`Schedule`
|
|
952
|
+
"""
|
|
953
|
+
|
|
954
|
+
query = {}
|
|
955
|
+
if page_size is not None: query['page_size'] = page_size
|
|
956
|
+
if page_token is not None: query['page_token'] = page_token
|
|
957
|
+
headers = {'Accept': 'application/json', }
|
|
958
|
+
|
|
959
|
+
while True:
|
|
960
|
+
json = self._api.do('GET',
|
|
961
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules',
|
|
962
|
+
query=query,
|
|
963
|
+
headers=headers)
|
|
964
|
+
if 'schedules' in json:
|
|
965
|
+
for v in json['schedules']:
|
|
966
|
+
yield Schedule.from_dict(v)
|
|
967
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
968
|
+
return
|
|
969
|
+
query['page_token'] = json['next_page_token']
|
|
970
|
+
|
|
971
|
+
def list_subscriptions(self,
|
|
972
|
+
dashboard_id: str,
|
|
973
|
+
schedule_id: str,
|
|
974
|
+
*,
|
|
975
|
+
page_size: Optional[int] = None,
|
|
976
|
+
page_token: Optional[str] = None) -> Iterator[Subscription]:
|
|
977
|
+
"""List schedule subscriptions.
|
|
978
|
+
|
|
979
|
+
:param dashboard_id: str
|
|
980
|
+
UUID identifying the dashboard to which the subscription belongs.
|
|
981
|
+
:param schedule_id: str
|
|
982
|
+
UUID identifying the schedule to which the subscription belongs.
|
|
983
|
+
:param page_size: int (optional)
|
|
984
|
+
The number of subscriptions to return per page.
|
|
985
|
+
:param page_token: str (optional)
|
|
986
|
+
A page token, received from a previous `ListSubscriptions` call. Use this to retrieve the subsequent
|
|
987
|
+
page.
|
|
988
|
+
|
|
989
|
+
:returns: Iterator over :class:`Subscription`
|
|
990
|
+
"""
|
|
991
|
+
|
|
992
|
+
query = {}
|
|
993
|
+
if page_size is not None: query['page_size'] = page_size
|
|
994
|
+
if page_token is not None: query['page_token'] = page_token
|
|
995
|
+
headers = {'Accept': 'application/json', }
|
|
996
|
+
|
|
997
|
+
while True:
|
|
998
|
+
json = self._api.do(
|
|
999
|
+
'GET',
|
|
1000
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}/subscriptions',
|
|
1001
|
+
query=query,
|
|
1002
|
+
headers=headers)
|
|
1003
|
+
if 'subscriptions' in json:
|
|
1004
|
+
for v in json['subscriptions']:
|
|
1005
|
+
yield Subscription.from_dict(v)
|
|
1006
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
1007
|
+
return
|
|
1008
|
+
query['page_token'] = json['next_page_token']
|
|
1009
|
+
|
|
344
1010
|
def migrate(self,
|
|
345
1011
|
source_dashboard_id: str,
|
|
346
1012
|
*,
|
|
@@ -465,3 +1131,42 @@ class LakeviewAPI:
|
|
|
465
1131
|
body=body,
|
|
466
1132
|
headers=headers)
|
|
467
1133
|
return Dashboard.from_dict(res)
|
|
1134
|
+
|
|
1135
|
+
def update_schedule(self,
|
|
1136
|
+
dashboard_id: str,
|
|
1137
|
+
schedule_id: str,
|
|
1138
|
+
cron_schedule: CronSchedule,
|
|
1139
|
+
*,
|
|
1140
|
+
display_name: Optional[str] = None,
|
|
1141
|
+
etag: Optional[str] = None,
|
|
1142
|
+
pause_status: Optional[SchedulePauseStatus] = None) -> Schedule:
|
|
1143
|
+
"""Update dashboard schedule.
|
|
1144
|
+
|
|
1145
|
+
:param dashboard_id: str
|
|
1146
|
+
UUID identifying the dashboard to which the schedule belongs.
|
|
1147
|
+
:param schedule_id: str
|
|
1148
|
+
UUID identifying the schedule.
|
|
1149
|
+
:param cron_schedule: :class:`CronSchedule`
|
|
1150
|
+
The cron expression describing the frequency of the periodic refresh for this schedule.
|
|
1151
|
+
:param display_name: str (optional)
|
|
1152
|
+
The display name for schedule.
|
|
1153
|
+
:param etag: str (optional)
|
|
1154
|
+
The etag for the schedule. Must be left empty on create, must be provided on updates to ensure that
|
|
1155
|
+
the schedule has not been modified since the last read, and can be optionally provided on delete.
|
|
1156
|
+
:param pause_status: :class:`SchedulePauseStatus` (optional)
|
|
1157
|
+
The status indicates whether this schedule is paused or not.
|
|
1158
|
+
|
|
1159
|
+
:returns: :class:`Schedule`
|
|
1160
|
+
"""
|
|
1161
|
+
body = {}
|
|
1162
|
+
if cron_schedule is not None: body['cron_schedule'] = cron_schedule.as_dict()
|
|
1163
|
+
if display_name is not None: body['display_name'] = display_name
|
|
1164
|
+
if etag is not None: body['etag'] = etag
|
|
1165
|
+
if pause_status is not None: body['pause_status'] = pause_status.value
|
|
1166
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1167
|
+
|
|
1168
|
+
res = self._api.do('PUT',
|
|
1169
|
+
f'/api/2.0/lakeview/dashboards/{dashboard_id}/schedules/{schedule_id}',
|
|
1170
|
+
body=body,
|
|
1171
|
+
headers=headers)
|
|
1172
|
+
return Schedule.from_dict(res)
|