databricks-sdk 0.44.1__py3-none-any.whl → 0.45.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 +123 -115
- databricks/sdk/_base_client.py +112 -88
- databricks/sdk/_property.py +12 -7
- databricks/sdk/_widgets/__init__.py +13 -2
- databricks/sdk/_widgets/default_widgets_utils.py +21 -15
- databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
- databricks/sdk/azure.py +8 -6
- databricks/sdk/casing.py +5 -5
- databricks/sdk/config.py +152 -99
- databricks/sdk/core.py +57 -47
- databricks/sdk/credentials_provider.py +300 -205
- databricks/sdk/data_plane.py +86 -3
- databricks/sdk/dbutils.py +123 -87
- databricks/sdk/environments.py +52 -35
- databricks/sdk/errors/base.py +61 -35
- databricks/sdk/errors/customizer.py +3 -3
- databricks/sdk/errors/deserializer.py +38 -25
- databricks/sdk/errors/details.py +417 -0
- databricks/sdk/errors/mapper.py +1 -1
- databricks/sdk/errors/overrides.py +27 -24
- databricks/sdk/errors/parser.py +26 -14
- databricks/sdk/errors/platform.py +10 -10
- databricks/sdk/errors/private_link.py +24 -24
- databricks/sdk/logger/round_trip_logger.py +28 -20
- databricks/sdk/mixins/compute.py +90 -60
- databricks/sdk/mixins/files.py +815 -145
- databricks/sdk/mixins/jobs.py +191 -16
- databricks/sdk/mixins/open_ai_client.py +26 -20
- databricks/sdk/mixins/workspace.py +45 -34
- databricks/sdk/oauth.py +372 -196
- databricks/sdk/retries.py +14 -12
- databricks/sdk/runtime/__init__.py +34 -17
- databricks/sdk/runtime/dbutils_stub.py +52 -39
- databricks/sdk/service/_internal.py +12 -7
- databricks/sdk/service/apps.py +618 -418
- databricks/sdk/service/billing.py +827 -604
- databricks/sdk/service/catalog.py +6552 -4474
- databricks/sdk/service/cleanrooms.py +550 -388
- databricks/sdk/service/compute.py +5241 -3531
- databricks/sdk/service/dashboards.py +1313 -923
- databricks/sdk/service/files.py +442 -309
- databricks/sdk/service/iam.py +2115 -1483
- databricks/sdk/service/jobs.py +4151 -2588
- databricks/sdk/service/marketplace.py +2210 -1517
- databricks/sdk/service/ml.py +3364 -2255
- databricks/sdk/service/oauth2.py +922 -584
- databricks/sdk/service/pipelines.py +1865 -1203
- databricks/sdk/service/provisioning.py +1435 -1029
- databricks/sdk/service/serving.py +2040 -1278
- databricks/sdk/service/settings.py +2846 -1929
- databricks/sdk/service/sharing.py +2201 -877
- databricks/sdk/service/sql.py +4650 -3103
- databricks/sdk/service/vectorsearch.py +816 -550
- databricks/sdk/service/workspace.py +1330 -906
- databricks/sdk/useragent.py +36 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/METADATA +31 -31
- databricks_sdk-0.45.0.dist-info/RECORD +70 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/WHEEL +1 -1
- databricks_sdk-0.44.1.dist-info/RECORD +0 -69
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/top_level.txt +0 -0
|
@@ -5,11 +5,12 @@ from __future__ import annotations
|
|
|
5
5
|
import logging
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from enum import Enum
|
|
8
|
-
from typing import BinaryIO, Dict, Iterator, List, Optional
|
|
8
|
+
from typing import Any, BinaryIO, Dict, Iterator, List, Optional
|
|
9
9
|
|
|
10
10
|
from ._internal import _enum, _from_dict, _repeated_dict
|
|
11
11
|
|
|
12
|
-
_LOG = logging.getLogger(
|
|
12
|
+
_LOG = logging.getLogger("databricks.sdk")
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
from databricks.sdk.service import compute
|
|
15
16
|
|
|
@@ -31,31 +32,37 @@ class ActionConfiguration:
|
|
|
31
32
|
"""Serializes the ActionConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
32
33
|
body = {}
|
|
33
34
|
if self.action_configuration_id is not None:
|
|
34
|
-
body[
|
|
35
|
-
if self.action_type is not None:
|
|
36
|
-
|
|
35
|
+
body["action_configuration_id"] = self.action_configuration_id
|
|
36
|
+
if self.action_type is not None:
|
|
37
|
+
body["action_type"] = self.action_type.value
|
|
38
|
+
if self.target is not None:
|
|
39
|
+
body["target"] = self.target
|
|
37
40
|
return body
|
|
38
41
|
|
|
39
42
|
def as_shallow_dict(self) -> dict:
|
|
40
43
|
"""Serializes the ActionConfiguration into a shallow dictionary of its immediate attributes."""
|
|
41
44
|
body = {}
|
|
42
45
|
if self.action_configuration_id is not None:
|
|
43
|
-
body[
|
|
44
|
-
if self.action_type is not None:
|
|
45
|
-
|
|
46
|
+
body["action_configuration_id"] = self.action_configuration_id
|
|
47
|
+
if self.action_type is not None:
|
|
48
|
+
body["action_type"] = self.action_type
|
|
49
|
+
if self.target is not None:
|
|
50
|
+
body["target"] = self.target
|
|
46
51
|
return body
|
|
47
52
|
|
|
48
53
|
@classmethod
|
|
49
|
-
def from_dict(cls, d: Dict[str,
|
|
54
|
+
def from_dict(cls, d: Dict[str, Any]) -> ActionConfiguration:
|
|
50
55
|
"""Deserializes the ActionConfiguration from a dictionary."""
|
|
51
|
-
return cls(
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
return cls(
|
|
57
|
+
action_configuration_id=d.get("action_configuration_id", None),
|
|
58
|
+
action_type=_enum(d, "action_type", ActionConfigurationType),
|
|
59
|
+
target=d.get("target", None),
|
|
60
|
+
)
|
|
54
61
|
|
|
55
62
|
|
|
56
63
|
class ActionConfigurationType(Enum):
|
|
57
64
|
|
|
58
|
-
EMAIL_NOTIFICATION =
|
|
65
|
+
EMAIL_NOTIFICATION = "EMAIL_NOTIFICATION"
|
|
59
66
|
|
|
60
67
|
|
|
61
68
|
@dataclass
|
|
@@ -85,51 +92,62 @@ class AlertConfiguration:
|
|
|
85
92
|
"""Serializes the AlertConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
86
93
|
body = {}
|
|
87
94
|
if self.action_configurations:
|
|
88
|
-
body[
|
|
95
|
+
body["action_configurations"] = [v.as_dict() for v in self.action_configurations]
|
|
89
96
|
if self.alert_configuration_id is not None:
|
|
90
|
-
body[
|
|
91
|
-
if self.quantity_threshold is not None:
|
|
92
|
-
|
|
93
|
-
if self.
|
|
94
|
-
|
|
97
|
+
body["alert_configuration_id"] = self.alert_configuration_id
|
|
98
|
+
if self.quantity_threshold is not None:
|
|
99
|
+
body["quantity_threshold"] = self.quantity_threshold
|
|
100
|
+
if self.quantity_type is not None:
|
|
101
|
+
body["quantity_type"] = self.quantity_type.value
|
|
102
|
+
if self.time_period is not None:
|
|
103
|
+
body["time_period"] = self.time_period.value
|
|
104
|
+
if self.trigger_type is not None:
|
|
105
|
+
body["trigger_type"] = self.trigger_type.value
|
|
95
106
|
return body
|
|
96
107
|
|
|
97
108
|
def as_shallow_dict(self) -> dict:
|
|
98
109
|
"""Serializes the AlertConfiguration into a shallow dictionary of its immediate attributes."""
|
|
99
110
|
body = {}
|
|
100
|
-
if self.action_configurations:
|
|
111
|
+
if self.action_configurations:
|
|
112
|
+
body["action_configurations"] = self.action_configurations
|
|
101
113
|
if self.alert_configuration_id is not None:
|
|
102
|
-
body[
|
|
103
|
-
if self.quantity_threshold is not None:
|
|
104
|
-
|
|
105
|
-
if self.
|
|
106
|
-
|
|
114
|
+
body["alert_configuration_id"] = self.alert_configuration_id
|
|
115
|
+
if self.quantity_threshold is not None:
|
|
116
|
+
body["quantity_threshold"] = self.quantity_threshold
|
|
117
|
+
if self.quantity_type is not None:
|
|
118
|
+
body["quantity_type"] = self.quantity_type
|
|
119
|
+
if self.time_period is not None:
|
|
120
|
+
body["time_period"] = self.time_period
|
|
121
|
+
if self.trigger_type is not None:
|
|
122
|
+
body["trigger_type"] = self.trigger_type
|
|
107
123
|
return body
|
|
108
124
|
|
|
109
125
|
@classmethod
|
|
110
|
-
def from_dict(cls, d: Dict[str,
|
|
126
|
+
def from_dict(cls, d: Dict[str, Any]) -> AlertConfiguration:
|
|
111
127
|
"""Deserializes the AlertConfiguration from a dictionary."""
|
|
112
|
-
return cls(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
return cls(
|
|
129
|
+
action_configurations=_repeated_dict(d, "action_configurations", ActionConfiguration),
|
|
130
|
+
alert_configuration_id=d.get("alert_configuration_id", None),
|
|
131
|
+
quantity_threshold=d.get("quantity_threshold", None),
|
|
132
|
+
quantity_type=_enum(d, "quantity_type", AlertConfigurationQuantityType),
|
|
133
|
+
time_period=_enum(d, "time_period", AlertConfigurationTimePeriod),
|
|
134
|
+
trigger_type=_enum(d, "trigger_type", AlertConfigurationTriggerType),
|
|
135
|
+
)
|
|
118
136
|
|
|
119
137
|
|
|
120
138
|
class AlertConfigurationQuantityType(Enum):
|
|
121
139
|
|
|
122
|
-
LIST_PRICE_DOLLARS_USD =
|
|
140
|
+
LIST_PRICE_DOLLARS_USD = "LIST_PRICE_DOLLARS_USD"
|
|
123
141
|
|
|
124
142
|
|
|
125
143
|
class AlertConfigurationTimePeriod(Enum):
|
|
126
144
|
|
|
127
|
-
MONTH =
|
|
145
|
+
MONTH = "MONTH"
|
|
128
146
|
|
|
129
147
|
|
|
130
148
|
class AlertConfigurationTriggerType(Enum):
|
|
131
149
|
|
|
132
|
-
CUMULATIVE_SPENDING_EXCEEDED =
|
|
150
|
+
CUMULATIVE_SPENDING_EXCEEDED = "CUMULATIVE_SPENDING_EXCEEDED"
|
|
133
151
|
|
|
134
152
|
|
|
135
153
|
@dataclass
|
|
@@ -161,40 +179,53 @@ class BudgetConfiguration:
|
|
|
161
179
|
def as_dict(self) -> dict:
|
|
162
180
|
"""Serializes the BudgetConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
163
181
|
body = {}
|
|
164
|
-
if self.account_id is not None:
|
|
182
|
+
if self.account_id is not None:
|
|
183
|
+
body["account_id"] = self.account_id
|
|
165
184
|
if self.alert_configurations:
|
|
166
|
-
body[
|
|
185
|
+
body["alert_configurations"] = [v.as_dict() for v in self.alert_configurations]
|
|
167
186
|
if self.budget_configuration_id is not None:
|
|
168
|
-
body[
|
|
169
|
-
if self.create_time is not None:
|
|
170
|
-
|
|
171
|
-
if self.
|
|
172
|
-
|
|
187
|
+
body["budget_configuration_id"] = self.budget_configuration_id
|
|
188
|
+
if self.create_time is not None:
|
|
189
|
+
body["create_time"] = self.create_time
|
|
190
|
+
if self.display_name is not None:
|
|
191
|
+
body["display_name"] = self.display_name
|
|
192
|
+
if self.filter:
|
|
193
|
+
body["filter"] = self.filter.as_dict()
|
|
194
|
+
if self.update_time is not None:
|
|
195
|
+
body["update_time"] = self.update_time
|
|
173
196
|
return body
|
|
174
197
|
|
|
175
198
|
def as_shallow_dict(self) -> dict:
|
|
176
199
|
"""Serializes the BudgetConfiguration into a shallow dictionary of its immediate attributes."""
|
|
177
200
|
body = {}
|
|
178
|
-
if self.account_id is not None:
|
|
179
|
-
|
|
201
|
+
if self.account_id is not None:
|
|
202
|
+
body["account_id"] = self.account_id
|
|
203
|
+
if self.alert_configurations:
|
|
204
|
+
body["alert_configurations"] = self.alert_configurations
|
|
180
205
|
if self.budget_configuration_id is not None:
|
|
181
|
-
body[
|
|
182
|
-
if self.create_time is not None:
|
|
183
|
-
|
|
184
|
-
if self.
|
|
185
|
-
|
|
206
|
+
body["budget_configuration_id"] = self.budget_configuration_id
|
|
207
|
+
if self.create_time is not None:
|
|
208
|
+
body["create_time"] = self.create_time
|
|
209
|
+
if self.display_name is not None:
|
|
210
|
+
body["display_name"] = self.display_name
|
|
211
|
+
if self.filter:
|
|
212
|
+
body["filter"] = self.filter
|
|
213
|
+
if self.update_time is not None:
|
|
214
|
+
body["update_time"] = self.update_time
|
|
186
215
|
return body
|
|
187
216
|
|
|
188
217
|
@classmethod
|
|
189
|
-
def from_dict(cls, d: Dict[str,
|
|
218
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetConfiguration:
|
|
190
219
|
"""Deserializes the BudgetConfiguration from a dictionary."""
|
|
191
|
-
return cls(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
220
|
+
return cls(
|
|
221
|
+
account_id=d.get("account_id", None),
|
|
222
|
+
alert_configurations=_repeated_dict(d, "alert_configurations", AlertConfiguration),
|
|
223
|
+
budget_configuration_id=d.get("budget_configuration_id", None),
|
|
224
|
+
create_time=d.get("create_time", None),
|
|
225
|
+
display_name=d.get("display_name", None),
|
|
226
|
+
filter=_from_dict(d, "filter", BudgetConfigurationFilter),
|
|
227
|
+
update_time=d.get("update_time", None),
|
|
228
|
+
)
|
|
198
229
|
|
|
199
230
|
|
|
200
231
|
@dataclass
|
|
@@ -210,22 +241,28 @@ class BudgetConfigurationFilter:
|
|
|
210
241
|
def as_dict(self) -> dict:
|
|
211
242
|
"""Serializes the BudgetConfigurationFilter into a dictionary suitable for use as a JSON request body."""
|
|
212
243
|
body = {}
|
|
213
|
-
if self.tags:
|
|
214
|
-
|
|
244
|
+
if self.tags:
|
|
245
|
+
body["tags"] = [v.as_dict() for v in self.tags]
|
|
246
|
+
if self.workspace_id:
|
|
247
|
+
body["workspace_id"] = self.workspace_id.as_dict()
|
|
215
248
|
return body
|
|
216
249
|
|
|
217
250
|
def as_shallow_dict(self) -> dict:
|
|
218
251
|
"""Serializes the BudgetConfigurationFilter into a shallow dictionary of its immediate attributes."""
|
|
219
252
|
body = {}
|
|
220
|
-
if self.tags:
|
|
221
|
-
|
|
253
|
+
if self.tags:
|
|
254
|
+
body["tags"] = self.tags
|
|
255
|
+
if self.workspace_id:
|
|
256
|
+
body["workspace_id"] = self.workspace_id
|
|
222
257
|
return body
|
|
223
258
|
|
|
224
259
|
@classmethod
|
|
225
|
-
def from_dict(cls, d: Dict[str,
|
|
260
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetConfigurationFilter:
|
|
226
261
|
"""Deserializes the BudgetConfigurationFilter from a dictionary."""
|
|
227
|
-
return cls(
|
|
228
|
-
|
|
262
|
+
return cls(
|
|
263
|
+
tags=_repeated_dict(d, "tags", BudgetConfigurationFilterTagClause),
|
|
264
|
+
workspace_id=_from_dict(d, "workspace_id", BudgetConfigurationFilterWorkspaceIdClause),
|
|
265
|
+
)
|
|
229
266
|
|
|
230
267
|
|
|
231
268
|
@dataclass
|
|
@@ -237,27 +274,30 @@ class BudgetConfigurationFilterClause:
|
|
|
237
274
|
def as_dict(self) -> dict:
|
|
238
275
|
"""Serializes the BudgetConfigurationFilterClause into a dictionary suitable for use as a JSON request body."""
|
|
239
276
|
body = {}
|
|
240
|
-
if self.operator is not None:
|
|
241
|
-
|
|
277
|
+
if self.operator is not None:
|
|
278
|
+
body["operator"] = self.operator.value
|
|
279
|
+
if self.values:
|
|
280
|
+
body["values"] = [v for v in self.values]
|
|
242
281
|
return body
|
|
243
282
|
|
|
244
283
|
def as_shallow_dict(self) -> dict:
|
|
245
284
|
"""Serializes the BudgetConfigurationFilterClause into a shallow dictionary of its immediate attributes."""
|
|
246
285
|
body = {}
|
|
247
|
-
if self.operator is not None:
|
|
248
|
-
|
|
286
|
+
if self.operator is not None:
|
|
287
|
+
body["operator"] = self.operator
|
|
288
|
+
if self.values:
|
|
289
|
+
body["values"] = self.values
|
|
249
290
|
return body
|
|
250
291
|
|
|
251
292
|
@classmethod
|
|
252
|
-
def from_dict(cls, d: Dict[str,
|
|
293
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetConfigurationFilterClause:
|
|
253
294
|
"""Deserializes the BudgetConfigurationFilterClause from a dictionary."""
|
|
254
|
-
return cls(operator=_enum(d,
|
|
255
|
-
values=d.get('values', None))
|
|
295
|
+
return cls(operator=_enum(d, "operator", BudgetConfigurationFilterOperator), values=d.get("values", None))
|
|
256
296
|
|
|
257
297
|
|
|
258
298
|
class BudgetConfigurationFilterOperator(Enum):
|
|
259
299
|
|
|
260
|
-
IN =
|
|
300
|
+
IN = "IN"
|
|
261
301
|
|
|
262
302
|
|
|
263
303
|
@dataclass
|
|
@@ -269,21 +309,25 @@ class BudgetConfigurationFilterTagClause:
|
|
|
269
309
|
def as_dict(self) -> dict:
|
|
270
310
|
"""Serializes the BudgetConfigurationFilterTagClause into a dictionary suitable for use as a JSON request body."""
|
|
271
311
|
body = {}
|
|
272
|
-
if self.key is not None:
|
|
273
|
-
|
|
312
|
+
if self.key is not None:
|
|
313
|
+
body["key"] = self.key
|
|
314
|
+
if self.value:
|
|
315
|
+
body["value"] = self.value.as_dict()
|
|
274
316
|
return body
|
|
275
317
|
|
|
276
318
|
def as_shallow_dict(self) -> dict:
|
|
277
319
|
"""Serializes the BudgetConfigurationFilterTagClause into a shallow dictionary of its immediate attributes."""
|
|
278
320
|
body = {}
|
|
279
|
-
if self.key is not None:
|
|
280
|
-
|
|
321
|
+
if self.key is not None:
|
|
322
|
+
body["key"] = self.key
|
|
323
|
+
if self.value:
|
|
324
|
+
body["value"] = self.value
|
|
281
325
|
return body
|
|
282
326
|
|
|
283
327
|
@classmethod
|
|
284
|
-
def from_dict(cls, d: Dict[str,
|
|
328
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetConfigurationFilterTagClause:
|
|
285
329
|
"""Deserializes the BudgetConfigurationFilterTagClause from a dictionary."""
|
|
286
|
-
return cls(key=d.get(
|
|
330
|
+
return cls(key=d.get("key", None), value=_from_dict(d, "value", BudgetConfigurationFilterClause))
|
|
287
331
|
|
|
288
332
|
|
|
289
333
|
@dataclass
|
|
@@ -295,34 +339,37 @@ class BudgetConfigurationFilterWorkspaceIdClause:
|
|
|
295
339
|
def as_dict(self) -> dict:
|
|
296
340
|
"""Serializes the BudgetConfigurationFilterWorkspaceIdClause into a dictionary suitable for use as a JSON request body."""
|
|
297
341
|
body = {}
|
|
298
|
-
if self.operator is not None:
|
|
299
|
-
|
|
342
|
+
if self.operator is not None:
|
|
343
|
+
body["operator"] = self.operator.value
|
|
344
|
+
if self.values:
|
|
345
|
+
body["values"] = [v for v in self.values]
|
|
300
346
|
return body
|
|
301
347
|
|
|
302
348
|
def as_shallow_dict(self) -> dict:
|
|
303
349
|
"""Serializes the BudgetConfigurationFilterWorkspaceIdClause into a shallow dictionary of its immediate attributes."""
|
|
304
350
|
body = {}
|
|
305
|
-
if self.operator is not None:
|
|
306
|
-
|
|
351
|
+
if self.operator is not None:
|
|
352
|
+
body["operator"] = self.operator
|
|
353
|
+
if self.values:
|
|
354
|
+
body["values"] = self.values
|
|
307
355
|
return body
|
|
308
356
|
|
|
309
357
|
@classmethod
|
|
310
|
-
def from_dict(cls, d: Dict[str,
|
|
358
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetConfigurationFilterWorkspaceIdClause:
|
|
311
359
|
"""Deserializes the BudgetConfigurationFilterWorkspaceIdClause from a dictionary."""
|
|
312
|
-
return cls(operator=_enum(d,
|
|
313
|
-
values=d.get('values', None))
|
|
360
|
+
return cls(operator=_enum(d, "operator", BudgetConfigurationFilterOperator), values=d.get("values", None))
|
|
314
361
|
|
|
315
362
|
|
|
316
363
|
@dataclass
|
|
317
364
|
class BudgetPolicy:
|
|
318
365
|
"""Contains the BudgetPolicy details."""
|
|
319
366
|
|
|
320
|
-
policy_id: str
|
|
321
|
-
"""The Id of the policy. This field is generated by Databricks and globally unique."""
|
|
322
|
-
|
|
323
367
|
custom_tags: Optional[List[compute.CustomPolicyTag]] = None
|
|
324
368
|
"""A list of tags defined by the customer. At most 20 entries are allowed per policy."""
|
|
325
369
|
|
|
370
|
+
policy_id: Optional[str] = None
|
|
371
|
+
"""The Id of the policy. This field is generated by Databricks and globally unique."""
|
|
372
|
+
|
|
326
373
|
policy_name: Optional[str] = None
|
|
327
374
|
"""The name of the policy. - Must be unique among active policies. - Can contain only characters
|
|
328
375
|
from the ISO 8859-1 (latin1) set."""
|
|
@@ -330,25 +377,33 @@ class BudgetPolicy:
|
|
|
330
377
|
def as_dict(self) -> dict:
|
|
331
378
|
"""Serializes the BudgetPolicy into a dictionary suitable for use as a JSON request body."""
|
|
332
379
|
body = {}
|
|
333
|
-
if self.custom_tags:
|
|
334
|
-
|
|
335
|
-
if self.
|
|
380
|
+
if self.custom_tags:
|
|
381
|
+
body["custom_tags"] = [v.as_dict() for v in self.custom_tags]
|
|
382
|
+
if self.policy_id is not None:
|
|
383
|
+
body["policy_id"] = self.policy_id
|
|
384
|
+
if self.policy_name is not None:
|
|
385
|
+
body["policy_name"] = self.policy_name
|
|
336
386
|
return body
|
|
337
387
|
|
|
338
388
|
def as_shallow_dict(self) -> dict:
|
|
339
389
|
"""Serializes the BudgetPolicy into a shallow dictionary of its immediate attributes."""
|
|
340
390
|
body = {}
|
|
341
|
-
if self.custom_tags:
|
|
342
|
-
|
|
343
|
-
if self.
|
|
391
|
+
if self.custom_tags:
|
|
392
|
+
body["custom_tags"] = self.custom_tags
|
|
393
|
+
if self.policy_id is not None:
|
|
394
|
+
body["policy_id"] = self.policy_id
|
|
395
|
+
if self.policy_name is not None:
|
|
396
|
+
body["policy_name"] = self.policy_name
|
|
344
397
|
return body
|
|
345
398
|
|
|
346
399
|
@classmethod
|
|
347
|
-
def from_dict(cls, d: Dict[str,
|
|
400
|
+
def from_dict(cls, d: Dict[str, Any]) -> BudgetPolicy:
|
|
348
401
|
"""Deserializes the BudgetPolicy from a dictionary."""
|
|
349
|
-
return cls(
|
|
350
|
-
|
|
351
|
-
|
|
402
|
+
return cls(
|
|
403
|
+
custom_tags=_repeated_dict(d, "custom_tags", compute.CustomPolicyTag),
|
|
404
|
+
policy_id=d.get("policy_id", None),
|
|
405
|
+
policy_name=d.get("policy_name", None),
|
|
406
|
+
)
|
|
352
407
|
|
|
353
408
|
|
|
354
409
|
@dataclass
|
|
@@ -363,22 +418,27 @@ class CreateBillingUsageDashboardRequest:
|
|
|
363
418
|
def as_dict(self) -> dict:
|
|
364
419
|
"""Serializes the CreateBillingUsageDashboardRequest into a dictionary suitable for use as a JSON request body."""
|
|
365
420
|
body = {}
|
|
366
|
-
if self.dashboard_type is not None:
|
|
367
|
-
|
|
421
|
+
if self.dashboard_type is not None:
|
|
422
|
+
body["dashboard_type"] = self.dashboard_type.value
|
|
423
|
+
if self.workspace_id is not None:
|
|
424
|
+
body["workspace_id"] = self.workspace_id
|
|
368
425
|
return body
|
|
369
426
|
|
|
370
427
|
def as_shallow_dict(self) -> dict:
|
|
371
428
|
"""Serializes the CreateBillingUsageDashboardRequest into a shallow dictionary of its immediate attributes."""
|
|
372
429
|
body = {}
|
|
373
|
-
if self.dashboard_type is not None:
|
|
374
|
-
|
|
430
|
+
if self.dashboard_type is not None:
|
|
431
|
+
body["dashboard_type"] = self.dashboard_type
|
|
432
|
+
if self.workspace_id is not None:
|
|
433
|
+
body["workspace_id"] = self.workspace_id
|
|
375
434
|
return body
|
|
376
435
|
|
|
377
436
|
@classmethod
|
|
378
|
-
def from_dict(cls, d: Dict[str,
|
|
437
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBillingUsageDashboardRequest:
|
|
379
438
|
"""Deserializes the CreateBillingUsageDashboardRequest from a dictionary."""
|
|
380
|
-
return cls(
|
|
381
|
-
|
|
439
|
+
return cls(
|
|
440
|
+
dashboard_type=_enum(d, "dashboard_type", UsageDashboardType), workspace_id=d.get("workspace_id", None)
|
|
441
|
+
)
|
|
382
442
|
|
|
383
443
|
|
|
384
444
|
@dataclass
|
|
@@ -389,19 +449,21 @@ class CreateBillingUsageDashboardResponse:
|
|
|
389
449
|
def as_dict(self) -> dict:
|
|
390
450
|
"""Serializes the CreateBillingUsageDashboardResponse into a dictionary suitable for use as a JSON request body."""
|
|
391
451
|
body = {}
|
|
392
|
-
if self.dashboard_id is not None:
|
|
452
|
+
if self.dashboard_id is not None:
|
|
453
|
+
body["dashboard_id"] = self.dashboard_id
|
|
393
454
|
return body
|
|
394
455
|
|
|
395
456
|
def as_shallow_dict(self) -> dict:
|
|
396
457
|
"""Serializes the CreateBillingUsageDashboardResponse into a shallow dictionary of its immediate attributes."""
|
|
397
458
|
body = {}
|
|
398
|
-
if self.dashboard_id is not None:
|
|
459
|
+
if self.dashboard_id is not None:
|
|
460
|
+
body["dashboard_id"] = self.dashboard_id
|
|
399
461
|
return body
|
|
400
462
|
|
|
401
463
|
@classmethod
|
|
402
|
-
def from_dict(cls, d: Dict[str,
|
|
464
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBillingUsageDashboardResponse:
|
|
403
465
|
"""Deserializes the CreateBillingUsageDashboardResponse from a dictionary."""
|
|
404
|
-
return cls(dashboard_id=d.get(
|
|
466
|
+
return cls(dashboard_id=d.get("dashboard_id", None))
|
|
405
467
|
|
|
406
468
|
|
|
407
469
|
@dataclass
|
|
@@ -424,30 +486,40 @@ class CreateBudgetConfigurationBudget:
|
|
|
424
486
|
def as_dict(self) -> dict:
|
|
425
487
|
"""Serializes the CreateBudgetConfigurationBudget into a dictionary suitable for use as a JSON request body."""
|
|
426
488
|
body = {}
|
|
427
|
-
if self.account_id is not None:
|
|
489
|
+
if self.account_id is not None:
|
|
490
|
+
body["account_id"] = self.account_id
|
|
428
491
|
if self.alert_configurations:
|
|
429
|
-
body[
|
|
430
|
-
if self.display_name is not None:
|
|
431
|
-
|
|
492
|
+
body["alert_configurations"] = [v.as_dict() for v in self.alert_configurations]
|
|
493
|
+
if self.display_name is not None:
|
|
494
|
+
body["display_name"] = self.display_name
|
|
495
|
+
if self.filter:
|
|
496
|
+
body["filter"] = self.filter.as_dict()
|
|
432
497
|
return body
|
|
433
498
|
|
|
434
499
|
def as_shallow_dict(self) -> dict:
|
|
435
500
|
"""Serializes the CreateBudgetConfigurationBudget into a shallow dictionary of its immediate attributes."""
|
|
436
501
|
body = {}
|
|
437
|
-
if self.account_id is not None:
|
|
438
|
-
|
|
439
|
-
if self.
|
|
440
|
-
|
|
502
|
+
if self.account_id is not None:
|
|
503
|
+
body["account_id"] = self.account_id
|
|
504
|
+
if self.alert_configurations:
|
|
505
|
+
body["alert_configurations"] = self.alert_configurations
|
|
506
|
+
if self.display_name is not None:
|
|
507
|
+
body["display_name"] = self.display_name
|
|
508
|
+
if self.filter:
|
|
509
|
+
body["filter"] = self.filter
|
|
441
510
|
return body
|
|
442
511
|
|
|
443
512
|
@classmethod
|
|
444
|
-
def from_dict(cls, d: Dict[str,
|
|
513
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetConfigurationBudget:
|
|
445
514
|
"""Deserializes the CreateBudgetConfigurationBudget from a dictionary."""
|
|
446
|
-
return cls(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
515
|
+
return cls(
|
|
516
|
+
account_id=d.get("account_id", None),
|
|
517
|
+
alert_configurations=_repeated_dict(
|
|
518
|
+
d, "alert_configurations", CreateBudgetConfigurationBudgetAlertConfigurations
|
|
519
|
+
),
|
|
520
|
+
display_name=d.get("display_name", None),
|
|
521
|
+
filter=_from_dict(d, "filter", BudgetConfigurationFilter),
|
|
522
|
+
)
|
|
451
523
|
|
|
452
524
|
|
|
453
525
|
@dataclass
|
|
@@ -461,21 +533,25 @@ class CreateBudgetConfigurationBudgetActionConfigurations:
|
|
|
461
533
|
def as_dict(self) -> dict:
|
|
462
534
|
"""Serializes the CreateBudgetConfigurationBudgetActionConfigurations into a dictionary suitable for use as a JSON request body."""
|
|
463
535
|
body = {}
|
|
464
|
-
if self.action_type is not None:
|
|
465
|
-
|
|
536
|
+
if self.action_type is not None:
|
|
537
|
+
body["action_type"] = self.action_type.value
|
|
538
|
+
if self.target is not None:
|
|
539
|
+
body["target"] = self.target
|
|
466
540
|
return body
|
|
467
541
|
|
|
468
542
|
def as_shallow_dict(self) -> dict:
|
|
469
543
|
"""Serializes the CreateBudgetConfigurationBudgetActionConfigurations into a shallow dictionary of its immediate attributes."""
|
|
470
544
|
body = {}
|
|
471
|
-
if self.action_type is not None:
|
|
472
|
-
|
|
545
|
+
if self.action_type is not None:
|
|
546
|
+
body["action_type"] = self.action_type
|
|
547
|
+
if self.target is not None:
|
|
548
|
+
body["target"] = self.target
|
|
473
549
|
return body
|
|
474
550
|
|
|
475
551
|
@classmethod
|
|
476
|
-
def from_dict(cls, d: Dict[str,
|
|
552
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetConfigurationBudgetActionConfigurations:
|
|
477
553
|
"""Deserializes the CreateBudgetConfigurationBudgetActionConfigurations from a dictionary."""
|
|
478
|
-
return cls(action_type=_enum(d,
|
|
554
|
+
return cls(action_type=_enum(d, "action_type", ActionConfigurationType), target=d.get("target", None))
|
|
479
555
|
|
|
480
556
|
|
|
481
557
|
@dataclass
|
|
@@ -502,32 +578,44 @@ class CreateBudgetConfigurationBudgetAlertConfigurations:
|
|
|
502
578
|
"""Serializes the CreateBudgetConfigurationBudgetAlertConfigurations into a dictionary suitable for use as a JSON request body."""
|
|
503
579
|
body = {}
|
|
504
580
|
if self.action_configurations:
|
|
505
|
-
body[
|
|
506
|
-
if self.quantity_threshold is not None:
|
|
507
|
-
|
|
508
|
-
if self.
|
|
509
|
-
|
|
581
|
+
body["action_configurations"] = [v.as_dict() for v in self.action_configurations]
|
|
582
|
+
if self.quantity_threshold is not None:
|
|
583
|
+
body["quantity_threshold"] = self.quantity_threshold
|
|
584
|
+
if self.quantity_type is not None:
|
|
585
|
+
body["quantity_type"] = self.quantity_type.value
|
|
586
|
+
if self.time_period is not None:
|
|
587
|
+
body["time_period"] = self.time_period.value
|
|
588
|
+
if self.trigger_type is not None:
|
|
589
|
+
body["trigger_type"] = self.trigger_type.value
|
|
510
590
|
return body
|
|
511
591
|
|
|
512
592
|
def as_shallow_dict(self) -> dict:
|
|
513
593
|
"""Serializes the CreateBudgetConfigurationBudgetAlertConfigurations into a shallow dictionary of its immediate attributes."""
|
|
514
594
|
body = {}
|
|
515
|
-
if self.action_configurations:
|
|
516
|
-
|
|
517
|
-
if self.
|
|
518
|
-
|
|
519
|
-
if self.
|
|
595
|
+
if self.action_configurations:
|
|
596
|
+
body["action_configurations"] = self.action_configurations
|
|
597
|
+
if self.quantity_threshold is not None:
|
|
598
|
+
body["quantity_threshold"] = self.quantity_threshold
|
|
599
|
+
if self.quantity_type is not None:
|
|
600
|
+
body["quantity_type"] = self.quantity_type
|
|
601
|
+
if self.time_period is not None:
|
|
602
|
+
body["time_period"] = self.time_period
|
|
603
|
+
if self.trigger_type is not None:
|
|
604
|
+
body["trigger_type"] = self.trigger_type
|
|
520
605
|
return body
|
|
521
606
|
|
|
522
607
|
@classmethod
|
|
523
|
-
def from_dict(cls, d: Dict[str,
|
|
608
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetConfigurationBudgetAlertConfigurations:
|
|
524
609
|
"""Deserializes the CreateBudgetConfigurationBudgetAlertConfigurations from a dictionary."""
|
|
525
|
-
return cls(
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
610
|
+
return cls(
|
|
611
|
+
action_configurations=_repeated_dict(
|
|
612
|
+
d, "action_configurations", CreateBudgetConfigurationBudgetActionConfigurations
|
|
613
|
+
),
|
|
614
|
+
quantity_threshold=d.get("quantity_threshold", None),
|
|
615
|
+
quantity_type=_enum(d, "quantity_type", AlertConfigurationQuantityType),
|
|
616
|
+
time_period=_enum(d, "time_period", AlertConfigurationTimePeriod),
|
|
617
|
+
trigger_type=_enum(d, "trigger_type", AlertConfigurationTriggerType),
|
|
618
|
+
)
|
|
531
619
|
|
|
532
620
|
|
|
533
621
|
@dataclass
|
|
@@ -538,19 +626,21 @@ class CreateBudgetConfigurationRequest:
|
|
|
538
626
|
def as_dict(self) -> dict:
|
|
539
627
|
"""Serializes the CreateBudgetConfigurationRequest into a dictionary suitable for use as a JSON request body."""
|
|
540
628
|
body = {}
|
|
541
|
-
if self.budget:
|
|
629
|
+
if self.budget:
|
|
630
|
+
body["budget"] = self.budget.as_dict()
|
|
542
631
|
return body
|
|
543
632
|
|
|
544
633
|
def as_shallow_dict(self) -> dict:
|
|
545
634
|
"""Serializes the CreateBudgetConfigurationRequest into a shallow dictionary of its immediate attributes."""
|
|
546
635
|
body = {}
|
|
547
|
-
if self.budget:
|
|
636
|
+
if self.budget:
|
|
637
|
+
body["budget"] = self.budget
|
|
548
638
|
return body
|
|
549
639
|
|
|
550
640
|
@classmethod
|
|
551
|
-
def from_dict(cls, d: Dict[str,
|
|
641
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetConfigurationRequest:
|
|
552
642
|
"""Deserializes the CreateBudgetConfigurationRequest from a dictionary."""
|
|
553
|
-
return cls(budget=_from_dict(d,
|
|
643
|
+
return cls(budget=_from_dict(d, "budget", CreateBudgetConfigurationBudget))
|
|
554
644
|
|
|
555
645
|
|
|
556
646
|
@dataclass
|
|
@@ -561,31 +651,31 @@ class CreateBudgetConfigurationResponse:
|
|
|
561
651
|
def as_dict(self) -> dict:
|
|
562
652
|
"""Serializes the CreateBudgetConfigurationResponse into a dictionary suitable for use as a JSON request body."""
|
|
563
653
|
body = {}
|
|
564
|
-
if self.budget:
|
|
654
|
+
if self.budget:
|
|
655
|
+
body["budget"] = self.budget.as_dict()
|
|
565
656
|
return body
|
|
566
657
|
|
|
567
658
|
def as_shallow_dict(self) -> dict:
|
|
568
659
|
"""Serializes the CreateBudgetConfigurationResponse into a shallow dictionary of its immediate attributes."""
|
|
569
660
|
body = {}
|
|
570
|
-
if self.budget:
|
|
661
|
+
if self.budget:
|
|
662
|
+
body["budget"] = self.budget
|
|
571
663
|
return body
|
|
572
664
|
|
|
573
665
|
@classmethod
|
|
574
|
-
def from_dict(cls, d: Dict[str,
|
|
666
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetConfigurationResponse:
|
|
575
667
|
"""Deserializes the CreateBudgetConfigurationResponse from a dictionary."""
|
|
576
|
-
return cls(budget=_from_dict(d,
|
|
668
|
+
return cls(budget=_from_dict(d, "budget", BudgetConfiguration))
|
|
577
669
|
|
|
578
670
|
|
|
579
671
|
@dataclass
|
|
580
672
|
class CreateBudgetPolicyRequest:
|
|
581
673
|
"""A request to create a BudgetPolicy."""
|
|
582
674
|
|
|
583
|
-
|
|
584
|
-
"""
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
"""The name of the policy. - Must be unique among active policies. - Can contain only characters of
|
|
588
|
-
0-9, a-z, A-Z, -, =, ., :, /, @, _, +, whitespace."""
|
|
675
|
+
policy: Optional[BudgetPolicy] = None
|
|
676
|
+
"""The policy to create. `policy_id` needs to be empty as it will be generated `policy_name` must
|
|
677
|
+
be provided, custom_tags may need to be provided depending on the cloud provider. All other
|
|
678
|
+
fields are optional."""
|
|
589
679
|
|
|
590
680
|
request_id: Optional[str] = None
|
|
591
681
|
"""A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is
|
|
@@ -594,25 +684,25 @@ class CreateBudgetPolicyRequest:
|
|
|
594
684
|
def as_dict(self) -> dict:
|
|
595
685
|
"""Serializes the CreateBudgetPolicyRequest into a dictionary suitable for use as a JSON request body."""
|
|
596
686
|
body = {}
|
|
597
|
-
if self.
|
|
598
|
-
|
|
599
|
-
if self.request_id is not None:
|
|
687
|
+
if self.policy:
|
|
688
|
+
body["policy"] = self.policy.as_dict()
|
|
689
|
+
if self.request_id is not None:
|
|
690
|
+
body["request_id"] = self.request_id
|
|
600
691
|
return body
|
|
601
692
|
|
|
602
693
|
def as_shallow_dict(self) -> dict:
|
|
603
694
|
"""Serializes the CreateBudgetPolicyRequest into a shallow dictionary of its immediate attributes."""
|
|
604
695
|
body = {}
|
|
605
|
-
if self.
|
|
606
|
-
|
|
607
|
-
if self.request_id is not None:
|
|
696
|
+
if self.policy:
|
|
697
|
+
body["policy"] = self.policy
|
|
698
|
+
if self.request_id is not None:
|
|
699
|
+
body["request_id"] = self.request_id
|
|
608
700
|
return body
|
|
609
701
|
|
|
610
702
|
@classmethod
|
|
611
|
-
def from_dict(cls, d: Dict[str,
|
|
703
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateBudgetPolicyRequest:
|
|
612
704
|
"""Deserializes the CreateBudgetPolicyRequest from a dictionary."""
|
|
613
|
-
return cls(
|
|
614
|
-
policy_name=d.get('policy_name', None),
|
|
615
|
-
request_id=d.get('request_id', None))
|
|
705
|
+
return cls(policy=_from_dict(d, "policy", BudgetPolicy), request_id=d.get("request_id", None))
|
|
616
706
|
|
|
617
707
|
|
|
618
708
|
@dataclass
|
|
@@ -689,50 +779,67 @@ class CreateLogDeliveryConfigurationParams:
|
|
|
689
779
|
def as_dict(self) -> dict:
|
|
690
780
|
"""Serializes the CreateLogDeliveryConfigurationParams into a dictionary suitable for use as a JSON request body."""
|
|
691
781
|
body = {}
|
|
692
|
-
if self.config_name is not None:
|
|
693
|
-
|
|
694
|
-
if self.
|
|
695
|
-
|
|
696
|
-
if self.
|
|
697
|
-
|
|
698
|
-
if self.
|
|
782
|
+
if self.config_name is not None:
|
|
783
|
+
body["config_name"] = self.config_name
|
|
784
|
+
if self.credentials_id is not None:
|
|
785
|
+
body["credentials_id"] = self.credentials_id
|
|
786
|
+
if self.delivery_path_prefix is not None:
|
|
787
|
+
body["delivery_path_prefix"] = self.delivery_path_prefix
|
|
788
|
+
if self.delivery_start_time is not None:
|
|
789
|
+
body["delivery_start_time"] = self.delivery_start_time
|
|
790
|
+
if self.log_type is not None:
|
|
791
|
+
body["log_type"] = self.log_type.value
|
|
792
|
+
if self.output_format is not None:
|
|
793
|
+
body["output_format"] = self.output_format.value
|
|
794
|
+
if self.status is not None:
|
|
795
|
+
body["status"] = self.status.value
|
|
699
796
|
if self.storage_configuration_id is not None:
|
|
700
|
-
body[
|
|
701
|
-
if self.workspace_ids_filter:
|
|
797
|
+
body["storage_configuration_id"] = self.storage_configuration_id
|
|
798
|
+
if self.workspace_ids_filter:
|
|
799
|
+
body["workspace_ids_filter"] = [v for v in self.workspace_ids_filter]
|
|
702
800
|
return body
|
|
703
801
|
|
|
704
802
|
def as_shallow_dict(self) -> dict:
|
|
705
803
|
"""Serializes the CreateLogDeliveryConfigurationParams into a shallow dictionary of its immediate attributes."""
|
|
706
804
|
body = {}
|
|
707
|
-
if self.config_name is not None:
|
|
708
|
-
|
|
709
|
-
if self.
|
|
710
|
-
|
|
711
|
-
if self.
|
|
712
|
-
|
|
713
|
-
if self.
|
|
805
|
+
if self.config_name is not None:
|
|
806
|
+
body["config_name"] = self.config_name
|
|
807
|
+
if self.credentials_id is not None:
|
|
808
|
+
body["credentials_id"] = self.credentials_id
|
|
809
|
+
if self.delivery_path_prefix is not None:
|
|
810
|
+
body["delivery_path_prefix"] = self.delivery_path_prefix
|
|
811
|
+
if self.delivery_start_time is not None:
|
|
812
|
+
body["delivery_start_time"] = self.delivery_start_time
|
|
813
|
+
if self.log_type is not None:
|
|
814
|
+
body["log_type"] = self.log_type
|
|
815
|
+
if self.output_format is not None:
|
|
816
|
+
body["output_format"] = self.output_format
|
|
817
|
+
if self.status is not None:
|
|
818
|
+
body["status"] = self.status
|
|
714
819
|
if self.storage_configuration_id is not None:
|
|
715
|
-
body[
|
|
716
|
-
if self.workspace_ids_filter:
|
|
820
|
+
body["storage_configuration_id"] = self.storage_configuration_id
|
|
821
|
+
if self.workspace_ids_filter:
|
|
822
|
+
body["workspace_ids_filter"] = self.workspace_ids_filter
|
|
717
823
|
return body
|
|
718
824
|
|
|
719
825
|
@classmethod
|
|
720
|
-
def from_dict(cls, d: Dict[str,
|
|
826
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateLogDeliveryConfigurationParams:
|
|
721
827
|
"""Deserializes the CreateLogDeliveryConfigurationParams from a dictionary."""
|
|
722
|
-
return cls(
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
828
|
+
return cls(
|
|
829
|
+
config_name=d.get("config_name", None),
|
|
830
|
+
credentials_id=d.get("credentials_id", None),
|
|
831
|
+
delivery_path_prefix=d.get("delivery_path_prefix", None),
|
|
832
|
+
delivery_start_time=d.get("delivery_start_time", None),
|
|
833
|
+
log_type=_enum(d, "log_type", LogType),
|
|
834
|
+
output_format=_enum(d, "output_format", OutputFormat),
|
|
835
|
+
status=_enum(d, "status", LogDeliveryConfigStatus),
|
|
836
|
+
storage_configuration_id=d.get("storage_configuration_id", None),
|
|
837
|
+
workspace_ids_filter=d.get("workspace_ids_filter", None),
|
|
838
|
+
)
|
|
731
839
|
|
|
732
840
|
|
|
733
841
|
@dataclass
|
|
734
842
|
class DeleteBudgetConfigurationResponse:
|
|
735
|
-
|
|
736
843
|
def as_dict(self) -> dict:
|
|
737
844
|
"""Serializes the DeleteBudgetConfigurationResponse into a dictionary suitable for use as a JSON request body."""
|
|
738
845
|
body = {}
|
|
@@ -744,14 +851,13 @@ class DeleteBudgetConfigurationResponse:
|
|
|
744
851
|
return body
|
|
745
852
|
|
|
746
853
|
@classmethod
|
|
747
|
-
def from_dict(cls, d: Dict[str,
|
|
854
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteBudgetConfigurationResponse:
|
|
748
855
|
"""Deserializes the DeleteBudgetConfigurationResponse from a dictionary."""
|
|
749
856
|
return cls()
|
|
750
857
|
|
|
751
858
|
|
|
752
859
|
@dataclass
|
|
753
860
|
class DeleteResponse:
|
|
754
|
-
|
|
755
861
|
def as_dict(self) -> dict:
|
|
756
862
|
"""Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
|
|
757
863
|
body = {}
|
|
@@ -763,7 +869,7 @@ class DeleteResponse:
|
|
|
763
869
|
return body
|
|
764
870
|
|
|
765
871
|
@classmethod
|
|
766
|
-
def from_dict(cls, d: Dict[str,
|
|
872
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteResponse:
|
|
767
873
|
"""Deserializes the DeleteResponse from a dictionary."""
|
|
768
874
|
return cls()
|
|
769
875
|
|
|
@@ -777,11 +883,11 @@ class DeliveryStatus(Enum):
|
|
|
777
883
|
if it doesn't go away soon. * `NOT_FOUND`: The log delivery status as the configuration has been
|
|
778
884
|
disabled since the release of this feature or there are no workspaces in the account."""
|
|
779
885
|
|
|
780
|
-
CREATED =
|
|
781
|
-
NOT_FOUND =
|
|
782
|
-
SUCCEEDED =
|
|
783
|
-
SYSTEM_FAILURE =
|
|
784
|
-
USER_FAILURE =
|
|
886
|
+
CREATED = "CREATED"
|
|
887
|
+
NOT_FOUND = "NOT_FOUND"
|
|
888
|
+
SUCCEEDED = "SUCCEEDED"
|
|
889
|
+
SYSTEM_FAILURE = "SYSTEM_FAILURE"
|
|
890
|
+
USER_FAILURE = "USER_FAILURE"
|
|
785
891
|
|
|
786
892
|
|
|
787
893
|
@dataclass
|
|
@@ -791,19 +897,21 @@ class DownloadResponse:
|
|
|
791
897
|
def as_dict(self) -> dict:
|
|
792
898
|
"""Serializes the DownloadResponse into a dictionary suitable for use as a JSON request body."""
|
|
793
899
|
body = {}
|
|
794
|
-
if self.contents:
|
|
900
|
+
if self.contents:
|
|
901
|
+
body["contents"] = self.contents
|
|
795
902
|
return body
|
|
796
903
|
|
|
797
904
|
def as_shallow_dict(self) -> dict:
|
|
798
905
|
"""Serializes the DownloadResponse into a shallow dictionary of its immediate attributes."""
|
|
799
906
|
body = {}
|
|
800
|
-
if self.contents:
|
|
907
|
+
if self.contents:
|
|
908
|
+
body["contents"] = self.contents
|
|
801
909
|
return body
|
|
802
910
|
|
|
803
911
|
@classmethod
|
|
804
|
-
def from_dict(cls, d: Dict[str,
|
|
912
|
+
def from_dict(cls, d: Dict[str, Any]) -> DownloadResponse:
|
|
805
913
|
"""Deserializes the DownloadResponse from a dictionary."""
|
|
806
|
-
return cls(contents=d.get(
|
|
914
|
+
return cls(contents=d.get("contents", None))
|
|
807
915
|
|
|
808
916
|
|
|
809
917
|
@dataclass
|
|
@@ -823,25 +931,33 @@ class Filter:
|
|
|
823
931
|
def as_dict(self) -> dict:
|
|
824
932
|
"""Serializes the Filter into a dictionary suitable for use as a JSON request body."""
|
|
825
933
|
body = {}
|
|
826
|
-
if self.creator_user_id is not None:
|
|
827
|
-
|
|
828
|
-
if self.
|
|
934
|
+
if self.creator_user_id is not None:
|
|
935
|
+
body["creator_user_id"] = self.creator_user_id
|
|
936
|
+
if self.creator_user_name is not None:
|
|
937
|
+
body["creator_user_name"] = self.creator_user_name
|
|
938
|
+
if self.policy_name is not None:
|
|
939
|
+
body["policy_name"] = self.policy_name
|
|
829
940
|
return body
|
|
830
941
|
|
|
831
942
|
def as_shallow_dict(self) -> dict:
|
|
832
943
|
"""Serializes the Filter into a shallow dictionary of its immediate attributes."""
|
|
833
944
|
body = {}
|
|
834
|
-
if self.creator_user_id is not None:
|
|
835
|
-
|
|
836
|
-
if self.
|
|
945
|
+
if self.creator_user_id is not None:
|
|
946
|
+
body["creator_user_id"] = self.creator_user_id
|
|
947
|
+
if self.creator_user_name is not None:
|
|
948
|
+
body["creator_user_name"] = self.creator_user_name
|
|
949
|
+
if self.policy_name is not None:
|
|
950
|
+
body["policy_name"] = self.policy_name
|
|
837
951
|
return body
|
|
838
952
|
|
|
839
953
|
@classmethod
|
|
840
|
-
def from_dict(cls, d: Dict[str,
|
|
954
|
+
def from_dict(cls, d: Dict[str, Any]) -> Filter:
|
|
841
955
|
"""Deserializes the Filter from a dictionary."""
|
|
842
|
-
return cls(
|
|
843
|
-
|
|
844
|
-
|
|
956
|
+
return cls(
|
|
957
|
+
creator_user_id=d.get("creator_user_id", None),
|
|
958
|
+
creator_user_name=d.get("creator_user_name", None),
|
|
959
|
+
policy_name=d.get("policy_name", None),
|
|
960
|
+
)
|
|
845
961
|
|
|
846
962
|
|
|
847
963
|
@dataclass
|
|
@@ -855,21 +971,25 @@ class GetBillingUsageDashboardResponse:
|
|
|
855
971
|
def as_dict(self) -> dict:
|
|
856
972
|
"""Serializes the GetBillingUsageDashboardResponse into a dictionary suitable for use as a JSON request body."""
|
|
857
973
|
body = {}
|
|
858
|
-
if self.dashboard_id is not None:
|
|
859
|
-
|
|
974
|
+
if self.dashboard_id is not None:
|
|
975
|
+
body["dashboard_id"] = self.dashboard_id
|
|
976
|
+
if self.dashboard_url is not None:
|
|
977
|
+
body["dashboard_url"] = self.dashboard_url
|
|
860
978
|
return body
|
|
861
979
|
|
|
862
980
|
def as_shallow_dict(self) -> dict:
|
|
863
981
|
"""Serializes the GetBillingUsageDashboardResponse into a shallow dictionary of its immediate attributes."""
|
|
864
982
|
body = {}
|
|
865
|
-
if self.dashboard_id is not None:
|
|
866
|
-
|
|
983
|
+
if self.dashboard_id is not None:
|
|
984
|
+
body["dashboard_id"] = self.dashboard_id
|
|
985
|
+
if self.dashboard_url is not None:
|
|
986
|
+
body["dashboard_url"] = self.dashboard_url
|
|
867
987
|
return body
|
|
868
988
|
|
|
869
989
|
@classmethod
|
|
870
|
-
def from_dict(cls, d: Dict[str,
|
|
990
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetBillingUsageDashboardResponse:
|
|
871
991
|
"""Deserializes the GetBillingUsageDashboardResponse from a dictionary."""
|
|
872
|
-
return cls(dashboard_id=d.get(
|
|
992
|
+
return cls(dashboard_id=d.get("dashboard_id", None), dashboard_url=d.get("dashboard_url", None))
|
|
873
993
|
|
|
874
994
|
|
|
875
995
|
@dataclass
|
|
@@ -879,19 +999,21 @@ class GetBudgetConfigurationResponse:
|
|
|
879
999
|
def as_dict(self) -> dict:
|
|
880
1000
|
"""Serializes the GetBudgetConfigurationResponse into a dictionary suitable for use as a JSON request body."""
|
|
881
1001
|
body = {}
|
|
882
|
-
if self.budget:
|
|
1002
|
+
if self.budget:
|
|
1003
|
+
body["budget"] = self.budget.as_dict()
|
|
883
1004
|
return body
|
|
884
1005
|
|
|
885
1006
|
def as_shallow_dict(self) -> dict:
|
|
886
1007
|
"""Serializes the GetBudgetConfigurationResponse into a shallow dictionary of its immediate attributes."""
|
|
887
1008
|
body = {}
|
|
888
|
-
if self.budget:
|
|
1009
|
+
if self.budget:
|
|
1010
|
+
body["budget"] = self.budget
|
|
889
1011
|
return body
|
|
890
1012
|
|
|
891
1013
|
@classmethod
|
|
892
|
-
def from_dict(cls, d: Dict[str,
|
|
1014
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetBudgetConfigurationResponse:
|
|
893
1015
|
"""Deserializes the GetBudgetConfigurationResponse from a dictionary."""
|
|
894
|
-
return cls(budget=_from_dict(d,
|
|
1016
|
+
return cls(budget=_from_dict(d, "budget", BudgetConfiguration))
|
|
895
1017
|
|
|
896
1018
|
|
|
897
1019
|
@dataclass
|
|
@@ -910,7 +1032,7 @@ class LimitConfig:
|
|
|
910
1032
|
return body
|
|
911
1033
|
|
|
912
1034
|
@classmethod
|
|
913
|
-
def from_dict(cls, d: Dict[str,
|
|
1035
|
+
def from_dict(cls, d: Dict[str, Any]) -> LimitConfig:
|
|
914
1036
|
"""Deserializes the LimitConfig from a dictionary."""
|
|
915
1037
|
return cls()
|
|
916
1038
|
|
|
@@ -926,22 +1048,27 @@ class ListBudgetConfigurationsResponse:
|
|
|
926
1048
|
def as_dict(self) -> dict:
|
|
927
1049
|
"""Serializes the ListBudgetConfigurationsResponse into a dictionary suitable for use as a JSON request body."""
|
|
928
1050
|
body = {}
|
|
929
|
-
if self.budgets:
|
|
930
|
-
|
|
1051
|
+
if self.budgets:
|
|
1052
|
+
body["budgets"] = [v.as_dict() for v in self.budgets]
|
|
1053
|
+
if self.next_page_token is not None:
|
|
1054
|
+
body["next_page_token"] = self.next_page_token
|
|
931
1055
|
return body
|
|
932
1056
|
|
|
933
1057
|
def as_shallow_dict(self) -> dict:
|
|
934
1058
|
"""Serializes the ListBudgetConfigurationsResponse into a shallow dictionary of its immediate attributes."""
|
|
935
1059
|
body = {}
|
|
936
|
-
if self.budgets:
|
|
937
|
-
|
|
1060
|
+
if self.budgets:
|
|
1061
|
+
body["budgets"] = self.budgets
|
|
1062
|
+
if self.next_page_token is not None:
|
|
1063
|
+
body["next_page_token"] = self.next_page_token
|
|
938
1064
|
return body
|
|
939
1065
|
|
|
940
1066
|
@classmethod
|
|
941
|
-
def from_dict(cls, d: Dict[str,
|
|
1067
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListBudgetConfigurationsResponse:
|
|
942
1068
|
"""Deserializes the ListBudgetConfigurationsResponse from a dictionary."""
|
|
943
|
-
return cls(
|
|
944
|
-
|
|
1069
|
+
return cls(
|
|
1070
|
+
budgets=_repeated_dict(d, "budgets", BudgetConfiguration), next_page_token=d.get("next_page_token", None)
|
|
1071
|
+
)
|
|
945
1072
|
|
|
946
1073
|
|
|
947
1074
|
@dataclass
|
|
@@ -961,25 +1088,33 @@ class ListBudgetPoliciesResponse:
|
|
|
961
1088
|
def as_dict(self) -> dict:
|
|
962
1089
|
"""Serializes the ListBudgetPoliciesResponse into a dictionary suitable for use as a JSON request body."""
|
|
963
1090
|
body = {}
|
|
964
|
-
if self.next_page_token is not None:
|
|
965
|
-
|
|
966
|
-
if self.
|
|
1091
|
+
if self.next_page_token is not None:
|
|
1092
|
+
body["next_page_token"] = self.next_page_token
|
|
1093
|
+
if self.policies:
|
|
1094
|
+
body["policies"] = [v.as_dict() for v in self.policies]
|
|
1095
|
+
if self.previous_page_token is not None:
|
|
1096
|
+
body["previous_page_token"] = self.previous_page_token
|
|
967
1097
|
return body
|
|
968
1098
|
|
|
969
1099
|
def as_shallow_dict(self) -> dict:
|
|
970
1100
|
"""Serializes the ListBudgetPoliciesResponse into a shallow dictionary of its immediate attributes."""
|
|
971
1101
|
body = {}
|
|
972
|
-
if self.next_page_token is not None:
|
|
973
|
-
|
|
974
|
-
if self.
|
|
1102
|
+
if self.next_page_token is not None:
|
|
1103
|
+
body["next_page_token"] = self.next_page_token
|
|
1104
|
+
if self.policies:
|
|
1105
|
+
body["policies"] = self.policies
|
|
1106
|
+
if self.previous_page_token is not None:
|
|
1107
|
+
body["previous_page_token"] = self.previous_page_token
|
|
975
1108
|
return body
|
|
976
1109
|
|
|
977
1110
|
@classmethod
|
|
978
|
-
def from_dict(cls, d: Dict[str,
|
|
1111
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListBudgetPoliciesResponse:
|
|
979
1112
|
"""Deserializes the ListBudgetPoliciesResponse from a dictionary."""
|
|
980
|
-
return cls(
|
|
981
|
-
|
|
982
|
-
|
|
1113
|
+
return cls(
|
|
1114
|
+
next_page_token=d.get("next_page_token", None),
|
|
1115
|
+
policies=_repeated_dict(d, "policies", BudgetPolicy),
|
|
1116
|
+
previous_page_token=d.get("previous_page_token", None),
|
|
1117
|
+
)
|
|
983
1118
|
|
|
984
1119
|
|
|
985
1120
|
class LogDeliveryConfigStatus(Enum):
|
|
@@ -988,8 +1123,8 @@ class LogDeliveryConfigStatus(Enum):
|
|
|
988
1123
|
configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration
|
|
989
1124
|
is not supported, so disable a log delivery configuration that is no longer needed."""
|
|
990
1125
|
|
|
991
|
-
DISABLED =
|
|
992
|
-
ENABLED =
|
|
1126
|
+
DISABLED = "DISABLED"
|
|
1127
|
+
ENABLED = "ENABLED"
|
|
993
1128
|
|
|
994
1129
|
|
|
995
1130
|
@dataclass
|
|
@@ -1081,60 +1216,88 @@ class LogDeliveryConfiguration:
|
|
|
1081
1216
|
def as_dict(self) -> dict:
|
|
1082
1217
|
"""Serializes the LogDeliveryConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
1083
1218
|
body = {}
|
|
1084
|
-
if self.account_id is not None:
|
|
1085
|
-
|
|
1086
|
-
if self.
|
|
1087
|
-
|
|
1088
|
-
if self.
|
|
1089
|
-
|
|
1090
|
-
if self.
|
|
1091
|
-
|
|
1092
|
-
if self.
|
|
1093
|
-
|
|
1094
|
-
if self.
|
|
1219
|
+
if self.account_id is not None:
|
|
1220
|
+
body["account_id"] = self.account_id
|
|
1221
|
+
if self.config_id is not None:
|
|
1222
|
+
body["config_id"] = self.config_id
|
|
1223
|
+
if self.config_name is not None:
|
|
1224
|
+
body["config_name"] = self.config_name
|
|
1225
|
+
if self.creation_time is not None:
|
|
1226
|
+
body["creation_time"] = self.creation_time
|
|
1227
|
+
if self.credentials_id is not None:
|
|
1228
|
+
body["credentials_id"] = self.credentials_id
|
|
1229
|
+
if self.delivery_path_prefix is not None:
|
|
1230
|
+
body["delivery_path_prefix"] = self.delivery_path_prefix
|
|
1231
|
+
if self.delivery_start_time is not None:
|
|
1232
|
+
body["delivery_start_time"] = self.delivery_start_time
|
|
1233
|
+
if self.log_delivery_status:
|
|
1234
|
+
body["log_delivery_status"] = self.log_delivery_status.as_dict()
|
|
1235
|
+
if self.log_type is not None:
|
|
1236
|
+
body["log_type"] = self.log_type.value
|
|
1237
|
+
if self.output_format is not None:
|
|
1238
|
+
body["output_format"] = self.output_format.value
|
|
1239
|
+
if self.status is not None:
|
|
1240
|
+
body["status"] = self.status.value
|
|
1095
1241
|
if self.storage_configuration_id is not None:
|
|
1096
|
-
body[
|
|
1097
|
-
if self.update_time is not None:
|
|
1098
|
-
|
|
1242
|
+
body["storage_configuration_id"] = self.storage_configuration_id
|
|
1243
|
+
if self.update_time is not None:
|
|
1244
|
+
body["update_time"] = self.update_time
|
|
1245
|
+
if self.workspace_ids_filter:
|
|
1246
|
+
body["workspace_ids_filter"] = [v for v in self.workspace_ids_filter]
|
|
1099
1247
|
return body
|
|
1100
1248
|
|
|
1101
1249
|
def as_shallow_dict(self) -> dict:
|
|
1102
1250
|
"""Serializes the LogDeliveryConfiguration into a shallow dictionary of its immediate attributes."""
|
|
1103
1251
|
body = {}
|
|
1104
|
-
if self.account_id is not None:
|
|
1105
|
-
|
|
1106
|
-
if self.
|
|
1107
|
-
|
|
1108
|
-
if self.
|
|
1109
|
-
|
|
1110
|
-
if self.
|
|
1111
|
-
|
|
1112
|
-
if self.
|
|
1113
|
-
|
|
1114
|
-
if self.
|
|
1252
|
+
if self.account_id is not None:
|
|
1253
|
+
body["account_id"] = self.account_id
|
|
1254
|
+
if self.config_id is not None:
|
|
1255
|
+
body["config_id"] = self.config_id
|
|
1256
|
+
if self.config_name is not None:
|
|
1257
|
+
body["config_name"] = self.config_name
|
|
1258
|
+
if self.creation_time is not None:
|
|
1259
|
+
body["creation_time"] = self.creation_time
|
|
1260
|
+
if self.credentials_id is not None:
|
|
1261
|
+
body["credentials_id"] = self.credentials_id
|
|
1262
|
+
if self.delivery_path_prefix is not None:
|
|
1263
|
+
body["delivery_path_prefix"] = self.delivery_path_prefix
|
|
1264
|
+
if self.delivery_start_time is not None:
|
|
1265
|
+
body["delivery_start_time"] = self.delivery_start_time
|
|
1266
|
+
if self.log_delivery_status:
|
|
1267
|
+
body["log_delivery_status"] = self.log_delivery_status
|
|
1268
|
+
if self.log_type is not None:
|
|
1269
|
+
body["log_type"] = self.log_type
|
|
1270
|
+
if self.output_format is not None:
|
|
1271
|
+
body["output_format"] = self.output_format
|
|
1272
|
+
if self.status is not None:
|
|
1273
|
+
body["status"] = self.status
|
|
1115
1274
|
if self.storage_configuration_id is not None:
|
|
1116
|
-
body[
|
|
1117
|
-
if self.update_time is not None:
|
|
1118
|
-
|
|
1275
|
+
body["storage_configuration_id"] = self.storage_configuration_id
|
|
1276
|
+
if self.update_time is not None:
|
|
1277
|
+
body["update_time"] = self.update_time
|
|
1278
|
+
if self.workspace_ids_filter:
|
|
1279
|
+
body["workspace_ids_filter"] = self.workspace_ids_filter
|
|
1119
1280
|
return body
|
|
1120
1281
|
|
|
1121
1282
|
@classmethod
|
|
1122
|
-
def from_dict(cls, d: Dict[str,
|
|
1283
|
+
def from_dict(cls, d: Dict[str, Any]) -> LogDeliveryConfiguration:
|
|
1123
1284
|
"""Deserializes the LogDeliveryConfiguration from a dictionary."""
|
|
1124
|
-
return cls(
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1285
|
+
return cls(
|
|
1286
|
+
account_id=d.get("account_id", None),
|
|
1287
|
+
config_id=d.get("config_id", None),
|
|
1288
|
+
config_name=d.get("config_name", None),
|
|
1289
|
+
creation_time=d.get("creation_time", None),
|
|
1290
|
+
credentials_id=d.get("credentials_id", None),
|
|
1291
|
+
delivery_path_prefix=d.get("delivery_path_prefix", None),
|
|
1292
|
+
delivery_start_time=d.get("delivery_start_time", None),
|
|
1293
|
+
log_delivery_status=_from_dict(d, "log_delivery_status", LogDeliveryStatus),
|
|
1294
|
+
log_type=_enum(d, "log_type", LogType),
|
|
1295
|
+
output_format=_enum(d, "output_format", OutputFormat),
|
|
1296
|
+
status=_enum(d, "status", LogDeliveryConfigStatus),
|
|
1297
|
+
storage_configuration_id=d.get("storage_configuration_id", None),
|
|
1298
|
+
update_time=d.get("update_time", None),
|
|
1299
|
+
workspace_ids_filter=d.get("workspace_ids_filter", None),
|
|
1300
|
+
)
|
|
1138
1301
|
|
|
1139
1302
|
|
|
1140
1303
|
@dataclass
|
|
@@ -1163,68 +1326,76 @@ class LogDeliveryStatus:
|
|
|
1163
1326
|
def as_dict(self) -> dict:
|
|
1164
1327
|
"""Serializes the LogDeliveryStatus into a dictionary suitable for use as a JSON request body."""
|
|
1165
1328
|
body = {}
|
|
1166
|
-
if self.last_attempt_time is not None:
|
|
1329
|
+
if self.last_attempt_time is not None:
|
|
1330
|
+
body["last_attempt_time"] = self.last_attempt_time
|
|
1167
1331
|
if self.last_successful_attempt_time is not None:
|
|
1168
|
-
body[
|
|
1169
|
-
if self.message is not None:
|
|
1170
|
-
|
|
1332
|
+
body["last_successful_attempt_time"] = self.last_successful_attempt_time
|
|
1333
|
+
if self.message is not None:
|
|
1334
|
+
body["message"] = self.message
|
|
1335
|
+
if self.status is not None:
|
|
1336
|
+
body["status"] = self.status.value
|
|
1171
1337
|
return body
|
|
1172
1338
|
|
|
1173
1339
|
def as_shallow_dict(self) -> dict:
|
|
1174
1340
|
"""Serializes the LogDeliveryStatus into a shallow dictionary of its immediate attributes."""
|
|
1175
1341
|
body = {}
|
|
1176
|
-
if self.last_attempt_time is not None:
|
|
1342
|
+
if self.last_attempt_time is not None:
|
|
1343
|
+
body["last_attempt_time"] = self.last_attempt_time
|
|
1177
1344
|
if self.last_successful_attempt_time is not None:
|
|
1178
|
-
body[
|
|
1179
|
-
if self.message is not None:
|
|
1180
|
-
|
|
1345
|
+
body["last_successful_attempt_time"] = self.last_successful_attempt_time
|
|
1346
|
+
if self.message is not None:
|
|
1347
|
+
body["message"] = self.message
|
|
1348
|
+
if self.status is not None:
|
|
1349
|
+
body["status"] = self.status
|
|
1181
1350
|
return body
|
|
1182
1351
|
|
|
1183
1352
|
@classmethod
|
|
1184
|
-
def from_dict(cls, d: Dict[str,
|
|
1353
|
+
def from_dict(cls, d: Dict[str, Any]) -> LogDeliveryStatus:
|
|
1185
1354
|
"""Deserializes the LogDeliveryStatus from a dictionary."""
|
|
1186
|
-
return cls(
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1355
|
+
return cls(
|
|
1356
|
+
last_attempt_time=d.get("last_attempt_time", None),
|
|
1357
|
+
last_successful_attempt_time=d.get("last_successful_attempt_time", None),
|
|
1358
|
+
message=d.get("message", None),
|
|
1359
|
+
status=_enum(d, "status", DeliveryStatus),
|
|
1360
|
+
)
|
|
1190
1361
|
|
|
1191
1362
|
|
|
1192
1363
|
class LogType(Enum):
|
|
1193
1364
|
"""Log delivery type. Supported values are:
|
|
1194
|
-
|
|
1365
|
+
|
|
1195
1366
|
* `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the CSV schema, see the
|
|
1196
1367
|
[View billable usage].
|
|
1197
|
-
|
|
1368
|
+
|
|
1198
1369
|
* `AUDIT_LOGS` — Configure [audit log delivery]. For the JSON schema, see [Configure audit
|
|
1199
1370
|
logging]
|
|
1200
|
-
|
|
1371
|
+
|
|
1201
1372
|
[Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html
|
|
1202
1373
|
[View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html
|
|
1203
1374
|
[audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html
|
|
1204
|
-
[billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html
|
|
1375
|
+
[billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html
|
|
1376
|
+
"""
|
|
1205
1377
|
|
|
1206
|
-
AUDIT_LOGS =
|
|
1207
|
-
BILLABLE_USAGE =
|
|
1378
|
+
AUDIT_LOGS = "AUDIT_LOGS"
|
|
1379
|
+
BILLABLE_USAGE = "BILLABLE_USAGE"
|
|
1208
1380
|
|
|
1209
1381
|
|
|
1210
1382
|
class OutputFormat(Enum):
|
|
1211
1383
|
"""The file type of log delivery.
|
|
1212
|
-
|
|
1384
|
+
|
|
1213
1385
|
* If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated
|
|
1214
1386
|
values) format is supported. For the schema, see the [View billable usage] * If `log_type` is
|
|
1215
1387
|
`AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is
|
|
1216
1388
|
supported. For the schema, see the [Configuring audit logs].
|
|
1217
|
-
|
|
1389
|
+
|
|
1218
1390
|
[Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html
|
|
1219
1391
|
[View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html"""
|
|
1220
1392
|
|
|
1221
|
-
CSV =
|
|
1222
|
-
JSON =
|
|
1393
|
+
CSV = "CSV"
|
|
1394
|
+
JSON = "JSON"
|
|
1223
1395
|
|
|
1224
1396
|
|
|
1225
1397
|
@dataclass
|
|
1226
1398
|
class PatchStatusResponse:
|
|
1227
|
-
|
|
1228
1399
|
def as_dict(self) -> dict:
|
|
1229
1400
|
"""Serializes the PatchStatusResponse into a dictionary suitable for use as a JSON request body."""
|
|
1230
1401
|
body = {}
|
|
@@ -1236,7 +1407,7 @@ class PatchStatusResponse:
|
|
|
1236
1407
|
return body
|
|
1237
1408
|
|
|
1238
1409
|
@classmethod
|
|
1239
|
-
def from_dict(cls, d: Dict[str,
|
|
1410
|
+
def from_dict(cls, d: Dict[str, Any]) -> PatchStatusResponse:
|
|
1240
1411
|
"""Deserializes the PatchStatusResponse from a dictionary."""
|
|
1241
1412
|
return cls()
|
|
1242
1413
|
|
|
@@ -1252,26 +1423,30 @@ class SortSpec:
|
|
|
1252
1423
|
def as_dict(self) -> dict:
|
|
1253
1424
|
"""Serializes the SortSpec into a dictionary suitable for use as a JSON request body."""
|
|
1254
1425
|
body = {}
|
|
1255
|
-
if self.descending is not None:
|
|
1256
|
-
|
|
1426
|
+
if self.descending is not None:
|
|
1427
|
+
body["descending"] = self.descending
|
|
1428
|
+
if self.field is not None:
|
|
1429
|
+
body["field"] = self.field.value
|
|
1257
1430
|
return body
|
|
1258
1431
|
|
|
1259
1432
|
def as_shallow_dict(self) -> dict:
|
|
1260
1433
|
"""Serializes the SortSpec into a shallow dictionary of its immediate attributes."""
|
|
1261
1434
|
body = {}
|
|
1262
|
-
if self.descending is not None:
|
|
1263
|
-
|
|
1435
|
+
if self.descending is not None:
|
|
1436
|
+
body["descending"] = self.descending
|
|
1437
|
+
if self.field is not None:
|
|
1438
|
+
body["field"] = self.field
|
|
1264
1439
|
return body
|
|
1265
1440
|
|
|
1266
1441
|
@classmethod
|
|
1267
|
-
def from_dict(cls, d: Dict[str,
|
|
1442
|
+
def from_dict(cls, d: Dict[str, Any]) -> SortSpec:
|
|
1268
1443
|
"""Deserializes the SortSpec from a dictionary."""
|
|
1269
|
-
return cls(descending=d.get(
|
|
1444
|
+
return cls(descending=d.get("descending", None), field=_enum(d, "field", SortSpecField))
|
|
1270
1445
|
|
|
1271
1446
|
|
|
1272
1447
|
class SortSpecField(Enum):
|
|
1273
1448
|
|
|
1274
|
-
POLICY_NAME =
|
|
1449
|
+
POLICY_NAME = "POLICY_NAME"
|
|
1275
1450
|
|
|
1276
1451
|
|
|
1277
1452
|
@dataclass
|
|
@@ -1297,34 +1472,43 @@ class UpdateBudgetConfigurationBudget:
|
|
|
1297
1472
|
def as_dict(self) -> dict:
|
|
1298
1473
|
"""Serializes the UpdateBudgetConfigurationBudget into a dictionary suitable for use as a JSON request body."""
|
|
1299
1474
|
body = {}
|
|
1300
|
-
if self.account_id is not None:
|
|
1475
|
+
if self.account_id is not None:
|
|
1476
|
+
body["account_id"] = self.account_id
|
|
1301
1477
|
if self.alert_configurations:
|
|
1302
|
-
body[
|
|
1478
|
+
body["alert_configurations"] = [v.as_dict() for v in self.alert_configurations]
|
|
1303
1479
|
if self.budget_configuration_id is not None:
|
|
1304
|
-
body[
|
|
1305
|
-
if self.display_name is not None:
|
|
1306
|
-
|
|
1480
|
+
body["budget_configuration_id"] = self.budget_configuration_id
|
|
1481
|
+
if self.display_name is not None:
|
|
1482
|
+
body["display_name"] = self.display_name
|
|
1483
|
+
if self.filter:
|
|
1484
|
+
body["filter"] = self.filter.as_dict()
|
|
1307
1485
|
return body
|
|
1308
1486
|
|
|
1309
1487
|
def as_shallow_dict(self) -> dict:
|
|
1310
1488
|
"""Serializes the UpdateBudgetConfigurationBudget into a shallow dictionary of its immediate attributes."""
|
|
1311
1489
|
body = {}
|
|
1312
|
-
if self.account_id is not None:
|
|
1313
|
-
|
|
1490
|
+
if self.account_id is not None:
|
|
1491
|
+
body["account_id"] = self.account_id
|
|
1492
|
+
if self.alert_configurations:
|
|
1493
|
+
body["alert_configurations"] = self.alert_configurations
|
|
1314
1494
|
if self.budget_configuration_id is not None:
|
|
1315
|
-
body[
|
|
1316
|
-
if self.display_name is not None:
|
|
1317
|
-
|
|
1495
|
+
body["budget_configuration_id"] = self.budget_configuration_id
|
|
1496
|
+
if self.display_name is not None:
|
|
1497
|
+
body["display_name"] = self.display_name
|
|
1498
|
+
if self.filter:
|
|
1499
|
+
body["filter"] = self.filter
|
|
1318
1500
|
return body
|
|
1319
1501
|
|
|
1320
1502
|
@classmethod
|
|
1321
|
-
def from_dict(cls, d: Dict[str,
|
|
1503
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateBudgetConfigurationBudget:
|
|
1322
1504
|
"""Deserializes the UpdateBudgetConfigurationBudget from a dictionary."""
|
|
1323
|
-
return cls(
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1505
|
+
return cls(
|
|
1506
|
+
account_id=d.get("account_id", None),
|
|
1507
|
+
alert_configurations=_repeated_dict(d, "alert_configurations", AlertConfiguration),
|
|
1508
|
+
budget_configuration_id=d.get("budget_configuration_id", None),
|
|
1509
|
+
display_name=d.get("display_name", None),
|
|
1510
|
+
filter=_from_dict(d, "filter", BudgetConfigurationFilter),
|
|
1511
|
+
)
|
|
1328
1512
|
|
|
1329
1513
|
|
|
1330
1514
|
@dataclass
|
|
@@ -1338,22 +1522,25 @@ class UpdateBudgetConfigurationRequest:
|
|
|
1338
1522
|
def as_dict(self) -> dict:
|
|
1339
1523
|
"""Serializes the UpdateBudgetConfigurationRequest into a dictionary suitable for use as a JSON request body."""
|
|
1340
1524
|
body = {}
|
|
1341
|
-
if self.budget:
|
|
1342
|
-
|
|
1525
|
+
if self.budget:
|
|
1526
|
+
body["budget"] = self.budget.as_dict()
|
|
1527
|
+
if self.budget_id is not None:
|
|
1528
|
+
body["budget_id"] = self.budget_id
|
|
1343
1529
|
return body
|
|
1344
1530
|
|
|
1345
1531
|
def as_shallow_dict(self) -> dict:
|
|
1346
1532
|
"""Serializes the UpdateBudgetConfigurationRequest into a shallow dictionary of its immediate attributes."""
|
|
1347
1533
|
body = {}
|
|
1348
|
-
if self.budget:
|
|
1349
|
-
|
|
1534
|
+
if self.budget:
|
|
1535
|
+
body["budget"] = self.budget
|
|
1536
|
+
if self.budget_id is not None:
|
|
1537
|
+
body["budget_id"] = self.budget_id
|
|
1350
1538
|
return body
|
|
1351
1539
|
|
|
1352
1540
|
@classmethod
|
|
1353
|
-
def from_dict(cls, d: Dict[str,
|
|
1541
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateBudgetConfigurationRequest:
|
|
1354
1542
|
"""Deserializes the UpdateBudgetConfigurationRequest from a dictionary."""
|
|
1355
|
-
return cls(budget=_from_dict(d,
|
|
1356
|
-
budget_id=d.get('budget_id', None))
|
|
1543
|
+
return cls(budget=_from_dict(d, "budget", UpdateBudgetConfigurationBudget), budget_id=d.get("budget_id", None))
|
|
1357
1544
|
|
|
1358
1545
|
|
|
1359
1546
|
@dataclass
|
|
@@ -1364,19 +1551,21 @@ class UpdateBudgetConfigurationResponse:
|
|
|
1364
1551
|
def as_dict(self) -> dict:
|
|
1365
1552
|
"""Serializes the UpdateBudgetConfigurationResponse into a dictionary suitable for use as a JSON request body."""
|
|
1366
1553
|
body = {}
|
|
1367
|
-
if self.budget:
|
|
1554
|
+
if self.budget:
|
|
1555
|
+
body["budget"] = self.budget.as_dict()
|
|
1368
1556
|
return body
|
|
1369
1557
|
|
|
1370
1558
|
def as_shallow_dict(self) -> dict:
|
|
1371
1559
|
"""Serializes the UpdateBudgetConfigurationResponse into a shallow dictionary of its immediate attributes."""
|
|
1372
1560
|
body = {}
|
|
1373
|
-
if self.budget:
|
|
1561
|
+
if self.budget:
|
|
1562
|
+
body["budget"] = self.budget
|
|
1374
1563
|
return body
|
|
1375
1564
|
|
|
1376
1565
|
@classmethod
|
|
1377
|
-
def from_dict(cls, d: Dict[str,
|
|
1566
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateBudgetConfigurationResponse:
|
|
1378
1567
|
"""Deserializes the UpdateBudgetConfigurationResponse from a dictionary."""
|
|
1379
|
-
return cls(budget=_from_dict(d,
|
|
1568
|
+
return cls(budget=_from_dict(d, "budget", BudgetConfiguration))
|
|
1380
1569
|
|
|
1381
1570
|
|
|
1382
1571
|
@dataclass
|
|
@@ -1394,29 +1583,33 @@ class UpdateLogDeliveryConfigurationStatusRequest:
|
|
|
1394
1583
|
"""Serializes the UpdateLogDeliveryConfigurationStatusRequest into a dictionary suitable for use as a JSON request body."""
|
|
1395
1584
|
body = {}
|
|
1396
1585
|
if self.log_delivery_configuration_id is not None:
|
|
1397
|
-
body[
|
|
1398
|
-
if self.status is not None:
|
|
1586
|
+
body["log_delivery_configuration_id"] = self.log_delivery_configuration_id
|
|
1587
|
+
if self.status is not None:
|
|
1588
|
+
body["status"] = self.status.value
|
|
1399
1589
|
return body
|
|
1400
1590
|
|
|
1401
1591
|
def as_shallow_dict(self) -> dict:
|
|
1402
1592
|
"""Serializes the UpdateLogDeliveryConfigurationStatusRequest into a shallow dictionary of its immediate attributes."""
|
|
1403
1593
|
body = {}
|
|
1404
1594
|
if self.log_delivery_configuration_id is not None:
|
|
1405
|
-
body[
|
|
1406
|
-
if self.status is not None:
|
|
1595
|
+
body["log_delivery_configuration_id"] = self.log_delivery_configuration_id
|
|
1596
|
+
if self.status is not None:
|
|
1597
|
+
body["status"] = self.status
|
|
1407
1598
|
return body
|
|
1408
1599
|
|
|
1409
1600
|
@classmethod
|
|
1410
|
-
def from_dict(cls, d: Dict[str,
|
|
1601
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateLogDeliveryConfigurationStatusRequest:
|
|
1411
1602
|
"""Deserializes the UpdateLogDeliveryConfigurationStatusRequest from a dictionary."""
|
|
1412
|
-
return cls(
|
|
1413
|
-
|
|
1603
|
+
return cls(
|
|
1604
|
+
log_delivery_configuration_id=d.get("log_delivery_configuration_id", None),
|
|
1605
|
+
status=_enum(d, "status", LogDeliveryConfigStatus),
|
|
1606
|
+
)
|
|
1414
1607
|
|
|
1415
1608
|
|
|
1416
1609
|
class UsageDashboardType(Enum):
|
|
1417
1610
|
|
|
1418
|
-
USAGE_DASHBOARD_TYPE_GLOBAL =
|
|
1419
|
-
USAGE_DASHBOARD_TYPE_WORKSPACE =
|
|
1611
|
+
USAGE_DASHBOARD_TYPE_GLOBAL = "USAGE_DASHBOARD_TYPE_GLOBAL"
|
|
1612
|
+
USAGE_DASHBOARD_TYPE_WORKSPACE = "USAGE_DASHBOARD_TYPE_WORKSPACE"
|
|
1420
1613
|
|
|
1421
1614
|
|
|
1422
1615
|
@dataclass
|
|
@@ -1427,21 +1620,22 @@ class WrappedCreateLogDeliveryConfiguration:
|
|
|
1427
1620
|
"""Serializes the WrappedCreateLogDeliveryConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
1428
1621
|
body = {}
|
|
1429
1622
|
if self.log_delivery_configuration:
|
|
1430
|
-
body[
|
|
1623
|
+
body["log_delivery_configuration"] = self.log_delivery_configuration.as_dict()
|
|
1431
1624
|
return body
|
|
1432
1625
|
|
|
1433
1626
|
def as_shallow_dict(self) -> dict:
|
|
1434
1627
|
"""Serializes the WrappedCreateLogDeliveryConfiguration into a shallow dictionary of its immediate attributes."""
|
|
1435
1628
|
body = {}
|
|
1436
1629
|
if self.log_delivery_configuration:
|
|
1437
|
-
body[
|
|
1630
|
+
body["log_delivery_configuration"] = self.log_delivery_configuration
|
|
1438
1631
|
return body
|
|
1439
1632
|
|
|
1440
1633
|
@classmethod
|
|
1441
|
-
def from_dict(cls, d: Dict[str,
|
|
1634
|
+
def from_dict(cls, d: Dict[str, Any]) -> WrappedCreateLogDeliveryConfiguration:
|
|
1442
1635
|
"""Deserializes the WrappedCreateLogDeliveryConfiguration from a dictionary."""
|
|
1443
|
-
return cls(
|
|
1444
|
-
|
|
1636
|
+
return cls(
|
|
1637
|
+
log_delivery_configuration=_from_dict(d, "log_delivery_configuration", CreateLogDeliveryConfigurationParams)
|
|
1638
|
+
)
|
|
1445
1639
|
|
|
1446
1640
|
|
|
1447
1641
|
@dataclass
|
|
@@ -1452,21 +1646,20 @@ class WrappedLogDeliveryConfiguration:
|
|
|
1452
1646
|
"""Serializes the WrappedLogDeliveryConfiguration into a dictionary suitable for use as a JSON request body."""
|
|
1453
1647
|
body = {}
|
|
1454
1648
|
if self.log_delivery_configuration:
|
|
1455
|
-
body[
|
|
1649
|
+
body["log_delivery_configuration"] = self.log_delivery_configuration.as_dict()
|
|
1456
1650
|
return body
|
|
1457
1651
|
|
|
1458
1652
|
def as_shallow_dict(self) -> dict:
|
|
1459
1653
|
"""Serializes the WrappedLogDeliveryConfiguration into a shallow dictionary of its immediate attributes."""
|
|
1460
1654
|
body = {}
|
|
1461
1655
|
if self.log_delivery_configuration:
|
|
1462
|
-
body[
|
|
1656
|
+
body["log_delivery_configuration"] = self.log_delivery_configuration
|
|
1463
1657
|
return body
|
|
1464
1658
|
|
|
1465
1659
|
@classmethod
|
|
1466
|
-
def from_dict(cls, d: Dict[str,
|
|
1660
|
+
def from_dict(cls, d: Dict[str, Any]) -> WrappedLogDeliveryConfiguration:
|
|
1467
1661
|
"""Deserializes the WrappedLogDeliveryConfiguration from a dictionary."""
|
|
1468
|
-
return cls(
|
|
1469
|
-
log_delivery_configuration=_from_dict(d, 'log_delivery_configuration', LogDeliveryConfiguration))
|
|
1662
|
+
return cls(log_delivery_configuration=_from_dict(d, "log_delivery_configuration", LogDeliveryConfiguration))
|
|
1470
1663
|
|
|
1471
1664
|
|
|
1472
1665
|
@dataclass
|
|
@@ -1477,21 +1670,22 @@ class WrappedLogDeliveryConfigurations:
|
|
|
1477
1670
|
"""Serializes the WrappedLogDeliveryConfigurations into a dictionary suitable for use as a JSON request body."""
|
|
1478
1671
|
body = {}
|
|
1479
1672
|
if self.log_delivery_configurations:
|
|
1480
|
-
body[
|
|
1673
|
+
body["log_delivery_configurations"] = [v.as_dict() for v in self.log_delivery_configurations]
|
|
1481
1674
|
return body
|
|
1482
1675
|
|
|
1483
1676
|
def as_shallow_dict(self) -> dict:
|
|
1484
1677
|
"""Serializes the WrappedLogDeliveryConfigurations into a shallow dictionary of its immediate attributes."""
|
|
1485
1678
|
body = {}
|
|
1486
1679
|
if self.log_delivery_configurations:
|
|
1487
|
-
body[
|
|
1680
|
+
body["log_delivery_configurations"] = self.log_delivery_configurations
|
|
1488
1681
|
return body
|
|
1489
1682
|
|
|
1490
1683
|
@classmethod
|
|
1491
|
-
def from_dict(cls, d: Dict[str,
|
|
1684
|
+
def from_dict(cls, d: Dict[str, Any]) -> WrappedLogDeliveryConfigurations:
|
|
1492
1685
|
"""Deserializes the WrappedLogDeliveryConfigurations from a dictionary."""
|
|
1493
|
-
return cls(
|
|
1494
|
-
|
|
1686
|
+
return cls(
|
|
1687
|
+
log_delivery_configurations=_repeated_dict(d, "log_delivery_configurations", LogDeliveryConfiguration)
|
|
1688
|
+
)
|
|
1495
1689
|
|
|
1496
1690
|
|
|
1497
1691
|
class BillableUsageAPI:
|
|
@@ -1501,22 +1695,18 @@ class BillableUsageAPI:
|
|
|
1501
1695
|
def __init__(self, api_client):
|
|
1502
1696
|
self._api = api_client
|
|
1503
1697
|
|
|
1504
|
-
def download(self,
|
|
1505
|
-
start_month: str,
|
|
1506
|
-
end_month: str,
|
|
1507
|
-
*,
|
|
1508
|
-
personal_data: Optional[bool] = None) -> DownloadResponse:
|
|
1698
|
+
def download(self, start_month: str, end_month: str, *, personal_data: Optional[bool] = None) -> DownloadResponse:
|
|
1509
1699
|
"""Return billable usage logs.
|
|
1510
|
-
|
|
1700
|
+
|
|
1511
1701
|
Returns billable usage logs in CSV format for the specified account and date range. For the data
|
|
1512
1702
|
schema, see [CSV file schema]. Note that this method might take multiple minutes to complete.
|
|
1513
|
-
|
|
1703
|
+
|
|
1514
1704
|
**Warning**: Depending on the queried date range, the number of workspaces in the account, the size of
|
|
1515
1705
|
the response and the internet speed of the caller, this API may hit a timeout after a few minutes. If
|
|
1516
1706
|
you experience this, try to mitigate by calling the API with narrower date ranges.
|
|
1517
|
-
|
|
1707
|
+
|
|
1518
1708
|
[CSV file schema]: https://docs.databricks.com/administration-guide/account-settings/usage-analysis.html#schema
|
|
1519
|
-
|
|
1709
|
+
|
|
1520
1710
|
:param start_month: str
|
|
1521
1711
|
Format: `YYYY-MM`. First month to return billable usage logs for. This field is required.
|
|
1522
1712
|
:param end_month: str
|
|
@@ -1525,21 +1715,24 @@ class BillableUsageAPI:
|
|
|
1525
1715
|
Specify whether to include personally identifiable information in the billable usage logs, for
|
|
1526
1716
|
example the email addresses of cluster creators. Handle this information with care. Defaults to
|
|
1527
1717
|
false.
|
|
1528
|
-
|
|
1718
|
+
|
|
1529
1719
|
:returns: :class:`DownloadResponse`
|
|
1530
1720
|
"""
|
|
1531
1721
|
|
|
1532
1722
|
query = {}
|
|
1533
|
-
if end_month is not None:
|
|
1534
|
-
|
|
1535
|
-
if
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1723
|
+
if end_month is not None:
|
|
1724
|
+
query["end_month"] = end_month
|
|
1725
|
+
if personal_data is not None:
|
|
1726
|
+
query["personal_data"] = personal_data
|
|
1727
|
+
if start_month is not None:
|
|
1728
|
+
query["start_month"] = start_month
|
|
1729
|
+
headers = {
|
|
1730
|
+
"Accept": "text/plain",
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
res = self._api.do(
|
|
1734
|
+
"GET", f"/api/2.0/accounts/{self._api.account_id}/usage/download", query=query, headers=headers, raw=True
|
|
1735
|
+
)
|
|
1543
1736
|
return DownloadResponse.from_dict(res)
|
|
1544
1737
|
|
|
1545
1738
|
|
|
@@ -1549,83 +1742,85 @@ class BudgetPolicyAPI:
|
|
|
1549
1742
|
def __init__(self, api_client):
|
|
1550
1743
|
self._api = api_client
|
|
1551
1744
|
|
|
1552
|
-
def create(self,
|
|
1553
|
-
*,
|
|
1554
|
-
custom_tags: Optional[List[compute.CustomPolicyTag]] = None,
|
|
1555
|
-
policy_name: Optional[str] = None,
|
|
1556
|
-
request_id: Optional[str] = None) -> BudgetPolicy:
|
|
1745
|
+
def create(self, *, policy: Optional[BudgetPolicy] = None, request_id: Optional[str] = None) -> BudgetPolicy:
|
|
1557
1746
|
"""Create a budget policy.
|
|
1558
|
-
|
|
1747
|
+
|
|
1559
1748
|
Creates a new policy.
|
|
1560
|
-
|
|
1561
|
-
:param
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
0-9, a-z, A-Z, -, =, ., :, /, @, _, +, whitespace.
|
|
1749
|
+
|
|
1750
|
+
:param policy: :class:`BudgetPolicy` (optional)
|
|
1751
|
+
The policy to create. `policy_id` needs to be empty as it will be generated `policy_name` must be
|
|
1752
|
+
provided, custom_tags may need to be provided depending on the cloud provider. All other fields are
|
|
1753
|
+
optional.
|
|
1566
1754
|
:param request_id: str (optional)
|
|
1567
1755
|
A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is
|
|
1568
1756
|
recommended. This request is only idempotent if a `request_id` is provided.
|
|
1569
|
-
|
|
1757
|
+
|
|
1570
1758
|
:returns: :class:`BudgetPolicy`
|
|
1571
1759
|
"""
|
|
1572
1760
|
body = {}
|
|
1573
|
-
if
|
|
1574
|
-
|
|
1575
|
-
if request_id is not None:
|
|
1576
|
-
|
|
1761
|
+
if policy is not None:
|
|
1762
|
+
body["policy"] = policy.as_dict()
|
|
1763
|
+
if request_id is not None:
|
|
1764
|
+
body["request_id"] = request_id
|
|
1765
|
+
headers = {
|
|
1766
|
+
"Accept": "application/json",
|
|
1767
|
+
"Content-Type": "application/json",
|
|
1768
|
+
}
|
|
1577
1769
|
|
|
1578
|
-
res = self._api.do(
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
headers=headers)
|
|
1770
|
+
res = self._api.do(
|
|
1771
|
+
"POST", f"/api/2.1/accounts/{self._api.account_id}/budget-policies", body=body, headers=headers
|
|
1772
|
+
)
|
|
1582
1773
|
return BudgetPolicy.from_dict(res)
|
|
1583
1774
|
|
|
1584
1775
|
def delete(self, policy_id: str):
|
|
1585
1776
|
"""Delete a budget policy.
|
|
1586
|
-
|
|
1777
|
+
|
|
1587
1778
|
Deletes a policy
|
|
1588
|
-
|
|
1779
|
+
|
|
1589
1780
|
:param policy_id: str
|
|
1590
1781
|
The Id of the policy.
|
|
1591
|
-
|
|
1592
|
-
|
|
1782
|
+
|
|
1783
|
+
|
|
1593
1784
|
"""
|
|
1594
1785
|
|
|
1595
|
-
headers = {
|
|
1786
|
+
headers = {
|
|
1787
|
+
"Accept": "application/json",
|
|
1788
|
+
}
|
|
1596
1789
|
|
|
1597
|
-
self._api.do(
|
|
1598
|
-
f'/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}',
|
|
1599
|
-
headers=headers)
|
|
1790
|
+
self._api.do("DELETE", f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", headers=headers)
|
|
1600
1791
|
|
|
1601
1792
|
def get(self, policy_id: str) -> BudgetPolicy:
|
|
1602
1793
|
"""Get a budget policy.
|
|
1603
|
-
|
|
1794
|
+
|
|
1604
1795
|
Retrieves a policy by it's ID.
|
|
1605
|
-
|
|
1796
|
+
|
|
1606
1797
|
:param policy_id: str
|
|
1607
1798
|
The Id of the policy.
|
|
1608
|
-
|
|
1799
|
+
|
|
1609
1800
|
:returns: :class:`BudgetPolicy`
|
|
1610
1801
|
"""
|
|
1611
1802
|
|
|
1612
|
-
headers = {
|
|
1803
|
+
headers = {
|
|
1804
|
+
"Accept": "application/json",
|
|
1805
|
+
}
|
|
1613
1806
|
|
|
1614
|
-
res = self._api.do(
|
|
1615
|
-
|
|
1616
|
-
|
|
1807
|
+
res = self._api.do(
|
|
1808
|
+
"GET", f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}", headers=headers
|
|
1809
|
+
)
|
|
1617
1810
|
return BudgetPolicy.from_dict(res)
|
|
1618
1811
|
|
|
1619
|
-
def list(
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1812
|
+
def list(
|
|
1813
|
+
self,
|
|
1814
|
+
*,
|
|
1815
|
+
filter_by: Optional[Filter] = None,
|
|
1816
|
+
page_size: Optional[int] = None,
|
|
1817
|
+
page_token: Optional[str] = None,
|
|
1818
|
+
sort_spec: Optional[SortSpec] = None,
|
|
1819
|
+
) -> Iterator[BudgetPolicy]:
|
|
1625
1820
|
"""List policies.
|
|
1626
|
-
|
|
1821
|
+
|
|
1627
1822
|
Lists all policies. Policies are returned in the alphabetically ascending order of their names.
|
|
1628
|
-
|
|
1823
|
+
|
|
1629
1824
|
:param filter_by: :class:`Filter` (optional)
|
|
1630
1825
|
A filter to apply to the list of policies.
|
|
1631
1826
|
:param page_size: int (optional)
|
|
@@ -1634,62 +1829,71 @@ class BudgetPolicyAPI:
|
|
|
1634
1829
|
:param page_token: str (optional)
|
|
1635
1830
|
A page token, received from a previous `ListServerlessPolicies` call. Provide this to retrieve the
|
|
1636
1831
|
subsequent page. If unspecified, the first page will be returned.
|
|
1637
|
-
|
|
1832
|
+
|
|
1638
1833
|
When paginating, all other parameters provided to `ListServerlessPoliciesRequest` must match the
|
|
1639
1834
|
call that provided the page token.
|
|
1640
1835
|
:param sort_spec: :class:`SortSpec` (optional)
|
|
1641
1836
|
The sort specification.
|
|
1642
|
-
|
|
1837
|
+
|
|
1643
1838
|
:returns: Iterator over :class:`BudgetPolicy`
|
|
1644
1839
|
"""
|
|
1645
1840
|
|
|
1646
1841
|
query = {}
|
|
1647
|
-
if filter_by is not None:
|
|
1648
|
-
|
|
1649
|
-
if
|
|
1650
|
-
|
|
1651
|
-
|
|
1842
|
+
if filter_by is not None:
|
|
1843
|
+
query["filter_by"] = filter_by.as_dict()
|
|
1844
|
+
if page_size is not None:
|
|
1845
|
+
query["page_size"] = page_size
|
|
1846
|
+
if page_token is not None:
|
|
1847
|
+
query["page_token"] = page_token
|
|
1848
|
+
if sort_spec is not None:
|
|
1849
|
+
query["sort_spec"] = sort_spec.as_dict()
|
|
1850
|
+
headers = {
|
|
1851
|
+
"Accept": "application/json",
|
|
1852
|
+
}
|
|
1652
1853
|
|
|
1653
1854
|
while True:
|
|
1654
|
-
json = self._api.do(
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
for v in json['policies']:
|
|
1855
|
+
json = self._api.do(
|
|
1856
|
+
"GET", f"/api/2.1/accounts/{self._api.account_id}/budget-policies", query=query, headers=headers
|
|
1857
|
+
)
|
|
1858
|
+
if "policies" in json:
|
|
1859
|
+
for v in json["policies"]:
|
|
1660
1860
|
yield BudgetPolicy.from_dict(v)
|
|
1661
|
-
if
|
|
1861
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
1662
1862
|
return
|
|
1663
|
-
query[
|
|
1863
|
+
query["page_token"] = json["next_page_token"]
|
|
1664
1864
|
|
|
1665
|
-
def update(
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
limit_config: Optional[LimitConfig] = None,
|
|
1669
|
-
policy: Optional[BudgetPolicy] = None) -> BudgetPolicy:
|
|
1865
|
+
def update(
|
|
1866
|
+
self, policy_id: str, *, limit_config: Optional[LimitConfig] = None, policy: Optional[BudgetPolicy] = None
|
|
1867
|
+
) -> BudgetPolicy:
|
|
1670
1868
|
"""Update a budget policy.
|
|
1671
|
-
|
|
1869
|
+
|
|
1672
1870
|
Updates a policy
|
|
1673
|
-
|
|
1871
|
+
|
|
1674
1872
|
:param policy_id: str
|
|
1675
1873
|
The Id of the policy. This field is generated by Databricks and globally unique.
|
|
1676
1874
|
:param limit_config: :class:`LimitConfig` (optional)
|
|
1677
1875
|
DEPRECATED. This is redundant field as LimitConfig is part of the BudgetPolicy
|
|
1678
1876
|
:param policy: :class:`BudgetPolicy` (optional)
|
|
1679
1877
|
Contains the BudgetPolicy details.
|
|
1680
|
-
|
|
1878
|
+
|
|
1681
1879
|
:returns: :class:`BudgetPolicy`
|
|
1682
1880
|
"""
|
|
1683
1881
|
body = policy.as_dict()
|
|
1684
1882
|
query = {}
|
|
1685
|
-
if limit_config is not None:
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1883
|
+
if limit_config is not None:
|
|
1884
|
+
query["limit_config"] = limit_config.as_dict()
|
|
1885
|
+
headers = {
|
|
1886
|
+
"Accept": "application/json",
|
|
1887
|
+
"Content-Type": "application/json",
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
res = self._api.do(
|
|
1891
|
+
"PATCH",
|
|
1892
|
+
f"/api/2.1/accounts/{self._api.account_id}/budget-policies/{policy_id}",
|
|
1893
|
+
query=query,
|
|
1894
|
+
body=body,
|
|
1895
|
+
headers=headers,
|
|
1896
|
+
)
|
|
1693
1897
|
return BudgetPolicy.from_dict(res)
|
|
1694
1898
|
|
|
1695
1899
|
|
|
@@ -1703,111 +1907,116 @@ class BudgetsAPI:
|
|
|
1703
1907
|
|
|
1704
1908
|
def create(self, budget: CreateBudgetConfigurationBudget) -> CreateBudgetConfigurationResponse:
|
|
1705
1909
|
"""Create new budget.
|
|
1706
|
-
|
|
1910
|
+
|
|
1707
1911
|
Create a new budget configuration for an account. For full details, see
|
|
1708
1912
|
https://docs.databricks.com/en/admin/account-settings/budgets.html.
|
|
1709
|
-
|
|
1913
|
+
|
|
1710
1914
|
:param budget: :class:`CreateBudgetConfigurationBudget`
|
|
1711
1915
|
Properties of the new budget configuration.
|
|
1712
|
-
|
|
1916
|
+
|
|
1713
1917
|
:returns: :class:`CreateBudgetConfigurationResponse`
|
|
1714
1918
|
"""
|
|
1715
1919
|
body = {}
|
|
1716
|
-
if budget is not None:
|
|
1717
|
-
|
|
1920
|
+
if budget is not None:
|
|
1921
|
+
body["budget"] = budget.as_dict()
|
|
1922
|
+
headers = {
|
|
1923
|
+
"Accept": "application/json",
|
|
1924
|
+
"Content-Type": "application/json",
|
|
1925
|
+
}
|
|
1718
1926
|
|
|
1719
|
-
res = self._api.do(
|
|
1720
|
-
f'/api/2.1/accounts/{self._api.account_id}/budgets',
|
|
1721
|
-
body=body,
|
|
1722
|
-
headers=headers)
|
|
1927
|
+
res = self._api.do("POST", f"/api/2.1/accounts/{self._api.account_id}/budgets", body=body, headers=headers)
|
|
1723
1928
|
return CreateBudgetConfigurationResponse.from_dict(res)
|
|
1724
1929
|
|
|
1725
1930
|
def delete(self, budget_id: str):
|
|
1726
1931
|
"""Delete budget.
|
|
1727
|
-
|
|
1932
|
+
|
|
1728
1933
|
Deletes a budget configuration for an account. Both account and budget configuration are specified by
|
|
1729
1934
|
ID. This cannot be undone.
|
|
1730
|
-
|
|
1935
|
+
|
|
1731
1936
|
:param budget_id: str
|
|
1732
1937
|
The Databricks budget configuration ID.
|
|
1733
|
-
|
|
1734
|
-
|
|
1938
|
+
|
|
1939
|
+
|
|
1735
1940
|
"""
|
|
1736
1941
|
|
|
1737
|
-
headers = {
|
|
1942
|
+
headers = {
|
|
1943
|
+
"Accept": "application/json",
|
|
1944
|
+
}
|
|
1738
1945
|
|
|
1739
|
-
self._api.do(
|
|
1740
|
-
f'/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}',
|
|
1741
|
-
headers=headers)
|
|
1946
|
+
self._api.do("DELETE", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", headers=headers)
|
|
1742
1947
|
|
|
1743
1948
|
def get(self, budget_id: str) -> GetBudgetConfigurationResponse:
|
|
1744
1949
|
"""Get budget.
|
|
1745
|
-
|
|
1950
|
+
|
|
1746
1951
|
Gets a budget configuration for an account. Both account and budget configuration are specified by ID.
|
|
1747
|
-
|
|
1952
|
+
|
|
1748
1953
|
:param budget_id: str
|
|
1749
1954
|
The budget configuration ID
|
|
1750
|
-
|
|
1955
|
+
|
|
1751
1956
|
:returns: :class:`GetBudgetConfigurationResponse`
|
|
1752
1957
|
"""
|
|
1753
1958
|
|
|
1754
|
-
headers = {
|
|
1959
|
+
headers = {
|
|
1960
|
+
"Accept": "application/json",
|
|
1961
|
+
}
|
|
1755
1962
|
|
|
1756
|
-
res = self._api.do(
|
|
1757
|
-
f'/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}',
|
|
1758
|
-
headers=headers)
|
|
1963
|
+
res = self._api.do("GET", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", headers=headers)
|
|
1759
1964
|
return GetBudgetConfigurationResponse.from_dict(res)
|
|
1760
1965
|
|
|
1761
1966
|
def list(self, *, page_token: Optional[str] = None) -> Iterator[BudgetConfiguration]:
|
|
1762
1967
|
"""Get all budgets.
|
|
1763
|
-
|
|
1968
|
+
|
|
1764
1969
|
Gets all budgets associated with this account.
|
|
1765
|
-
|
|
1970
|
+
|
|
1766
1971
|
:param page_token: str (optional)
|
|
1767
1972
|
A page token received from a previous get all budget configurations call. This token can be used to
|
|
1768
1973
|
retrieve the subsequent page. Requests first page if absent.
|
|
1769
|
-
|
|
1974
|
+
|
|
1770
1975
|
:returns: Iterator over :class:`BudgetConfiguration`
|
|
1771
1976
|
"""
|
|
1772
1977
|
|
|
1773
1978
|
query = {}
|
|
1774
|
-
if page_token is not None:
|
|
1775
|
-
|
|
1979
|
+
if page_token is not None:
|
|
1980
|
+
query["page_token"] = page_token
|
|
1981
|
+
headers = {
|
|
1982
|
+
"Accept": "application/json",
|
|
1983
|
+
}
|
|
1776
1984
|
|
|
1777
1985
|
while True:
|
|
1778
|
-
json = self._api.do(
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
for v in json['budgets']:
|
|
1986
|
+
json = self._api.do(
|
|
1987
|
+
"GET", f"/api/2.1/accounts/{self._api.account_id}/budgets", query=query, headers=headers
|
|
1988
|
+
)
|
|
1989
|
+
if "budgets" in json:
|
|
1990
|
+
for v in json["budgets"]:
|
|
1784
1991
|
yield BudgetConfiguration.from_dict(v)
|
|
1785
|
-
if
|
|
1992
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
1786
1993
|
return
|
|
1787
|
-
query[
|
|
1994
|
+
query["page_token"] = json["next_page_token"]
|
|
1788
1995
|
|
|
1789
|
-
def update(self, budget_id: str,
|
|
1790
|
-
budget: UpdateBudgetConfigurationBudget) -> UpdateBudgetConfigurationResponse:
|
|
1996
|
+
def update(self, budget_id: str, budget: UpdateBudgetConfigurationBudget) -> UpdateBudgetConfigurationResponse:
|
|
1791
1997
|
"""Modify budget.
|
|
1792
|
-
|
|
1998
|
+
|
|
1793
1999
|
Updates a budget configuration for an account. Both account and budget configuration are specified by
|
|
1794
2000
|
ID.
|
|
1795
|
-
|
|
2001
|
+
|
|
1796
2002
|
:param budget_id: str
|
|
1797
2003
|
The Databricks budget configuration ID.
|
|
1798
2004
|
:param budget: :class:`UpdateBudgetConfigurationBudget`
|
|
1799
2005
|
The updated budget. This will overwrite the budget specified by the budget ID.
|
|
1800
|
-
|
|
2006
|
+
|
|
1801
2007
|
:returns: :class:`UpdateBudgetConfigurationResponse`
|
|
1802
2008
|
"""
|
|
1803
2009
|
body = {}
|
|
1804
|
-
if budget is not None:
|
|
1805
|
-
|
|
2010
|
+
if budget is not None:
|
|
2011
|
+
body["budget"] = budget.as_dict()
|
|
2012
|
+
headers = {
|
|
2013
|
+
"Accept": "application/json",
|
|
2014
|
+
"Content-Type": "application/json",
|
|
2015
|
+
}
|
|
1806
2016
|
|
|
1807
|
-
res = self._api.do(
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
headers=headers)
|
|
2017
|
+
res = self._api.do(
|
|
2018
|
+
"PUT", f"/api/2.1/accounts/{self._api.account_id}/budgets/{budget_id}", body=body, headers=headers
|
|
2019
|
+
)
|
|
1811
2020
|
return UpdateBudgetConfigurationResponse.from_dict(res)
|
|
1812
2021
|
|
|
1813
2022
|
|
|
@@ -1815,12 +2024,12 @@ class LogDeliveryAPI:
|
|
|
1815
2024
|
"""These APIs manage log delivery configurations for this account. The two supported log types for this API
|
|
1816
2025
|
are _billable usage logs_ and _audit logs_. This feature is in Public Preview. This feature works with all
|
|
1817
2026
|
account ID types.
|
|
1818
|
-
|
|
2027
|
+
|
|
1819
2028
|
Log delivery works with all account types. However, if your account is on the E2 version of the platform
|
|
1820
2029
|
or on a select custom plan that allows multiple workspaces per account, you can optionally configure
|
|
1821
2030
|
different storage destinations for each workspace. Log delivery status is also provided to know the latest
|
|
1822
2031
|
status of log delivery attempts. The high-level flow of billable usage delivery:
|
|
1823
|
-
|
|
2032
|
+
|
|
1824
2033
|
1. **Create storage**: In AWS, [create a new AWS S3 bucket] with a specific bucket policy. Using
|
|
1825
2034
|
Databricks APIs, call the Account API to create a [storage configuration object](:method:Storage/Create)
|
|
1826
2035
|
that uses the bucket name. 2. **Create credentials**: In AWS, create the appropriate AWS IAM role. For
|
|
@@ -1834,7 +2043,7 @@ class LogDeliveryAPI:
|
|
|
1834
2043
|
Account level log delivery applies to all current and future workspaces plus account level logs, while
|
|
1835
2044
|
workspace level log delivery solely delivers logs related to the specified workspaces. You can create
|
|
1836
2045
|
multiple types of delivery configurations per account.
|
|
1837
|
-
|
|
2046
|
+
|
|
1838
2047
|
For billable usage delivery: * For more information about billable usage logs, see [Billable usage log
|
|
1839
2048
|
delivery]. For the CSV schema, see the [Usage page]. * The delivery location is
|
|
1840
2049
|
`<bucket-name>/<prefix>/billable-usage/csv/`, where `<prefix>` is the name of the optional delivery path
|
|
@@ -1843,7 +2052,7 @@ class LogDeliveryAPI:
|
|
|
1843
2052
|
workspaces (_workspace level_ logs). You can aggregate usage for your entire account by creating an
|
|
1844
2053
|
_account level_ delivery configuration that delivers logs for all current and future workspaces in your
|
|
1845
2054
|
account. * The files are delivered daily by overwriting the month's CSV file for each workspace.
|
|
1846
|
-
|
|
2055
|
+
|
|
1847
2056
|
For audit log delivery: * For more information about about audit log delivery, see [Audit log delivery],
|
|
1848
2057
|
which includes information about the used JSON schema. * The delivery location is
|
|
1849
2058
|
`<bucket-name>/<delivery-path-prefix>/workspaceId=<workspaceId>/date=<yyyy-mm-dd>/auditlogs_<internal-id>.json`.
|
|
@@ -1853,7 +2062,7 @@ class LogDeliveryAPI:
|
|
|
1853
2062
|
level_ delivery configuration), the audit log delivery includes workspace-level audit logs for all
|
|
1854
2063
|
workspaces in the account as well as account-level audit logs. See [Audit log delivery] for details. *
|
|
1855
2064
|
Auditable events are typically available in logs within 15 minutes.
|
|
1856
|
-
|
|
2065
|
+
|
|
1857
2066
|
[Audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html
|
|
1858
2067
|
[Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html
|
|
1859
2068
|
[Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html
|
|
@@ -1863,107 +2072,114 @@ class LogDeliveryAPI:
|
|
|
1863
2072
|
self._api = api_client
|
|
1864
2073
|
|
|
1865
2074
|
def create(
|
|
1866
|
-
self,
|
|
1867
|
-
*,
|
|
1868
|
-
log_delivery_configuration: Optional[CreateLogDeliveryConfigurationParams] = None
|
|
2075
|
+
self, *, log_delivery_configuration: Optional[CreateLogDeliveryConfigurationParams] = None
|
|
1869
2076
|
) -> WrappedLogDeliveryConfiguration:
|
|
1870
2077
|
"""Create a new log delivery configuration.
|
|
1871
|
-
|
|
2078
|
+
|
|
1872
2079
|
Creates a new Databricks log delivery configuration to enable delivery of the specified type of logs
|
|
1873
2080
|
to your storage location. This requires that you already created a [credential
|
|
1874
2081
|
object](:method:Credentials/Create) (which encapsulates a cross-account service IAM role) and a
|
|
1875
2082
|
[storage configuration object](:method:Storage/Create) (which encapsulates an S3 bucket).
|
|
1876
|
-
|
|
2083
|
+
|
|
1877
2084
|
For full details, including the required IAM role policies and bucket policies, see [Deliver and
|
|
1878
2085
|
access billable usage logs] or [Configure audit logging].
|
|
1879
|
-
|
|
2086
|
+
|
|
1880
2087
|
**Note**: There is a limit on the number of log delivery configurations available per account (each
|
|
1881
2088
|
limit applies separately to each log type including billable usage and audit logs). You can create a
|
|
1882
2089
|
maximum of two enabled account-level delivery configurations (configurations without a workspace
|
|
1883
2090
|
filter) per type. Additionally, you can create two enabled workspace-level delivery configurations per
|
|
1884
2091
|
workspace for each log type, which means that the same workspace ID can occur in the workspace filter
|
|
1885
2092
|
for no more than two delivery configurations per log type.
|
|
1886
|
-
|
|
2093
|
+
|
|
1887
2094
|
You cannot delete a log delivery configuration, but you can disable it (see [Enable or disable log
|
|
1888
2095
|
delivery configuration](:method:LogDelivery/PatchStatus)).
|
|
1889
|
-
|
|
2096
|
+
|
|
1890
2097
|
[Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html
|
|
1891
2098
|
[Deliver and access billable usage logs]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html
|
|
1892
|
-
|
|
2099
|
+
|
|
1893
2100
|
:param log_delivery_configuration: :class:`CreateLogDeliveryConfigurationParams` (optional)
|
|
1894
|
-
|
|
2101
|
+
|
|
1895
2102
|
:returns: :class:`WrappedLogDeliveryConfiguration`
|
|
1896
2103
|
"""
|
|
1897
2104
|
body = {}
|
|
1898
2105
|
if log_delivery_configuration is not None:
|
|
1899
|
-
body[
|
|
1900
|
-
headers = {
|
|
2106
|
+
body["log_delivery_configuration"] = log_delivery_configuration.as_dict()
|
|
2107
|
+
headers = {
|
|
2108
|
+
"Accept": "application/json",
|
|
2109
|
+
"Content-Type": "application/json",
|
|
2110
|
+
}
|
|
1901
2111
|
|
|
1902
|
-
res = self._api.do(
|
|
1903
|
-
f'/api/2.0/accounts/{self._api.account_id}/log-delivery',
|
|
1904
|
-
body=body,
|
|
1905
|
-
headers=headers)
|
|
2112
|
+
res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/log-delivery", body=body, headers=headers)
|
|
1906
2113
|
return WrappedLogDeliveryConfiguration.from_dict(res)
|
|
1907
2114
|
|
|
1908
2115
|
def get(self, log_delivery_configuration_id: str) -> WrappedLogDeliveryConfiguration:
|
|
1909
2116
|
"""Get log delivery configuration.
|
|
1910
|
-
|
|
2117
|
+
|
|
1911
2118
|
Gets a Databricks log delivery configuration object for an account, both specified by ID.
|
|
1912
|
-
|
|
2119
|
+
|
|
1913
2120
|
:param log_delivery_configuration_id: str
|
|
1914
2121
|
Databricks log delivery configuration ID
|
|
1915
|
-
|
|
2122
|
+
|
|
1916
2123
|
:returns: :class:`WrappedLogDeliveryConfiguration`
|
|
1917
2124
|
"""
|
|
1918
2125
|
|
|
1919
|
-
headers = {
|
|
2126
|
+
headers = {
|
|
2127
|
+
"Accept": "application/json",
|
|
2128
|
+
}
|
|
1920
2129
|
|
|
1921
2130
|
res = self._api.do(
|
|
1922
|
-
|
|
1923
|
-
f
|
|
1924
|
-
headers=headers
|
|
2131
|
+
"GET",
|
|
2132
|
+
f"/api/2.0/accounts/{self._api.account_id}/log-delivery/{log_delivery_configuration_id}",
|
|
2133
|
+
headers=headers,
|
|
2134
|
+
)
|
|
1925
2135
|
return WrappedLogDeliveryConfiguration.from_dict(res)
|
|
1926
2136
|
|
|
1927
|
-
def list(
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
2137
|
+
def list(
|
|
2138
|
+
self,
|
|
2139
|
+
*,
|
|
2140
|
+
credentials_id: Optional[str] = None,
|
|
2141
|
+
status: Optional[LogDeliveryConfigStatus] = None,
|
|
2142
|
+
storage_configuration_id: Optional[str] = None,
|
|
2143
|
+
) -> Iterator[LogDeliveryConfiguration]:
|
|
1932
2144
|
"""Get all log delivery configurations.
|
|
1933
|
-
|
|
2145
|
+
|
|
1934
2146
|
Gets all Databricks log delivery configurations associated with an account specified by ID.
|
|
1935
|
-
|
|
2147
|
+
|
|
1936
2148
|
:param credentials_id: str (optional)
|
|
1937
2149
|
Filter by credential configuration ID.
|
|
1938
2150
|
:param status: :class:`LogDeliveryConfigStatus` (optional)
|
|
1939
2151
|
Filter by status `ENABLED` or `DISABLED`.
|
|
1940
2152
|
:param storage_configuration_id: str (optional)
|
|
1941
2153
|
Filter by storage configuration ID.
|
|
1942
|
-
|
|
2154
|
+
|
|
1943
2155
|
:returns: Iterator over :class:`LogDeliveryConfiguration`
|
|
1944
2156
|
"""
|
|
1945
2157
|
|
|
1946
2158
|
query = {}
|
|
1947
|
-
if credentials_id is not None:
|
|
1948
|
-
|
|
1949
|
-
if
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
2159
|
+
if credentials_id is not None:
|
|
2160
|
+
query["credentials_id"] = credentials_id
|
|
2161
|
+
if status is not None:
|
|
2162
|
+
query["status"] = status.value
|
|
2163
|
+
if storage_configuration_id is not None:
|
|
2164
|
+
query["storage_configuration_id"] = storage_configuration_id
|
|
2165
|
+
headers = {
|
|
2166
|
+
"Accept": "application/json",
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
json = self._api.do(
|
|
2170
|
+
"GET", f"/api/2.0/accounts/{self._api.account_id}/log-delivery", query=query, headers=headers
|
|
2171
|
+
)
|
|
1956
2172
|
parsed = WrappedLogDeliveryConfigurations.from_dict(json).log_delivery_configurations
|
|
1957
2173
|
return parsed if parsed is not None else []
|
|
1958
2174
|
|
|
1959
2175
|
def patch_status(self, log_delivery_configuration_id: str, status: LogDeliveryConfigStatus):
|
|
1960
2176
|
"""Enable or disable log delivery configuration.
|
|
1961
|
-
|
|
2177
|
+
|
|
1962
2178
|
Enables or disables a log delivery configuration. Deletion of delivery configurations is not
|
|
1963
2179
|
supported, so disable log delivery configurations that are no longer needed. Note that you can't
|
|
1964
2180
|
re-enable a delivery configuration if this would violate the delivery configuration limits described
|
|
1965
2181
|
under [Create log delivery](:method:LogDelivery/Create).
|
|
1966
|
-
|
|
2182
|
+
|
|
1967
2183
|
:param log_delivery_configuration_id: str
|
|
1968
2184
|
Databricks log delivery configuration ID
|
|
1969
2185
|
:param status: :class:`LogDeliveryConfigStatus`
|
|
@@ -1971,17 +2187,23 @@ class LogDeliveryAPI:
|
|
|
1971
2187
|
to `ENABLED`. You can [enable or disable the
|
|
1972
2188
|
configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is
|
|
1973
2189
|
not supported, so disable a log delivery configuration that is no longer needed.
|
|
1974
|
-
|
|
1975
|
-
|
|
2190
|
+
|
|
2191
|
+
|
|
1976
2192
|
"""
|
|
1977
2193
|
body = {}
|
|
1978
|
-
if status is not None:
|
|
1979
|
-
|
|
2194
|
+
if status is not None:
|
|
2195
|
+
body["status"] = status.value
|
|
2196
|
+
headers = {
|
|
2197
|
+
"Accept": "application/json",
|
|
2198
|
+
"Content-Type": "application/json",
|
|
2199
|
+
}
|
|
1980
2200
|
|
|
1981
|
-
self._api.do(
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2201
|
+
self._api.do(
|
|
2202
|
+
"PATCH",
|
|
2203
|
+
f"/api/2.0/accounts/{self._api.account_id}/log-delivery/{log_delivery_configuration_id}",
|
|
2204
|
+
body=body,
|
|
2205
|
+
headers=headers,
|
|
2206
|
+
)
|
|
1985
2207
|
|
|
1986
2208
|
|
|
1987
2209
|
class UsageDashboardsAPI:
|
|
@@ -1992,57 +2214,58 @@ class UsageDashboardsAPI:
|
|
|
1992
2214
|
def __init__(self, api_client):
|
|
1993
2215
|
self._api = api_client
|
|
1994
2216
|
|
|
1995
|
-
def create(
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
workspace_id: Optional[int] = None) -> CreateBillingUsageDashboardResponse:
|
|
2217
|
+
def create(
|
|
2218
|
+
self, *, dashboard_type: Optional[UsageDashboardType] = None, workspace_id: Optional[int] = None
|
|
2219
|
+
) -> CreateBillingUsageDashboardResponse:
|
|
1999
2220
|
"""Create new usage dashboard.
|
|
2000
|
-
|
|
2221
|
+
|
|
2001
2222
|
Create a usage dashboard specified by workspaceId, accountId, and dashboard type.
|
|
2002
|
-
|
|
2223
|
+
|
|
2003
2224
|
:param dashboard_type: :class:`UsageDashboardType` (optional)
|
|
2004
2225
|
Workspace level usage dashboard shows usage data for the specified workspace ID. Global level usage
|
|
2005
2226
|
dashboard shows usage data for all workspaces in the account.
|
|
2006
2227
|
:param workspace_id: int (optional)
|
|
2007
2228
|
The workspace ID of the workspace in which the usage dashboard is created.
|
|
2008
|
-
|
|
2229
|
+
|
|
2009
2230
|
:returns: :class:`CreateBillingUsageDashboardResponse`
|
|
2010
2231
|
"""
|
|
2011
2232
|
body = {}
|
|
2012
|
-
if dashboard_type is not None:
|
|
2013
|
-
|
|
2014
|
-
|
|
2233
|
+
if dashboard_type is not None:
|
|
2234
|
+
body["dashboard_type"] = dashboard_type.value
|
|
2235
|
+
if workspace_id is not None:
|
|
2236
|
+
body["workspace_id"] = workspace_id
|
|
2237
|
+
headers = {
|
|
2238
|
+
"Accept": "application/json",
|
|
2239
|
+
"Content-Type": "application/json",
|
|
2240
|
+
}
|
|
2015
2241
|
|
|
2016
|
-
res = self._api.do(
|
|
2017
|
-
f'/api/2.0/accounts/{self._api.account_id}/dashboard',
|
|
2018
|
-
body=body,
|
|
2019
|
-
headers=headers)
|
|
2242
|
+
res = self._api.do("POST", f"/api/2.0/accounts/{self._api.account_id}/dashboard", body=body, headers=headers)
|
|
2020
2243
|
return CreateBillingUsageDashboardResponse.from_dict(res)
|
|
2021
2244
|
|
|
2022
|
-
def get(
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
workspace_id: Optional[int] = None) -> GetBillingUsageDashboardResponse:
|
|
2245
|
+
def get(
|
|
2246
|
+
self, *, dashboard_type: Optional[UsageDashboardType] = None, workspace_id: Optional[int] = None
|
|
2247
|
+
) -> GetBillingUsageDashboardResponse:
|
|
2026
2248
|
"""Get usage dashboard.
|
|
2027
|
-
|
|
2249
|
+
|
|
2028
2250
|
Get a usage dashboard specified by workspaceId, accountId, and dashboard type.
|
|
2029
|
-
|
|
2251
|
+
|
|
2030
2252
|
:param dashboard_type: :class:`UsageDashboardType` (optional)
|
|
2031
2253
|
Workspace level usage dashboard shows usage data for the specified workspace ID. Global level usage
|
|
2032
2254
|
dashboard shows usage data for all workspaces in the account.
|
|
2033
2255
|
:param workspace_id: int (optional)
|
|
2034
2256
|
The workspace ID of the workspace in which the usage dashboard is created.
|
|
2035
|
-
|
|
2257
|
+
|
|
2036
2258
|
:returns: :class:`GetBillingUsageDashboardResponse`
|
|
2037
2259
|
"""
|
|
2038
2260
|
|
|
2039
2261
|
query = {}
|
|
2040
|
-
if dashboard_type is not None:
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2262
|
+
if dashboard_type is not None:
|
|
2263
|
+
query["dashboard_type"] = dashboard_type.value
|
|
2264
|
+
if workspace_id is not None:
|
|
2265
|
+
query["workspace_id"] = workspace_id
|
|
2266
|
+
headers = {
|
|
2267
|
+
"Accept": "application/json",
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
res = self._api.do("GET", f"/api/2.0/accounts/{self._api.account_id}/dashboard", query=query, headers=headers)
|
|
2048
2271
|
return GetBillingUsageDashboardResponse.from_dict(res)
|