databricks-sdk 0.38.0__py3-none-any.whl → 0.40.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 +36 -1
- databricks/sdk/mixins/open_ai_client.py +2 -2
- databricks/sdk/service/apps.py +175 -0
- databricks/sdk/service/billing.py +247 -0
- databricks/sdk/service/catalog.py +1795 -62
- databricks/sdk/service/cleanrooms.py +1281 -0
- databricks/sdk/service/compute.py +1843 -67
- databricks/sdk/service/dashboards.py +342 -3
- databricks/sdk/service/files.py +162 -2
- databricks/sdk/service/iam.py +351 -0
- databricks/sdk/service/jobs.py +1355 -24
- databricks/sdk/service/marketplace.py +688 -0
- databricks/sdk/service/ml.py +1038 -2
- databricks/sdk/service/oauth2.py +636 -0
- databricks/sdk/service/pipelines.py +524 -4
- databricks/sdk/service/provisioning.py +387 -0
- databricks/sdk/service/serving.py +615 -0
- databricks/sdk/service/settings.py +1186 -1
- databricks/sdk/service/sharing.py +326 -2
- databricks/sdk/service/sql.py +1186 -2
- databricks/sdk/service/vectorsearch.py +290 -0
- databricks/sdk/service/workspace.py +451 -0
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/METADATA +26 -26
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/RECORD +29 -28
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/WHEEL +1 -1
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.38.0.dist-info → databricks_sdk-0.40.0.dist-info}/top_level.txt +0 -0
databricks/sdk/service/oauth2.py
CHANGED
|
@@ -41,6 +41,16 @@ class CreateCustomAppIntegration:
|
|
|
41
41
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
42
42
|
return body
|
|
43
43
|
|
|
44
|
+
def as_shallow_dict(self) -> dict:
|
|
45
|
+
"""Serializes the CreateCustomAppIntegration into a shallow dictionary of its immediate attributes."""
|
|
46
|
+
body = {}
|
|
47
|
+
if self.confidential is not None: body['confidential'] = self.confidential
|
|
48
|
+
if self.name is not None: body['name'] = self.name
|
|
49
|
+
if self.redirect_urls: body['redirect_urls'] = self.redirect_urls
|
|
50
|
+
if self.scopes: body['scopes'] = self.scopes
|
|
51
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
52
|
+
return body
|
|
53
|
+
|
|
44
54
|
@classmethod
|
|
45
55
|
def from_dict(cls, d: Dict[str, any]) -> CreateCustomAppIntegration:
|
|
46
56
|
"""Deserializes the CreateCustomAppIntegration from a dictionary."""
|
|
@@ -71,6 +81,14 @@ class CreateCustomAppIntegrationOutput:
|
|
|
71
81
|
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
72
82
|
return body
|
|
73
83
|
|
|
84
|
+
def as_shallow_dict(self) -> dict:
|
|
85
|
+
"""Serializes the CreateCustomAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
86
|
+
body = {}
|
|
87
|
+
if self.client_id is not None: body['client_id'] = self.client_id
|
|
88
|
+
if self.client_secret is not None: body['client_secret'] = self.client_secret
|
|
89
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
90
|
+
return body
|
|
91
|
+
|
|
74
92
|
@classmethod
|
|
75
93
|
def from_dict(cls, d: Dict[str, any]) -> CreateCustomAppIntegrationOutput:
|
|
76
94
|
"""Deserializes the CreateCustomAppIntegrationOutput from a dictionary."""
|
|
@@ -94,6 +112,13 @@ class CreatePublishedAppIntegration:
|
|
|
94
112
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
95
113
|
return body
|
|
96
114
|
|
|
115
|
+
def as_shallow_dict(self) -> dict:
|
|
116
|
+
"""Serializes the CreatePublishedAppIntegration into a shallow dictionary of its immediate attributes."""
|
|
117
|
+
body = {}
|
|
118
|
+
if self.app_id is not None: body['app_id'] = self.app_id
|
|
119
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
120
|
+
return body
|
|
121
|
+
|
|
97
122
|
@classmethod
|
|
98
123
|
def from_dict(cls, d: Dict[str, any]) -> CreatePublishedAppIntegration:
|
|
99
124
|
"""Deserializes the CreatePublishedAppIntegration from a dictionary."""
|
|
@@ -112,6 +137,12 @@ class CreatePublishedAppIntegrationOutput:
|
|
|
112
137
|
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
113
138
|
return body
|
|
114
139
|
|
|
140
|
+
def as_shallow_dict(self) -> dict:
|
|
141
|
+
"""Serializes the CreatePublishedAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
142
|
+
body = {}
|
|
143
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
144
|
+
return body
|
|
145
|
+
|
|
115
146
|
@classmethod
|
|
116
147
|
def from_dict(cls, d: Dict[str, any]) -> CreatePublishedAppIntegrationOutput:
|
|
117
148
|
"""Deserializes the CreatePublishedAppIntegrationOutput from a dictionary."""
|
|
@@ -149,6 +180,17 @@ class CreateServicePrincipalSecretResponse:
|
|
|
149
180
|
if self.update_time is not None: body['update_time'] = self.update_time
|
|
150
181
|
return body
|
|
151
182
|
|
|
183
|
+
def as_shallow_dict(self) -> dict:
|
|
184
|
+
"""Serializes the CreateServicePrincipalSecretResponse into a shallow dictionary of its immediate attributes."""
|
|
185
|
+
body = {}
|
|
186
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
187
|
+
if self.id is not None: body['id'] = self.id
|
|
188
|
+
if self.secret is not None: body['secret'] = self.secret
|
|
189
|
+
if self.secret_hash is not None: body['secret_hash'] = self.secret_hash
|
|
190
|
+
if self.status is not None: body['status'] = self.status
|
|
191
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
192
|
+
return body
|
|
193
|
+
|
|
152
194
|
@classmethod
|
|
153
195
|
def from_dict(cls, d: Dict[str, any]) -> CreateServicePrincipalSecretResponse:
|
|
154
196
|
"""Deserializes the CreateServicePrincipalSecretResponse from a dictionary."""
|
|
@@ -175,6 +217,13 @@ class DataPlaneInfo:
|
|
|
175
217
|
if self.endpoint_url is not None: body['endpoint_url'] = self.endpoint_url
|
|
176
218
|
return body
|
|
177
219
|
|
|
220
|
+
def as_shallow_dict(self) -> dict:
|
|
221
|
+
"""Serializes the DataPlaneInfo into a shallow dictionary of its immediate attributes."""
|
|
222
|
+
body = {}
|
|
223
|
+
if self.authorization_details is not None: body['authorization_details'] = self.authorization_details
|
|
224
|
+
if self.endpoint_url is not None: body['endpoint_url'] = self.endpoint_url
|
|
225
|
+
return body
|
|
226
|
+
|
|
178
227
|
@classmethod
|
|
179
228
|
def from_dict(cls, d: Dict[str, any]) -> DataPlaneInfo:
|
|
180
229
|
"""Deserializes the DataPlaneInfo from a dictionary."""
|
|
@@ -190,6 +239,11 @@ class DeleteCustomAppIntegrationOutput:
|
|
|
190
239
|
body = {}
|
|
191
240
|
return body
|
|
192
241
|
|
|
242
|
+
def as_shallow_dict(self) -> dict:
|
|
243
|
+
"""Serializes the DeleteCustomAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
244
|
+
body = {}
|
|
245
|
+
return body
|
|
246
|
+
|
|
193
247
|
@classmethod
|
|
194
248
|
def from_dict(cls, d: Dict[str, any]) -> DeleteCustomAppIntegrationOutput:
|
|
195
249
|
"""Deserializes the DeleteCustomAppIntegrationOutput from a dictionary."""
|
|
@@ -204,6 +258,11 @@ class DeletePublishedAppIntegrationOutput:
|
|
|
204
258
|
body = {}
|
|
205
259
|
return body
|
|
206
260
|
|
|
261
|
+
def as_shallow_dict(self) -> dict:
|
|
262
|
+
"""Serializes the DeletePublishedAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
263
|
+
body = {}
|
|
264
|
+
return body
|
|
265
|
+
|
|
207
266
|
@classmethod
|
|
208
267
|
def from_dict(cls, d: Dict[str, any]) -> DeletePublishedAppIntegrationOutput:
|
|
209
268
|
"""Deserializes the DeletePublishedAppIntegrationOutput from a dictionary."""
|
|
@@ -218,12 +277,71 @@ class DeleteResponse:
|
|
|
218
277
|
body = {}
|
|
219
278
|
return body
|
|
220
279
|
|
|
280
|
+
def as_shallow_dict(self) -> dict:
|
|
281
|
+
"""Serializes the DeleteResponse into a shallow dictionary of its immediate attributes."""
|
|
282
|
+
body = {}
|
|
283
|
+
return body
|
|
284
|
+
|
|
221
285
|
@classmethod
|
|
222
286
|
def from_dict(cls, d: Dict[str, any]) -> DeleteResponse:
|
|
223
287
|
"""Deserializes the DeleteResponse from a dictionary."""
|
|
224
288
|
return cls()
|
|
225
289
|
|
|
226
290
|
|
|
291
|
+
@dataclass
|
|
292
|
+
class FederationPolicy:
|
|
293
|
+
create_time: Optional[str] = None
|
|
294
|
+
"""Creation time of the federation policy."""
|
|
295
|
+
|
|
296
|
+
description: Optional[str] = None
|
|
297
|
+
"""Description of the federation policy."""
|
|
298
|
+
|
|
299
|
+
name: Optional[str] = None
|
|
300
|
+
"""Name of the federation policy. The name must contain only lowercase alphanumeric characters,
|
|
301
|
+
numbers, and hyphens. It must be unique within the account."""
|
|
302
|
+
|
|
303
|
+
oidc_policy: Optional[OidcFederationPolicy] = None
|
|
304
|
+
"""Specifies the policy to use for validating OIDC claims in your federated tokens."""
|
|
305
|
+
|
|
306
|
+
uid: Optional[str] = None
|
|
307
|
+
"""Unique, immutable id of the federation policy."""
|
|
308
|
+
|
|
309
|
+
update_time: Optional[str] = None
|
|
310
|
+
"""Last update time of the federation policy."""
|
|
311
|
+
|
|
312
|
+
def as_dict(self) -> dict:
|
|
313
|
+
"""Serializes the FederationPolicy into a dictionary suitable for use as a JSON request body."""
|
|
314
|
+
body = {}
|
|
315
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
316
|
+
if self.description is not None: body['description'] = self.description
|
|
317
|
+
if self.name is not None: body['name'] = self.name
|
|
318
|
+
if self.oidc_policy: body['oidc_policy'] = self.oidc_policy.as_dict()
|
|
319
|
+
if self.uid is not None: body['uid'] = self.uid
|
|
320
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
321
|
+
return body
|
|
322
|
+
|
|
323
|
+
def as_shallow_dict(self) -> dict:
|
|
324
|
+
"""Serializes the FederationPolicy into a shallow dictionary of its immediate attributes."""
|
|
325
|
+
body = {}
|
|
326
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
327
|
+
if self.description is not None: body['description'] = self.description
|
|
328
|
+
if self.name is not None: body['name'] = self.name
|
|
329
|
+
if self.oidc_policy: body['oidc_policy'] = self.oidc_policy
|
|
330
|
+
if self.uid is not None: body['uid'] = self.uid
|
|
331
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
332
|
+
return body
|
|
333
|
+
|
|
334
|
+
@classmethod
|
|
335
|
+
def from_dict(cls, d: Dict[str, any]) -> FederationPolicy:
|
|
336
|
+
"""Deserializes the FederationPolicy from a dictionary."""
|
|
337
|
+
return cls(create_time=d.get('create_time', None),
|
|
338
|
+
description=d.get('description', None),
|
|
339
|
+
name=d.get('name', None),
|
|
340
|
+
oidc_policy=_from_dict(d, 'oidc_policy', OidcFederationPolicy),
|
|
341
|
+
uid=d.get('uid', None),
|
|
342
|
+
update_time=d.get('update_time', None))
|
|
343
|
+
|
|
344
|
+
|
|
227
345
|
@dataclass
|
|
228
346
|
class GetCustomAppIntegrationOutput:
|
|
229
347
|
client_id: Optional[str] = None
|
|
@@ -267,6 +385,21 @@ class GetCustomAppIntegrationOutput:
|
|
|
267
385
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
268
386
|
return body
|
|
269
387
|
|
|
388
|
+
def as_shallow_dict(self) -> dict:
|
|
389
|
+
"""Serializes the GetCustomAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
390
|
+
body = {}
|
|
391
|
+
if self.client_id is not None: body['client_id'] = self.client_id
|
|
392
|
+
if self.confidential is not None: body['confidential'] = self.confidential
|
|
393
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
394
|
+
if self.created_by is not None: body['created_by'] = self.created_by
|
|
395
|
+
if self.creator_username is not None: body['creator_username'] = self.creator_username
|
|
396
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
397
|
+
if self.name is not None: body['name'] = self.name
|
|
398
|
+
if self.redirect_urls: body['redirect_urls'] = self.redirect_urls
|
|
399
|
+
if self.scopes: body['scopes'] = self.scopes
|
|
400
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
401
|
+
return body
|
|
402
|
+
|
|
270
403
|
@classmethod
|
|
271
404
|
def from_dict(cls, d: Dict[str, any]) -> GetCustomAppIntegrationOutput:
|
|
272
405
|
"""Deserializes the GetCustomAppIntegrationOutput from a dictionary."""
|
|
@@ -296,6 +429,13 @@ class GetCustomAppIntegrationsOutput:
|
|
|
296
429
|
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
297
430
|
return body
|
|
298
431
|
|
|
432
|
+
def as_shallow_dict(self) -> dict:
|
|
433
|
+
"""Serializes the GetCustomAppIntegrationsOutput into a shallow dictionary of its immediate attributes."""
|
|
434
|
+
body = {}
|
|
435
|
+
if self.apps: body['apps'] = self.apps
|
|
436
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
437
|
+
return body
|
|
438
|
+
|
|
299
439
|
@classmethod
|
|
300
440
|
def from_dict(cls, d: Dict[str, any]) -> GetCustomAppIntegrationsOutput:
|
|
301
441
|
"""Deserializes the GetCustomAppIntegrationsOutput from a dictionary."""
|
|
@@ -332,6 +472,17 @@ class GetPublishedAppIntegrationOutput:
|
|
|
332
472
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
333
473
|
return body
|
|
334
474
|
|
|
475
|
+
def as_shallow_dict(self) -> dict:
|
|
476
|
+
"""Serializes the GetPublishedAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
477
|
+
body = {}
|
|
478
|
+
if self.app_id is not None: body['app_id'] = self.app_id
|
|
479
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
480
|
+
if self.created_by is not None: body['created_by'] = self.created_by
|
|
481
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
482
|
+
if self.name is not None: body['name'] = self.name
|
|
483
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
484
|
+
return body
|
|
485
|
+
|
|
335
486
|
@classmethod
|
|
336
487
|
def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppIntegrationOutput:
|
|
337
488
|
"""Deserializes the GetPublishedAppIntegrationOutput from a dictionary."""
|
|
@@ -357,6 +508,13 @@ class GetPublishedAppIntegrationsOutput:
|
|
|
357
508
|
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
358
509
|
return body
|
|
359
510
|
|
|
511
|
+
def as_shallow_dict(self) -> dict:
|
|
512
|
+
"""Serializes the GetPublishedAppIntegrationsOutput into a shallow dictionary of its immediate attributes."""
|
|
513
|
+
body = {}
|
|
514
|
+
if self.apps: body['apps'] = self.apps
|
|
515
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
516
|
+
return body
|
|
517
|
+
|
|
360
518
|
@classmethod
|
|
361
519
|
def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppIntegrationsOutput:
|
|
362
520
|
"""Deserializes the GetPublishedAppIntegrationsOutput from a dictionary."""
|
|
@@ -380,6 +538,13 @@ class GetPublishedAppsOutput:
|
|
|
380
538
|
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
381
539
|
return body
|
|
382
540
|
|
|
541
|
+
def as_shallow_dict(self) -> dict:
|
|
542
|
+
"""Serializes the GetPublishedAppsOutput into a shallow dictionary of its immediate attributes."""
|
|
543
|
+
body = {}
|
|
544
|
+
if self.apps: body['apps'] = self.apps
|
|
545
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
546
|
+
return body
|
|
547
|
+
|
|
383
548
|
@classmethod
|
|
384
549
|
def from_dict(cls, d: Dict[str, any]) -> GetPublishedAppsOutput:
|
|
385
550
|
"""Deserializes the GetPublishedAppsOutput from a dictionary."""
|
|
@@ -387,6 +552,33 @@ class GetPublishedAppsOutput:
|
|
|
387
552
|
next_page_token=d.get('next_page_token', None))
|
|
388
553
|
|
|
389
554
|
|
|
555
|
+
@dataclass
|
|
556
|
+
class ListFederationPoliciesResponse:
|
|
557
|
+
next_page_token: Optional[str] = None
|
|
558
|
+
|
|
559
|
+
policies: Optional[List[FederationPolicy]] = None
|
|
560
|
+
|
|
561
|
+
def as_dict(self) -> dict:
|
|
562
|
+
"""Serializes the ListFederationPoliciesResponse into a dictionary suitable for use as a JSON request body."""
|
|
563
|
+
body = {}
|
|
564
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
565
|
+
if self.policies: body['policies'] = [v.as_dict() for v in self.policies]
|
|
566
|
+
return body
|
|
567
|
+
|
|
568
|
+
def as_shallow_dict(self) -> dict:
|
|
569
|
+
"""Serializes the ListFederationPoliciesResponse into a shallow dictionary of its immediate attributes."""
|
|
570
|
+
body = {}
|
|
571
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
572
|
+
if self.policies: body['policies'] = self.policies
|
|
573
|
+
return body
|
|
574
|
+
|
|
575
|
+
@classmethod
|
|
576
|
+
def from_dict(cls, d: Dict[str, any]) -> ListFederationPoliciesResponse:
|
|
577
|
+
"""Deserializes the ListFederationPoliciesResponse from a dictionary."""
|
|
578
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
579
|
+
policies=_repeated_dict(d, 'policies', FederationPolicy))
|
|
580
|
+
|
|
581
|
+
|
|
390
582
|
@dataclass
|
|
391
583
|
class ListServicePrincipalSecretsResponse:
|
|
392
584
|
next_page_token: Optional[str] = None
|
|
@@ -402,6 +594,13 @@ class ListServicePrincipalSecretsResponse:
|
|
|
402
594
|
if self.secrets: body['secrets'] = [v.as_dict() for v in self.secrets]
|
|
403
595
|
return body
|
|
404
596
|
|
|
597
|
+
def as_shallow_dict(self) -> dict:
|
|
598
|
+
"""Serializes the ListServicePrincipalSecretsResponse into a shallow dictionary of its immediate attributes."""
|
|
599
|
+
body = {}
|
|
600
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
601
|
+
if self.secrets: body['secrets'] = self.secrets
|
|
602
|
+
return body
|
|
603
|
+
|
|
405
604
|
@classmethod
|
|
406
605
|
def from_dict(cls, d: Dict[str, any]) -> ListServicePrincipalSecretsResponse:
|
|
407
606
|
"""Deserializes the ListServicePrincipalSecretsResponse from a dictionary."""
|
|
@@ -409,6 +608,64 @@ class ListServicePrincipalSecretsResponse:
|
|
|
409
608
|
secrets=_repeated_dict(d, 'secrets', SecretInfo))
|
|
410
609
|
|
|
411
610
|
|
|
611
|
+
@dataclass
|
|
612
|
+
class OidcFederationPolicy:
|
|
613
|
+
"""Specifies the policy to use for validating OIDC claims in your federated tokens."""
|
|
614
|
+
|
|
615
|
+
audiences: Optional[List[str]] = None
|
|
616
|
+
"""The allowed token audiences, as specified in the 'aud' claim of federated tokens. The audience
|
|
617
|
+
identifier is intended to represent the recipient of the token. Can be any non-empty string
|
|
618
|
+
value. As long as the audience in the token matches at least one audience in the policy, the
|
|
619
|
+
token is considered a match. If audiences is unspecified, defaults to your Databricks account
|
|
620
|
+
id."""
|
|
621
|
+
|
|
622
|
+
issuer: Optional[str] = None
|
|
623
|
+
"""The required token issuer, as specified in the 'iss' claim of federated tokens."""
|
|
624
|
+
|
|
625
|
+
jwks_json: Optional[str] = None
|
|
626
|
+
"""The public keys used to validate the signature of federated tokens, in JWKS format. If
|
|
627
|
+
unspecified (recommended), Databricks automatically fetches the public keys from your issuer’s
|
|
628
|
+
well known endpoint. Databricks strongly recommends relying on your issuer’s well known
|
|
629
|
+
endpoint for discovering public keys."""
|
|
630
|
+
|
|
631
|
+
subject: Optional[str] = None
|
|
632
|
+
"""The required token subject, as specified in the subject claim of federated tokens. Must be
|
|
633
|
+
specified for service principal federation policies. Must not be specified for account
|
|
634
|
+
federation policies."""
|
|
635
|
+
|
|
636
|
+
subject_claim: Optional[str] = None
|
|
637
|
+
"""The claim that contains the subject of the token. If unspecified, the default value is 'sub'."""
|
|
638
|
+
|
|
639
|
+
def as_dict(self) -> dict:
|
|
640
|
+
"""Serializes the OidcFederationPolicy into a dictionary suitable for use as a JSON request body."""
|
|
641
|
+
body = {}
|
|
642
|
+
if self.audiences: body['audiences'] = [v for v in self.audiences]
|
|
643
|
+
if self.issuer is not None: body['issuer'] = self.issuer
|
|
644
|
+
if self.jwks_json is not None: body['jwks_json'] = self.jwks_json
|
|
645
|
+
if self.subject is not None: body['subject'] = self.subject
|
|
646
|
+
if self.subject_claim is not None: body['subject_claim'] = self.subject_claim
|
|
647
|
+
return body
|
|
648
|
+
|
|
649
|
+
def as_shallow_dict(self) -> dict:
|
|
650
|
+
"""Serializes the OidcFederationPolicy into a shallow dictionary of its immediate attributes."""
|
|
651
|
+
body = {}
|
|
652
|
+
if self.audiences: body['audiences'] = self.audiences
|
|
653
|
+
if self.issuer is not None: body['issuer'] = self.issuer
|
|
654
|
+
if self.jwks_json is not None: body['jwks_json'] = self.jwks_json
|
|
655
|
+
if self.subject is not None: body['subject'] = self.subject
|
|
656
|
+
if self.subject_claim is not None: body['subject_claim'] = self.subject_claim
|
|
657
|
+
return body
|
|
658
|
+
|
|
659
|
+
@classmethod
|
|
660
|
+
def from_dict(cls, d: Dict[str, any]) -> OidcFederationPolicy:
|
|
661
|
+
"""Deserializes the OidcFederationPolicy from a dictionary."""
|
|
662
|
+
return cls(audiences=d.get('audiences', None),
|
|
663
|
+
issuer=d.get('issuer', None),
|
|
664
|
+
jwks_json=d.get('jwks_json', None),
|
|
665
|
+
subject=d.get('subject', None),
|
|
666
|
+
subject_claim=d.get('subject_claim', None))
|
|
667
|
+
|
|
668
|
+
|
|
412
669
|
@dataclass
|
|
413
670
|
class PublishedAppOutput:
|
|
414
671
|
app_id: Optional[str] = None
|
|
@@ -446,6 +703,19 @@ class PublishedAppOutput:
|
|
|
446
703
|
if self.scopes: body['scopes'] = [v for v in self.scopes]
|
|
447
704
|
return body
|
|
448
705
|
|
|
706
|
+
def as_shallow_dict(self) -> dict:
|
|
707
|
+
"""Serializes the PublishedAppOutput into a shallow dictionary of its immediate attributes."""
|
|
708
|
+
body = {}
|
|
709
|
+
if self.app_id is not None: body['app_id'] = self.app_id
|
|
710
|
+
if self.client_id is not None: body['client_id'] = self.client_id
|
|
711
|
+
if self.description is not None: body['description'] = self.description
|
|
712
|
+
if self.is_confidential_client is not None:
|
|
713
|
+
body['is_confidential_client'] = self.is_confidential_client
|
|
714
|
+
if self.name is not None: body['name'] = self.name
|
|
715
|
+
if self.redirect_urls: body['redirect_urls'] = self.redirect_urls
|
|
716
|
+
if self.scopes: body['scopes'] = self.scopes
|
|
717
|
+
return body
|
|
718
|
+
|
|
449
719
|
@classmethod
|
|
450
720
|
def from_dict(cls, d: Dict[str, any]) -> PublishedAppOutput:
|
|
451
721
|
"""Deserializes the PublishedAppOutput from a dictionary."""
|
|
@@ -485,6 +755,16 @@ class SecretInfo:
|
|
|
485
755
|
if self.update_time is not None: body['update_time'] = self.update_time
|
|
486
756
|
return body
|
|
487
757
|
|
|
758
|
+
def as_shallow_dict(self) -> dict:
|
|
759
|
+
"""Serializes the SecretInfo into a shallow dictionary of its immediate attributes."""
|
|
760
|
+
body = {}
|
|
761
|
+
if self.create_time is not None: body['create_time'] = self.create_time
|
|
762
|
+
if self.id is not None: body['id'] = self.id
|
|
763
|
+
if self.secret_hash is not None: body['secret_hash'] = self.secret_hash
|
|
764
|
+
if self.status is not None: body['status'] = self.status
|
|
765
|
+
if self.update_time is not None: body['update_time'] = self.update_time
|
|
766
|
+
return body
|
|
767
|
+
|
|
488
768
|
@classmethod
|
|
489
769
|
def from_dict(cls, d: Dict[str, any]) -> SecretInfo:
|
|
490
770
|
"""Deserializes the SecretInfo from a dictionary."""
|
|
@@ -512,6 +792,15 @@ class TokenAccessPolicy:
|
|
|
512
792
|
body['refresh_token_ttl_in_minutes'] = self.refresh_token_ttl_in_minutes
|
|
513
793
|
return body
|
|
514
794
|
|
|
795
|
+
def as_shallow_dict(self) -> dict:
|
|
796
|
+
"""Serializes the TokenAccessPolicy into a shallow dictionary of its immediate attributes."""
|
|
797
|
+
body = {}
|
|
798
|
+
if self.access_token_ttl_in_minutes is not None:
|
|
799
|
+
body['access_token_ttl_in_minutes'] = self.access_token_ttl_in_minutes
|
|
800
|
+
if self.refresh_token_ttl_in_minutes is not None:
|
|
801
|
+
body['refresh_token_ttl_in_minutes'] = self.refresh_token_ttl_in_minutes
|
|
802
|
+
return body
|
|
803
|
+
|
|
515
804
|
@classmethod
|
|
516
805
|
def from_dict(cls, d: Dict[str, any]) -> TokenAccessPolicy:
|
|
517
806
|
"""Deserializes the TokenAccessPolicy from a dictionary."""
|
|
@@ -537,6 +826,14 @@ class UpdateCustomAppIntegration:
|
|
|
537
826
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
538
827
|
return body
|
|
539
828
|
|
|
829
|
+
def as_shallow_dict(self) -> dict:
|
|
830
|
+
"""Serializes the UpdateCustomAppIntegration into a shallow dictionary of its immediate attributes."""
|
|
831
|
+
body = {}
|
|
832
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
833
|
+
if self.redirect_urls: body['redirect_urls'] = self.redirect_urls
|
|
834
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
835
|
+
return body
|
|
836
|
+
|
|
540
837
|
@classmethod
|
|
541
838
|
def from_dict(cls, d: Dict[str, any]) -> UpdateCustomAppIntegration:
|
|
542
839
|
"""Deserializes the UpdateCustomAppIntegration from a dictionary."""
|
|
@@ -553,6 +850,11 @@ class UpdateCustomAppIntegrationOutput:
|
|
|
553
850
|
body = {}
|
|
554
851
|
return body
|
|
555
852
|
|
|
853
|
+
def as_shallow_dict(self) -> dict:
|
|
854
|
+
"""Serializes the UpdateCustomAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
855
|
+
body = {}
|
|
856
|
+
return body
|
|
857
|
+
|
|
556
858
|
@classmethod
|
|
557
859
|
def from_dict(cls, d: Dict[str, any]) -> UpdateCustomAppIntegrationOutput:
|
|
558
860
|
"""Deserializes the UpdateCustomAppIntegrationOutput from a dictionary."""
|
|
@@ -573,6 +875,13 @@ class UpdatePublishedAppIntegration:
|
|
|
573
875
|
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy.as_dict()
|
|
574
876
|
return body
|
|
575
877
|
|
|
878
|
+
def as_shallow_dict(self) -> dict:
|
|
879
|
+
"""Serializes the UpdatePublishedAppIntegration into a shallow dictionary of its immediate attributes."""
|
|
880
|
+
body = {}
|
|
881
|
+
if self.integration_id is not None: body['integration_id'] = self.integration_id
|
|
882
|
+
if self.token_access_policy: body['token_access_policy'] = self.token_access_policy
|
|
883
|
+
return body
|
|
884
|
+
|
|
576
885
|
@classmethod
|
|
577
886
|
def from_dict(cls, d: Dict[str, any]) -> UpdatePublishedAppIntegration:
|
|
578
887
|
"""Deserializes the UpdatePublishedAppIntegration from a dictionary."""
|
|
@@ -588,12 +897,169 @@ class UpdatePublishedAppIntegrationOutput:
|
|
|
588
897
|
body = {}
|
|
589
898
|
return body
|
|
590
899
|
|
|
900
|
+
def as_shallow_dict(self) -> dict:
|
|
901
|
+
"""Serializes the UpdatePublishedAppIntegrationOutput into a shallow dictionary of its immediate attributes."""
|
|
902
|
+
body = {}
|
|
903
|
+
return body
|
|
904
|
+
|
|
591
905
|
@classmethod
|
|
592
906
|
def from_dict(cls, d: Dict[str, any]) -> UpdatePublishedAppIntegrationOutput:
|
|
593
907
|
"""Deserializes the UpdatePublishedAppIntegrationOutput from a dictionary."""
|
|
594
908
|
return cls()
|
|
595
909
|
|
|
596
910
|
|
|
911
|
+
class AccountFederationPolicyAPI:
|
|
912
|
+
"""These APIs manage account federation policies.
|
|
913
|
+
|
|
914
|
+
Account federation policies allow users and service principals in your Databricks account to securely
|
|
915
|
+
access Databricks APIs using tokens from your trusted identity providers (IdPs).
|
|
916
|
+
|
|
917
|
+
With token federation, your users and service principals can exchange tokens from your IdP for Databricks
|
|
918
|
+
OAuth tokens, which can be used to access Databricks APIs. Token federation eliminates the need to manage
|
|
919
|
+
Databricks secrets, and allows you to centralize management of token issuance policies in your IdP.
|
|
920
|
+
Databricks token federation is typically used in combination with [SCIM], so users in your IdP are
|
|
921
|
+
synchronized into your Databricks account.
|
|
922
|
+
|
|
923
|
+
Token federation is configured in your Databricks account using an account federation policy. An account
|
|
924
|
+
federation policy specifies: * which IdP, or issuer, your Databricks account should accept tokens from *
|
|
925
|
+
how to determine which Databricks user, or subject, a token is issued for
|
|
926
|
+
|
|
927
|
+
To configure a federation policy, you provide the following: * The required token __issuer__, as specified
|
|
928
|
+
in the “iss” claim of your tokens. The issuer is an https URL that identifies your IdP. * The allowed
|
|
929
|
+
token __audiences__, as specified in the “aud” claim of your tokens. This identifier is intended to
|
|
930
|
+
represent the recipient of the token. As long as the audience in the token matches at least one audience
|
|
931
|
+
in the policy, the token is considered a match. If unspecified, the default value is your Databricks
|
|
932
|
+
account id. * The __subject claim__, which indicates which token claim contains the Databricks username of
|
|
933
|
+
the user the token was issued for. If unspecified, the default value is “sub”. * Optionally, the
|
|
934
|
+
public keys used to validate the signature of your tokens, in JWKS format. If unspecified (recommended),
|
|
935
|
+
Databricks automatically fetches the public keys from your issuer’s well known endpoint. Databricks
|
|
936
|
+
strongly recommends relying on your issuer’s well known endpoint for discovering public keys.
|
|
937
|
+
|
|
938
|
+
An example federation policy is: ``` issuer: "https://idp.mycompany.com/oidc" audiences: ["databricks"]
|
|
939
|
+
subject_claim: "sub" ```
|
|
940
|
+
|
|
941
|
+
An example JWT token body that matches this policy and could be used to authenticate to Databricks as user
|
|
942
|
+
`username@mycompany.com` is: ``` { "iss": "https://idp.mycompany.com/oidc", "aud": "databricks", "sub":
|
|
943
|
+
"username@mycompany.com" } ```
|
|
944
|
+
|
|
945
|
+
You may also need to configure your IdP to generate tokens for your users to exchange with Databricks, if
|
|
946
|
+
your users do not already have the ability to generate tokens that are compatible with your federation
|
|
947
|
+
policy.
|
|
948
|
+
|
|
949
|
+
You do not need to configure an OAuth application in Databricks to use token federation.
|
|
950
|
+
|
|
951
|
+
[SCIM]: https://docs.databricks.com/admin/users-groups/scim/index.html"""
|
|
952
|
+
|
|
953
|
+
def __init__(self, api_client):
|
|
954
|
+
self._api = api_client
|
|
955
|
+
|
|
956
|
+
def create(self,
|
|
957
|
+
*,
|
|
958
|
+
policy: Optional[FederationPolicy] = None,
|
|
959
|
+
policy_id: Optional[str] = None) -> FederationPolicy:
|
|
960
|
+
"""Create account federation policy.
|
|
961
|
+
|
|
962
|
+
:param policy: :class:`FederationPolicy` (optional)
|
|
963
|
+
:param policy_id: str (optional)
|
|
964
|
+
The identifier for the federation policy. If unspecified, the id will be assigned by Databricks.
|
|
965
|
+
|
|
966
|
+
:returns: :class:`FederationPolicy`
|
|
967
|
+
"""
|
|
968
|
+
body = policy.as_dict()
|
|
969
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
970
|
+
|
|
971
|
+
res = self._api.do('POST',
|
|
972
|
+
f'/api/2.0/accounts/{self._api.account_id}/federationPolicies',
|
|
973
|
+
query=query,
|
|
974
|
+
body=body,
|
|
975
|
+
headers=headers)
|
|
976
|
+
return FederationPolicy.from_dict(res)
|
|
977
|
+
|
|
978
|
+
def delete(self, policy_id: str):
|
|
979
|
+
"""Delete account federation policy.
|
|
980
|
+
|
|
981
|
+
:param policy_id: str
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
"""
|
|
985
|
+
|
|
986
|
+
headers = {'Accept': 'application/json', }
|
|
987
|
+
|
|
988
|
+
self._api.do('DELETE',
|
|
989
|
+
f'/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}',
|
|
990
|
+
headers=headers)
|
|
991
|
+
|
|
992
|
+
def get(self, policy_id: str) -> FederationPolicy:
|
|
993
|
+
"""Get account federation policy.
|
|
994
|
+
|
|
995
|
+
:param policy_id: str
|
|
996
|
+
|
|
997
|
+
:returns: :class:`FederationPolicy`
|
|
998
|
+
"""
|
|
999
|
+
|
|
1000
|
+
headers = {'Accept': 'application/json', }
|
|
1001
|
+
|
|
1002
|
+
res = self._api.do('GET',
|
|
1003
|
+
f'/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}',
|
|
1004
|
+
headers=headers)
|
|
1005
|
+
return FederationPolicy.from_dict(res)
|
|
1006
|
+
|
|
1007
|
+
def list(self,
|
|
1008
|
+
*,
|
|
1009
|
+
page_size: Optional[int] = None,
|
|
1010
|
+
page_token: Optional[str] = None) -> Iterator[FederationPolicy]:
|
|
1011
|
+
"""List account federation policies.
|
|
1012
|
+
|
|
1013
|
+
:param page_size: int (optional)
|
|
1014
|
+
:param page_token: str (optional)
|
|
1015
|
+
|
|
1016
|
+
:returns: Iterator over :class:`FederationPolicy`
|
|
1017
|
+
"""
|
|
1018
|
+
|
|
1019
|
+
query = {}
|
|
1020
|
+
if page_size is not None: query['page_size'] = page_size
|
|
1021
|
+
if page_token is not None: query['page_token'] = page_token
|
|
1022
|
+
headers = {'Accept': 'application/json', }
|
|
1023
|
+
|
|
1024
|
+
while True:
|
|
1025
|
+
json = self._api.do('GET',
|
|
1026
|
+
f'/api/2.0/accounts/{self._api.account_id}/federationPolicies',
|
|
1027
|
+
query=query,
|
|
1028
|
+
headers=headers)
|
|
1029
|
+
if 'policies' in json:
|
|
1030
|
+
for v in json['policies']:
|
|
1031
|
+
yield FederationPolicy.from_dict(v)
|
|
1032
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
1033
|
+
return
|
|
1034
|
+
query['page_token'] = json['next_page_token']
|
|
1035
|
+
|
|
1036
|
+
def update(self,
|
|
1037
|
+
policy_id: str,
|
|
1038
|
+
update_mask: str,
|
|
1039
|
+
*,
|
|
1040
|
+
policy: Optional[FederationPolicy] = None) -> FederationPolicy:
|
|
1041
|
+
"""Update account federation policy.
|
|
1042
|
+
|
|
1043
|
+
:param policy_id: str
|
|
1044
|
+
:param update_mask: str
|
|
1045
|
+
Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
|
|
1046
|
+
setting payload will be updated. The field mask needs to be supplied as single string. To specify
|
|
1047
|
+
multiple fields in the field mask, use comma as the separator (no space).
|
|
1048
|
+
:param policy: :class:`FederationPolicy` (optional)
|
|
1049
|
+
|
|
1050
|
+
:returns: :class:`FederationPolicy`
|
|
1051
|
+
"""
|
|
1052
|
+
body = policy.as_dict()
|
|
1053
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1054
|
+
|
|
1055
|
+
res = self._api.do('PATCH',
|
|
1056
|
+
f'/api/2.0/accounts/{self._api.account_id}/federationPolicies/{policy_id}',
|
|
1057
|
+
query=query,
|
|
1058
|
+
body=body,
|
|
1059
|
+
headers=headers)
|
|
1060
|
+
return FederationPolicy.from_dict(res)
|
|
1061
|
+
|
|
1062
|
+
|
|
597
1063
|
class CustomAppIntegrationAPI:
|
|
598
1064
|
"""These APIs enable administrators to manage custom OAuth app integrations, which is required for
|
|
599
1065
|
adding/using Custom OAuth App Integration like Tableau Cloud for Databricks in AWS cloud."""
|
|
@@ -911,6 +1377,176 @@ class PublishedAppIntegrationAPI:
|
|
|
911
1377
|
headers=headers)
|
|
912
1378
|
|
|
913
1379
|
|
|
1380
|
+
class ServicePrincipalFederationPolicyAPI:
|
|
1381
|
+
"""These APIs manage service principal federation policies.
|
|
1382
|
+
|
|
1383
|
+
Service principal federation, also known as Workload Identity Federation, allows your automated workloads
|
|
1384
|
+
running outside of Databricks to securely access Databricks APIs without the need for Databricks secrets.
|
|
1385
|
+
With Workload Identity Federation, your application (or workload) authenticates to Databricks as a
|
|
1386
|
+
Databricks service principal, using tokens provided by the workload runtime.
|
|
1387
|
+
|
|
1388
|
+
Databricks strongly recommends using Workload Identity Federation to authenticate to Databricks from
|
|
1389
|
+
automated workloads, over alternatives such as OAuth client secrets or Personal Access Tokens, whenever
|
|
1390
|
+
possible. Workload Identity Federation is supported by many popular services, including Github Actions,
|
|
1391
|
+
Azure DevOps, GitLab, Terraform Cloud, and Kubernetes clusters, among others.
|
|
1392
|
+
|
|
1393
|
+
Workload identity federation is configured in your Databricks account using a service principal federation
|
|
1394
|
+
policy. A service principal federation policy specifies: * which IdP, or issuer, the service principal is
|
|
1395
|
+
allowed to authenticate from * which workload identity, or subject, is allowed to authenticate as the
|
|
1396
|
+
Databricks service principal
|
|
1397
|
+
|
|
1398
|
+
To configure a federation policy, you provide the following: * The required token __issuer__, as specified
|
|
1399
|
+
in the “iss” claim of workload identity tokens. The issuer is an https URL that identifies the
|
|
1400
|
+
workload identity provider. * The required token __subject__, as specified in the “sub” claim of
|
|
1401
|
+
workload identity tokens. The subject uniquely identifies the workload in the workload runtime
|
|
1402
|
+
environment. * The allowed token __audiences__, as specified in the “aud” claim of workload identity
|
|
1403
|
+
tokens. The audience is intended to represent the recipient of the token. As long as the audience in the
|
|
1404
|
+
token matches at least one audience in the policy, the token is considered a match. If unspecified, the
|
|
1405
|
+
default value is your Databricks account id. * Optionally, the public keys used to validate the signature
|
|
1406
|
+
of the workload identity tokens, in JWKS format. If unspecified (recommended), Databricks automatically
|
|
1407
|
+
fetches the public keys from the issuer’s well known endpoint. Databricks strongly recommends relying on
|
|
1408
|
+
the issuer’s well known endpoint for discovering public keys.
|
|
1409
|
+
|
|
1410
|
+
An example service principal federation policy, for a Github Actions workload, is: ``` issuer:
|
|
1411
|
+
"https://token.actions.githubusercontent.com" audiences: ["https://github.com/my-github-org"] subject:
|
|
1412
|
+
"repo:my-github-org/my-repo:environment:prod" ```
|
|
1413
|
+
|
|
1414
|
+
An example JWT token body that matches this policy and could be used to authenticate to Databricks is: ```
|
|
1415
|
+
{ "iss": "https://token.actions.githubusercontent.com", "aud": "https://github.com/my-github-org", "sub":
|
|
1416
|
+
"repo:my-github-org/my-repo:environment:prod" } ```
|
|
1417
|
+
|
|
1418
|
+
You may also need to configure the workload runtime to generate tokens for your workloads.
|
|
1419
|
+
|
|
1420
|
+
You do not need to configure an OAuth application in Databricks to use token federation."""
|
|
1421
|
+
|
|
1422
|
+
def __init__(self, api_client):
|
|
1423
|
+
self._api = api_client
|
|
1424
|
+
|
|
1425
|
+
def create(self,
|
|
1426
|
+
service_principal_id: int,
|
|
1427
|
+
*,
|
|
1428
|
+
policy: Optional[FederationPolicy] = None,
|
|
1429
|
+
policy_id: Optional[str] = None) -> FederationPolicy:
|
|
1430
|
+
"""Create service principal federation policy.
|
|
1431
|
+
|
|
1432
|
+
:param service_principal_id: int
|
|
1433
|
+
The service principal id for the federation policy.
|
|
1434
|
+
:param policy: :class:`FederationPolicy` (optional)
|
|
1435
|
+
:param policy_id: str (optional)
|
|
1436
|
+
The identifier for the federation policy. If unspecified, the id will be assigned by Databricks.
|
|
1437
|
+
|
|
1438
|
+
:returns: :class:`FederationPolicy`
|
|
1439
|
+
"""
|
|
1440
|
+
body = policy.as_dict()
|
|
1441
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1442
|
+
|
|
1443
|
+
res = self._api.do(
|
|
1444
|
+
'POST',
|
|
1445
|
+
f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/federationPolicies',
|
|
1446
|
+
query=query,
|
|
1447
|
+
body=body,
|
|
1448
|
+
headers=headers)
|
|
1449
|
+
return FederationPolicy.from_dict(res)
|
|
1450
|
+
|
|
1451
|
+
def delete(self, service_principal_id: int, policy_id: str):
|
|
1452
|
+
"""Delete service principal federation policy.
|
|
1453
|
+
|
|
1454
|
+
:param service_principal_id: int
|
|
1455
|
+
The service principal id for the federation policy.
|
|
1456
|
+
:param policy_id: str
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
"""
|
|
1460
|
+
|
|
1461
|
+
headers = {'Accept': 'application/json', }
|
|
1462
|
+
|
|
1463
|
+
self._api.do(
|
|
1464
|
+
'DELETE',
|
|
1465
|
+
f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/federationPolicies/{policy_id}',
|
|
1466
|
+
headers=headers)
|
|
1467
|
+
|
|
1468
|
+
def get(self, service_principal_id: int, policy_id: str) -> FederationPolicy:
|
|
1469
|
+
"""Get service principal federation policy.
|
|
1470
|
+
|
|
1471
|
+
:param service_principal_id: int
|
|
1472
|
+
The service principal id for the federation policy.
|
|
1473
|
+
:param policy_id: str
|
|
1474
|
+
|
|
1475
|
+
:returns: :class:`FederationPolicy`
|
|
1476
|
+
"""
|
|
1477
|
+
|
|
1478
|
+
headers = {'Accept': 'application/json', }
|
|
1479
|
+
|
|
1480
|
+
res = self._api.do(
|
|
1481
|
+
'GET',
|
|
1482
|
+
f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/federationPolicies/{policy_id}',
|
|
1483
|
+
headers=headers)
|
|
1484
|
+
return FederationPolicy.from_dict(res)
|
|
1485
|
+
|
|
1486
|
+
def list(self,
|
|
1487
|
+
service_principal_id: int,
|
|
1488
|
+
*,
|
|
1489
|
+
page_size: Optional[int] = None,
|
|
1490
|
+
page_token: Optional[str] = None) -> Iterator[FederationPolicy]:
|
|
1491
|
+
"""List service principal federation policies.
|
|
1492
|
+
|
|
1493
|
+
:param service_principal_id: int
|
|
1494
|
+
The service principal id for the federation policy.
|
|
1495
|
+
:param page_size: int (optional)
|
|
1496
|
+
:param page_token: str (optional)
|
|
1497
|
+
|
|
1498
|
+
:returns: Iterator over :class:`FederationPolicy`
|
|
1499
|
+
"""
|
|
1500
|
+
|
|
1501
|
+
query = {}
|
|
1502
|
+
if page_size is not None: query['page_size'] = page_size
|
|
1503
|
+
if page_token is not None: query['page_token'] = page_token
|
|
1504
|
+
headers = {'Accept': 'application/json', }
|
|
1505
|
+
|
|
1506
|
+
while True:
|
|
1507
|
+
json = self._api.do(
|
|
1508
|
+
'GET',
|
|
1509
|
+
f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/federationPolicies',
|
|
1510
|
+
query=query,
|
|
1511
|
+
headers=headers)
|
|
1512
|
+
if 'policies' in json:
|
|
1513
|
+
for v in json['policies']:
|
|
1514
|
+
yield FederationPolicy.from_dict(v)
|
|
1515
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
1516
|
+
return
|
|
1517
|
+
query['page_token'] = json['next_page_token']
|
|
1518
|
+
|
|
1519
|
+
def update(self,
|
|
1520
|
+
service_principal_id: int,
|
|
1521
|
+
policy_id: str,
|
|
1522
|
+
update_mask: str,
|
|
1523
|
+
*,
|
|
1524
|
+
policy: Optional[FederationPolicy] = None) -> FederationPolicy:
|
|
1525
|
+
"""Update service principal federation policy.
|
|
1526
|
+
|
|
1527
|
+
:param service_principal_id: int
|
|
1528
|
+
The service principal id for the federation policy.
|
|
1529
|
+
:param policy_id: str
|
|
1530
|
+
:param update_mask: str
|
|
1531
|
+
Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
|
|
1532
|
+
setting payload will be updated. The field mask needs to be supplied as single string. To specify
|
|
1533
|
+
multiple fields in the field mask, use comma as the separator (no space).
|
|
1534
|
+
:param policy: :class:`FederationPolicy` (optional)
|
|
1535
|
+
|
|
1536
|
+
:returns: :class:`FederationPolicy`
|
|
1537
|
+
"""
|
|
1538
|
+
body = policy.as_dict()
|
|
1539
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1540
|
+
|
|
1541
|
+
res = self._api.do(
|
|
1542
|
+
'PATCH',
|
|
1543
|
+
f'/api/2.0/accounts/{self._api.account_id}/servicePrincipals/{service_principal_id}/federationPolicies/{policy_id}',
|
|
1544
|
+
query=query,
|
|
1545
|
+
body=body,
|
|
1546
|
+
headers=headers)
|
|
1547
|
+
return FederationPolicy.from_dict(res)
|
|
1548
|
+
|
|
1549
|
+
|
|
914
1550
|
class ServicePrincipalSecretsAPI:
|
|
915
1551
|
"""These APIs enable administrators to manage service principal secrets.
|
|
916
1552
|
|