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

@@ -0,0 +1,937 @@
1
+ # Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from dataclasses import dataclass
7
+ from enum import Enum
8
+ from typing import Any, Dict, Iterator, List, Optional
9
+
10
+ from ._internal import _enum, _from_dict, _repeated_dict
11
+
12
+ _LOG = logging.getLogger("databricks.sdk")
13
+
14
+
15
+ # all definitions in this file are in alphabetical order
16
+
17
+
18
+ @dataclass
19
+ class AibiDashboardEmbeddingAccessPolicy:
20
+ access_policy_type: AibiDashboardEmbeddingAccessPolicyAccessPolicyType
21
+
22
+ def as_dict(self) -> dict:
23
+ """Serializes the AibiDashboardEmbeddingAccessPolicy into a dictionary suitable for use as a JSON request body."""
24
+ body = {}
25
+ if self.access_policy_type is not None:
26
+ body["access_policy_type"] = self.access_policy_type.value
27
+ return body
28
+
29
+ def as_shallow_dict(self) -> dict:
30
+ """Serializes the AibiDashboardEmbeddingAccessPolicy into a shallow dictionary of its immediate attributes."""
31
+ body = {}
32
+ if self.access_policy_type is not None:
33
+ body["access_policy_type"] = self.access_policy_type
34
+ return body
35
+
36
+ @classmethod
37
+ def from_dict(cls, d: Dict[str, Any]) -> AibiDashboardEmbeddingAccessPolicy:
38
+ """Deserializes the AibiDashboardEmbeddingAccessPolicy from a dictionary."""
39
+ return cls(
40
+ access_policy_type=_enum(d, "access_policy_type", AibiDashboardEmbeddingAccessPolicyAccessPolicyType)
41
+ )
42
+
43
+
44
+ class AibiDashboardEmbeddingAccessPolicyAccessPolicyType(Enum):
45
+
46
+ ALLOW_ALL_DOMAINS = "ALLOW_ALL_DOMAINS"
47
+ ALLOW_APPROVED_DOMAINS = "ALLOW_APPROVED_DOMAINS"
48
+ DENY_ALL_DOMAINS = "DENY_ALL_DOMAINS"
49
+
50
+
51
+ @dataclass
52
+ class AibiDashboardEmbeddingApprovedDomains:
53
+ approved_domains: Optional[List[str]] = None
54
+
55
+ def as_dict(self) -> dict:
56
+ """Serializes the AibiDashboardEmbeddingApprovedDomains into a dictionary suitable for use as a JSON request body."""
57
+ body = {}
58
+ if self.approved_domains:
59
+ body["approved_domains"] = [v for v in self.approved_domains]
60
+ return body
61
+
62
+ def as_shallow_dict(self) -> dict:
63
+ """Serializes the AibiDashboardEmbeddingApprovedDomains into a shallow dictionary of its immediate attributes."""
64
+ body = {}
65
+ if self.approved_domains:
66
+ body["approved_domains"] = self.approved_domains
67
+ return body
68
+
69
+ @classmethod
70
+ def from_dict(cls, d: Dict[str, Any]) -> AibiDashboardEmbeddingApprovedDomains:
71
+ """Deserializes the AibiDashboardEmbeddingApprovedDomains from a dictionary."""
72
+ return cls(approved_domains=d.get("approved_domains", None))
73
+
74
+
75
+ @dataclass
76
+ class BooleanMessage:
77
+ value: Optional[bool] = None
78
+
79
+ def as_dict(self) -> dict:
80
+ """Serializes the BooleanMessage into a dictionary suitable for use as a JSON request body."""
81
+ body = {}
82
+ if self.value is not None:
83
+ body["value"] = self.value
84
+ return body
85
+
86
+ def as_shallow_dict(self) -> dict:
87
+ """Serializes the BooleanMessage into a shallow dictionary of its immediate attributes."""
88
+ body = {}
89
+ if self.value is not None:
90
+ body["value"] = self.value
91
+ return body
92
+
93
+ @classmethod
94
+ def from_dict(cls, d: Dict[str, Any]) -> BooleanMessage:
95
+ """Deserializes the BooleanMessage from a dictionary."""
96
+ return cls(value=d.get("value", None))
97
+
98
+
99
+ @dataclass
100
+ class ClusterAutoRestartMessage:
101
+ can_toggle: Optional[bool] = None
102
+
103
+ enabled: Optional[bool] = None
104
+
105
+ enablement_details: Optional[ClusterAutoRestartMessageEnablementDetails] = None
106
+
107
+ maintenance_window: Optional[ClusterAutoRestartMessageMaintenanceWindow] = None
108
+
109
+ restart_even_if_no_updates_available: Optional[bool] = None
110
+
111
+ def as_dict(self) -> dict:
112
+ """Serializes the ClusterAutoRestartMessage into a dictionary suitable for use as a JSON request body."""
113
+ body = {}
114
+ if self.can_toggle is not None:
115
+ body["can_toggle"] = self.can_toggle
116
+ if self.enabled is not None:
117
+ body["enabled"] = self.enabled
118
+ if self.enablement_details:
119
+ body["enablement_details"] = self.enablement_details.as_dict()
120
+ if self.maintenance_window:
121
+ body["maintenance_window"] = self.maintenance_window.as_dict()
122
+ if self.restart_even_if_no_updates_available is not None:
123
+ body["restart_even_if_no_updates_available"] = self.restart_even_if_no_updates_available
124
+ return body
125
+
126
+ def as_shallow_dict(self) -> dict:
127
+ """Serializes the ClusterAutoRestartMessage into a shallow dictionary of its immediate attributes."""
128
+ body = {}
129
+ if self.can_toggle is not None:
130
+ body["can_toggle"] = self.can_toggle
131
+ if self.enabled is not None:
132
+ body["enabled"] = self.enabled
133
+ if self.enablement_details:
134
+ body["enablement_details"] = self.enablement_details
135
+ if self.maintenance_window:
136
+ body["maintenance_window"] = self.maintenance_window
137
+ if self.restart_even_if_no_updates_available is not None:
138
+ body["restart_even_if_no_updates_available"] = self.restart_even_if_no_updates_available
139
+ return body
140
+
141
+ @classmethod
142
+ def from_dict(cls, d: Dict[str, Any]) -> ClusterAutoRestartMessage:
143
+ """Deserializes the ClusterAutoRestartMessage from a dictionary."""
144
+ return cls(
145
+ can_toggle=d.get("can_toggle", None),
146
+ enabled=d.get("enabled", None),
147
+ enablement_details=_from_dict(d, "enablement_details", ClusterAutoRestartMessageEnablementDetails),
148
+ maintenance_window=_from_dict(d, "maintenance_window", ClusterAutoRestartMessageMaintenanceWindow),
149
+ restart_even_if_no_updates_available=d.get("restart_even_if_no_updates_available", None),
150
+ )
151
+
152
+
153
+ @dataclass
154
+ class ClusterAutoRestartMessageEnablementDetails:
155
+ """Contains an information about the enablement status judging (e.g. whether the enterprise tier is
156
+ enabled) This is only additional information that MUST NOT be used to decide whether the setting
157
+ is enabled or not. This is intended to use only for purposes like showing an error message to
158
+ the customer with the additional details. For example, using these details we can check why
159
+ exactly the feature is disabled for this customer."""
160
+
161
+ forced_for_compliance_mode: Optional[bool] = None
162
+ """The feature is force enabled if compliance mode is active"""
163
+
164
+ unavailable_for_disabled_entitlement: Optional[bool] = None
165
+ """The feature is unavailable if the corresponding entitlement disabled (see
166
+ getShieldEntitlementEnable)"""
167
+
168
+ unavailable_for_non_enterprise_tier: Optional[bool] = None
169
+ """The feature is unavailable if the customer doesn't have enterprise tier"""
170
+
171
+ def as_dict(self) -> dict:
172
+ """Serializes the ClusterAutoRestartMessageEnablementDetails into a dictionary suitable for use as a JSON request body."""
173
+ body = {}
174
+ if self.forced_for_compliance_mode is not None:
175
+ body["forced_for_compliance_mode"] = self.forced_for_compliance_mode
176
+ if self.unavailable_for_disabled_entitlement is not None:
177
+ body["unavailable_for_disabled_entitlement"] = self.unavailable_for_disabled_entitlement
178
+ if self.unavailable_for_non_enterprise_tier is not None:
179
+ body["unavailable_for_non_enterprise_tier"] = self.unavailable_for_non_enterprise_tier
180
+ return body
181
+
182
+ def as_shallow_dict(self) -> dict:
183
+ """Serializes the ClusterAutoRestartMessageEnablementDetails into a shallow dictionary of its immediate attributes."""
184
+ body = {}
185
+ if self.forced_for_compliance_mode is not None:
186
+ body["forced_for_compliance_mode"] = self.forced_for_compliance_mode
187
+ if self.unavailable_for_disabled_entitlement is not None:
188
+ body["unavailable_for_disabled_entitlement"] = self.unavailable_for_disabled_entitlement
189
+ if self.unavailable_for_non_enterprise_tier is not None:
190
+ body["unavailable_for_non_enterprise_tier"] = self.unavailable_for_non_enterprise_tier
191
+ return body
192
+
193
+ @classmethod
194
+ def from_dict(cls, d: Dict[str, Any]) -> ClusterAutoRestartMessageEnablementDetails:
195
+ """Deserializes the ClusterAutoRestartMessageEnablementDetails from a dictionary."""
196
+ return cls(
197
+ forced_for_compliance_mode=d.get("forced_for_compliance_mode", None),
198
+ unavailable_for_disabled_entitlement=d.get("unavailable_for_disabled_entitlement", None),
199
+ unavailable_for_non_enterprise_tier=d.get("unavailable_for_non_enterprise_tier", None),
200
+ )
201
+
202
+
203
+ @dataclass
204
+ class ClusterAutoRestartMessageMaintenanceWindow:
205
+ week_day_based_schedule: Optional[ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule] = None
206
+
207
+ def as_dict(self) -> dict:
208
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindow into a dictionary suitable for use as a JSON request body."""
209
+ body = {}
210
+ if self.week_day_based_schedule:
211
+ body["week_day_based_schedule"] = self.week_day_based_schedule.as_dict()
212
+ return body
213
+
214
+ def as_shallow_dict(self) -> dict:
215
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindow into a shallow dictionary of its immediate attributes."""
216
+ body = {}
217
+ if self.week_day_based_schedule:
218
+ body["week_day_based_schedule"] = self.week_day_based_schedule
219
+ return body
220
+
221
+ @classmethod
222
+ def from_dict(cls, d: Dict[str, Any]) -> ClusterAutoRestartMessageMaintenanceWindow:
223
+ """Deserializes the ClusterAutoRestartMessageMaintenanceWindow from a dictionary."""
224
+ return cls(
225
+ week_day_based_schedule=_from_dict(
226
+ d, "week_day_based_schedule", ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule
227
+ )
228
+ )
229
+
230
+
231
+ class ClusterAutoRestartMessageMaintenanceWindowDayOfWeek(Enum):
232
+
233
+ FRIDAY = "FRIDAY"
234
+ MONDAY = "MONDAY"
235
+ SATURDAY = "SATURDAY"
236
+ SUNDAY = "SUNDAY"
237
+ THURSDAY = "THURSDAY"
238
+ TUESDAY = "TUESDAY"
239
+ WEDNESDAY = "WEDNESDAY"
240
+
241
+
242
+ @dataclass
243
+ class ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule:
244
+ day_of_week: Optional[ClusterAutoRestartMessageMaintenanceWindowDayOfWeek] = None
245
+
246
+ frequency: Optional[ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency] = None
247
+
248
+ window_start_time: Optional[ClusterAutoRestartMessageMaintenanceWindowWindowStartTime] = None
249
+
250
+ def as_dict(self) -> dict:
251
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule into a dictionary suitable for use as a JSON request body."""
252
+ body = {}
253
+ if self.day_of_week is not None:
254
+ body["day_of_week"] = self.day_of_week.value
255
+ if self.frequency is not None:
256
+ body["frequency"] = self.frequency.value
257
+ if self.window_start_time:
258
+ body["window_start_time"] = self.window_start_time.as_dict()
259
+ return body
260
+
261
+ def as_shallow_dict(self) -> dict:
262
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule into a shallow dictionary of its immediate attributes."""
263
+ body = {}
264
+ if self.day_of_week is not None:
265
+ body["day_of_week"] = self.day_of_week
266
+ if self.frequency is not None:
267
+ body["frequency"] = self.frequency
268
+ if self.window_start_time:
269
+ body["window_start_time"] = self.window_start_time
270
+ return body
271
+
272
+ @classmethod
273
+ def from_dict(cls, d: Dict[str, Any]) -> ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule:
274
+ """Deserializes the ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule from a dictionary."""
275
+ return cls(
276
+ day_of_week=_enum(d, "day_of_week", ClusterAutoRestartMessageMaintenanceWindowDayOfWeek),
277
+ frequency=_enum(d, "frequency", ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency),
278
+ window_start_time=_from_dict(
279
+ d, "window_start_time", ClusterAutoRestartMessageMaintenanceWindowWindowStartTime
280
+ ),
281
+ )
282
+
283
+
284
+ class ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency(Enum):
285
+
286
+ EVERY_WEEK = "EVERY_WEEK"
287
+ FIRST_AND_THIRD_OF_MONTH = "FIRST_AND_THIRD_OF_MONTH"
288
+ FIRST_OF_MONTH = "FIRST_OF_MONTH"
289
+ FOURTH_OF_MONTH = "FOURTH_OF_MONTH"
290
+ SECOND_AND_FOURTH_OF_MONTH = "SECOND_AND_FOURTH_OF_MONTH"
291
+ SECOND_OF_MONTH = "SECOND_OF_MONTH"
292
+ THIRD_OF_MONTH = "THIRD_OF_MONTH"
293
+
294
+
295
+ @dataclass
296
+ class ClusterAutoRestartMessageMaintenanceWindowWindowStartTime:
297
+ hours: Optional[int] = None
298
+
299
+ minutes: Optional[int] = None
300
+
301
+ def as_dict(self) -> dict:
302
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindowWindowStartTime into a dictionary suitable for use as a JSON request body."""
303
+ body = {}
304
+ if self.hours is not None:
305
+ body["hours"] = self.hours
306
+ if self.minutes is not None:
307
+ body["minutes"] = self.minutes
308
+ return body
309
+
310
+ def as_shallow_dict(self) -> dict:
311
+ """Serializes the ClusterAutoRestartMessageMaintenanceWindowWindowStartTime into a shallow dictionary of its immediate attributes."""
312
+ body = {}
313
+ if self.hours is not None:
314
+ body["hours"] = self.hours
315
+ if self.minutes is not None:
316
+ body["minutes"] = self.minutes
317
+ return body
318
+
319
+ @classmethod
320
+ def from_dict(cls, d: Dict[str, Any]) -> ClusterAutoRestartMessageMaintenanceWindowWindowStartTime:
321
+ """Deserializes the ClusterAutoRestartMessageMaintenanceWindowWindowStartTime from a dictionary."""
322
+ return cls(hours=d.get("hours", None), minutes=d.get("minutes", None))
323
+
324
+
325
+ @dataclass
326
+ class DefaultDataSecurityModeMessage:
327
+ """Changes the behaviour of Jobs service when creating job clusters.
328
+
329
+ Before this setting is introduced, all workspaces with metastore attached had behaviour matching
330
+ SINGLE_USER setting.
331
+
332
+ See: - go/defaultdatasecuritymode - go/defaultdatasecuritymode/setting - go/datasecuritymode"""
333
+
334
+ status: DefaultDataSecurityModeMessageStatus
335
+
336
+ def as_dict(self) -> dict:
337
+ """Serializes the DefaultDataSecurityModeMessage into a dictionary suitable for use as a JSON request body."""
338
+ body = {}
339
+ if self.status is not None:
340
+ body["status"] = self.status.value
341
+ return body
342
+
343
+ def as_shallow_dict(self) -> dict:
344
+ """Serializes the DefaultDataSecurityModeMessage into a shallow dictionary of its immediate attributes."""
345
+ body = {}
346
+ if self.status is not None:
347
+ body["status"] = self.status
348
+ return body
349
+
350
+ @classmethod
351
+ def from_dict(cls, d: Dict[str, Any]) -> DefaultDataSecurityModeMessage:
352
+ """Deserializes the DefaultDataSecurityModeMessage from a dictionary."""
353
+ return cls(status=_enum(d, "status", DefaultDataSecurityModeMessageStatus))
354
+
355
+
356
+ class DefaultDataSecurityModeMessageStatus(Enum):
357
+
358
+ NOT_SET = "NOT_SET"
359
+ SINGLE_USER = "SINGLE_USER"
360
+ USER_ISOLATION = "USER_ISOLATION"
361
+
362
+
363
+ @dataclass
364
+ class IntegerMessage:
365
+ value: Optional[int] = None
366
+
367
+ def as_dict(self) -> dict:
368
+ """Serializes the IntegerMessage into a dictionary suitable for use as a JSON request body."""
369
+ body = {}
370
+ if self.value is not None:
371
+ body["value"] = self.value
372
+ return body
373
+
374
+ def as_shallow_dict(self) -> dict:
375
+ """Serializes the IntegerMessage into a shallow dictionary of its immediate attributes."""
376
+ body = {}
377
+ if self.value is not None:
378
+ body["value"] = self.value
379
+ return body
380
+
381
+ @classmethod
382
+ def from_dict(cls, d: Dict[str, Any]) -> IntegerMessage:
383
+ """Deserializes the IntegerMessage from a dictionary."""
384
+ return cls(value=d.get("value", None))
385
+
386
+
387
+ @dataclass
388
+ class ListAccountSettingsMetadataResponse:
389
+ next_page_token: Optional[str] = None
390
+ """A token that can be sent as `page_token` to retrieve the next page. If this field is omitted,
391
+ there are no subsequent pages."""
392
+
393
+ settings_metadata: Optional[List[SettingsMetadata]] = None
394
+ """List of all settings available via public APIs and their metadata"""
395
+
396
+ def as_dict(self) -> dict:
397
+ """Serializes the ListAccountSettingsMetadataResponse into a dictionary suitable for use as a JSON request body."""
398
+ body = {}
399
+ if self.next_page_token is not None:
400
+ body["next_page_token"] = self.next_page_token
401
+ if self.settings_metadata:
402
+ body["settings_metadata"] = [v.as_dict() for v in self.settings_metadata]
403
+ return body
404
+
405
+ def as_shallow_dict(self) -> dict:
406
+ """Serializes the ListAccountSettingsMetadataResponse into a shallow dictionary of its immediate attributes."""
407
+ body = {}
408
+ if self.next_page_token is not None:
409
+ body["next_page_token"] = self.next_page_token
410
+ if self.settings_metadata:
411
+ body["settings_metadata"] = self.settings_metadata
412
+ return body
413
+
414
+ @classmethod
415
+ def from_dict(cls, d: Dict[str, Any]) -> ListAccountSettingsMetadataResponse:
416
+ """Deserializes the ListAccountSettingsMetadataResponse from a dictionary."""
417
+ return cls(
418
+ next_page_token=d.get("next_page_token", None),
419
+ settings_metadata=_repeated_dict(d, "settings_metadata", SettingsMetadata),
420
+ )
421
+
422
+
423
+ @dataclass
424
+ class ListWorkspaceSettingsMetadataResponse:
425
+ next_page_token: Optional[str] = None
426
+ """A token that can be sent as `page_token` to retrieve the next page. If this field is omitted,
427
+ there are no subsequent pages."""
428
+
429
+ settings_metadata: Optional[List[SettingsMetadata]] = None
430
+ """List of all settings available via public APIs and their metadata"""
431
+
432
+ def as_dict(self) -> dict:
433
+ """Serializes the ListWorkspaceSettingsMetadataResponse into a dictionary suitable for use as a JSON request body."""
434
+ body = {}
435
+ if self.next_page_token is not None:
436
+ body["next_page_token"] = self.next_page_token
437
+ if self.settings_metadata:
438
+ body["settings_metadata"] = [v.as_dict() for v in self.settings_metadata]
439
+ return body
440
+
441
+ def as_shallow_dict(self) -> dict:
442
+ """Serializes the ListWorkspaceSettingsMetadataResponse into a shallow dictionary of its immediate attributes."""
443
+ body = {}
444
+ if self.next_page_token is not None:
445
+ body["next_page_token"] = self.next_page_token
446
+ if self.settings_metadata:
447
+ body["settings_metadata"] = self.settings_metadata
448
+ return body
449
+
450
+ @classmethod
451
+ def from_dict(cls, d: Dict[str, Any]) -> ListWorkspaceSettingsMetadataResponse:
452
+ """Deserializes the ListWorkspaceSettingsMetadataResponse from a dictionary."""
453
+ return cls(
454
+ next_page_token=d.get("next_page_token", None),
455
+ settings_metadata=_repeated_dict(d, "settings_metadata", SettingsMetadata),
456
+ )
457
+
458
+
459
+ @dataclass
460
+ class PersonalComputeMessage:
461
+ value: Optional[PersonalComputeMessagePersonalComputeMessageEnum] = None
462
+
463
+ def as_dict(self) -> dict:
464
+ """Serializes the PersonalComputeMessage into a dictionary suitable for use as a JSON request body."""
465
+ body = {}
466
+ if self.value is not None:
467
+ body["value"] = self.value.value
468
+ return body
469
+
470
+ def as_shallow_dict(self) -> dict:
471
+ """Serializes the PersonalComputeMessage into a shallow dictionary of its immediate attributes."""
472
+ body = {}
473
+ if self.value is not None:
474
+ body["value"] = self.value
475
+ return body
476
+
477
+ @classmethod
478
+ def from_dict(cls, d: Dict[str, Any]) -> PersonalComputeMessage:
479
+ """Deserializes the PersonalComputeMessage from a dictionary."""
480
+ return cls(value=_enum(d, "value", PersonalComputeMessagePersonalComputeMessageEnum))
481
+
482
+
483
+ class PersonalComputeMessagePersonalComputeMessageEnum(Enum):
484
+ """ON: Grants all users in all workspaces access to the Personal Compute default policy, allowing
485
+ all users to create single-machine compute resources. DELEGATE: Moves access control for the
486
+ Personal Compute default policy to individual workspaces and requires a workspace’s users or
487
+ groups to be added to the ACLs of that workspace’s Personal Compute default policy before they
488
+ will be able to create compute resources through that policy."""
489
+
490
+ DELEGATE = "DELEGATE"
491
+ ON = "ON"
492
+
493
+
494
+ @dataclass
495
+ class RestrictWorkspaceAdminsMessage:
496
+ status: RestrictWorkspaceAdminsMessageStatus
497
+
498
+ def as_dict(self) -> dict:
499
+ """Serializes the RestrictWorkspaceAdminsMessage into a dictionary suitable for use as a JSON request body."""
500
+ body = {}
501
+ if self.status is not None:
502
+ body["status"] = self.status.value
503
+ return body
504
+
505
+ def as_shallow_dict(self) -> dict:
506
+ """Serializes the RestrictWorkspaceAdminsMessage into a shallow dictionary of its immediate attributes."""
507
+ body = {}
508
+ if self.status is not None:
509
+ body["status"] = self.status
510
+ return body
511
+
512
+ @classmethod
513
+ def from_dict(cls, d: Dict[str, Any]) -> RestrictWorkspaceAdminsMessage:
514
+ """Deserializes the RestrictWorkspaceAdminsMessage from a dictionary."""
515
+ return cls(status=_enum(d, "status", RestrictWorkspaceAdminsMessageStatus))
516
+
517
+
518
+ class RestrictWorkspaceAdminsMessageStatus(Enum):
519
+
520
+ ALLOW_ALL = "ALLOW_ALL"
521
+ RESTRICT_TOKENS_AND_JOB_RUN_AS = "RESTRICT_TOKENS_AND_JOB_RUN_AS"
522
+
523
+
524
+ @dataclass
525
+ class Setting:
526
+ aibi_dashboard_embedding_access_policy: Optional[AibiDashboardEmbeddingAccessPolicy] = None
527
+
528
+ aibi_dashboard_embedding_approved_domains: Optional[AibiDashboardEmbeddingApprovedDomains] = None
529
+
530
+ automatic_cluster_update_workspace: Optional[ClusterAutoRestartMessage] = None
531
+ """todo: Mark these Public after onboarded to DSL"""
532
+
533
+ boolean_val: Optional[BooleanMessage] = None
534
+
535
+ default_data_security_mode: Optional[DefaultDataSecurityModeMessage] = None
536
+
537
+ effective_aibi_dashboard_embedding_access_policy: Optional[AibiDashboardEmbeddingAccessPolicy] = None
538
+
539
+ effective_aibi_dashboard_embedding_approved_domains: Optional[AibiDashboardEmbeddingApprovedDomains] = None
540
+
541
+ effective_automatic_cluster_update_workspace: Optional[ClusterAutoRestartMessage] = None
542
+
543
+ effective_boolean_val: Optional[BooleanMessage] = None
544
+
545
+ effective_default_data_security_mode: Optional[DefaultDataSecurityModeMessage] = None
546
+
547
+ effective_integer_val: Optional[IntegerMessage] = None
548
+
549
+ effective_personal_compute: Optional[PersonalComputeMessage] = None
550
+
551
+ effective_restrict_workspace_admins: Optional[RestrictWorkspaceAdminsMessage] = None
552
+
553
+ effective_string_val: Optional[StringMessage] = None
554
+
555
+ integer_val: Optional[IntegerMessage] = None
556
+
557
+ name: Optional[str] = None
558
+ """Name of the setting."""
559
+
560
+ personal_compute: Optional[PersonalComputeMessage] = None
561
+
562
+ restrict_workspace_admins: Optional[RestrictWorkspaceAdminsMessage] = None
563
+
564
+ string_val: Optional[StringMessage] = None
565
+
566
+ def as_dict(self) -> dict:
567
+ """Serializes the Setting into a dictionary suitable for use as a JSON request body."""
568
+ body = {}
569
+ if self.aibi_dashboard_embedding_access_policy:
570
+ body["aibi_dashboard_embedding_access_policy"] = self.aibi_dashboard_embedding_access_policy.as_dict()
571
+ if self.aibi_dashboard_embedding_approved_domains:
572
+ body["aibi_dashboard_embedding_approved_domains"] = self.aibi_dashboard_embedding_approved_domains.as_dict()
573
+ if self.automatic_cluster_update_workspace:
574
+ body["automatic_cluster_update_workspace"] = self.automatic_cluster_update_workspace.as_dict()
575
+ if self.boolean_val:
576
+ body["boolean_val"] = self.boolean_val.as_dict()
577
+ if self.default_data_security_mode:
578
+ body["default_data_security_mode"] = self.default_data_security_mode.as_dict()
579
+ if self.effective_aibi_dashboard_embedding_access_policy:
580
+ body["effective_aibi_dashboard_embedding_access_policy"] = (
581
+ self.effective_aibi_dashboard_embedding_access_policy.as_dict()
582
+ )
583
+ if self.effective_aibi_dashboard_embedding_approved_domains:
584
+ body["effective_aibi_dashboard_embedding_approved_domains"] = (
585
+ self.effective_aibi_dashboard_embedding_approved_domains.as_dict()
586
+ )
587
+ if self.effective_automatic_cluster_update_workspace:
588
+ body["effective_automatic_cluster_update_workspace"] = (
589
+ self.effective_automatic_cluster_update_workspace.as_dict()
590
+ )
591
+ if self.effective_boolean_val:
592
+ body["effective_boolean_val"] = self.effective_boolean_val.as_dict()
593
+ if self.effective_default_data_security_mode:
594
+ body["effective_default_data_security_mode"] = self.effective_default_data_security_mode.as_dict()
595
+ if self.effective_integer_val:
596
+ body["effective_integer_val"] = self.effective_integer_val.as_dict()
597
+ if self.effective_personal_compute:
598
+ body["effective_personal_compute"] = self.effective_personal_compute.as_dict()
599
+ if self.effective_restrict_workspace_admins:
600
+ body["effective_restrict_workspace_admins"] = self.effective_restrict_workspace_admins.as_dict()
601
+ if self.effective_string_val:
602
+ body["effective_string_val"] = self.effective_string_val.as_dict()
603
+ if self.integer_val:
604
+ body["integer_val"] = self.integer_val.as_dict()
605
+ if self.name is not None:
606
+ body["name"] = self.name
607
+ if self.personal_compute:
608
+ body["personal_compute"] = self.personal_compute.as_dict()
609
+ if self.restrict_workspace_admins:
610
+ body["restrict_workspace_admins"] = self.restrict_workspace_admins.as_dict()
611
+ if self.string_val:
612
+ body["string_val"] = self.string_val.as_dict()
613
+ return body
614
+
615
+ def as_shallow_dict(self) -> dict:
616
+ """Serializes the Setting into a shallow dictionary of its immediate attributes."""
617
+ body = {}
618
+ if self.aibi_dashboard_embedding_access_policy:
619
+ body["aibi_dashboard_embedding_access_policy"] = self.aibi_dashboard_embedding_access_policy
620
+ if self.aibi_dashboard_embedding_approved_domains:
621
+ body["aibi_dashboard_embedding_approved_domains"] = self.aibi_dashboard_embedding_approved_domains
622
+ if self.automatic_cluster_update_workspace:
623
+ body["automatic_cluster_update_workspace"] = self.automatic_cluster_update_workspace
624
+ if self.boolean_val:
625
+ body["boolean_val"] = self.boolean_val
626
+ if self.default_data_security_mode:
627
+ body["default_data_security_mode"] = self.default_data_security_mode
628
+ if self.effective_aibi_dashboard_embedding_access_policy:
629
+ body["effective_aibi_dashboard_embedding_access_policy"] = (
630
+ self.effective_aibi_dashboard_embedding_access_policy
631
+ )
632
+ if self.effective_aibi_dashboard_embedding_approved_domains:
633
+ body["effective_aibi_dashboard_embedding_approved_domains"] = (
634
+ self.effective_aibi_dashboard_embedding_approved_domains
635
+ )
636
+ if self.effective_automatic_cluster_update_workspace:
637
+ body["effective_automatic_cluster_update_workspace"] = self.effective_automatic_cluster_update_workspace
638
+ if self.effective_boolean_val:
639
+ body["effective_boolean_val"] = self.effective_boolean_val
640
+ if self.effective_default_data_security_mode:
641
+ body["effective_default_data_security_mode"] = self.effective_default_data_security_mode
642
+ if self.effective_integer_val:
643
+ body["effective_integer_val"] = self.effective_integer_val
644
+ if self.effective_personal_compute:
645
+ body["effective_personal_compute"] = self.effective_personal_compute
646
+ if self.effective_restrict_workspace_admins:
647
+ body["effective_restrict_workspace_admins"] = self.effective_restrict_workspace_admins
648
+ if self.effective_string_val:
649
+ body["effective_string_val"] = self.effective_string_val
650
+ if self.integer_val:
651
+ body["integer_val"] = self.integer_val
652
+ if self.name is not None:
653
+ body["name"] = self.name
654
+ if self.personal_compute:
655
+ body["personal_compute"] = self.personal_compute
656
+ if self.restrict_workspace_admins:
657
+ body["restrict_workspace_admins"] = self.restrict_workspace_admins
658
+ if self.string_val:
659
+ body["string_val"] = self.string_val
660
+ return body
661
+
662
+ @classmethod
663
+ def from_dict(cls, d: Dict[str, Any]) -> Setting:
664
+ """Deserializes the Setting from a dictionary."""
665
+ return cls(
666
+ aibi_dashboard_embedding_access_policy=_from_dict(
667
+ d, "aibi_dashboard_embedding_access_policy", AibiDashboardEmbeddingAccessPolicy
668
+ ),
669
+ aibi_dashboard_embedding_approved_domains=_from_dict(
670
+ d, "aibi_dashboard_embedding_approved_domains", AibiDashboardEmbeddingApprovedDomains
671
+ ),
672
+ automatic_cluster_update_workspace=_from_dict(
673
+ d, "automatic_cluster_update_workspace", ClusterAutoRestartMessage
674
+ ),
675
+ boolean_val=_from_dict(d, "boolean_val", BooleanMessage),
676
+ default_data_security_mode=_from_dict(d, "default_data_security_mode", DefaultDataSecurityModeMessage),
677
+ effective_aibi_dashboard_embedding_access_policy=_from_dict(
678
+ d, "effective_aibi_dashboard_embedding_access_policy", AibiDashboardEmbeddingAccessPolicy
679
+ ),
680
+ effective_aibi_dashboard_embedding_approved_domains=_from_dict(
681
+ d, "effective_aibi_dashboard_embedding_approved_domains", AibiDashboardEmbeddingApprovedDomains
682
+ ),
683
+ effective_automatic_cluster_update_workspace=_from_dict(
684
+ d, "effective_automatic_cluster_update_workspace", ClusterAutoRestartMessage
685
+ ),
686
+ effective_boolean_val=_from_dict(d, "effective_boolean_val", BooleanMessage),
687
+ effective_default_data_security_mode=_from_dict(
688
+ d, "effective_default_data_security_mode", DefaultDataSecurityModeMessage
689
+ ),
690
+ effective_integer_val=_from_dict(d, "effective_integer_val", IntegerMessage),
691
+ effective_personal_compute=_from_dict(d, "effective_personal_compute", PersonalComputeMessage),
692
+ effective_restrict_workspace_admins=_from_dict(
693
+ d, "effective_restrict_workspace_admins", RestrictWorkspaceAdminsMessage
694
+ ),
695
+ effective_string_val=_from_dict(d, "effective_string_val", StringMessage),
696
+ integer_val=_from_dict(d, "integer_val", IntegerMessage),
697
+ name=d.get("name", None),
698
+ personal_compute=_from_dict(d, "personal_compute", PersonalComputeMessage),
699
+ restrict_workspace_admins=_from_dict(d, "restrict_workspace_admins", RestrictWorkspaceAdminsMessage),
700
+ string_val=_from_dict(d, "string_val", StringMessage),
701
+ )
702
+
703
+
704
+ @dataclass
705
+ class SettingsMetadata:
706
+ description: Optional[str] = None
707
+ """Setting description for what this setting controls"""
708
+
709
+ docs_link: Optional[str] = None
710
+ """Link to databricks documentation for the setting"""
711
+
712
+ name: Optional[str] = None
713
+ """Name of the setting."""
714
+
715
+ type: Optional[str] = None
716
+ """Type of the setting. To set this setting, the value sent must match this type."""
717
+
718
+ def as_dict(self) -> dict:
719
+ """Serializes the SettingsMetadata into a dictionary suitable for use as a JSON request body."""
720
+ body = {}
721
+ if self.description is not None:
722
+ body["description"] = self.description
723
+ if self.docs_link is not None:
724
+ body["docs_link"] = self.docs_link
725
+ if self.name is not None:
726
+ body["name"] = self.name
727
+ if self.type is not None:
728
+ body["type"] = self.type
729
+ return body
730
+
731
+ def as_shallow_dict(self) -> dict:
732
+ """Serializes the SettingsMetadata into a shallow dictionary of its immediate attributes."""
733
+ body = {}
734
+ if self.description is not None:
735
+ body["description"] = self.description
736
+ if self.docs_link is not None:
737
+ body["docs_link"] = self.docs_link
738
+ if self.name is not None:
739
+ body["name"] = self.name
740
+ if self.type is not None:
741
+ body["type"] = self.type
742
+ return body
743
+
744
+ @classmethod
745
+ def from_dict(cls, d: Dict[str, Any]) -> SettingsMetadata:
746
+ """Deserializes the SettingsMetadata from a dictionary."""
747
+ return cls(
748
+ description=d.get("description", None),
749
+ docs_link=d.get("docs_link", None),
750
+ name=d.get("name", None),
751
+ type=d.get("type", None),
752
+ )
753
+
754
+
755
+ @dataclass
756
+ class StringMessage:
757
+ value: Optional[str] = None
758
+ """Represents a generic string value."""
759
+
760
+ def as_dict(self) -> dict:
761
+ """Serializes the StringMessage into a dictionary suitable for use as a JSON request body."""
762
+ body = {}
763
+ if self.value is not None:
764
+ body["value"] = self.value
765
+ return body
766
+
767
+ def as_shallow_dict(self) -> dict:
768
+ """Serializes the StringMessage into a shallow dictionary of its immediate attributes."""
769
+ body = {}
770
+ if self.value is not None:
771
+ body["value"] = self.value
772
+ return body
773
+
774
+ @classmethod
775
+ def from_dict(cls, d: Dict[str, Any]) -> StringMessage:
776
+ """Deserializes the StringMessage from a dictionary."""
777
+ return cls(value=d.get("value", None))
778
+
779
+
780
+ class AccountSettingsV2API:
781
+ """APIs to manage account level settings"""
782
+
783
+ def __init__(self, api_client):
784
+ self._api = api_client
785
+
786
+ def get_public_account_setting(self, name: str) -> Setting:
787
+ """Get a setting value at account level
788
+
789
+ :param name: str
790
+
791
+ :returns: :class:`Setting`
792
+ """
793
+
794
+ headers = {
795
+ "Accept": "application/json",
796
+ }
797
+
798
+ res = self._api.do("GET", f"/api/2.1/accounts/{self._api.account_id}/settings/{name}", headers=headers)
799
+ return Setting.from_dict(res)
800
+
801
+ def list_account_settings_metadata(
802
+ self, *, page_size: Optional[int] = None, page_token: Optional[str] = None
803
+ ) -> Iterator[SettingsMetadata]:
804
+ """List valid setting keys and metadata. These settings are available to referenced via [GET
805
+ /api/2.1/settings/{name}](#~1api~1account~1settingsv2~1getpublicaccountsetting) and [PATCH
806
+ /api/2.1/settings/{name}](#~1api~1account~1settingsv2~patchpublicaccountsetting) APIs
807
+
808
+ :param page_size: int (optional)
809
+ The maximum number of settings to return. The service may return fewer than this value. If
810
+ unspecified, at most 200 settings will be returned. The maximum value is 1000; values above 1000
811
+ will be coerced to 1000.
812
+ :param page_token: str (optional)
813
+ A page token, received from a previous `ListAccountSettingsMetadataRequest` call. Provide this to
814
+ retrieve the subsequent page.
815
+
816
+ When paginating, all other parameters provided to `ListAccountSettingsMetadataRequest` must match
817
+ the call that provided the page token.
818
+
819
+ :returns: Iterator over :class:`SettingsMetadata`
820
+ """
821
+
822
+ query = {}
823
+ if page_size is not None:
824
+ query["page_size"] = page_size
825
+ if page_token is not None:
826
+ query["page_token"] = page_token
827
+ headers = {
828
+ "Accept": "application/json",
829
+ }
830
+
831
+ while True:
832
+ json = self._api.do(
833
+ "GET", f"/api/2.1/accounts/{self._api.account_id}/settings-metadata", query=query, headers=headers
834
+ )
835
+ if "settings_metadata" in json:
836
+ for v in json["settings_metadata"]:
837
+ yield SettingsMetadata.from_dict(v)
838
+ if "next_page_token" not in json or not json["next_page_token"]:
839
+ return
840
+ query["page_token"] = json["next_page_token"]
841
+
842
+ def patch_public_account_setting(self, name: str, setting: Setting) -> Setting:
843
+ """Patch a setting value at account level
844
+
845
+ :param name: str
846
+ :param setting: :class:`Setting`
847
+
848
+ :returns: :class:`Setting`
849
+ """
850
+ body = setting.as_dict()
851
+ headers = {
852
+ "Accept": "application/json",
853
+ "Content-Type": "application/json",
854
+ }
855
+
856
+ res = self._api.do(
857
+ "PATCH", f"/api/2.1/accounts/{self._api.account_id}/settings/{name}", body=body, headers=headers
858
+ )
859
+ return Setting.from_dict(res)
860
+
861
+
862
+ class WorkspaceSettingsV2API:
863
+ """APIs to manage workspace level settings"""
864
+
865
+ def __init__(self, api_client):
866
+ self._api = api_client
867
+
868
+ def get_public_workspace_setting(self, name: str) -> Setting:
869
+ """Get a setting value at workspace level
870
+
871
+ :param name: str
872
+
873
+ :returns: :class:`Setting`
874
+ """
875
+
876
+ headers = {
877
+ "Accept": "application/json",
878
+ }
879
+
880
+ res = self._api.do("GET", f"/api/2.1/settings/{name}", headers=headers)
881
+ return Setting.from_dict(res)
882
+
883
+ def list_workspace_settings_metadata(
884
+ self, *, page_size: Optional[int] = None, page_token: Optional[str] = None
885
+ ) -> Iterator[SettingsMetadata]:
886
+ """List valid setting keys and metadata. These settings are available to referenced via [GET
887
+ /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~1getpublicworkspacesetting) and [PATCH
888
+ /api/2.1/settings/{name}](#~1api~1workspace~1settingsv2~patchpublicworkspacesetting) APIs
889
+
890
+ :param page_size: int (optional)
891
+ The maximum number of settings to return. The service may return fewer than this value. If
892
+ unspecified, at most 200 settings will be returned. The maximum value is 1000; values above 1000
893
+ will be coerced to 1000.
894
+ :param page_token: str (optional)
895
+ A page token, received from a previous `ListWorkspaceSettingsMetadataRequest` call. Provide this to
896
+ retrieve the subsequent page.
897
+
898
+ When paginating, all other parameters provided to `ListWorkspaceSettingsMetadataRequest` must match
899
+ the call that provided the page token.
900
+
901
+ :returns: Iterator over :class:`SettingsMetadata`
902
+ """
903
+
904
+ query = {}
905
+ if page_size is not None:
906
+ query["page_size"] = page_size
907
+ if page_token is not None:
908
+ query["page_token"] = page_token
909
+ headers = {
910
+ "Accept": "application/json",
911
+ }
912
+
913
+ while True:
914
+ json = self._api.do("GET", "/api/2.1/settings-metadata", query=query, headers=headers)
915
+ if "settings_metadata" in json:
916
+ for v in json["settings_metadata"]:
917
+ yield SettingsMetadata.from_dict(v)
918
+ if "next_page_token" not in json or not json["next_page_token"]:
919
+ return
920
+ query["page_token"] = json["next_page_token"]
921
+
922
+ def patch_public_workspace_setting(self, name: str, setting: Setting) -> Setting:
923
+ """Patch a setting value at workspace level
924
+
925
+ :param name: str
926
+ :param setting: :class:`Setting`
927
+
928
+ :returns: :class:`Setting`
929
+ """
930
+ body = setting.as_dict()
931
+ headers = {
932
+ "Accept": "application/json",
933
+ "Content-Type": "application/json",
934
+ }
935
+
936
+ res = self._api.do("PATCH", f"/api/2.1/settings/{name}", body=body, headers=headers)
937
+ return Setting.from_dict(res)