stackit-authorization 0.0.1a0__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.
Files changed (29) hide show
  1. stackit/authorization/__init__.py +57 -0
  2. stackit/authorization/api/__init__.py +4 -0
  3. stackit/authorization/api/default_api.py +1894 -0
  4. stackit/authorization/api_client.py +626 -0
  5. stackit/authorization/api_response.py +23 -0
  6. stackit/authorization/configuration.py +110 -0
  7. stackit/authorization/exceptions.py +198 -0
  8. stackit/authorization/models/__init__.py +38 -0
  9. stackit/authorization/models/add_members_payload.py +106 -0
  10. stackit/authorization/models/error_response.py +94 -0
  11. stackit/authorization/models/existing_permission.py +90 -0
  12. stackit/authorization/models/list_members_response.py +115 -0
  13. stackit/authorization/models/list_permissions_response.py +98 -0
  14. stackit/authorization/models/list_user_memberships_response.py +98 -0
  15. stackit/authorization/models/list_user_permissions_response.py +98 -0
  16. stackit/authorization/models/member.py +90 -0
  17. stackit/authorization/models/members_response.py +121 -0
  18. stackit/authorization/models/permission.py +90 -0
  19. stackit/authorization/models/remove_members_payload.py +108 -0
  20. stackit/authorization/models/role.py +122 -0
  21. stackit/authorization/models/roles_response.py +113 -0
  22. stackit/authorization/models/user_membership.py +113 -0
  23. stackit/authorization/models/user_permission.py +117 -0
  24. stackit/authorization/models/zookie.py +81 -0
  25. stackit/authorization/py.typed +0 -0
  26. stackit/authorization/rest.py +148 -0
  27. stackit_authorization-0.0.1a0.dist-info/METADATA +44 -0
  28. stackit_authorization-0.0.1a0.dist-info/RECORD +29 -0
  29. stackit_authorization-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,1894 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Membership API
5
+
6
+ The Membership API is used to manage memberships, roles and permissions of STACKIT resources, like projects, folders, organizations and other resources.
7
+
8
+ The version of the OpenAPI document: 2.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from typing import Any, Dict, List, Optional, Tuple, Union
15
+
16
+ from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
17
+ from stackit.core.configuration import Configuration
18
+ from typing_extensions import Annotated
19
+
20
+ from stackit.authorization.api_client import ApiClient, RequestSerialized
21
+ from stackit.authorization.api_response import ApiResponse
22
+ from stackit.authorization.models.add_members_payload import AddMembersPayload
23
+ from stackit.authorization.models.list_members_response import ListMembersResponse
24
+ from stackit.authorization.models.list_permissions_response import (
25
+ ListPermissionsResponse,
26
+ )
27
+ from stackit.authorization.models.list_user_memberships_response import (
28
+ ListUserMembershipsResponse,
29
+ )
30
+ from stackit.authorization.models.list_user_permissions_response import (
31
+ ListUserPermissionsResponse,
32
+ )
33
+ from stackit.authorization.models.members_response import MembersResponse
34
+ from stackit.authorization.models.remove_members_payload import RemoveMembersPayload
35
+ from stackit.authorization.models.roles_response import RolesResponse
36
+ from stackit.authorization.rest import RESTResponseType
37
+
38
+
39
+ class DefaultApi:
40
+ """NOTE: This class is auto generated by OpenAPI Generator
41
+ Ref: https://openapi-generator.tech
42
+
43
+ Do not edit the class manually.
44
+ """
45
+
46
+ def __init__(self, configuration: Configuration = None) -> None:
47
+ if configuration is None:
48
+ configuration = Configuration()
49
+ self.configuration = configuration
50
+ self.api_client = ApiClient(self.configuration)
51
+
52
+ @validate_call
53
+ def add_members(
54
+ self,
55
+ resource_id: StrictStr,
56
+ add_members_payload: AddMembersPayload,
57
+ _request_timeout: Union[
58
+ None,
59
+ Annotated[StrictFloat, Field(gt=0)],
60
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
61
+ ] = None,
62
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
63
+ _content_type: Optional[StrictStr] = None,
64
+ _headers: Optional[Dict[StrictStr, Any]] = None,
65
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
66
+ ) -> MembersResponse:
67
+ """Add members to a resource
68
+
69
+ Add members to the given resource with specified roles.
70
+
71
+ :param resource_id: (required)
72
+ :type resource_id: str
73
+ :param add_members_payload: (required)
74
+ :type add_members_payload: AddMembersPayload
75
+ :param _request_timeout: timeout setting for this request. If one
76
+ number provided, it will be total request
77
+ timeout. It can also be a pair (tuple) of
78
+ (connection, read) timeouts.
79
+ :type _request_timeout: int, tuple(int, int), optional
80
+ :param _request_auth: set to override the auth_settings for an a single
81
+ request; this effectively ignores the
82
+ authentication in the spec for a single request.
83
+ :type _request_auth: dict, optional
84
+ :param _content_type: force content-type for the request.
85
+ :type _content_type: str, Optional
86
+ :param _headers: set to override the headers for a single
87
+ request; this effectively ignores the headers
88
+ in the spec for a single request.
89
+ :type _headers: dict, optional
90
+ :param _host_index: set to override the host_index for a single
91
+ request; this effectively ignores the host_index
92
+ in the spec for a single request.
93
+ :type _host_index: int, optional
94
+ :return: Returns the result object.
95
+ """ # noqa: E501 docstring might be too long
96
+
97
+ _param = self._add_members_serialize(
98
+ resource_id=resource_id,
99
+ add_members_payload=add_members_payload,
100
+ _request_auth=_request_auth,
101
+ _content_type=_content_type,
102
+ _headers=_headers,
103
+ _host_index=_host_index,
104
+ )
105
+
106
+ _response_types_map: Dict[str, Optional[str]] = {
107
+ "200": "MembersResponse",
108
+ "400": "ErrorResponse",
109
+ "401": "ErrorResponse",
110
+ "403": "ErrorResponse",
111
+ }
112
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
113
+ response_data.read()
114
+ return self.api_client.response_deserialize(
115
+ response_data=response_data,
116
+ response_types_map=_response_types_map,
117
+ ).data
118
+
119
+ @validate_call
120
+ def add_members_with_http_info(
121
+ self,
122
+ resource_id: StrictStr,
123
+ add_members_payload: AddMembersPayload,
124
+ _request_timeout: Union[
125
+ None,
126
+ Annotated[StrictFloat, Field(gt=0)],
127
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
128
+ ] = None,
129
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
130
+ _content_type: Optional[StrictStr] = None,
131
+ _headers: Optional[Dict[StrictStr, Any]] = None,
132
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
133
+ ) -> ApiResponse[MembersResponse]:
134
+ """Add members to a resource
135
+
136
+ Add members to the given resource with specified roles.
137
+
138
+ :param resource_id: (required)
139
+ :type resource_id: str
140
+ :param add_members_payload: (required)
141
+ :type add_members_payload: AddMembersPayload
142
+ :param _request_timeout: timeout setting for this request. If one
143
+ number provided, it will be total request
144
+ timeout. It can also be a pair (tuple) of
145
+ (connection, read) timeouts.
146
+ :type _request_timeout: int, tuple(int, int), optional
147
+ :param _request_auth: set to override the auth_settings for an a single
148
+ request; this effectively ignores the
149
+ authentication in the spec for a single request.
150
+ :type _request_auth: dict, optional
151
+ :param _content_type: force content-type for the request.
152
+ :type _content_type: str, Optional
153
+ :param _headers: set to override the headers for a single
154
+ request; this effectively ignores the headers
155
+ in the spec for a single request.
156
+ :type _headers: dict, optional
157
+ :param _host_index: set to override the host_index for a single
158
+ request; this effectively ignores the host_index
159
+ in the spec for a single request.
160
+ :type _host_index: int, optional
161
+ :return: Returns the result object.
162
+ """ # noqa: E501 docstring might be too long
163
+
164
+ _param = self._add_members_serialize(
165
+ resource_id=resource_id,
166
+ add_members_payload=add_members_payload,
167
+ _request_auth=_request_auth,
168
+ _content_type=_content_type,
169
+ _headers=_headers,
170
+ _host_index=_host_index,
171
+ )
172
+
173
+ _response_types_map: Dict[str, Optional[str]] = {
174
+ "200": "MembersResponse",
175
+ "400": "ErrorResponse",
176
+ "401": "ErrorResponse",
177
+ "403": "ErrorResponse",
178
+ }
179
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
180
+ response_data.read()
181
+ return self.api_client.response_deserialize(
182
+ response_data=response_data,
183
+ response_types_map=_response_types_map,
184
+ )
185
+
186
+ @validate_call
187
+ def add_members_without_preload_content(
188
+ self,
189
+ resource_id: StrictStr,
190
+ add_members_payload: AddMembersPayload,
191
+ _request_timeout: Union[
192
+ None,
193
+ Annotated[StrictFloat, Field(gt=0)],
194
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
195
+ ] = None,
196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
197
+ _content_type: Optional[StrictStr] = None,
198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
200
+ ) -> RESTResponseType:
201
+ """Add members to a resource
202
+
203
+ Add members to the given resource with specified roles.
204
+
205
+ :param resource_id: (required)
206
+ :type resource_id: str
207
+ :param add_members_payload: (required)
208
+ :type add_members_payload: AddMembersPayload
209
+ :param _request_timeout: timeout setting for this request. If one
210
+ number provided, it will be total request
211
+ timeout. It can also be a pair (tuple) of
212
+ (connection, read) timeouts.
213
+ :type _request_timeout: int, tuple(int, int), optional
214
+ :param _request_auth: set to override the auth_settings for an a single
215
+ request; this effectively ignores the
216
+ authentication in the spec for a single request.
217
+ :type _request_auth: dict, optional
218
+ :param _content_type: force content-type for the request.
219
+ :type _content_type: str, Optional
220
+ :param _headers: set to override the headers for a single
221
+ request; this effectively ignores the headers
222
+ in the spec for a single request.
223
+ :type _headers: dict, optional
224
+ :param _host_index: set to override the host_index for a single
225
+ request; this effectively ignores the host_index
226
+ in the spec for a single request.
227
+ :type _host_index: int, optional
228
+ :return: Returns the result object.
229
+ """ # noqa: E501 docstring might be too long
230
+
231
+ _param = self._add_members_serialize(
232
+ resource_id=resource_id,
233
+ add_members_payload=add_members_payload,
234
+ _request_auth=_request_auth,
235
+ _content_type=_content_type,
236
+ _headers=_headers,
237
+ _host_index=_host_index,
238
+ )
239
+
240
+ _response_types_map: Dict[str, Optional[str]] = {
241
+ "200": "MembersResponse",
242
+ "400": "ErrorResponse",
243
+ "401": "ErrorResponse",
244
+ "403": "ErrorResponse",
245
+ }
246
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
247
+ return response_data.response
248
+
249
+ def _add_members_serialize(
250
+ self,
251
+ resource_id,
252
+ add_members_payload,
253
+ _request_auth,
254
+ _content_type,
255
+ _headers,
256
+ _host_index,
257
+ ) -> RequestSerialized:
258
+
259
+ _host = None
260
+
261
+ _collection_formats: Dict[str, str] = {}
262
+
263
+ _path_params: Dict[str, str] = {}
264
+ _query_params: List[Tuple[str, str]] = []
265
+ _header_params: Dict[str, Optional[str]] = _headers or {}
266
+ _form_params: List[Tuple[str, str]] = []
267
+ _files: Dict[str, Union[str, bytes]] = {}
268
+ _body_params: Optional[bytes] = None
269
+
270
+ # process the path parameters
271
+ if resource_id is not None:
272
+ _path_params["resourceId"] = resource_id
273
+ # process the query parameters
274
+ # process the header parameters
275
+ # process the form parameters
276
+ # process the body parameter
277
+ if add_members_payload is not None:
278
+ _body_params = add_members_payload
279
+
280
+ # set the HTTP header `Accept`
281
+ if "Accept" not in _header_params:
282
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
283
+
284
+ # set the HTTP header `Content-Type`
285
+ if _content_type:
286
+ _header_params["Content-Type"] = _content_type
287
+ else:
288
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
289
+ if _default_content_type is not None:
290
+ _header_params["Content-Type"] = _default_content_type
291
+
292
+ # authentication setting
293
+ _auth_settings: List[str] = []
294
+
295
+ return self.api_client.param_serialize(
296
+ method="PATCH",
297
+ resource_path="/v2/{resourceId}/members",
298
+ path_params=_path_params,
299
+ query_params=_query_params,
300
+ header_params=_header_params,
301
+ body=_body_params,
302
+ post_params=_form_params,
303
+ files=_files,
304
+ auth_settings=_auth_settings,
305
+ collection_formats=_collection_formats,
306
+ _host=_host,
307
+ _request_auth=_request_auth,
308
+ )
309
+
310
+ @validate_call
311
+ def list_members(
312
+ self,
313
+ resource_type: StrictStr,
314
+ resource_id: StrictStr,
315
+ subject: Optional[StrictStr] = None,
316
+ _request_timeout: Union[
317
+ None,
318
+ Annotated[StrictFloat, Field(gt=0)],
319
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
320
+ ] = None,
321
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
322
+ _content_type: Optional[StrictStr] = None,
323
+ _headers: Optional[Dict[StrictStr, Any]] = None,
324
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
325
+ ) -> ListMembersResponse:
326
+ """Get members to a resource
327
+
328
+ List members of the given resource.
329
+
330
+ :param resource_type: (required)
331
+ :type resource_type: str
332
+ :param resource_id: (required)
333
+ :type resource_id: str
334
+ :param subject:
335
+ :type subject: str
336
+ :param _request_timeout: timeout setting for this request. If one
337
+ number provided, it will be total request
338
+ timeout. It can also be a pair (tuple) of
339
+ (connection, read) timeouts.
340
+ :type _request_timeout: int, tuple(int, int), optional
341
+ :param _request_auth: set to override the auth_settings for an a single
342
+ request; this effectively ignores the
343
+ authentication in the spec for a single request.
344
+ :type _request_auth: dict, optional
345
+ :param _content_type: force content-type for the request.
346
+ :type _content_type: str, Optional
347
+ :param _headers: set to override the headers for a single
348
+ request; this effectively ignores the headers
349
+ in the spec for a single request.
350
+ :type _headers: dict, optional
351
+ :param _host_index: set to override the host_index for a single
352
+ request; this effectively ignores the host_index
353
+ in the spec for a single request.
354
+ :type _host_index: int, optional
355
+ :return: Returns the result object.
356
+ """ # noqa: E501 docstring might be too long
357
+
358
+ _param = self._list_members_serialize(
359
+ resource_type=resource_type,
360
+ resource_id=resource_id,
361
+ subject=subject,
362
+ _request_auth=_request_auth,
363
+ _content_type=_content_type,
364
+ _headers=_headers,
365
+ _host_index=_host_index,
366
+ )
367
+
368
+ _response_types_map: Dict[str, Optional[str]] = {
369
+ "200": "ListMembersResponse",
370
+ "400": "ErrorResponse",
371
+ "401": "ErrorResponse",
372
+ "403": "ErrorResponse",
373
+ }
374
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
375
+ response_data.read()
376
+ return self.api_client.response_deserialize(
377
+ response_data=response_data,
378
+ response_types_map=_response_types_map,
379
+ ).data
380
+
381
+ @validate_call
382
+ def list_members_with_http_info(
383
+ self,
384
+ resource_type: StrictStr,
385
+ resource_id: StrictStr,
386
+ subject: Optional[StrictStr] = None,
387
+ _request_timeout: Union[
388
+ None,
389
+ Annotated[StrictFloat, Field(gt=0)],
390
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
391
+ ] = None,
392
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
393
+ _content_type: Optional[StrictStr] = None,
394
+ _headers: Optional[Dict[StrictStr, Any]] = None,
395
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
396
+ ) -> ApiResponse[ListMembersResponse]:
397
+ """Get members to a resource
398
+
399
+ List members of the given resource.
400
+
401
+ :param resource_type: (required)
402
+ :type resource_type: str
403
+ :param resource_id: (required)
404
+ :type resource_id: str
405
+ :param subject:
406
+ :type subject: str
407
+ :param _request_timeout: timeout setting for this request. If one
408
+ number provided, it will be total request
409
+ timeout. It can also be a pair (tuple) of
410
+ (connection, read) timeouts.
411
+ :type _request_timeout: int, tuple(int, int), optional
412
+ :param _request_auth: set to override the auth_settings for an a single
413
+ request; this effectively ignores the
414
+ authentication in the spec for a single request.
415
+ :type _request_auth: dict, optional
416
+ :param _content_type: force content-type for the request.
417
+ :type _content_type: str, Optional
418
+ :param _headers: set to override the headers for a single
419
+ request; this effectively ignores the headers
420
+ in the spec for a single request.
421
+ :type _headers: dict, optional
422
+ :param _host_index: set to override the host_index for a single
423
+ request; this effectively ignores the host_index
424
+ in the spec for a single request.
425
+ :type _host_index: int, optional
426
+ :return: Returns the result object.
427
+ """ # noqa: E501 docstring might be too long
428
+
429
+ _param = self._list_members_serialize(
430
+ resource_type=resource_type,
431
+ resource_id=resource_id,
432
+ subject=subject,
433
+ _request_auth=_request_auth,
434
+ _content_type=_content_type,
435
+ _headers=_headers,
436
+ _host_index=_host_index,
437
+ )
438
+
439
+ _response_types_map: Dict[str, Optional[str]] = {
440
+ "200": "ListMembersResponse",
441
+ "400": "ErrorResponse",
442
+ "401": "ErrorResponse",
443
+ "403": "ErrorResponse",
444
+ }
445
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
446
+ response_data.read()
447
+ return self.api_client.response_deserialize(
448
+ response_data=response_data,
449
+ response_types_map=_response_types_map,
450
+ )
451
+
452
+ @validate_call
453
+ def list_members_without_preload_content(
454
+ self,
455
+ resource_type: StrictStr,
456
+ resource_id: StrictStr,
457
+ subject: Optional[StrictStr] = None,
458
+ _request_timeout: Union[
459
+ None,
460
+ Annotated[StrictFloat, Field(gt=0)],
461
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
462
+ ] = None,
463
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
464
+ _content_type: Optional[StrictStr] = None,
465
+ _headers: Optional[Dict[StrictStr, Any]] = None,
466
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
467
+ ) -> RESTResponseType:
468
+ """Get members to a resource
469
+
470
+ List members of the given resource.
471
+
472
+ :param resource_type: (required)
473
+ :type resource_type: str
474
+ :param resource_id: (required)
475
+ :type resource_id: str
476
+ :param subject:
477
+ :type subject: str
478
+ :param _request_timeout: timeout setting for this request. If one
479
+ number provided, it will be total request
480
+ timeout. It can also be a pair (tuple) of
481
+ (connection, read) timeouts.
482
+ :type _request_timeout: int, tuple(int, int), optional
483
+ :param _request_auth: set to override the auth_settings for an a single
484
+ request; this effectively ignores the
485
+ authentication in the spec for a single request.
486
+ :type _request_auth: dict, optional
487
+ :param _content_type: force content-type for the request.
488
+ :type _content_type: str, Optional
489
+ :param _headers: set to override the headers for a single
490
+ request; this effectively ignores the headers
491
+ in the spec for a single request.
492
+ :type _headers: dict, optional
493
+ :param _host_index: set to override the host_index for a single
494
+ request; this effectively ignores the host_index
495
+ in the spec for a single request.
496
+ :type _host_index: int, optional
497
+ :return: Returns the result object.
498
+ """ # noqa: E501 docstring might be too long
499
+
500
+ _param = self._list_members_serialize(
501
+ resource_type=resource_type,
502
+ resource_id=resource_id,
503
+ subject=subject,
504
+ _request_auth=_request_auth,
505
+ _content_type=_content_type,
506
+ _headers=_headers,
507
+ _host_index=_host_index,
508
+ )
509
+
510
+ _response_types_map: Dict[str, Optional[str]] = {
511
+ "200": "ListMembersResponse",
512
+ "400": "ErrorResponse",
513
+ "401": "ErrorResponse",
514
+ "403": "ErrorResponse",
515
+ }
516
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
517
+ return response_data.response
518
+
519
+ def _list_members_serialize(
520
+ self,
521
+ resource_type,
522
+ resource_id,
523
+ subject,
524
+ _request_auth,
525
+ _content_type,
526
+ _headers,
527
+ _host_index,
528
+ ) -> RequestSerialized:
529
+
530
+ _host = None
531
+
532
+ _collection_formats: Dict[str, str] = {}
533
+
534
+ _path_params: Dict[str, str] = {}
535
+ _query_params: List[Tuple[str, str]] = []
536
+ _header_params: Dict[str, Optional[str]] = _headers or {}
537
+ _form_params: List[Tuple[str, str]] = []
538
+ _files: Dict[str, Union[str, bytes]] = {}
539
+ _body_params: Optional[bytes] = None
540
+
541
+ # process the path parameters
542
+ if resource_type is not None:
543
+ _path_params["resourceType"] = resource_type
544
+ if resource_id is not None:
545
+ _path_params["resourceId"] = resource_id
546
+ # process the query parameters
547
+ if subject is not None:
548
+
549
+ _query_params.append(("subject", subject))
550
+
551
+ # process the header parameters
552
+ # process the form parameters
553
+ # process the body parameter
554
+
555
+ # set the HTTP header `Accept`
556
+ if "Accept" not in _header_params:
557
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
558
+
559
+ # authentication setting
560
+ _auth_settings: List[str] = []
561
+
562
+ return self.api_client.param_serialize(
563
+ method="GET",
564
+ resource_path="/v2/{resourceType}/{resourceId}/members",
565
+ path_params=_path_params,
566
+ query_params=_query_params,
567
+ header_params=_header_params,
568
+ body=_body_params,
569
+ post_params=_form_params,
570
+ files=_files,
571
+ auth_settings=_auth_settings,
572
+ collection_formats=_collection_formats,
573
+ _host=_host,
574
+ _request_auth=_request_auth,
575
+ )
576
+
577
+ @validate_call
578
+ def list_permissions(
579
+ self,
580
+ resource_type: Optional[StrictStr] = None,
581
+ _request_timeout: Union[
582
+ None,
583
+ Annotated[StrictFloat, Field(gt=0)],
584
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
585
+ ] = None,
586
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
587
+ _content_type: Optional[StrictStr] = None,
588
+ _headers: Optional[Dict[StrictStr, Any]] = None,
589
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
590
+ ) -> ListPermissionsResponse:
591
+ """Get available permissions
592
+
593
+ Get available permissions
594
+
595
+ :param resource_type:
596
+ :type resource_type: str
597
+ :param _request_timeout: timeout setting for this request. If one
598
+ number provided, it will be total request
599
+ timeout. It can also be a pair (tuple) of
600
+ (connection, read) timeouts.
601
+ :type _request_timeout: int, tuple(int, int), optional
602
+ :param _request_auth: set to override the auth_settings for an a single
603
+ request; this effectively ignores the
604
+ authentication in the spec for a single request.
605
+ :type _request_auth: dict, optional
606
+ :param _content_type: force content-type for the request.
607
+ :type _content_type: str, Optional
608
+ :param _headers: set to override the headers for a single
609
+ request; this effectively ignores the headers
610
+ in the spec for a single request.
611
+ :type _headers: dict, optional
612
+ :param _host_index: set to override the host_index for a single
613
+ request; this effectively ignores the host_index
614
+ in the spec for a single request.
615
+ :type _host_index: int, optional
616
+ :return: Returns the result object.
617
+ """ # noqa: E501 docstring might be too long
618
+
619
+ _param = self._list_permissions_serialize(
620
+ resource_type=resource_type,
621
+ _request_auth=_request_auth,
622
+ _content_type=_content_type,
623
+ _headers=_headers,
624
+ _host_index=_host_index,
625
+ )
626
+
627
+ _response_types_map: Dict[str, Optional[str]] = {
628
+ "200": "ListPermissionsResponse",
629
+ "400": "ErrorResponse",
630
+ "401": "ErrorResponse",
631
+ "403": "ErrorResponse",
632
+ }
633
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
634
+ response_data.read()
635
+ return self.api_client.response_deserialize(
636
+ response_data=response_data,
637
+ response_types_map=_response_types_map,
638
+ ).data
639
+
640
+ @validate_call
641
+ def list_permissions_with_http_info(
642
+ self,
643
+ resource_type: Optional[StrictStr] = None,
644
+ _request_timeout: Union[
645
+ None,
646
+ Annotated[StrictFloat, Field(gt=0)],
647
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
648
+ ] = None,
649
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
650
+ _content_type: Optional[StrictStr] = None,
651
+ _headers: Optional[Dict[StrictStr, Any]] = None,
652
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
653
+ ) -> ApiResponse[ListPermissionsResponse]:
654
+ """Get available permissions
655
+
656
+ Get available permissions
657
+
658
+ :param resource_type:
659
+ :type resource_type: str
660
+ :param _request_timeout: timeout setting for this request. If one
661
+ number provided, it will be total request
662
+ timeout. It can also be a pair (tuple) of
663
+ (connection, read) timeouts.
664
+ :type _request_timeout: int, tuple(int, int), optional
665
+ :param _request_auth: set to override the auth_settings for an a single
666
+ request; this effectively ignores the
667
+ authentication in the spec for a single request.
668
+ :type _request_auth: dict, optional
669
+ :param _content_type: force content-type for the request.
670
+ :type _content_type: str, Optional
671
+ :param _headers: set to override the headers for a single
672
+ request; this effectively ignores the headers
673
+ in the spec for a single request.
674
+ :type _headers: dict, optional
675
+ :param _host_index: set to override the host_index for a single
676
+ request; this effectively ignores the host_index
677
+ in the spec for a single request.
678
+ :type _host_index: int, optional
679
+ :return: Returns the result object.
680
+ """ # noqa: E501 docstring might be too long
681
+
682
+ _param = self._list_permissions_serialize(
683
+ resource_type=resource_type,
684
+ _request_auth=_request_auth,
685
+ _content_type=_content_type,
686
+ _headers=_headers,
687
+ _host_index=_host_index,
688
+ )
689
+
690
+ _response_types_map: Dict[str, Optional[str]] = {
691
+ "200": "ListPermissionsResponse",
692
+ "400": "ErrorResponse",
693
+ "401": "ErrorResponse",
694
+ "403": "ErrorResponse",
695
+ }
696
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
697
+ response_data.read()
698
+ return self.api_client.response_deserialize(
699
+ response_data=response_data,
700
+ response_types_map=_response_types_map,
701
+ )
702
+
703
+ @validate_call
704
+ def list_permissions_without_preload_content(
705
+ self,
706
+ resource_type: Optional[StrictStr] = None,
707
+ _request_timeout: Union[
708
+ None,
709
+ Annotated[StrictFloat, Field(gt=0)],
710
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
711
+ ] = None,
712
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
713
+ _content_type: Optional[StrictStr] = None,
714
+ _headers: Optional[Dict[StrictStr, Any]] = None,
715
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
716
+ ) -> RESTResponseType:
717
+ """Get available permissions
718
+
719
+ Get available permissions
720
+
721
+ :param resource_type:
722
+ :type resource_type: str
723
+ :param _request_timeout: timeout setting for this request. If one
724
+ number provided, it will be total request
725
+ timeout. It can also be a pair (tuple) of
726
+ (connection, read) timeouts.
727
+ :type _request_timeout: int, tuple(int, int), optional
728
+ :param _request_auth: set to override the auth_settings for an a single
729
+ request; this effectively ignores the
730
+ authentication in the spec for a single request.
731
+ :type _request_auth: dict, optional
732
+ :param _content_type: force content-type for the request.
733
+ :type _content_type: str, Optional
734
+ :param _headers: set to override the headers for a single
735
+ request; this effectively ignores the headers
736
+ in the spec for a single request.
737
+ :type _headers: dict, optional
738
+ :param _host_index: set to override the host_index for a single
739
+ request; this effectively ignores the host_index
740
+ in the spec for a single request.
741
+ :type _host_index: int, optional
742
+ :return: Returns the result object.
743
+ """ # noqa: E501 docstring might be too long
744
+
745
+ _param = self._list_permissions_serialize(
746
+ resource_type=resource_type,
747
+ _request_auth=_request_auth,
748
+ _content_type=_content_type,
749
+ _headers=_headers,
750
+ _host_index=_host_index,
751
+ )
752
+
753
+ _response_types_map: Dict[str, Optional[str]] = {
754
+ "200": "ListPermissionsResponse",
755
+ "400": "ErrorResponse",
756
+ "401": "ErrorResponse",
757
+ "403": "ErrorResponse",
758
+ }
759
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
760
+ return response_data.response
761
+
762
+ def _list_permissions_serialize(
763
+ self,
764
+ resource_type,
765
+ _request_auth,
766
+ _content_type,
767
+ _headers,
768
+ _host_index,
769
+ ) -> RequestSerialized:
770
+
771
+ _host = None
772
+
773
+ _collection_formats: Dict[str, str] = {}
774
+
775
+ _path_params: Dict[str, str] = {}
776
+ _query_params: List[Tuple[str, str]] = []
777
+ _header_params: Dict[str, Optional[str]] = _headers or {}
778
+ _form_params: List[Tuple[str, str]] = []
779
+ _files: Dict[str, Union[str, bytes]] = {}
780
+ _body_params: Optional[bytes] = None
781
+
782
+ # process the path parameters
783
+ # process the query parameters
784
+ if resource_type is not None:
785
+
786
+ _query_params.append(("resourceType", resource_type))
787
+
788
+ # process the header parameters
789
+ # process the form parameters
790
+ # process the body parameter
791
+
792
+ # set the HTTP header `Accept`
793
+ if "Accept" not in _header_params:
794
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
795
+
796
+ # authentication setting
797
+ _auth_settings: List[str] = []
798
+
799
+ return self.api_client.param_serialize(
800
+ method="GET",
801
+ resource_path="/v2/permissions",
802
+ path_params=_path_params,
803
+ query_params=_query_params,
804
+ header_params=_header_params,
805
+ body=_body_params,
806
+ post_params=_form_params,
807
+ files=_files,
808
+ auth_settings=_auth_settings,
809
+ collection_formats=_collection_formats,
810
+ _host=_host,
811
+ _request_auth=_request_auth,
812
+ )
813
+
814
+ @validate_call
815
+ def list_roles(
816
+ self,
817
+ resource_type: StrictStr,
818
+ resource_id: StrictStr,
819
+ _request_timeout: Union[
820
+ None,
821
+ Annotated[StrictFloat, Field(gt=0)],
822
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
823
+ ] = None,
824
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
825
+ _content_type: Optional[StrictStr] = None,
826
+ _headers: Optional[Dict[StrictStr, Any]] = None,
827
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
828
+ ) -> RolesResponse:
829
+ """Get roles and permissions of a resource
830
+
831
+ Get roles and permissions of a resource
832
+
833
+ :param resource_type: (required)
834
+ :type resource_type: str
835
+ :param resource_id: (required)
836
+ :type resource_id: str
837
+ :param _request_timeout: timeout setting for this request. If one
838
+ number provided, it will be total request
839
+ timeout. It can also be a pair (tuple) of
840
+ (connection, read) timeouts.
841
+ :type _request_timeout: int, tuple(int, int), optional
842
+ :param _request_auth: set to override the auth_settings for an a single
843
+ request; this effectively ignores the
844
+ authentication in the spec for a single request.
845
+ :type _request_auth: dict, optional
846
+ :param _content_type: force content-type for the request.
847
+ :type _content_type: str, Optional
848
+ :param _headers: set to override the headers for a single
849
+ request; this effectively ignores the headers
850
+ in the spec for a single request.
851
+ :type _headers: dict, optional
852
+ :param _host_index: set to override the host_index for a single
853
+ request; this effectively ignores the host_index
854
+ in the spec for a single request.
855
+ :type _host_index: int, optional
856
+ :return: Returns the result object.
857
+ """ # noqa: E501 docstring might be too long
858
+
859
+ _param = self._list_roles_serialize(
860
+ resource_type=resource_type,
861
+ resource_id=resource_id,
862
+ _request_auth=_request_auth,
863
+ _content_type=_content_type,
864
+ _headers=_headers,
865
+ _host_index=_host_index,
866
+ )
867
+
868
+ _response_types_map: Dict[str, Optional[str]] = {
869
+ "200": "RolesResponse",
870
+ "400": "ErrorResponse",
871
+ "401": "ErrorResponse",
872
+ "403": "ErrorResponse",
873
+ }
874
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
875
+ response_data.read()
876
+ return self.api_client.response_deserialize(
877
+ response_data=response_data,
878
+ response_types_map=_response_types_map,
879
+ ).data
880
+
881
+ @validate_call
882
+ def list_roles_with_http_info(
883
+ self,
884
+ resource_type: StrictStr,
885
+ resource_id: StrictStr,
886
+ _request_timeout: Union[
887
+ None,
888
+ Annotated[StrictFloat, Field(gt=0)],
889
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
890
+ ] = None,
891
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
892
+ _content_type: Optional[StrictStr] = None,
893
+ _headers: Optional[Dict[StrictStr, Any]] = None,
894
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
895
+ ) -> ApiResponse[RolesResponse]:
896
+ """Get roles and permissions of a resource
897
+
898
+ Get roles and permissions of a resource
899
+
900
+ :param resource_type: (required)
901
+ :type resource_type: str
902
+ :param resource_id: (required)
903
+ :type resource_id: str
904
+ :param _request_timeout: timeout setting for this request. If one
905
+ number provided, it will be total request
906
+ timeout. It can also be a pair (tuple) of
907
+ (connection, read) timeouts.
908
+ :type _request_timeout: int, tuple(int, int), optional
909
+ :param _request_auth: set to override the auth_settings for an a single
910
+ request; this effectively ignores the
911
+ authentication in the spec for a single request.
912
+ :type _request_auth: dict, optional
913
+ :param _content_type: force content-type for the request.
914
+ :type _content_type: str, Optional
915
+ :param _headers: set to override the headers for a single
916
+ request; this effectively ignores the headers
917
+ in the spec for a single request.
918
+ :type _headers: dict, optional
919
+ :param _host_index: set to override the host_index for a single
920
+ request; this effectively ignores the host_index
921
+ in the spec for a single request.
922
+ :type _host_index: int, optional
923
+ :return: Returns the result object.
924
+ """ # noqa: E501 docstring might be too long
925
+
926
+ _param = self._list_roles_serialize(
927
+ resource_type=resource_type,
928
+ resource_id=resource_id,
929
+ _request_auth=_request_auth,
930
+ _content_type=_content_type,
931
+ _headers=_headers,
932
+ _host_index=_host_index,
933
+ )
934
+
935
+ _response_types_map: Dict[str, Optional[str]] = {
936
+ "200": "RolesResponse",
937
+ "400": "ErrorResponse",
938
+ "401": "ErrorResponse",
939
+ "403": "ErrorResponse",
940
+ }
941
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
942
+ response_data.read()
943
+ return self.api_client.response_deserialize(
944
+ response_data=response_data,
945
+ response_types_map=_response_types_map,
946
+ )
947
+
948
+ @validate_call
949
+ def list_roles_without_preload_content(
950
+ self,
951
+ resource_type: StrictStr,
952
+ resource_id: StrictStr,
953
+ _request_timeout: Union[
954
+ None,
955
+ Annotated[StrictFloat, Field(gt=0)],
956
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
957
+ ] = None,
958
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
959
+ _content_type: Optional[StrictStr] = None,
960
+ _headers: Optional[Dict[StrictStr, Any]] = None,
961
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
962
+ ) -> RESTResponseType:
963
+ """Get roles and permissions of a resource
964
+
965
+ Get roles and permissions of a resource
966
+
967
+ :param resource_type: (required)
968
+ :type resource_type: str
969
+ :param resource_id: (required)
970
+ :type resource_id: str
971
+ :param _request_timeout: timeout setting for this request. If one
972
+ number provided, it will be total request
973
+ timeout. It can also be a pair (tuple) of
974
+ (connection, read) timeouts.
975
+ :type _request_timeout: int, tuple(int, int), optional
976
+ :param _request_auth: set to override the auth_settings for an a single
977
+ request; this effectively ignores the
978
+ authentication in the spec for a single request.
979
+ :type _request_auth: dict, optional
980
+ :param _content_type: force content-type for the request.
981
+ :type _content_type: str, Optional
982
+ :param _headers: set to override the headers for a single
983
+ request; this effectively ignores the headers
984
+ in the spec for a single request.
985
+ :type _headers: dict, optional
986
+ :param _host_index: set to override the host_index for a single
987
+ request; this effectively ignores the host_index
988
+ in the spec for a single request.
989
+ :type _host_index: int, optional
990
+ :return: Returns the result object.
991
+ """ # noqa: E501 docstring might be too long
992
+
993
+ _param = self._list_roles_serialize(
994
+ resource_type=resource_type,
995
+ resource_id=resource_id,
996
+ _request_auth=_request_auth,
997
+ _content_type=_content_type,
998
+ _headers=_headers,
999
+ _host_index=_host_index,
1000
+ )
1001
+
1002
+ _response_types_map: Dict[str, Optional[str]] = {
1003
+ "200": "RolesResponse",
1004
+ "400": "ErrorResponse",
1005
+ "401": "ErrorResponse",
1006
+ "403": "ErrorResponse",
1007
+ }
1008
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1009
+ return response_data.response
1010
+
1011
+ def _list_roles_serialize(
1012
+ self,
1013
+ resource_type,
1014
+ resource_id,
1015
+ _request_auth,
1016
+ _content_type,
1017
+ _headers,
1018
+ _host_index,
1019
+ ) -> RequestSerialized:
1020
+
1021
+ _host = None
1022
+
1023
+ _collection_formats: Dict[str, str] = {}
1024
+
1025
+ _path_params: Dict[str, str] = {}
1026
+ _query_params: List[Tuple[str, str]] = []
1027
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1028
+ _form_params: List[Tuple[str, str]] = []
1029
+ _files: Dict[str, Union[str, bytes]] = {}
1030
+ _body_params: Optional[bytes] = None
1031
+
1032
+ # process the path parameters
1033
+ if resource_type is not None:
1034
+ _path_params["resourceType"] = resource_type
1035
+ if resource_id is not None:
1036
+ _path_params["resourceId"] = resource_id
1037
+ # process the query parameters
1038
+ # process the header parameters
1039
+ # process the form parameters
1040
+ # process the body parameter
1041
+
1042
+ # set the HTTP header `Accept`
1043
+ if "Accept" not in _header_params:
1044
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1045
+
1046
+ # authentication setting
1047
+ _auth_settings: List[str] = []
1048
+
1049
+ return self.api_client.param_serialize(
1050
+ method="GET",
1051
+ resource_path="/v2/{resourceType}/{resourceId}/roles",
1052
+ path_params=_path_params,
1053
+ query_params=_query_params,
1054
+ header_params=_header_params,
1055
+ body=_body_params,
1056
+ post_params=_form_params,
1057
+ files=_files,
1058
+ auth_settings=_auth_settings,
1059
+ collection_formats=_collection_formats,
1060
+ _host=_host,
1061
+ _request_auth=_request_auth,
1062
+ )
1063
+
1064
+ @validate_call
1065
+ def list_user_memberships(
1066
+ self,
1067
+ email: StrictStr,
1068
+ resource_type: Optional[StrictStr] = None,
1069
+ resource_id: Optional[StrictStr] = None,
1070
+ parent_resource_id: Optional[StrictStr] = None,
1071
+ _request_timeout: Union[
1072
+ None,
1073
+ Annotated[StrictFloat, Field(gt=0)],
1074
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1075
+ ] = None,
1076
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1077
+ _content_type: Optional[StrictStr] = None,
1078
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1079
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1080
+ ) -> ListUserMembershipsResponse:
1081
+ """List memberships of a user
1082
+
1083
+ List memberships of a user. An administrative access is needed to list any user's memberships, while the user can do it on his/her own email. You can use filters to scope the request to a project/folder/organization. In this case -if caller is not the subject-, owner permissions are required. Because of hierarchical role bindings, the user might have permissions on more resources.
1084
+
1085
+ :param email: (required)
1086
+ :type email: str
1087
+ :param resource_type:
1088
+ :type resource_type: str
1089
+ :param resource_id:
1090
+ :type resource_id: str
1091
+ :param parent_resource_id:
1092
+ :type parent_resource_id: str
1093
+ :param _request_timeout: timeout setting for this request. If one
1094
+ number provided, it will be total request
1095
+ timeout. It can also be a pair (tuple) of
1096
+ (connection, read) timeouts.
1097
+ :type _request_timeout: int, tuple(int, int), optional
1098
+ :param _request_auth: set to override the auth_settings for an a single
1099
+ request; this effectively ignores the
1100
+ authentication in the spec for a single request.
1101
+ :type _request_auth: dict, optional
1102
+ :param _content_type: force content-type for the request.
1103
+ :type _content_type: str, Optional
1104
+ :param _headers: set to override the headers for a single
1105
+ request; this effectively ignores the headers
1106
+ in the spec for a single request.
1107
+ :type _headers: dict, optional
1108
+ :param _host_index: set to override the host_index for a single
1109
+ request; this effectively ignores the host_index
1110
+ in the spec for a single request.
1111
+ :type _host_index: int, optional
1112
+ :return: Returns the result object.
1113
+ """ # noqa: E501 docstring might be too long
1114
+
1115
+ _param = self._list_user_memberships_serialize(
1116
+ email=email,
1117
+ resource_type=resource_type,
1118
+ resource_id=resource_id,
1119
+ parent_resource_id=parent_resource_id,
1120
+ _request_auth=_request_auth,
1121
+ _content_type=_content_type,
1122
+ _headers=_headers,
1123
+ _host_index=_host_index,
1124
+ )
1125
+
1126
+ _response_types_map: Dict[str, Optional[str]] = {
1127
+ "200": "ListUserMembershipsResponse",
1128
+ "400": "ErrorResponse",
1129
+ "401": "ErrorResponse",
1130
+ "403": "ErrorResponse",
1131
+ }
1132
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1133
+ response_data.read()
1134
+ return self.api_client.response_deserialize(
1135
+ response_data=response_data,
1136
+ response_types_map=_response_types_map,
1137
+ ).data
1138
+
1139
+ @validate_call
1140
+ def list_user_memberships_with_http_info(
1141
+ self,
1142
+ email: StrictStr,
1143
+ resource_type: Optional[StrictStr] = None,
1144
+ resource_id: Optional[StrictStr] = None,
1145
+ parent_resource_id: Optional[StrictStr] = None,
1146
+ _request_timeout: Union[
1147
+ None,
1148
+ Annotated[StrictFloat, Field(gt=0)],
1149
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1150
+ ] = None,
1151
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1152
+ _content_type: Optional[StrictStr] = None,
1153
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1154
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1155
+ ) -> ApiResponse[ListUserMembershipsResponse]:
1156
+ """List memberships of a user
1157
+
1158
+ List memberships of a user. An administrative access is needed to list any user's memberships, while the user can do it on his/her own email. You can use filters to scope the request to a project/folder/organization. In this case -if caller is not the subject-, owner permissions are required. Because of hierarchical role bindings, the user might have permissions on more resources.
1159
+
1160
+ :param email: (required)
1161
+ :type email: str
1162
+ :param resource_type:
1163
+ :type resource_type: str
1164
+ :param resource_id:
1165
+ :type resource_id: str
1166
+ :param parent_resource_id:
1167
+ :type parent_resource_id: str
1168
+ :param _request_timeout: timeout setting for this request. If one
1169
+ number provided, it will be total request
1170
+ timeout. It can also be a pair (tuple) of
1171
+ (connection, read) timeouts.
1172
+ :type _request_timeout: int, tuple(int, int), optional
1173
+ :param _request_auth: set to override the auth_settings for an a single
1174
+ request; this effectively ignores the
1175
+ authentication in the spec for a single request.
1176
+ :type _request_auth: dict, optional
1177
+ :param _content_type: force content-type for the request.
1178
+ :type _content_type: str, Optional
1179
+ :param _headers: set to override the headers for a single
1180
+ request; this effectively ignores the headers
1181
+ in the spec for a single request.
1182
+ :type _headers: dict, optional
1183
+ :param _host_index: set to override the host_index for a single
1184
+ request; this effectively ignores the host_index
1185
+ in the spec for a single request.
1186
+ :type _host_index: int, optional
1187
+ :return: Returns the result object.
1188
+ """ # noqa: E501 docstring might be too long
1189
+
1190
+ _param = self._list_user_memberships_serialize(
1191
+ email=email,
1192
+ resource_type=resource_type,
1193
+ resource_id=resource_id,
1194
+ parent_resource_id=parent_resource_id,
1195
+ _request_auth=_request_auth,
1196
+ _content_type=_content_type,
1197
+ _headers=_headers,
1198
+ _host_index=_host_index,
1199
+ )
1200
+
1201
+ _response_types_map: Dict[str, Optional[str]] = {
1202
+ "200": "ListUserMembershipsResponse",
1203
+ "400": "ErrorResponse",
1204
+ "401": "ErrorResponse",
1205
+ "403": "ErrorResponse",
1206
+ }
1207
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1208
+ response_data.read()
1209
+ return self.api_client.response_deserialize(
1210
+ response_data=response_data,
1211
+ response_types_map=_response_types_map,
1212
+ )
1213
+
1214
+ @validate_call
1215
+ def list_user_memberships_without_preload_content(
1216
+ self,
1217
+ email: StrictStr,
1218
+ resource_type: Optional[StrictStr] = None,
1219
+ resource_id: Optional[StrictStr] = None,
1220
+ parent_resource_id: Optional[StrictStr] = None,
1221
+ _request_timeout: Union[
1222
+ None,
1223
+ Annotated[StrictFloat, Field(gt=0)],
1224
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1225
+ ] = None,
1226
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1227
+ _content_type: Optional[StrictStr] = None,
1228
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1229
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1230
+ ) -> RESTResponseType:
1231
+ """List memberships of a user
1232
+
1233
+ List memberships of a user. An administrative access is needed to list any user's memberships, while the user can do it on his/her own email. You can use filters to scope the request to a project/folder/organization. In this case -if caller is not the subject-, owner permissions are required. Because of hierarchical role bindings, the user might have permissions on more resources.
1234
+
1235
+ :param email: (required)
1236
+ :type email: str
1237
+ :param resource_type:
1238
+ :type resource_type: str
1239
+ :param resource_id:
1240
+ :type resource_id: str
1241
+ :param parent_resource_id:
1242
+ :type parent_resource_id: str
1243
+ :param _request_timeout: timeout setting for this request. If one
1244
+ number provided, it will be total request
1245
+ timeout. It can also be a pair (tuple) of
1246
+ (connection, read) timeouts.
1247
+ :type _request_timeout: int, tuple(int, int), optional
1248
+ :param _request_auth: set to override the auth_settings for an a single
1249
+ request; this effectively ignores the
1250
+ authentication in the spec for a single request.
1251
+ :type _request_auth: dict, optional
1252
+ :param _content_type: force content-type for the request.
1253
+ :type _content_type: str, Optional
1254
+ :param _headers: set to override the headers for a single
1255
+ request; this effectively ignores the headers
1256
+ in the spec for a single request.
1257
+ :type _headers: dict, optional
1258
+ :param _host_index: set to override the host_index for a single
1259
+ request; this effectively ignores the host_index
1260
+ in the spec for a single request.
1261
+ :type _host_index: int, optional
1262
+ :return: Returns the result object.
1263
+ """ # noqa: E501 docstring might be too long
1264
+
1265
+ _param = self._list_user_memberships_serialize(
1266
+ email=email,
1267
+ resource_type=resource_type,
1268
+ resource_id=resource_id,
1269
+ parent_resource_id=parent_resource_id,
1270
+ _request_auth=_request_auth,
1271
+ _content_type=_content_type,
1272
+ _headers=_headers,
1273
+ _host_index=_host_index,
1274
+ )
1275
+
1276
+ _response_types_map: Dict[str, Optional[str]] = {
1277
+ "200": "ListUserMembershipsResponse",
1278
+ "400": "ErrorResponse",
1279
+ "401": "ErrorResponse",
1280
+ "403": "ErrorResponse",
1281
+ }
1282
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1283
+ return response_data.response
1284
+
1285
+ def _list_user_memberships_serialize(
1286
+ self,
1287
+ email,
1288
+ resource_type,
1289
+ resource_id,
1290
+ parent_resource_id,
1291
+ _request_auth,
1292
+ _content_type,
1293
+ _headers,
1294
+ _host_index,
1295
+ ) -> RequestSerialized:
1296
+
1297
+ _host = None
1298
+
1299
+ _collection_formats: Dict[str, str] = {}
1300
+
1301
+ _path_params: Dict[str, str] = {}
1302
+ _query_params: List[Tuple[str, str]] = []
1303
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1304
+ _form_params: List[Tuple[str, str]] = []
1305
+ _files: Dict[str, Union[str, bytes]] = {}
1306
+ _body_params: Optional[bytes] = None
1307
+
1308
+ # process the path parameters
1309
+ if email is not None:
1310
+ _path_params["email"] = email
1311
+ # process the query parameters
1312
+ if resource_type is not None:
1313
+
1314
+ _query_params.append(("resourceType", resource_type))
1315
+
1316
+ if resource_id is not None:
1317
+
1318
+ _query_params.append(("resourceId", resource_id))
1319
+
1320
+ if parent_resource_id is not None:
1321
+
1322
+ _query_params.append(("parentResourceId", parent_resource_id))
1323
+
1324
+ # process the header parameters
1325
+ # process the form parameters
1326
+ # process the body parameter
1327
+
1328
+ # set the HTTP header `Accept`
1329
+ if "Accept" not in _header_params:
1330
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1331
+
1332
+ # authentication setting
1333
+ _auth_settings: List[str] = []
1334
+
1335
+ return self.api_client.param_serialize(
1336
+ method="GET",
1337
+ resource_path="/v2/users/{email}/memberships",
1338
+ path_params=_path_params,
1339
+ query_params=_query_params,
1340
+ header_params=_header_params,
1341
+ body=_body_params,
1342
+ post_params=_form_params,
1343
+ files=_files,
1344
+ auth_settings=_auth_settings,
1345
+ collection_formats=_collection_formats,
1346
+ _host=_host,
1347
+ _request_auth=_request_auth,
1348
+ )
1349
+
1350
+ @validate_call
1351
+ def list_user_permissions(
1352
+ self,
1353
+ email: StrictStr,
1354
+ resource: Optional[StrictStr] = None,
1355
+ resource_type: Optional[StrictStr] = None,
1356
+ permissions: Optional[List[StrictStr]] = None,
1357
+ _request_timeout: Union[
1358
+ None,
1359
+ Annotated[StrictFloat, Field(gt=0)],
1360
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1361
+ ] = None,
1362
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1363
+ _content_type: Optional[StrictStr] = None,
1364
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1365
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1366
+ ) -> ListUserPermissionsResponse:
1367
+ """List permissions of a user
1368
+
1369
+ List permissions of a user. An administrative access is needed to list any user's permissions, while the user can do it on his/her own email. Lists every resource of the given type where the user has any effective permissions. When requested, also lists why the permission is present.
1370
+
1371
+ :param email: (required)
1372
+ :type email: str
1373
+ :param resource:
1374
+ :type resource: str
1375
+ :param resource_type:
1376
+ :type resource_type: str
1377
+ :param permissions:
1378
+ :type permissions: List[str]
1379
+ :param _request_timeout: timeout setting for this request. If one
1380
+ number provided, it will be total request
1381
+ timeout. It can also be a pair (tuple) of
1382
+ (connection, read) timeouts.
1383
+ :type _request_timeout: int, tuple(int, int), optional
1384
+ :param _request_auth: set to override the auth_settings for an a single
1385
+ request; this effectively ignores the
1386
+ authentication in the spec for a single request.
1387
+ :type _request_auth: dict, optional
1388
+ :param _content_type: force content-type for the request.
1389
+ :type _content_type: str, Optional
1390
+ :param _headers: set to override the headers for a single
1391
+ request; this effectively ignores the headers
1392
+ in the spec for a single request.
1393
+ :type _headers: dict, optional
1394
+ :param _host_index: set to override the host_index for a single
1395
+ request; this effectively ignores the host_index
1396
+ in the spec for a single request.
1397
+ :type _host_index: int, optional
1398
+ :return: Returns the result object.
1399
+ """ # noqa: E501 docstring might be too long
1400
+
1401
+ _param = self._list_user_permissions_serialize(
1402
+ email=email,
1403
+ resource=resource,
1404
+ resource_type=resource_type,
1405
+ permissions=permissions,
1406
+ _request_auth=_request_auth,
1407
+ _content_type=_content_type,
1408
+ _headers=_headers,
1409
+ _host_index=_host_index,
1410
+ )
1411
+
1412
+ _response_types_map: Dict[str, Optional[str]] = {
1413
+ "200": "ListUserPermissionsResponse",
1414
+ "400": "ErrorResponse",
1415
+ "401": "ErrorResponse",
1416
+ "403": "ErrorResponse",
1417
+ }
1418
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1419
+ response_data.read()
1420
+ return self.api_client.response_deserialize(
1421
+ response_data=response_data,
1422
+ response_types_map=_response_types_map,
1423
+ ).data
1424
+
1425
+ @validate_call
1426
+ def list_user_permissions_with_http_info(
1427
+ self,
1428
+ email: StrictStr,
1429
+ resource: Optional[StrictStr] = None,
1430
+ resource_type: Optional[StrictStr] = None,
1431
+ permissions: Optional[List[StrictStr]] = None,
1432
+ _request_timeout: Union[
1433
+ None,
1434
+ Annotated[StrictFloat, Field(gt=0)],
1435
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1436
+ ] = None,
1437
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1438
+ _content_type: Optional[StrictStr] = None,
1439
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1440
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1441
+ ) -> ApiResponse[ListUserPermissionsResponse]:
1442
+ """List permissions of a user
1443
+
1444
+ List permissions of a user. An administrative access is needed to list any user's permissions, while the user can do it on his/her own email. Lists every resource of the given type where the user has any effective permissions. When requested, also lists why the permission is present.
1445
+
1446
+ :param email: (required)
1447
+ :type email: str
1448
+ :param resource:
1449
+ :type resource: str
1450
+ :param resource_type:
1451
+ :type resource_type: str
1452
+ :param permissions:
1453
+ :type permissions: List[str]
1454
+ :param _request_timeout: timeout setting for this request. If one
1455
+ number provided, it will be total request
1456
+ timeout. It can also be a pair (tuple) of
1457
+ (connection, read) timeouts.
1458
+ :type _request_timeout: int, tuple(int, int), optional
1459
+ :param _request_auth: set to override the auth_settings for an a single
1460
+ request; this effectively ignores the
1461
+ authentication in the spec for a single request.
1462
+ :type _request_auth: dict, optional
1463
+ :param _content_type: force content-type for the request.
1464
+ :type _content_type: str, Optional
1465
+ :param _headers: set to override the headers for a single
1466
+ request; this effectively ignores the headers
1467
+ in the spec for a single request.
1468
+ :type _headers: dict, optional
1469
+ :param _host_index: set to override the host_index for a single
1470
+ request; this effectively ignores the host_index
1471
+ in the spec for a single request.
1472
+ :type _host_index: int, optional
1473
+ :return: Returns the result object.
1474
+ """ # noqa: E501 docstring might be too long
1475
+
1476
+ _param = self._list_user_permissions_serialize(
1477
+ email=email,
1478
+ resource=resource,
1479
+ resource_type=resource_type,
1480
+ permissions=permissions,
1481
+ _request_auth=_request_auth,
1482
+ _content_type=_content_type,
1483
+ _headers=_headers,
1484
+ _host_index=_host_index,
1485
+ )
1486
+
1487
+ _response_types_map: Dict[str, Optional[str]] = {
1488
+ "200": "ListUserPermissionsResponse",
1489
+ "400": "ErrorResponse",
1490
+ "401": "ErrorResponse",
1491
+ "403": "ErrorResponse",
1492
+ }
1493
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1494
+ response_data.read()
1495
+ return self.api_client.response_deserialize(
1496
+ response_data=response_data,
1497
+ response_types_map=_response_types_map,
1498
+ )
1499
+
1500
+ @validate_call
1501
+ def list_user_permissions_without_preload_content(
1502
+ self,
1503
+ email: StrictStr,
1504
+ resource: Optional[StrictStr] = None,
1505
+ resource_type: Optional[StrictStr] = None,
1506
+ permissions: Optional[List[StrictStr]] = None,
1507
+ _request_timeout: Union[
1508
+ None,
1509
+ Annotated[StrictFloat, Field(gt=0)],
1510
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1511
+ ] = None,
1512
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1513
+ _content_type: Optional[StrictStr] = None,
1514
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1515
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1516
+ ) -> RESTResponseType:
1517
+ """List permissions of a user
1518
+
1519
+ List permissions of a user. An administrative access is needed to list any user's permissions, while the user can do it on his/her own email. Lists every resource of the given type where the user has any effective permissions. When requested, also lists why the permission is present.
1520
+
1521
+ :param email: (required)
1522
+ :type email: str
1523
+ :param resource:
1524
+ :type resource: str
1525
+ :param resource_type:
1526
+ :type resource_type: str
1527
+ :param permissions:
1528
+ :type permissions: List[str]
1529
+ :param _request_timeout: timeout setting for this request. If one
1530
+ number provided, it will be total request
1531
+ timeout. It can also be a pair (tuple) of
1532
+ (connection, read) timeouts.
1533
+ :type _request_timeout: int, tuple(int, int), optional
1534
+ :param _request_auth: set to override the auth_settings for an a single
1535
+ request; this effectively ignores the
1536
+ authentication in the spec for a single request.
1537
+ :type _request_auth: dict, optional
1538
+ :param _content_type: force content-type for the request.
1539
+ :type _content_type: str, Optional
1540
+ :param _headers: set to override the headers for a single
1541
+ request; this effectively ignores the headers
1542
+ in the spec for a single request.
1543
+ :type _headers: dict, optional
1544
+ :param _host_index: set to override the host_index for a single
1545
+ request; this effectively ignores the host_index
1546
+ in the spec for a single request.
1547
+ :type _host_index: int, optional
1548
+ :return: Returns the result object.
1549
+ """ # noqa: E501 docstring might be too long
1550
+
1551
+ _param = self._list_user_permissions_serialize(
1552
+ email=email,
1553
+ resource=resource,
1554
+ resource_type=resource_type,
1555
+ permissions=permissions,
1556
+ _request_auth=_request_auth,
1557
+ _content_type=_content_type,
1558
+ _headers=_headers,
1559
+ _host_index=_host_index,
1560
+ )
1561
+
1562
+ _response_types_map: Dict[str, Optional[str]] = {
1563
+ "200": "ListUserPermissionsResponse",
1564
+ "400": "ErrorResponse",
1565
+ "401": "ErrorResponse",
1566
+ "403": "ErrorResponse",
1567
+ }
1568
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1569
+ return response_data.response
1570
+
1571
+ def _list_user_permissions_serialize(
1572
+ self,
1573
+ email,
1574
+ resource,
1575
+ resource_type,
1576
+ permissions,
1577
+ _request_auth,
1578
+ _content_type,
1579
+ _headers,
1580
+ _host_index,
1581
+ ) -> RequestSerialized:
1582
+
1583
+ _host = None
1584
+
1585
+ _collection_formats: Dict[str, str] = {
1586
+ "permissions": "multi",
1587
+ }
1588
+
1589
+ _path_params: Dict[str, str] = {}
1590
+ _query_params: List[Tuple[str, str]] = []
1591
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1592
+ _form_params: List[Tuple[str, str]] = []
1593
+ _files: Dict[str, Union[str, bytes]] = {}
1594
+ _body_params: Optional[bytes] = None
1595
+
1596
+ # process the path parameters
1597
+ if email is not None:
1598
+ _path_params["email"] = email
1599
+ # process the query parameters
1600
+ if resource is not None:
1601
+
1602
+ _query_params.append(("resource", resource))
1603
+
1604
+ if resource_type is not None:
1605
+
1606
+ _query_params.append(("resourceType", resource_type))
1607
+
1608
+ if permissions is not None:
1609
+
1610
+ _query_params.append(("permissions", permissions))
1611
+
1612
+ # process the header parameters
1613
+ # process the form parameters
1614
+ # process the body parameter
1615
+
1616
+ # set the HTTP header `Accept`
1617
+ if "Accept" not in _header_params:
1618
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1619
+
1620
+ # authentication setting
1621
+ _auth_settings: List[str] = []
1622
+
1623
+ return self.api_client.param_serialize(
1624
+ method="GET",
1625
+ resource_path="/v2/users/{email}/permissions",
1626
+ path_params=_path_params,
1627
+ query_params=_query_params,
1628
+ header_params=_header_params,
1629
+ body=_body_params,
1630
+ post_params=_form_params,
1631
+ files=_files,
1632
+ auth_settings=_auth_settings,
1633
+ collection_formats=_collection_formats,
1634
+ _host=_host,
1635
+ _request_auth=_request_auth,
1636
+ )
1637
+
1638
+ @validate_call
1639
+ def remove_members(
1640
+ self,
1641
+ resource_id: StrictStr,
1642
+ remove_members_payload: RemoveMembersPayload,
1643
+ _request_timeout: Union[
1644
+ None,
1645
+ Annotated[StrictFloat, Field(gt=0)],
1646
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1647
+ ] = None,
1648
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1649
+ _content_type: Optional[StrictStr] = None,
1650
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1651
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1652
+ ) -> MembersResponse:
1653
+ """Remove members from a resource
1654
+
1655
+ Remove members from the given resource with specified roles.
1656
+
1657
+ :param resource_id: (required)
1658
+ :type resource_id: str
1659
+ :param remove_members_payload: (required)
1660
+ :type remove_members_payload: RemoveMembersPayload
1661
+ :param _request_timeout: timeout setting for this request. If one
1662
+ number provided, it will be total request
1663
+ timeout. It can also be a pair (tuple) of
1664
+ (connection, read) timeouts.
1665
+ :type _request_timeout: int, tuple(int, int), optional
1666
+ :param _request_auth: set to override the auth_settings for an a single
1667
+ request; this effectively ignores the
1668
+ authentication in the spec for a single request.
1669
+ :type _request_auth: dict, optional
1670
+ :param _content_type: force content-type for the request.
1671
+ :type _content_type: str, Optional
1672
+ :param _headers: set to override the headers for a single
1673
+ request; this effectively ignores the headers
1674
+ in the spec for a single request.
1675
+ :type _headers: dict, optional
1676
+ :param _host_index: set to override the host_index for a single
1677
+ request; this effectively ignores the host_index
1678
+ in the spec for a single request.
1679
+ :type _host_index: int, optional
1680
+ :return: Returns the result object.
1681
+ """ # noqa: E501 docstring might be too long
1682
+
1683
+ _param = self._remove_members_serialize(
1684
+ resource_id=resource_id,
1685
+ remove_members_payload=remove_members_payload,
1686
+ _request_auth=_request_auth,
1687
+ _content_type=_content_type,
1688
+ _headers=_headers,
1689
+ _host_index=_host_index,
1690
+ )
1691
+
1692
+ _response_types_map: Dict[str, Optional[str]] = {
1693
+ "200": "MembersResponse",
1694
+ "400": "ErrorResponse",
1695
+ "401": "ErrorResponse",
1696
+ "403": "ErrorResponse",
1697
+ }
1698
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1699
+ response_data.read()
1700
+ return self.api_client.response_deserialize(
1701
+ response_data=response_data,
1702
+ response_types_map=_response_types_map,
1703
+ ).data
1704
+
1705
+ @validate_call
1706
+ def remove_members_with_http_info(
1707
+ self,
1708
+ resource_id: StrictStr,
1709
+ remove_members_payload: RemoveMembersPayload,
1710
+ _request_timeout: Union[
1711
+ None,
1712
+ Annotated[StrictFloat, Field(gt=0)],
1713
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1714
+ ] = None,
1715
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1716
+ _content_type: Optional[StrictStr] = None,
1717
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1718
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1719
+ ) -> ApiResponse[MembersResponse]:
1720
+ """Remove members from a resource
1721
+
1722
+ Remove members from the given resource with specified roles.
1723
+
1724
+ :param resource_id: (required)
1725
+ :type resource_id: str
1726
+ :param remove_members_payload: (required)
1727
+ :type remove_members_payload: RemoveMembersPayload
1728
+ :param _request_timeout: timeout setting for this request. If one
1729
+ number provided, it will be total request
1730
+ timeout. It can also be a pair (tuple) of
1731
+ (connection, read) timeouts.
1732
+ :type _request_timeout: int, tuple(int, int), optional
1733
+ :param _request_auth: set to override the auth_settings for an a single
1734
+ request; this effectively ignores the
1735
+ authentication in the spec for a single request.
1736
+ :type _request_auth: dict, optional
1737
+ :param _content_type: force content-type for the request.
1738
+ :type _content_type: str, Optional
1739
+ :param _headers: set to override the headers for a single
1740
+ request; this effectively ignores the headers
1741
+ in the spec for a single request.
1742
+ :type _headers: dict, optional
1743
+ :param _host_index: set to override the host_index for a single
1744
+ request; this effectively ignores the host_index
1745
+ in the spec for a single request.
1746
+ :type _host_index: int, optional
1747
+ :return: Returns the result object.
1748
+ """ # noqa: E501 docstring might be too long
1749
+
1750
+ _param = self._remove_members_serialize(
1751
+ resource_id=resource_id,
1752
+ remove_members_payload=remove_members_payload,
1753
+ _request_auth=_request_auth,
1754
+ _content_type=_content_type,
1755
+ _headers=_headers,
1756
+ _host_index=_host_index,
1757
+ )
1758
+
1759
+ _response_types_map: Dict[str, Optional[str]] = {
1760
+ "200": "MembersResponse",
1761
+ "400": "ErrorResponse",
1762
+ "401": "ErrorResponse",
1763
+ "403": "ErrorResponse",
1764
+ }
1765
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1766
+ response_data.read()
1767
+ return self.api_client.response_deserialize(
1768
+ response_data=response_data,
1769
+ response_types_map=_response_types_map,
1770
+ )
1771
+
1772
+ @validate_call
1773
+ def remove_members_without_preload_content(
1774
+ self,
1775
+ resource_id: StrictStr,
1776
+ remove_members_payload: RemoveMembersPayload,
1777
+ _request_timeout: Union[
1778
+ None,
1779
+ Annotated[StrictFloat, Field(gt=0)],
1780
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1781
+ ] = None,
1782
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1783
+ _content_type: Optional[StrictStr] = None,
1784
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1785
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1786
+ ) -> RESTResponseType:
1787
+ """Remove members from a resource
1788
+
1789
+ Remove members from the given resource with specified roles.
1790
+
1791
+ :param resource_id: (required)
1792
+ :type resource_id: str
1793
+ :param remove_members_payload: (required)
1794
+ :type remove_members_payload: RemoveMembersPayload
1795
+ :param _request_timeout: timeout setting for this request. If one
1796
+ number provided, it will be total request
1797
+ timeout. It can also be a pair (tuple) of
1798
+ (connection, read) timeouts.
1799
+ :type _request_timeout: int, tuple(int, int), optional
1800
+ :param _request_auth: set to override the auth_settings for an a single
1801
+ request; this effectively ignores the
1802
+ authentication in the spec for a single request.
1803
+ :type _request_auth: dict, optional
1804
+ :param _content_type: force content-type for the request.
1805
+ :type _content_type: str, Optional
1806
+ :param _headers: set to override the headers for a single
1807
+ request; this effectively ignores the headers
1808
+ in the spec for a single request.
1809
+ :type _headers: dict, optional
1810
+ :param _host_index: set to override the host_index for a single
1811
+ request; this effectively ignores the host_index
1812
+ in the spec for a single request.
1813
+ :type _host_index: int, optional
1814
+ :return: Returns the result object.
1815
+ """ # noqa: E501 docstring might be too long
1816
+
1817
+ _param = self._remove_members_serialize(
1818
+ resource_id=resource_id,
1819
+ remove_members_payload=remove_members_payload,
1820
+ _request_auth=_request_auth,
1821
+ _content_type=_content_type,
1822
+ _headers=_headers,
1823
+ _host_index=_host_index,
1824
+ )
1825
+
1826
+ _response_types_map: Dict[str, Optional[str]] = {
1827
+ "200": "MembersResponse",
1828
+ "400": "ErrorResponse",
1829
+ "401": "ErrorResponse",
1830
+ "403": "ErrorResponse",
1831
+ }
1832
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1833
+ return response_data.response
1834
+
1835
+ def _remove_members_serialize(
1836
+ self,
1837
+ resource_id,
1838
+ remove_members_payload,
1839
+ _request_auth,
1840
+ _content_type,
1841
+ _headers,
1842
+ _host_index,
1843
+ ) -> RequestSerialized:
1844
+
1845
+ _host = None
1846
+
1847
+ _collection_formats: Dict[str, str] = {}
1848
+
1849
+ _path_params: Dict[str, str] = {}
1850
+ _query_params: List[Tuple[str, str]] = []
1851
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1852
+ _form_params: List[Tuple[str, str]] = []
1853
+ _files: Dict[str, Union[str, bytes]] = {}
1854
+ _body_params: Optional[bytes] = None
1855
+
1856
+ # process the path parameters
1857
+ if resource_id is not None:
1858
+ _path_params["resourceId"] = resource_id
1859
+ # process the query parameters
1860
+ # process the header parameters
1861
+ # process the form parameters
1862
+ # process the body parameter
1863
+ if remove_members_payload is not None:
1864
+ _body_params = remove_members_payload
1865
+
1866
+ # set the HTTP header `Accept`
1867
+ if "Accept" not in _header_params:
1868
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1869
+
1870
+ # set the HTTP header `Content-Type`
1871
+ if _content_type:
1872
+ _header_params["Content-Type"] = _content_type
1873
+ else:
1874
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
1875
+ if _default_content_type is not None:
1876
+ _header_params["Content-Type"] = _default_content_type
1877
+
1878
+ # authentication setting
1879
+ _auth_settings: List[str] = []
1880
+
1881
+ return self.api_client.param_serialize(
1882
+ method="POST",
1883
+ resource_path="/v2/{resourceId}/members/remove",
1884
+ path_params=_path_params,
1885
+ query_params=_query_params,
1886
+ header_params=_header_params,
1887
+ body=_body_params,
1888
+ post_params=_form_params,
1889
+ files=_files,
1890
+ auth_settings=_auth_settings,
1891
+ collection_formats=_collection_formats,
1892
+ _host=_host,
1893
+ _request_auth=_request_auth,
1894
+ )