databricks-sdk 0.0.7__py3-none-any.whl → 0.1.1__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 +121 -104
- databricks/sdk/core.py +76 -16
- databricks/sdk/dbutils.py +18 -17
- databricks/sdk/mixins/compute.py +6 -6
- databricks/sdk/mixins/dbfs.py +6 -6
- databricks/sdk/oauth.py +28 -14
- databricks/sdk/service/{unitycatalog.py → catalog.py} +375 -1146
- databricks/sdk/service/{clusters.py → compute.py} +2176 -61
- databricks/sdk/service/{dbfs.py → files.py} +6 -6
- databricks/sdk/service/{scim.py → iam.py} +567 -27
- databricks/sdk/service/jobs.py +44 -34
- databricks/sdk/service/{mlflow.py → ml.py} +976 -1071
- databricks/sdk/service/oauth2.py +3 -3
- databricks/sdk/service/pipelines.py +46 -30
- databricks/sdk/service/{deployment.py → provisioning.py} +47 -29
- databricks/sdk/service/settings.py +849 -0
- databricks/sdk/service/sharing.py +1176 -0
- databricks/sdk/service/sql.py +15 -15
- databricks/sdk/service/workspace.py +917 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/METADATA +3 -1
- databricks_sdk-0.1.1.dist-info/RECORD +37 -0
- databricks/sdk/service/clusterpolicies.py +0 -399
- databricks/sdk/service/commands.py +0 -478
- databricks/sdk/service/gitcredentials.py +0 -202
- databricks/sdk/service/globalinitscripts.py +0 -262
- databricks/sdk/service/instancepools.py +0 -757
- databricks/sdk/service/ipaccesslists.py +0 -340
- databricks/sdk/service/libraries.py +0 -282
- databricks/sdk/service/permissions.py +0 -470
- databricks/sdk/service/repos.py +0 -250
- databricks/sdk/service/secrets.py +0 -472
- databricks/sdk/service/tokenmanagement.py +0 -182
- databricks/sdk/service/tokens.py +0 -137
- databricks/sdk/service/workspaceconf.py +0 -50
- databricks_sdk-0.0.7.dist-info/RECORD +0 -48
- /databricks/sdk/service/{endpoints.py → serving.py} +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/top_level.txt +0 -0
databricks/sdk/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.
|
|
1
|
+
__version__ = '0.1.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: databricks-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Databricks SDK for Python (Experimental)
|
|
5
5
|
Home-page: https://github.com/databricks/databricks-sdk-py
|
|
6
6
|
Author: Serge Smertin
|
|
@@ -174,6 +174,8 @@ w = WorkspaceClient(host=input('Databricks Workspace URL: '),
|
|
|
174
174
|
azure_client_secret=input('AAD Client Secret: '))
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
Please see more examples in [this document](./docs/azure-ad.md).
|
|
178
|
+
|
|
177
179
|
### Overriding `.databrickscfg`
|
|
178
180
|
|
|
179
181
|
For [Databricks native authentication](#databricks-native-authentication), you can override the default behavior for using `.databrickscfg` as follows:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
databricks/__init__.py,sha256=-1cBy2684NfMPosP7CE8LgIYlw8ve82AGkP1ZVp9M5A,260
|
|
2
|
+
databricks/sdk/__init__.py,sha256=5hL4sD2aCGU7BHQFpEz5DmME-xk7Yp5fCdjStNpFziM,12817
|
|
3
|
+
databricks/sdk/azure.py,sha256=2CljLtiyOnH-rUQcCSarbLsJd0zkil5f4vpjsSGzyxc,1656
|
|
4
|
+
databricks/sdk/core.py,sha256=1AWSWam7aq-2xn2MNGMBVkxr1GqKNWznBEhzkrvOPOw,34311
|
|
5
|
+
databricks/sdk/dbconnect.py,sha256=mAqVSDSAIjuqy4oSsDbcKLWIgqDLEnWtXPlb133YYhQ,2616
|
|
6
|
+
databricks/sdk/dbutils.py,sha256=9lHGcXjRnIylWOSBFbioIym1JzVBo9of3laoXE7TvOA,11147
|
|
7
|
+
databricks/sdk/errors.py,sha256=SBy7QvNgGKzEg0j-zuyNpaiuChwx93DeKbya5MNftGc,94
|
|
8
|
+
databricks/sdk/oauth.py,sha256=0RHrbxbPvVEE_kFrSPigzgYQdqZr79aDJRE1q0IdsEs,13981
|
|
9
|
+
databricks/sdk/version.py,sha256=ls1camlIoMxEZz9gSkZ1OJo-MXqHWwKPtdPbZJmwp7E,22
|
|
10
|
+
databricks/sdk/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
databricks/sdk/mixins/compute.py,sha256=cCoRkkChrV9bEXq2h8WwxdWJ4sVB5dT9KazjJMSC74I,8909
|
|
12
|
+
databricks/sdk/mixins/dbfs.py,sha256=nvAhP_Aem_xmB3GT0LAozAb_PjUXB5Xc9Xev9BpW5aM,12666
|
|
13
|
+
databricks/sdk/runtime/__init__.py,sha256=pyEV0sUzZGyAdIi6FWOZCnih_eHfH78fHtoIE3qbQuI,587
|
|
14
|
+
databricks/sdk/runtime/stub.py,sha256=2tTysaz4rBKdM1yyo0dXdo-UFdXH6PEHyu6267AaU00,11790
|
|
15
|
+
databricks/sdk/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
databricks/sdk/service/_internal.py,sha256=Gy5f689Rg-50Md2RbHFWF6i2oZDRPDjeN-vPF6_ONlI,1296
|
|
17
|
+
databricks/sdk/service/billing.py,sha256=-wHIbaaVmOYBWmkg8247zdEjQNO1pbTpZwbHA4HIRUQ,30457
|
|
18
|
+
databricks/sdk/service/catalog.py,sha256=Ja5r35XUaQh0RuFz_eQTZUPaC4t599x9Bkq_RVPub-c,157480
|
|
19
|
+
databricks/sdk/service/compute.py,sha256=7neQ4I5qRwjYhVBScFM9NskRGtT2tPJyPN58DahFJjY,188918
|
|
20
|
+
databricks/sdk/service/files.py,sha256=FMN1_nnSlcsHn4j1KtVpSv2sTTvxnnG9dzIyI7RVWj4,14727
|
|
21
|
+
databricks/sdk/service/iam.py,sha256=31r2PuE9pTaO07J7HcdvDBe_cBqFhApiKk6NEkN_hwI,68249
|
|
22
|
+
databricks/sdk/service/jobs.py,sha256=rKf81p089Pqhnlwy41bRfGKkIbtVNUIHGzdtRP6rb2A,99652
|
|
23
|
+
databricks/sdk/service/ml.py,sha256=WpocTX_dNEDUGNTCWR1jME4nkNDfwEalYrb2Fn7cXdE,113286
|
|
24
|
+
databricks/sdk/service/oauth2.py,sha256=g8VmaznZv2f6YXaw88aRDAhi7b8O2urchxgdnqFq-fU,19395
|
|
25
|
+
databricks/sdk/service/pipelines.py,sha256=9e8JdmWPEgi3gKPMmp2l2OTkrTRWLEodnfXXhaX8M3I,51501
|
|
26
|
+
databricks/sdk/service/provisioning.py,sha256=8ZIAt5h1aRWzq0ffVPKJ5hf1LAsLsgD4guvbMEtYTog,87514
|
|
27
|
+
databricks/sdk/service/serving.py,sha256=5IxPUhzjj8VV8yvaiDf_sTlGd07Ed7U3o1VliMVbE64,24891
|
|
28
|
+
databricks/sdk/service/settings.py,sha256=rfcv96j5Y4udGKr9LzjA2jkAj8kuL8A7lXqW0NNq7Tg,33670
|
|
29
|
+
databricks/sdk/service/sharing.py,sha256=N83p-0AysFO8nwnm-HUSYT5qaQUgMsvXET6lY9JaOR4,44357
|
|
30
|
+
databricks/sdk/service/sql.py,sha256=geciXxYvv3Le-JHP7k_K0r4XBVw003TqXJ1oA7UzeoE,140031
|
|
31
|
+
databricks/sdk/service/workspace.py,sha256=h_zgD2ElOjJq83xxs-SG6QrGP-x0zDxZHADMiqKwD4o,43457
|
|
32
|
+
databricks_sdk-0.1.1.dist-info/LICENSE,sha256=afBgTZo-JsYqj4VOjnejBetMuHKcFR30YobDdpVFkqY,11411
|
|
33
|
+
databricks_sdk-0.1.1.dist-info/METADATA,sha256=iniqjP2p8RkicUG9w6yHTl7quH3AlgEstwmolcnGDeM,29644
|
|
34
|
+
databricks_sdk-0.1.1.dist-info/NOTICE,sha256=FXJCqJfV8_zzXWjB4wgTx_iot23yvSo_d2SyCjrlleg,725
|
|
35
|
+
databricks_sdk-0.1.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
36
|
+
databricks_sdk-0.1.1.dist-info/top_level.txt,sha256=7kRdatoSgU0EUurRQJ_3F1Nv4EOSHWAr6ng25tJOJKU,11
|
|
37
|
+
databricks_sdk-0.1.1.dist-info/RECORD,,
|
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from enum import Enum
|
|
6
|
-
from typing import Dict, Iterator, List
|
|
7
|
-
|
|
8
|
-
from ._internal import _repeated
|
|
9
|
-
|
|
10
|
-
_LOG = logging.getLogger('databricks.sdk')
|
|
11
|
-
|
|
12
|
-
# all definitions in this file are in alphabetical order
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@dataclass
|
|
16
|
-
class CreatePolicy:
|
|
17
|
-
name: str
|
|
18
|
-
definition: str = None
|
|
19
|
-
description: str = None
|
|
20
|
-
max_clusters_per_user: int = None
|
|
21
|
-
policy_family_definition_overrides: str = None
|
|
22
|
-
policy_family_id: str = None
|
|
23
|
-
|
|
24
|
-
def as_dict(self) -> dict:
|
|
25
|
-
body = {}
|
|
26
|
-
if self.definition: body['definition'] = self.definition
|
|
27
|
-
if self.description: body['description'] = self.description
|
|
28
|
-
if self.max_clusters_per_user: body['max_clusters_per_user'] = self.max_clusters_per_user
|
|
29
|
-
if self.name: body['name'] = self.name
|
|
30
|
-
if self.policy_family_definition_overrides:
|
|
31
|
-
body['policy_family_definition_overrides'] = self.policy_family_definition_overrides
|
|
32
|
-
if self.policy_family_id: body['policy_family_id'] = self.policy_family_id
|
|
33
|
-
return body
|
|
34
|
-
|
|
35
|
-
@classmethod
|
|
36
|
-
def from_dict(cls, d: Dict[str, any]) -> 'CreatePolicy':
|
|
37
|
-
return cls(definition=d.get('definition', None),
|
|
38
|
-
description=d.get('description', None),
|
|
39
|
-
max_clusters_per_user=d.get('max_clusters_per_user', None),
|
|
40
|
-
name=d.get('name', None),
|
|
41
|
-
policy_family_definition_overrides=d.get('policy_family_definition_overrides', None),
|
|
42
|
-
policy_family_id=d.get('policy_family_id', None))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@dataclass
|
|
46
|
-
class CreatePolicyResponse:
|
|
47
|
-
policy_id: str = None
|
|
48
|
-
|
|
49
|
-
def as_dict(self) -> dict:
|
|
50
|
-
body = {}
|
|
51
|
-
if self.policy_id: body['policy_id'] = self.policy_id
|
|
52
|
-
return body
|
|
53
|
-
|
|
54
|
-
@classmethod
|
|
55
|
-
def from_dict(cls, d: Dict[str, any]) -> 'CreatePolicyResponse':
|
|
56
|
-
return cls(policy_id=d.get('policy_id', None))
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
@dataclass
|
|
60
|
-
class DeletePolicy:
|
|
61
|
-
policy_id: str
|
|
62
|
-
|
|
63
|
-
def as_dict(self) -> dict:
|
|
64
|
-
body = {}
|
|
65
|
-
if self.policy_id: body['policy_id'] = self.policy_id
|
|
66
|
-
return body
|
|
67
|
-
|
|
68
|
-
@classmethod
|
|
69
|
-
def from_dict(cls, d: Dict[str, any]) -> 'DeletePolicy':
|
|
70
|
-
return cls(policy_id=d.get('policy_id', None))
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@dataclass
|
|
74
|
-
class EditPolicy:
|
|
75
|
-
policy_id: str
|
|
76
|
-
name: str
|
|
77
|
-
definition: str = None
|
|
78
|
-
description: str = None
|
|
79
|
-
max_clusters_per_user: int = None
|
|
80
|
-
policy_family_definition_overrides: str = None
|
|
81
|
-
policy_family_id: str = None
|
|
82
|
-
|
|
83
|
-
def as_dict(self) -> dict:
|
|
84
|
-
body = {}
|
|
85
|
-
if self.definition: body['definition'] = self.definition
|
|
86
|
-
if self.description: body['description'] = self.description
|
|
87
|
-
if self.max_clusters_per_user: body['max_clusters_per_user'] = self.max_clusters_per_user
|
|
88
|
-
if self.name: body['name'] = self.name
|
|
89
|
-
if self.policy_family_definition_overrides:
|
|
90
|
-
body['policy_family_definition_overrides'] = self.policy_family_definition_overrides
|
|
91
|
-
if self.policy_family_id: body['policy_family_id'] = self.policy_family_id
|
|
92
|
-
if self.policy_id: body['policy_id'] = self.policy_id
|
|
93
|
-
return body
|
|
94
|
-
|
|
95
|
-
@classmethod
|
|
96
|
-
def from_dict(cls, d: Dict[str, any]) -> 'EditPolicy':
|
|
97
|
-
return cls(definition=d.get('definition', None),
|
|
98
|
-
description=d.get('description', None),
|
|
99
|
-
max_clusters_per_user=d.get('max_clusters_per_user', None),
|
|
100
|
-
name=d.get('name', None),
|
|
101
|
-
policy_family_definition_overrides=d.get('policy_family_definition_overrides', None),
|
|
102
|
-
policy_family_id=d.get('policy_family_id', None),
|
|
103
|
-
policy_id=d.get('policy_id', None))
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@dataclass
|
|
107
|
-
class Get:
|
|
108
|
-
"""Get entity"""
|
|
109
|
-
|
|
110
|
-
policy_id: str
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
@dataclass
|
|
114
|
-
class GetPolicyFamilyRequest:
|
|
115
|
-
policy_family_id: str
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@dataclass
|
|
119
|
-
class ListRequest:
|
|
120
|
-
"""Get a cluster policy"""
|
|
121
|
-
|
|
122
|
-
sort_column: 'ListSortColumn' = None
|
|
123
|
-
sort_order: 'ListSortOrder' = None
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
@dataclass
|
|
127
|
-
class ListPoliciesResponse:
|
|
128
|
-
policies: 'List[Policy]' = None
|
|
129
|
-
|
|
130
|
-
def as_dict(self) -> dict:
|
|
131
|
-
body = {}
|
|
132
|
-
if self.policies: body['policies'] = [v.as_dict() for v in self.policies]
|
|
133
|
-
return body
|
|
134
|
-
|
|
135
|
-
@classmethod
|
|
136
|
-
def from_dict(cls, d: Dict[str, any]) -> 'ListPoliciesResponse':
|
|
137
|
-
return cls(policies=_repeated(d, 'policies', Policy))
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@dataclass
|
|
141
|
-
class ListPolicyFamiliesRequest:
|
|
142
|
-
max_results: int = None
|
|
143
|
-
page_token: str = None
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
@dataclass
|
|
147
|
-
class ListPolicyFamiliesResponse:
|
|
148
|
-
policy_families: 'List[PolicyFamily]'
|
|
149
|
-
next_page_token: str = None
|
|
150
|
-
|
|
151
|
-
def as_dict(self) -> dict:
|
|
152
|
-
body = {}
|
|
153
|
-
if self.next_page_token: body['next_page_token'] = self.next_page_token
|
|
154
|
-
if self.policy_families: body['policy_families'] = [v.as_dict() for v in self.policy_families]
|
|
155
|
-
return body
|
|
156
|
-
|
|
157
|
-
@classmethod
|
|
158
|
-
def from_dict(cls, d: Dict[str, any]) -> 'ListPolicyFamiliesResponse':
|
|
159
|
-
return cls(next_page_token=d.get('next_page_token', None),
|
|
160
|
-
policy_families=_repeated(d, 'policy_families', PolicyFamily))
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
class ListSortColumn(Enum):
|
|
164
|
-
|
|
165
|
-
POLICY_CREATION_TIME = 'POLICY_CREATION_TIME'
|
|
166
|
-
POLICY_NAME = 'POLICY_NAME'
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
class ListSortOrder(Enum):
|
|
170
|
-
|
|
171
|
-
ASC = 'ASC'
|
|
172
|
-
DESC = 'DESC'
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
@dataclass
|
|
176
|
-
class Policy:
|
|
177
|
-
created_at_timestamp: int = None
|
|
178
|
-
creator_user_name: str = None
|
|
179
|
-
definition: str = None
|
|
180
|
-
description: str = None
|
|
181
|
-
is_default: bool = None
|
|
182
|
-
max_clusters_per_user: int = None
|
|
183
|
-
name: str = None
|
|
184
|
-
policy_family_definition_overrides: str = None
|
|
185
|
-
policy_family_id: str = None
|
|
186
|
-
policy_id: str = None
|
|
187
|
-
|
|
188
|
-
def as_dict(self) -> dict:
|
|
189
|
-
body = {}
|
|
190
|
-
if self.created_at_timestamp: body['created_at_timestamp'] = self.created_at_timestamp
|
|
191
|
-
if self.creator_user_name: body['creator_user_name'] = self.creator_user_name
|
|
192
|
-
if self.definition: body['definition'] = self.definition
|
|
193
|
-
if self.description: body['description'] = self.description
|
|
194
|
-
if self.is_default: body['is_default'] = self.is_default
|
|
195
|
-
if self.max_clusters_per_user: body['max_clusters_per_user'] = self.max_clusters_per_user
|
|
196
|
-
if self.name: body['name'] = self.name
|
|
197
|
-
if self.policy_family_definition_overrides:
|
|
198
|
-
body['policy_family_definition_overrides'] = self.policy_family_definition_overrides
|
|
199
|
-
if self.policy_family_id: body['policy_family_id'] = self.policy_family_id
|
|
200
|
-
if self.policy_id: body['policy_id'] = self.policy_id
|
|
201
|
-
return body
|
|
202
|
-
|
|
203
|
-
@classmethod
|
|
204
|
-
def from_dict(cls, d: Dict[str, any]) -> 'Policy':
|
|
205
|
-
return cls(created_at_timestamp=d.get('created_at_timestamp', None),
|
|
206
|
-
creator_user_name=d.get('creator_user_name', None),
|
|
207
|
-
definition=d.get('definition', None),
|
|
208
|
-
description=d.get('description', None),
|
|
209
|
-
is_default=d.get('is_default', None),
|
|
210
|
-
max_clusters_per_user=d.get('max_clusters_per_user', None),
|
|
211
|
-
name=d.get('name', None),
|
|
212
|
-
policy_family_definition_overrides=d.get('policy_family_definition_overrides', None),
|
|
213
|
-
policy_family_id=d.get('policy_family_id', None),
|
|
214
|
-
policy_id=d.get('policy_id', None))
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
@dataclass
|
|
218
|
-
class PolicyFamily:
|
|
219
|
-
policy_family_id: str
|
|
220
|
-
name: str
|
|
221
|
-
description: str
|
|
222
|
-
definition: str
|
|
223
|
-
|
|
224
|
-
def as_dict(self) -> dict:
|
|
225
|
-
body = {}
|
|
226
|
-
if self.definition: body['definition'] = self.definition
|
|
227
|
-
if self.description: body['description'] = self.description
|
|
228
|
-
if self.name: body['name'] = self.name
|
|
229
|
-
if self.policy_family_id: body['policy_family_id'] = self.policy_family_id
|
|
230
|
-
return body
|
|
231
|
-
|
|
232
|
-
@classmethod
|
|
233
|
-
def from_dict(cls, d: Dict[str, any]) -> 'PolicyFamily':
|
|
234
|
-
return cls(definition=d.get('definition', None),
|
|
235
|
-
description=d.get('description', None),
|
|
236
|
-
name=d.get('name', None),
|
|
237
|
-
policy_family_id=d.get('policy_family_id', None))
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
class ClusterPoliciesAPI:
|
|
241
|
-
"""Cluster policy limits the ability to configure clusters based on a set of rules. The policy rules limit
|
|
242
|
-
the attributes or attribute values available for cluster creation. Cluster policies have ACLs that limit
|
|
243
|
-
their use to specific users and groups.
|
|
244
|
-
|
|
245
|
-
Cluster policies let you limit users to create clusters with prescribed settings, simplify the user
|
|
246
|
-
interface and enable more users to create their own clusters (by fixing and hiding some values), control
|
|
247
|
-
cost by limiting per cluster maximum cost (by setting limits on attributes whose values contribute to
|
|
248
|
-
hourly price).
|
|
249
|
-
|
|
250
|
-
Cluster policy permissions limit which policies a user can select in the Policy drop-down when the user
|
|
251
|
-
creates a cluster: - A user who has cluster create permission can select the Unrestricted policy and
|
|
252
|
-
create fully-configurable clusters. - A user who has both cluster create permission and access to cluster
|
|
253
|
-
policies can select the Unrestricted policy and policies they have access to. - A user that has access to
|
|
254
|
-
only cluster policies, can select the policies they have access to.
|
|
255
|
-
|
|
256
|
-
If no policies have been created in the workspace, the Policy drop-down does not display.
|
|
257
|
-
|
|
258
|
-
Only admin users can create, edit, and delete policies. Admin users also have access to all policies."""
|
|
259
|
-
|
|
260
|
-
def __init__(self, api_client):
|
|
261
|
-
self._api = api_client
|
|
262
|
-
|
|
263
|
-
def create(self,
|
|
264
|
-
name: str,
|
|
265
|
-
*,
|
|
266
|
-
definition: str = None,
|
|
267
|
-
description: str = None,
|
|
268
|
-
max_clusters_per_user: int = None,
|
|
269
|
-
policy_family_definition_overrides: str = None,
|
|
270
|
-
policy_family_id: str = None,
|
|
271
|
-
**kwargs) -> CreatePolicyResponse:
|
|
272
|
-
"""Create a new policy.
|
|
273
|
-
|
|
274
|
-
Creates a new policy with prescribed settings."""
|
|
275
|
-
request = kwargs.get('request', None)
|
|
276
|
-
if not request: # request is not given through keyed args
|
|
277
|
-
request = CreatePolicy(definition=definition,
|
|
278
|
-
description=description,
|
|
279
|
-
max_clusters_per_user=max_clusters_per_user,
|
|
280
|
-
name=name,
|
|
281
|
-
policy_family_definition_overrides=policy_family_definition_overrides,
|
|
282
|
-
policy_family_id=policy_family_id)
|
|
283
|
-
body = request.as_dict()
|
|
284
|
-
|
|
285
|
-
json = self._api.do('POST', '/api/2.0/policies/clusters/create', body=body)
|
|
286
|
-
return CreatePolicyResponse.from_dict(json)
|
|
287
|
-
|
|
288
|
-
def delete(self, policy_id: str, **kwargs):
|
|
289
|
-
"""Delete a cluster policy.
|
|
290
|
-
|
|
291
|
-
Delete a policy for a cluster. Clusters governed by this policy can still run, but cannot be edited."""
|
|
292
|
-
request = kwargs.get('request', None)
|
|
293
|
-
if not request: # request is not given through keyed args
|
|
294
|
-
request = DeletePolicy(policy_id=policy_id)
|
|
295
|
-
body = request.as_dict()
|
|
296
|
-
self._api.do('POST', '/api/2.0/policies/clusters/delete', body=body)
|
|
297
|
-
|
|
298
|
-
def edit(self,
|
|
299
|
-
policy_id: str,
|
|
300
|
-
name: str,
|
|
301
|
-
*,
|
|
302
|
-
definition: str = None,
|
|
303
|
-
description: str = None,
|
|
304
|
-
max_clusters_per_user: int = None,
|
|
305
|
-
policy_family_definition_overrides: str = None,
|
|
306
|
-
policy_family_id: str = None,
|
|
307
|
-
**kwargs):
|
|
308
|
-
"""Update a cluster policy.
|
|
309
|
-
|
|
310
|
-
Update an existing policy for cluster. This operation may make some clusters governed by the previous
|
|
311
|
-
policy invalid."""
|
|
312
|
-
request = kwargs.get('request', None)
|
|
313
|
-
if not request: # request is not given through keyed args
|
|
314
|
-
request = EditPolicy(definition=definition,
|
|
315
|
-
description=description,
|
|
316
|
-
max_clusters_per_user=max_clusters_per_user,
|
|
317
|
-
name=name,
|
|
318
|
-
policy_family_definition_overrides=policy_family_definition_overrides,
|
|
319
|
-
policy_family_id=policy_family_id,
|
|
320
|
-
policy_id=policy_id)
|
|
321
|
-
body = request.as_dict()
|
|
322
|
-
self._api.do('POST', '/api/2.0/policies/clusters/edit', body=body)
|
|
323
|
-
|
|
324
|
-
def get(self, policy_id: str, **kwargs) -> Policy:
|
|
325
|
-
"""Get entity.
|
|
326
|
-
|
|
327
|
-
Get a cluster policy entity. Creation and editing is available to admins only."""
|
|
328
|
-
request = kwargs.get('request', None)
|
|
329
|
-
if not request: # request is not given through keyed args
|
|
330
|
-
request = Get(policy_id=policy_id)
|
|
331
|
-
|
|
332
|
-
query = {}
|
|
333
|
-
if policy_id: query['policy_id'] = request.policy_id
|
|
334
|
-
|
|
335
|
-
json = self._api.do('GET', '/api/2.0/policies/clusters/get', query=query)
|
|
336
|
-
return Policy.from_dict(json)
|
|
337
|
-
|
|
338
|
-
def list(self,
|
|
339
|
-
*,
|
|
340
|
-
sort_column: ListSortColumn = None,
|
|
341
|
-
sort_order: ListSortOrder = None,
|
|
342
|
-
**kwargs) -> Iterator[Policy]:
|
|
343
|
-
"""Get a cluster policy.
|
|
344
|
-
|
|
345
|
-
Returns a list of policies accessible by the requesting user."""
|
|
346
|
-
request = kwargs.get('request', None)
|
|
347
|
-
if not request: # request is not given through keyed args
|
|
348
|
-
request = ListRequest(sort_column=sort_column, sort_order=sort_order)
|
|
349
|
-
|
|
350
|
-
query = {}
|
|
351
|
-
if sort_column: query['sort_column'] = request.sort_column.value
|
|
352
|
-
if sort_order: query['sort_order'] = request.sort_order.value
|
|
353
|
-
|
|
354
|
-
json = self._api.do('GET', '/api/2.0/policies/clusters/list', query=query)
|
|
355
|
-
return [Policy.from_dict(v) for v in json.get('policies', [])]
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
class PolicyFamiliesAPI:
|
|
359
|
-
"""View available policy families. A policy family contains a policy definition providing best practices for
|
|
360
|
-
configuring clusters for a particular use case.
|
|
361
|
-
|
|
362
|
-
Databricks manages and provides policy families for several common cluster use cases. You cannot create,
|
|
363
|
-
edit, or delete policy families.
|
|
364
|
-
|
|
365
|
-
Policy families cannot be used directly to create clusters. Instead, you create cluster policies using a
|
|
366
|
-
policy family. Cluster policies created using a policy family inherit the policy family's policy
|
|
367
|
-
definition."""
|
|
368
|
-
|
|
369
|
-
def __init__(self, api_client):
|
|
370
|
-
self._api = api_client
|
|
371
|
-
|
|
372
|
-
def get(self, policy_family_id: str, **kwargs) -> PolicyFamily:
|
|
373
|
-
|
|
374
|
-
request = kwargs.get('request', None)
|
|
375
|
-
if not request: # request is not given through keyed args
|
|
376
|
-
request = GetPolicyFamilyRequest(policy_family_id=policy_family_id)
|
|
377
|
-
|
|
378
|
-
json = self._api.do('GET', f'/api/2.0/policy-families/{request.policy_family_id}')
|
|
379
|
-
return PolicyFamily.from_dict(json)
|
|
380
|
-
|
|
381
|
-
def list(self, *, max_results: int = None, page_token: str = None, **kwargs) -> Iterator[PolicyFamily]:
|
|
382
|
-
|
|
383
|
-
request = kwargs.get('request', None)
|
|
384
|
-
if not request: # request is not given through keyed args
|
|
385
|
-
request = ListPolicyFamiliesRequest(max_results=max_results, page_token=page_token)
|
|
386
|
-
|
|
387
|
-
query = {}
|
|
388
|
-
if max_results: query['max_results'] = request.max_results
|
|
389
|
-
if page_token: query['page_token'] = request.page_token
|
|
390
|
-
|
|
391
|
-
while True:
|
|
392
|
-
json = self._api.do('GET', '/api/2.0/policy-families', query=query)
|
|
393
|
-
if 'policy_families' not in json or not json['policy_families']:
|
|
394
|
-
return
|
|
395
|
-
for v in json['policy_families']:
|
|
396
|
-
yield PolicyFamily.from_dict(v)
|
|
397
|
-
if 'next_page_token' not in json or not json['next_page_token']:
|
|
398
|
-
return
|
|
399
|
-
query['page_token'] = json['next_page_token']
|