-
Notifications
You must be signed in to change notification settings - Fork 195
Expand file tree
/
Copy pathiam.py
More file actions
executable file
·6462 lines (5431 loc) · 248 KB
/
iam.py
File metadata and controls
executable file
·6462 lines (5431 loc) · 248 KB
Edit and raw actions
OlderNewer
1
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2
3
from __future__ import annotations
4
5
import logging
6
from dataclasses import dataclass
7
from enum import Enum
8
from typing import Any, Dict, Iterator, List, Optional
9
10
from databricks.sdk.service._internal import (_enum, _from_dict,
11
_repeated_dict, _repeated_enum)
12
13
_LOG = logging.getLogger("databricks.sdk")
14
15
16
# all definitions in this file are in alphabetical order
17
18
19
@dataclass
20
class AccessControlRequest:
21
group_name: Optional[str] = None
22
"""name of the group"""
23
24
permission_level: Optional[PermissionLevel] = None
25
26
service_principal_name: Optional[str] = None
27
"""application ID of a service principal"""
28
29
user_name: Optional[str] = None
30
"""name of the user"""
31
32
def as_dict(self) -> dict:
33
"""Serializes the AccessControlRequest into a dictionary suitable for use as a JSON request body."""
34
body = {}
35
if self.group_name is not None:
36
body["group_name"] = self.group_name
37
if self.permission_level is not None:
38
body["permission_level"] = self.permission_level.value
39
if self.service_principal_name is not None:
40
body["service_principal_name"] = self.service_principal_name
41
if self.user_name is not None:
42
body["user_name"] = self.user_name
43
return body
44
45
def as_shallow_dict(self) -> dict:
46
"""Serializes the AccessControlRequest into a shallow dictionary of its immediate attributes."""
47
body = {}
48
if self.group_name is not None:
49
body["group_name"] = self.group_name
50
if self.permission_level is not None:
51
body["permission_level"] = self.permission_level
52
if self.service_principal_name is not None:
53
body["service_principal_name"] = self.service_principal_name
54
if self.user_name is not None:
55
body["user_name"] = self.user_name
56
return body
57
58
@classmethod
59
def from_dict(cls, d: Dict[str, Any]) -> AccessControlRequest:
60
"""Deserializes the AccessControlRequest from a dictionary."""
61
return cls(
62
group_name=d.get("group_name", None),
63
permission_level=_enum(d, "permission_level", PermissionLevel),
64
service_principal_name=d.get("service_principal_name", None),
65
user_name=d.get("user_name", None),
66
)
67
68
69
@dataclass
70
class AccessControlResponse:
71
all_permissions: Optional[List[Permission]] = None
72
"""All permissions."""
73
74
display_name: Optional[str] = None
75
"""Display name of the user or service principal."""
76
77
group_name: Optional[str] = None
78
"""name of the group"""
79
80
service_principal_name: Optional[str] = None
81
"""Name of the service principal."""
82
83
user_name: Optional[str] = None
84
"""name of the user"""
85
86
def as_dict(self) -> dict:
87
"""Serializes the AccessControlResponse into a dictionary suitable for use as a JSON request body."""
88
body = {}
89
if self.all_permissions:
90
body["all_permissions"] = [v.as_dict() for v in self.all_permissions]
91
if self.display_name is not None:
92
body["display_name"] = self.display_name
93
if self.group_name is not None:
94
body["group_name"] = self.group_name
95
if self.service_principal_name is not None:
96
body["service_principal_name"] = self.service_principal_name
97
if self.user_name is not None:
98
body["user_name"] = self.user_name
99
return body
100
101
def as_shallow_dict(self) -> dict:
102
"""Serializes the AccessControlResponse into a shallow dictionary of its immediate attributes."""
103
body = {}
104
if self.all_permissions:
105
body["all_permissions"] = self.all_permissions
106
if self.display_name is not None:
107
body["display_name"] = self.display_name
108
if self.group_name is not None:
109
body["group_name"] = self.group_name
110
if self.service_principal_name is not None:
111
body["service_principal_name"] = self.service_principal_name
112
if self.user_name is not None:
113
body["user_name"] = self.user_name
114
return body
115
116
@classmethod
117
def from_dict(cls, d: Dict[str, Any]) -> AccessControlResponse:
118
"""Deserializes the AccessControlResponse from a dictionary."""
119
return cls(
120
all_permissions=_repeated_dict(d, "all_permissions", Permission),
121
display_name=d.get("display_name", None),
122
group_name=d.get("group_name", None),
123
service_principal_name=d.get("service_principal_name", None),
124
user_name=d.get("user_name", None),
125
)
126
127
128
@dataclass
129
class AccountGroup:
130
account_id: Optional[str] = None
131
"""Databricks account ID"""
132
133
display_name: Optional[str] = None
134
"""String that represents a human-readable group name"""
135
136
external_id: Optional[str] = None
137
"""external_id should be unique for identifying groups"""
138
139
id: Optional[str] = None
140
"""Databricks group ID"""
141
142
members: Optional[List[ComplexValue]] = None
143
144
meta: Optional[ResourceMeta] = None
145
"""Container for the group identifier. Workspace local versus account."""
146
147
roles: Optional[List[ComplexValue]] = None
148
"""Indicates if the group has the admin role."""
149
150
def as_dict(self) -> dict:
151
"""Serializes the AccountGroup into a dictionary suitable for use as a JSON request body."""
152
body = {}
153
if self.account_id is not None:
154
body["account_id"] = self.account_id
155
if self.display_name is not None:
156
body["displayName"] = self.display_name
157
if self.external_id is not None:
158
body["externalId"] = self.external_id
159
if self.id is not None:
160
body["id"] = self.id
161
if self.members:
162
body["members"] = [v.as_dict() for v in self.members]
163
if self.meta:
164
body["meta"] = self.meta.as_dict()
165
if self.roles:
166
body["roles"] = [v.as_dict() for v in self.roles]
167
return body
168
169
def as_shallow_dict(self) -> dict:
170
"""Serializes the AccountGroup into a shallow dictionary of its immediate attributes."""
171
body = {}
172
if self.account_id is not None:
173
body["account_id"] = self.account_id
174
if self.display_name is not None:
175
body["displayName"] = self.display_name
176
if self.external_id is not None:
177
body["externalId"] = self.external_id
178
if self.id is not None:
179
body["id"] = self.id
180
if self.members:
181
body["members"] = self.members
182
if self.meta:
183
body["meta"] = self.meta
184
if self.roles:
185
body["roles"] = self.roles
186
return body
187
188
@classmethod
189
def from_dict(cls, d: Dict[str, Any]) -> AccountGroup:
190
"""Deserializes the AccountGroup from a dictionary."""
191
return cls(
192
account_id=d.get("account_id", None),
193
display_name=d.get("displayName", None),
194
external_id=d.get("externalId", None),
195
id=d.get("id", None),
196
members=_repeated_dict(d, "members", ComplexValue),
197
meta=_from_dict(d, "meta", ResourceMeta),
198
roles=_repeated_dict(d, "roles", ComplexValue),
199
)
200
201
202
@dataclass
203
class AccountServicePrincipal:
204
account_id: Optional[str] = None
205
"""Databricks account ID"""
206
207
active: Optional[bool] = None
208
"""If this user is active"""
209
210
application_id: Optional[str] = None
211
"""UUID relating to the service principal"""
212
213
display_name: Optional[str] = None
214
"""String that represents a concatenation of given and family names."""
215
216
external_id: Optional[str] = None
217
218
id: Optional[str] = None
219
"""Databricks service principal ID."""
220
221
roles: Optional[List[ComplexValue]] = None
222
"""Indicates if the group has the admin role."""
223
224
def as_dict(self) -> dict:
225
"""Serializes the AccountServicePrincipal into a dictionary suitable for use as a JSON request body."""
226
body = {}
227
if self.account_id is not None:
228
body["account_id"] = self.account_id
229
if self.active is not None:
230
body["active"] = self.active
231
if self.application_id is not None:
232
body["applicationId"] = self.application_id
233
if self.display_name is not None:
234
body["displayName"] = self.display_name
235
if self.external_id is not None:
236
body["externalId"] = self.external_id
237
if self.id is not None:
238
body["id"] = self.id
239
if self.roles:
240
body["roles"] = [v.as_dict() for v in self.roles]
241
return body
242
243
def as_shallow_dict(self) -> dict:
244
"""Serializes the AccountServicePrincipal into a shallow dictionary of its immediate attributes."""
245
body = {}
246
if self.account_id is not None:
247
body["account_id"] = self.account_id
248
if self.active is not None:
249
body["active"] = self.active
250
if self.application_id is not None:
251
body["applicationId"] = self.application_id
252
if self.display_name is not None:
253
body["displayName"] = self.display_name
254
if self.external_id is not None:
255
body["externalId"] = self.external_id
256
if self.id is not None:
257
body["id"] = self.id
258
if self.roles:
259
body["roles"] = self.roles
260
return body
261
262
@classmethod
263
def from_dict(cls, d: Dict[str, Any]) -> AccountServicePrincipal:
264
"""Deserializes the AccountServicePrincipal from a dictionary."""
265
return cls(
266
account_id=d.get("account_id", None),
267
active=d.get("active", None),
268
application_id=d.get("applicationId", None),
269
display_name=d.get("displayName", None),
270
external_id=d.get("externalId", None),
271
id=d.get("id", None),
272
roles=_repeated_dict(d, "roles", ComplexValue),
273
)
274
275
276
@dataclass
277
class AccountUser:
278
account_id: Optional[str] = None
279
"""Databricks account ID"""
280
281
active: Optional[bool] = None
282
"""If this user is active"""
283
284
display_name: Optional[str] = None
285
"""String that represents a concatenation of given and family names. For example `John Smith`."""
286
287
emails: Optional[List[ComplexValue]] = None
288
"""All the emails associated with the Databricks user."""
289
290
external_id: Optional[str] = None
291
"""External ID is not currently supported. It is reserved for future use."""
292
293
id: Optional[str] = None
294
"""Databricks user ID."""
295
296
name: Optional[Name] = None
297
298
roles: Optional[List[ComplexValue]] = None
299
"""Indicates if the group has the admin role."""
300
301
user_name: Optional[str] = None
302
"""Email address of the Databricks user."""
303
304
def as_dict(self) -> dict:
305
"""Serializes the AccountUser into a dictionary suitable for use as a JSON request body."""
306
body = {}
307
if self.account_id is not None:
308
body["account_id"] = self.account_id
309
if self.active is not None:
310
body["active"] = self.active
311
if self.display_name is not None:
312
body["displayName"] = self.display_name
313
if self.emails:
314
body["emails"] = [v.as_dict() for v in self.emails]
315
if self.external_id is not None:
316
body["externalId"] = self.external_id
317
if self.id is not None:
318
body["id"] = self.id
319
if self.name:
320
body["name"] = self.name.as_dict()
321
if self.roles:
322
body["roles"] = [v.as_dict() for v in self.roles]
323
if self.user_name is not None:
324
body["userName"] = self.user_name
325
return body
326
327
def as_shallow_dict(self) -> dict:
328
"""Serializes the AccountUser into a shallow dictionary of its immediate attributes."""
329
body = {}
330
if self.account_id is not None:
331
body["account_id"] = self.account_id
332
if self.active is not None:
333
body["active"] = self.active
334
if self.display_name is not None:
335
body["displayName"] = self.display_name
336
if self.emails:
337
body["emails"] = self.emails
338
if self.external_id is not None:
339
body["externalId"] = self.external_id
340
if self.id is not None:
341
body["id"] = self.id
342
if self.name:
343
body["name"] = self.name
344
if self.roles:
345
body["roles"] = self.roles
346
if self.user_name is not None:
347
body["userName"] = self.user_name
348
return body
349
350
@classmethod
351
def from_dict(cls, d: Dict[str, Any]) -> AccountUser:
352
"""Deserializes the AccountUser from a dictionary."""
353
return cls(
354
account_id=d.get("account_id", None),
355
active=d.get("active", None),
356
display_name=d.get("displayName", None),
357
emails=_repeated_dict(d, "emails", ComplexValue),
358
external_id=d.get("externalId", None),
359
id=d.get("id", None),
360
name=_from_dict(d, "name", Name),
361
roles=_repeated_dict(d, "roles", ComplexValue),
362
user_name=d.get("userName", None),
363
)
364
365
366
@dataclass
367
class Actor:
368
"""represents an identity trying to access a resource - user or a service principal group can be a
369
principal of a permission set assignment but an actor is always a user or a service principal"""
370
371
actor_id: Optional[int] = None
372
373
def as_dict(self) -> dict:
374
"""Serializes the Actor into a dictionary suitable for use as a JSON request body."""
375
body = {}
376
if self.actor_id is not None:
377
body["actor_id"] = self.actor_id
378
return body
379
380
def as_shallow_dict(self) -> dict:
381
"""Serializes the Actor into a shallow dictionary of its immediate attributes."""
382
body = {}
383
if self.actor_id is not None:
384
body["actor_id"] = self.actor_id
385
return body
386
387
@classmethod
388
def from_dict(cls, d: Dict[str, Any]) -> Actor:
389
"""Deserializes the Actor from a dictionary."""
390
return cls(actor_id=d.get("actor_id", None))
391
392
393
@dataclass
394
class CheckPolicyResponse:
395
consistency_token: ConsistencyToken
396
397
is_permitted: Optional[bool] = None
398
399
def as_dict(self) -> dict:
400
"""Serializes the CheckPolicyResponse into a dictionary suitable for use as a JSON request body."""
401
body = {}
402
if self.consistency_token:
403
body["consistency_token"] = self.consistency_token.as_dict()
404
if self.is_permitted is not None:
405
body["is_permitted"] = self.is_permitted
406
return body
407
408
def as_shallow_dict(self) -> dict:
409
"""Serializes the CheckPolicyResponse into a shallow dictionary of its immediate attributes."""
410
body = {}
411
if self.consistency_token:
412
body["consistency_token"] = self.consistency_token
413
if self.is_permitted is not None:
414
body["is_permitted"] = self.is_permitted
415
return body
416
417
@classmethod
418
def from_dict(cls, d: Dict[str, Any]) -> CheckPolicyResponse:
419
"""Deserializes the CheckPolicyResponse from a dictionary."""
420
return cls(
421
consistency_token=_from_dict(d, "consistency_token", ConsistencyToken),
422
is_permitted=d.get("is_permitted", None),
423
)
424
425
426
@dataclass
427
class ComplexValue:
428
display: Optional[str] = None
429
430
primary: Optional[bool] = None
431
432
ref: Optional[str] = None
433
434
type: Optional[str] = None
435
436
value: Optional[str] = None
437
438
def as_dict(self) -> dict:
439
"""Serializes the ComplexValue into a dictionary suitable for use as a JSON request body."""
440
body = {}
441
if self.display is not None:
442
body["display"] = self.display
443
if self.primary is not None:
444
body["primary"] = self.primary
445
if self.ref is not None:
446
body["$ref"] = self.ref
447
if self.type is not None:
448
body["type"] = self.type
449
if self.value is not None:
450
body["value"] = self.value
451
return body
452
453
def as_shallow_dict(self) -> dict:
454
"""Serializes the ComplexValue into a shallow dictionary of its immediate attributes."""
455
body = {}
456
if self.display is not None:
457
body["display"] = self.display
458
if self.primary is not None:
459
body["primary"] = self.primary
460
if self.ref is not None:
461
body["$ref"] = self.ref
462
if self.type is not None:
463
body["type"] = self.type
464
if self.value is not None:
465
body["value"] = self.value
466
return body
467
468
@classmethod
469
def from_dict(cls, d: Dict[str, Any]) -> ComplexValue:
470
"""Deserializes the ComplexValue from a dictionary."""
471
return cls(
472
display=d.get("display", None),
473
primary=d.get("primary", None),
474
ref=d.get("$ref", None),
475
type=d.get("type", None),
476
value=d.get("value", None),
477
)
478
479
480
@dataclass
481
class ConsistencyToken:
482
value: str
483
484
def as_dict(self) -> dict:
485
"""Serializes the ConsistencyToken into a dictionary suitable for use as a JSON request body."""
486
body = {}
487
if self.value is not None:
488
body["value"] = self.value
489
return body
490
491
def as_shallow_dict(self) -> dict:
492
"""Serializes the ConsistencyToken into a shallow dictionary of its immediate attributes."""
493
body = {}
494
if self.value is not None:
495
body["value"] = self.value
496
return body
497
498
@classmethod
499
def from_dict(cls, d: Dict[str, Any]) -> ConsistencyToken:
500
"""Deserializes the ConsistencyToken from a dictionary."""
501
return cls(value=d.get("value", None))
502
503
504
@dataclass
505
class DeleteWorkspacePermissionAssignmentResponse:
506
def as_dict(self) -> dict:
507
"""Serializes the DeleteWorkspacePermissionAssignmentResponse into a dictionary suitable for use as a JSON request body."""
508
body = {}
509
return body
510
511
def as_shallow_dict(self) -> dict:
512
"""Serializes the DeleteWorkspacePermissionAssignmentResponse into a shallow dictionary of its immediate attributes."""
513
body = {}
514
return body
515
516
@classmethod
517
def from_dict(cls, d: Dict[str, Any]) -> DeleteWorkspacePermissionAssignmentResponse:
518
"""Deserializes the DeleteWorkspacePermissionAssignmentResponse from a dictionary."""
519
return cls()
520
521
522
@dataclass
523
class GetAssignableRolesForResourceResponse:
524
roles: Optional[List[Role]] = None
525
526
def as_dict(self) -> dict:
527
"""Serializes the GetAssignableRolesForResourceResponse into a dictionary suitable for use as a JSON request body."""
528
body = {}
529
if self.roles:
530
body["roles"] = [v.as_dict() for v in self.roles]
531
return body
532
533
def as_shallow_dict(self) -> dict:
534
"""Serializes the GetAssignableRolesForResourceResponse into a shallow dictionary of its immediate attributes."""
535
body = {}
536
if self.roles:
537
body["roles"] = self.roles
538
return body
539
540
@classmethod
541
def from_dict(cls, d: Dict[str, Any]) -> GetAssignableRolesForResourceResponse:
542
"""Deserializes the GetAssignableRolesForResourceResponse from a dictionary."""
543
return cls(roles=_repeated_dict(d, "roles", Role))
544
545
546
@dataclass
547
class GetPasswordPermissionLevelsResponse:
548
permission_levels: Optional[List[PasswordPermissionsDescription]] = None
549
"""Specific permission levels"""
550
551
def as_dict(self) -> dict:
552
"""Serializes the GetPasswordPermissionLevelsResponse into a dictionary suitable for use as a JSON request body."""
553
body = {}
554
if self.permission_levels:
555
body["permission_levels"] = [v.as_dict() for v in self.permission_levels]
556
return body
557
558
def as_shallow_dict(self) -> dict:
559
"""Serializes the GetPasswordPermissionLevelsResponse into a shallow dictionary of its immediate attributes."""
560
body = {}
561
if self.permission_levels:
562
body["permission_levels"] = self.permission_levels
563
return body
564
565
@classmethod
566
def from_dict(cls, d: Dict[str, Any]) -> GetPasswordPermissionLevelsResponse:
567
"""Deserializes the GetPasswordPermissionLevelsResponse from a dictionary."""
568
return cls(permission_levels=_repeated_dict(d, "permission_levels", PasswordPermissionsDescription))
569
570
571
@dataclass
572
class GetPermissionLevelsResponse:
573
permission_levels: Optional[List[PermissionsDescription]] = None
574
"""Specific permission levels"""
575
576
def as_dict(self) -> dict:
577
"""Serializes the GetPermissionLevelsResponse into a dictionary suitable for use as a JSON request body."""
578
body = {}
579
if self.permission_levels:
580
body["permission_levels"] = [v.as_dict() for v in self.permission_levels]
581
return body
582
583
def as_shallow_dict(self) -> dict:
584
"""Serializes the GetPermissionLevelsResponse into a shallow dictionary of its immediate attributes."""
585
body = {}
586
if self.permission_levels:
587
body["permission_levels"] = self.permission_levels
588
return body
589
590
@classmethod
591
def from_dict(cls, d: Dict[str, Any]) -> GetPermissionLevelsResponse:
592
"""Deserializes the GetPermissionLevelsResponse from a dictionary."""
593
return cls(permission_levels=_repeated_dict(d, "permission_levels", PermissionsDescription))
594
595
596
class GetSortOrder(Enum):
597
598
ASCENDING = "ascending"
599
DESCENDING = "descending"
600
601
602
@dataclass
603
class GrantRule:
604
role: str
605
"""Role that is assigned to the list of principals."""
606
607
principals: Optional[List[str]] = None
608
"""Principals this grant rule applies to. A principal can be a user (for end users), a service
609
principal (for applications and compute workloads), or an account group. Each principal has its
610
own identifier format: * users/<USERNAME> * groups/<GROUP_NAME> *
611
servicePrincipals/<SERVICE_PRINCIPAL_APPLICATION_ID>"""
612
613
def as_dict(self) -> dict:
614
"""Serializes the GrantRule into a dictionary suitable for use as a JSON request body."""
615
body = {}
616
if self.principals:
617
body["principals"] = [v for v in self.principals]
618
if self.role is not None:
619
body["role"] = self.role
620
return body
621
622
def as_shallow_dict(self) -> dict:
623
"""Serializes the GrantRule into a shallow dictionary of its immediate attributes."""
624
body = {}
625
if self.principals:
626
body["principals"] = self.principals
627
if self.role is not None:
628
body["role"] = self.role
629
return body
630
631
@classmethod
632
def from_dict(cls, d: Dict[str, Any]) -> GrantRule:
633
"""Deserializes the GrantRule from a dictionary."""
634
return cls(principals=d.get("principals", None), role=d.get("role", None))
635
636
637
@dataclass
638
class Group:
639
display_name: Optional[str] = None
640
"""String that represents a human-readable group name"""
641
642
entitlements: Optional[List[ComplexValue]] = None
643
"""Entitlements assigned to the group. See [assigning entitlements] for a full list of supported
644
values.
645
646
[assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements"""
647
648
external_id: Optional[str] = None
649
"""external_id should be unique for identifying groups"""
650
651
groups: Optional[List[ComplexValue]] = None
652
653
id: Optional[str] = None
654
"""Databricks group ID"""
655
656
members: Optional[List[ComplexValue]] = None
657
658
meta: Optional[ResourceMeta] = None
659
"""Container for the group identifier. Workspace local versus account."""
660
661
roles: Optional[List[ComplexValue]] = None
662
"""Corresponds to AWS instance profile/arn role."""
663
664
schemas: Optional[List[GroupSchema]] = None
665
"""The schema of the group."""
666
667
def as_dict(self) -> dict:
668
"""Serializes the Group into a dictionary suitable for use as a JSON request body."""
669
body = {}
670
if self.display_name is not None:
671
body["displayName"] = self.display_name
672
if self.entitlements:
673
body["entitlements"] = [v.as_dict() for v in self.entitlements]
674
if self.external_id is not None:
675
body["externalId"] = self.external_id
676
if self.groups:
677
body["groups"] = [v.as_dict() for v in self.groups]
678
if self.id is not None:
679
body["id"] = self.id
680
if self.members:
681
body["members"] = [v.as_dict() for v in self.members]
682
if self.meta:
683
body["meta"] = self.meta.as_dict()
684
if self.roles:
685
body["roles"] = [v.as_dict() for v in self.roles]
686
if self.schemas:
687
body["schemas"] = [v.value for v in self.schemas]
688
return body
689
690
def as_shallow_dict(self) -> dict:
691
"""Serializes the Group into a shallow dictionary of its immediate attributes."""
692
body = {}
693
if self.display_name is not None:
694
body["displayName"] = self.display_name
695
if self.entitlements:
696
body["entitlements"] = self.entitlements
697
if self.external_id is not None:
698
body["externalId"] = self.external_id
699
if self.groups:
700
body["groups"] = self.groups
701
if self.id is not None:
702
body["id"] = self.id
703
if self.members:
704
body["members"] = self.members
705
if self.meta:
706
body["meta"] = self.meta
707
if self.roles:
708
body["roles"] = self.roles
709
if self.schemas:
710
body["schemas"] = self.schemas
711
return body
712
713
@classmethod
714
def from_dict(cls, d: Dict[str, Any]) -> Group:
715
"""Deserializes the Group from a dictionary."""
716
return cls(
717
display_name=d.get("displayName", None),
718
entitlements=_repeated_dict(d, "entitlements", ComplexValue),
719
external_id=d.get("externalId", None),
720
groups=_repeated_dict(d, "groups", ComplexValue),
721
id=d.get("id", None),
722
members=_repeated_dict(d, "members", ComplexValue),
723
meta=_from_dict(d, "meta", ResourceMeta),
724
roles=_repeated_dict(d, "roles", ComplexValue),
725
schemas=_repeated_enum(d, "schemas", GroupSchema),
726
)
727
728
729
class GroupSchema(Enum):
730
731
URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP = "urn:ietf:params:scim:schemas:core:2.0:Group"
732
733
734
@dataclass
735
class ListAccountGroupsResponse:
736
items_per_page: Optional[int] = None
737
"""Total results returned in the response."""
738
739
resources: Optional[List[AccountGroup]] = None
740
"""User objects returned in the response."""
741
742
start_index: Optional[int] = None
743
"""Starting index of all the results that matched the request filters. First item is number 1."""
744
745
total_results: Optional[int] = None
746
"""Total results that match the request filters."""
747
748
def as_dict(self) -> dict:
749
"""Serializes the ListAccountGroupsResponse into a dictionary suitable for use as a JSON request body."""
750
body = {}
751
if self.items_per_page is not None:
752
body["itemsPerPage"] = self.items_per_page
753
if self.resources:
754
body["Resources"] = [v.as_dict() for v in self.resources]
755
if self.start_index is not None:
756
body["startIndex"] = self.start_index
757
if self.total_results is not None:
758
body["totalResults"] = self.total_results
759
return body
760
761
def as_shallow_dict(self) -> dict:
762
"""Serializes the ListAccountGroupsResponse into a shallow dictionary of its immediate attributes."""
763
body = {}
764
if self.items_per_page is not None:
765
body["itemsPerPage"] = self.items_per_page
766
if self.resources:
767
body["Resources"] = self.resources
768
if self.start_index is not None:
769
body["startIndex"] = self.start_index
770
if self.total_results is not None:
771
body["totalResults"] = self.total_results
772
return body
773
774
@classmethod
775
def from_dict(cls, d: Dict[str, Any]) -> ListAccountGroupsResponse:
776
"""Deserializes the ListAccountGroupsResponse from a dictionary."""
777
return cls(
778
items_per_page=d.get("itemsPerPage", None),
779
resources=_repeated_dict(d, "Resources", AccountGroup),
780
start_index=d.get("startIndex", None),
781
total_results=d.get("totalResults", None),
782
)
783
784
785
@dataclass
786
class ListAccountServicePrincipalsResponse:
787
items_per_page: Optional[int] = None
788
"""Total results returned in the response."""
789
790
resources: Optional[List[AccountServicePrincipal]] = None
791
"""User objects returned in the response."""
792
793
start_index: Optional[int] = None
794
"""Starting index of all the results that matched the request filters. First item is number 1."""
795
796
total_results: Optional[int] = None
797
"""Total results that match the request filters."""
798
799
def as_dict(self) -> dict:
800
"""Serializes the ListAccountServicePrincipalsResponse into a dictionary suitable for use as a JSON request body."""
801
body = {}
802
if self.items_per_page is not None:
803
body["itemsPerPage"] = self.items_per_page
804
if self.resources:
805
body["Resources"] = [v.as_dict() for v in self.resources]
806
if self.start_index is not None:
807
body["startIndex"] = self.start_index
808
if self.total_results is not None:
809
body["totalResults"] = self.total_results
810
return body
811
812
def as_shallow_dict(self) -> dict:
813
"""Serializes the ListAccountServicePrincipalsResponse into a shallow dictionary of its immediate attributes."""
814
body = {}
815
if self.items_per_page is not None:
816
body["itemsPerPage"] = self.items_per_page
817
if self.resources:
818
body["Resources"] = self.resources
819
if self.start_index is not None:
820
body["startIndex"] = self.start_index
821
if self.total_results is not None:
822
body["totalResults"] = self.total_results
823
return body
824
825
@classmethod
826
def from_dict(cls, d: Dict[str, Any]) -> ListAccountServicePrincipalsResponse:
827
"""Deserializes the ListAccountServicePrincipalsResponse from a dictionary."""
828
return cls(
829
items_per_page=d.get("itemsPerPage", None),
830
resources=_repeated_dict(d, "Resources", AccountServicePrincipal),
831
start_index=d.get("startIndex", None),
832
total_results=d.get("totalResults", None),
833
)
834
835
836
@dataclass
837
class ListAccountUsersResponse:
838
items_per_page: Optional[int] = None
839
"""Total results returned in the response."""
840
841
resources: Optional[List[AccountUser]] = None
842
"""User objects returned in the response."""
843
844
start_index: Optional[int] = None
845
"""Starting index of all the results that matched the request filters. First item is number 1."""
846
847
total_results: Optional[int] = None
848
"""Total results that match the request filters."""
849
850
def as_dict(self) -> dict:
851
"""Serializes the ListAccountUsersResponse into a dictionary suitable for use as a JSON request body."""
852
body = {}
853
if self.items_per_page is not None:
854
body["itemsPerPage"] = self.items_per_page
855
if self.resources:
856
body["Resources"] = [v.as_dict() for v in self.resources]
857
if self.start_index is not None:
858
body["startIndex"] = self.start_index
859
if self.total_results is not None:
860
body["totalResults"] = self.total_results
861
return body
862
863
def as_shallow_dict(self) -> dict:
864
"""Serializes the ListAccountUsersResponse into a shallow dictionary of its immediate attributes."""
865
body = {}
866
if self.items_per_page is not None:
867
body["itemsPerPage"] = self.items_per_page
868
if self.resources:
869
body["Resources"] = self.resources
870
if self.start_index is not None:
871
body["startIndex"] = self.start_index
872
if self.total_results is not None:
873
body["totalResults"] = self.total_results
874
return body
875
876
@classmethod
877
def from_dict(cls, d: Dict[str, Any]) -> ListAccountUsersResponse:
878
"""Deserializes the ListAccountUsersResponse from a dictionary."""
879
return cls(
880
items_per_page=d.get("itemsPerPage", None),
881
resources=_repeated_dict(d, "Resources", AccountUser),
882
start_index=d.get("startIndex", None),
883
total_results=d.get("totalResults", None),
884
)
885
886
887
@dataclass
888
class ListGroupsResponse:
889
items_per_page: Optional[int] = None
890
"""Total results returned in the response."""
891
892
resources: Optional[List[Group]] = None
893
"""User objects returned in the response."""
894
895
schemas: Optional[List[ListResponseSchema]] = None
896
"""The schema of the service principal."""
897
898
start_index: Optional[int] = None
899
"""Starting index of all the results that matched the request filters. First item is number 1."""
900
901
total_results: Optional[int] = None
902
"""Total results that match the request filters."""
903
904
def as_dict(self) -> dict:
905
"""Serializes the ListGroupsResponse into a dictionary suitable for use as a JSON request body."""
906
body = {}
907
if self.items_per_page is not None:
908
body["itemsPerPage"] = self.items_per_page
909
if self.resources:
910
body["Resources"] = [v.as_dict() for v in self.resources]
911
if self.schemas:
912
body["schemas"] = [v.value for v in self.schemas]
913
if self.start_index is not None:
914
body["startIndex"] = self.start_index
915
if self.total_results is not None:
916
body["totalResults"] = self.total_results
917
return body
918
919
def as_shallow_dict(self) -> dict:
920
"""Serializes the ListGroupsResponse into a shallow dictionary of its immediate attributes."""
921
body = {}
922
if self.items_per_page is not None:
923
body["itemsPerPage"] = self.items_per_page
924
if self.resources:
925
body["Resources"] = self.resources
926
if self.schemas:
927
body["schemas"] = self.schemas
928
if self.start_index is not None:
929
body["startIndex"] = self.start_index
930
if self.total_results is not None:
931
body["totalResults"] = self.total_results
932
return body
933
934
@classmethod
935
def from_dict(cls, d: Dict[str, Any]) -> ListGroupsResponse:
936
"""Deserializes the ListGroupsResponse from a dictionary."""
937
return cls(
938
items_per_page=d.get("itemsPerPage", None),
939
resources=_repeated_dict(d, "Resources", Group),
940
schemas=_repeated_enum(d, "schemas", ListResponseSchema),
941
start_index=d.get("startIndex", None),
942
total_results=d.get("totalResults", None),
943
)
944
945
946
class ListResponseSchema(Enum):
947
948
URN_IETF_PARAMS_SCIM_API_MESSAGES_2_0_LIST_RESPONSE = "urn:ietf:params:scim:api:messages:2.0:ListResponse"
949
950
951
@dataclass
952
class ListServicePrincipalResponse:
953
items_per_page: Optional[int] = None
954
"""Total results returned in the response."""
955
956
resources: Optional[List[ServicePrincipal]] = None
957
"""User objects returned in the response."""
958
959
schemas: Optional[List[ListResponseSchema]] = None
960
"""The schema of the List response."""
961
962
start_index: Optional[int] = None
963
"""Starting index of all the results that matched the request filters. First item is number 1."""
964
965
total_results: Optional[int] = None
966
"""Total results that match the request filters."""
967
968
def as_dict(self) -> dict:
969
"""Serializes the ListServicePrincipalResponse into a dictionary suitable for use as a JSON request body."""
970
body = {}
971
if self.items_per_page is not None:
972
body["itemsPerPage"] = self.items_per_page
973
if self.resources:
974
body["Resources"] = [v.as_dict() for v in self.resources]
975
if self.schemas:
976
body["schemas"] = [v.value for v in self.schemas]
977
if self.start_index is not None:
978
body["startIndex"] = self.start_index
979
if self.total_results is not None:
980
body["totalResults"] = self.total_results
981
return body
982
983
def as_shallow_dict(self) -> dict:
984
"""Serializes the ListServicePrincipalResponse into a shallow dictionary of its immediate attributes."""
985
body = {}
986
if self.items_per_page is not None:
987
body["itemsPerPage"] = self.items_per_page
988
if self.resources:
989
body["Resources"] = self.resources
990
if self.schemas:
991
body["schemas"] = self.schemas
992
if self.start_index is not None:
993
body["startIndex"] = self.start_index
994
if self.total_results is not None:
995
body["totalResults"] = self.total_results
996
return body
997
998
@classmethod
999
def from_dict(cls, d: Dict[str, Any]) -> ListServicePrincipalResponse:
1000
"""Deserializes the ListServicePrincipalResponse from a dictionary."""