github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/api/external_api.py (about) 1 # coding: utf-8 2 3 """ 4 lakeFS API 5 6 lakeFS HTTP API 7 8 The version of the OpenAPI document: 1.0.0 9 Contact: services@treeverse.io 10 Generated by OpenAPI Generator (https://openapi-generator.tech) 11 12 Do not edit the class manually. 13 """ # noqa: E501 14 15 16 import re # noqa: F401 17 import io 18 import warnings 19 20 try: 21 from pydantic.v1 import validate_arguments, ValidationError 22 except ImportError: 23 from pydantic import validate_arguments, ValidationError 24 from typing_extensions import Annotated 25 26 try: 27 from pydantic.v1 import Field, StrictStr, conint 28 except ImportError: 29 from pydantic import Field, StrictStr, conint 30 31 from typing import Optional 32 33 from lakefs_sdk.models.authentication_token import AuthenticationToken 34 from lakefs_sdk.models.external_login_information import ExternalLoginInformation 35 from lakefs_sdk.models.external_principal import ExternalPrincipal 36 from lakefs_sdk.models.external_principal_creation import ExternalPrincipalCreation 37 from lakefs_sdk.models.external_principal_list import ExternalPrincipalList 38 39 from lakefs_sdk.api_client import ApiClient 40 from lakefs_sdk.api_response import ApiResponse 41 from lakefs_sdk.exceptions import ( # noqa: F401 42 ApiTypeError, 43 ApiValueError 44 ) 45 46 47 class ExternalApi(object): 48 """NOTE: This class is auto generated by OpenAPI Generator 49 Ref: https://openapi-generator.tech 50 51 Do not edit the class manually. 52 """ 53 54 def __init__(self, api_client=None): 55 if api_client is None: 56 api_client = ApiClient.get_default() 57 self.api_client = api_client 58 59 @validate_arguments 60 def create_user_external_principal(self, user_id : StrictStr, principal_id : StrictStr, external_principal_creation : Optional[ExternalPrincipalCreation] = None, **kwargs) -> None: # noqa: E501 61 """attach external principal to user # noqa: E501 62 63 This method makes a synchronous HTTP request by default. To make an 64 asynchronous HTTP request, please pass async_req=True 65 66 >>> thread = api.create_user_external_principal(user_id, principal_id, external_principal_creation, async_req=True) 67 >>> result = thread.get() 68 69 :param user_id: (required) 70 :type user_id: str 71 :param principal_id: (required) 72 :type principal_id: str 73 :param external_principal_creation: 74 :type external_principal_creation: ExternalPrincipalCreation 75 :param async_req: Whether to execute the request asynchronously. 76 :type async_req: bool, optional 77 :param _request_timeout: timeout setting for this request. If one 78 number provided, it will be total request 79 timeout. It can also be a pair (tuple) of 80 (connection, read) timeouts. 81 :return: Returns the result object. 82 If the method is called asynchronously, 83 returns the request thread. 84 :rtype: None 85 """ 86 kwargs['_return_http_data_only'] = True 87 if '_preload_content' in kwargs: 88 raise ValueError("Error! Please call the create_user_external_principal_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 89 return self.create_user_external_principal_with_http_info(user_id, principal_id, external_principal_creation, **kwargs) # noqa: E501 90 91 @validate_arguments 92 def create_user_external_principal_with_http_info(self, user_id : StrictStr, principal_id : StrictStr, external_principal_creation : Optional[ExternalPrincipalCreation] = None, **kwargs) -> ApiResponse: # noqa: E501 93 """attach external principal to user # noqa: E501 94 95 This method makes a synchronous HTTP request by default. To make an 96 asynchronous HTTP request, please pass async_req=True 97 98 >>> thread = api.create_user_external_principal_with_http_info(user_id, principal_id, external_principal_creation, async_req=True) 99 >>> result = thread.get() 100 101 :param user_id: (required) 102 :type user_id: str 103 :param principal_id: (required) 104 :type principal_id: str 105 :param external_principal_creation: 106 :type external_principal_creation: ExternalPrincipalCreation 107 :param async_req: Whether to execute the request asynchronously. 108 :type async_req: bool, optional 109 :param _preload_content: if False, the ApiResponse.data will 110 be set to none and raw_data will store the 111 HTTP response body without reading/decoding. 112 Default is True. 113 :type _preload_content: bool, optional 114 :param _return_http_data_only: response data instead of ApiResponse 115 object with status code, headers, etc 116 :type _return_http_data_only: bool, optional 117 :param _request_timeout: timeout setting for this request. If one 118 number provided, it will be total request 119 timeout. It can also be a pair (tuple) of 120 (connection, read) timeouts. 121 :param _request_auth: set to override the auth_settings for an a single 122 request; this effectively ignores the authentication 123 in the spec for a single request. 124 :type _request_auth: dict, optional 125 :type _content_type: string, optional: force content-type for the request 126 :return: Returns the result object. 127 If the method is called asynchronously, 128 returns the request thread. 129 :rtype: None 130 """ 131 132 _params = locals() 133 134 _all_params = [ 135 'user_id', 136 'principal_id', 137 'external_principal_creation' 138 ] 139 _all_params.extend( 140 [ 141 'async_req', 142 '_return_http_data_only', 143 '_preload_content', 144 '_request_timeout', 145 '_request_auth', 146 '_content_type', 147 '_headers' 148 ] 149 ) 150 151 # validate the arguments 152 for _key, _val in _params['kwargs'].items(): 153 if _key not in _all_params: 154 raise ApiTypeError( 155 "Got an unexpected keyword argument '%s'" 156 " to method create_user_external_principal" % _key 157 ) 158 _params[_key] = _val 159 del _params['kwargs'] 160 161 _collection_formats = {} 162 163 # process the path parameters 164 _path_params = {} 165 if _params['user_id']: 166 _path_params['userId'] = _params['user_id'] 167 168 169 # process the query parameters 170 _query_params = [] 171 if _params.get('principal_id') is not None: # noqa: E501 172 _query_params.append(('principalId', _params['principal_id'])) 173 174 # process the header parameters 175 _header_params = dict(_params.get('_headers', {})) 176 # process the form parameters 177 _form_params = [] 178 _files = {} 179 # process the body parameter 180 _body_params = None 181 if _params['external_principal_creation'] is not None: 182 _body_params = _params['external_principal_creation'] 183 184 # set the HTTP header `Accept` 185 _header_params['Accept'] = self.api_client.select_header_accept( 186 ['application/json']) # noqa: E501 187 188 # set the HTTP header `Content-Type` 189 _content_types_list = _params.get('_content_type', 190 self.api_client.select_header_content_type( 191 ['application/json'])) 192 if _content_types_list: 193 _header_params['Content-Type'] = _content_types_list 194 195 # authentication setting 196 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 197 198 _response_types_map = {} 199 200 return self.api_client.call_api( 201 '/auth/users/{userId}/external/principals', 'POST', 202 _path_params, 203 _query_params, 204 _header_params, 205 body=_body_params, 206 post_params=_form_params, 207 files=_files, 208 response_types_map=_response_types_map, 209 auth_settings=_auth_settings, 210 async_req=_params.get('async_req'), 211 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 212 _preload_content=_params.get('_preload_content', True), 213 _request_timeout=_params.get('_request_timeout'), 214 collection_formats=_collection_formats, 215 _request_auth=_params.get('_request_auth')) 216 217 @validate_arguments 218 def delete_user_external_principal(self, user_id : StrictStr, principal_id : StrictStr, **kwargs) -> None: # noqa: E501 219 """delete external principal from user # noqa: E501 220 221 This method makes a synchronous HTTP request by default. To make an 222 asynchronous HTTP request, please pass async_req=True 223 224 >>> thread = api.delete_user_external_principal(user_id, principal_id, async_req=True) 225 >>> result = thread.get() 226 227 :param user_id: (required) 228 :type user_id: str 229 :param principal_id: (required) 230 :type principal_id: str 231 :param async_req: Whether to execute the request asynchronously. 232 :type async_req: bool, optional 233 :param _request_timeout: timeout setting for this request. If one 234 number provided, it will be total request 235 timeout. It can also be a pair (tuple) of 236 (connection, read) timeouts. 237 :return: Returns the result object. 238 If the method is called asynchronously, 239 returns the request thread. 240 :rtype: None 241 """ 242 kwargs['_return_http_data_only'] = True 243 if '_preload_content' in kwargs: 244 raise ValueError("Error! Please call the delete_user_external_principal_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 245 return self.delete_user_external_principal_with_http_info(user_id, principal_id, **kwargs) # noqa: E501 246 247 @validate_arguments 248 def delete_user_external_principal_with_http_info(self, user_id : StrictStr, principal_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 249 """delete external principal from user # noqa: E501 250 251 This method makes a synchronous HTTP request by default. To make an 252 asynchronous HTTP request, please pass async_req=True 253 254 >>> thread = api.delete_user_external_principal_with_http_info(user_id, principal_id, async_req=True) 255 >>> result = thread.get() 256 257 :param user_id: (required) 258 :type user_id: str 259 :param principal_id: (required) 260 :type principal_id: str 261 :param async_req: Whether to execute the request asynchronously. 262 :type async_req: bool, optional 263 :param _preload_content: if False, the ApiResponse.data will 264 be set to none and raw_data will store the 265 HTTP response body without reading/decoding. 266 Default is True. 267 :type _preload_content: bool, optional 268 :param _return_http_data_only: response data instead of ApiResponse 269 object with status code, headers, etc 270 :type _return_http_data_only: bool, optional 271 :param _request_timeout: timeout setting for this request. If one 272 number provided, it will be total request 273 timeout. It can also be a pair (tuple) of 274 (connection, read) timeouts. 275 :param _request_auth: set to override the auth_settings for an a single 276 request; this effectively ignores the authentication 277 in the spec for a single request. 278 :type _request_auth: dict, optional 279 :type _content_type: string, optional: force content-type for the request 280 :return: Returns the result object. 281 If the method is called asynchronously, 282 returns the request thread. 283 :rtype: None 284 """ 285 286 _params = locals() 287 288 _all_params = [ 289 'user_id', 290 'principal_id' 291 ] 292 _all_params.extend( 293 [ 294 'async_req', 295 '_return_http_data_only', 296 '_preload_content', 297 '_request_timeout', 298 '_request_auth', 299 '_content_type', 300 '_headers' 301 ] 302 ) 303 304 # validate the arguments 305 for _key, _val in _params['kwargs'].items(): 306 if _key not in _all_params: 307 raise ApiTypeError( 308 "Got an unexpected keyword argument '%s'" 309 " to method delete_user_external_principal" % _key 310 ) 311 _params[_key] = _val 312 del _params['kwargs'] 313 314 _collection_formats = {} 315 316 # process the path parameters 317 _path_params = {} 318 if _params['user_id']: 319 _path_params['userId'] = _params['user_id'] 320 321 322 # process the query parameters 323 _query_params = [] 324 if _params.get('principal_id') is not None: # noqa: E501 325 _query_params.append(('principalId', _params['principal_id'])) 326 327 # process the header parameters 328 _header_params = dict(_params.get('_headers', {})) 329 # process the form parameters 330 _form_params = [] 331 _files = {} 332 # process the body parameter 333 _body_params = None 334 # set the HTTP header `Accept` 335 _header_params['Accept'] = self.api_client.select_header_accept( 336 ['application/json']) # noqa: E501 337 338 # authentication setting 339 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 340 341 _response_types_map = {} 342 343 return self.api_client.call_api( 344 '/auth/users/{userId}/external/principals', 'DELETE', 345 _path_params, 346 _query_params, 347 _header_params, 348 body=_body_params, 349 post_params=_form_params, 350 files=_files, 351 response_types_map=_response_types_map, 352 auth_settings=_auth_settings, 353 async_req=_params.get('async_req'), 354 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 355 _preload_content=_params.get('_preload_content', True), 356 _request_timeout=_params.get('_request_timeout'), 357 collection_formats=_collection_formats, 358 _request_auth=_params.get('_request_auth')) 359 360 @validate_arguments 361 def external_principal_login(self, external_login_information : Optional[ExternalLoginInformation] = None, **kwargs) -> AuthenticationToken: # noqa: E501 362 """perform a login using an external authenticator # noqa: E501 363 364 This method makes a synchronous HTTP request by default. To make an 365 asynchronous HTTP request, please pass async_req=True 366 367 >>> thread = api.external_principal_login(external_login_information, async_req=True) 368 >>> result = thread.get() 369 370 :param external_login_information: 371 :type external_login_information: ExternalLoginInformation 372 :param async_req: Whether to execute the request asynchronously. 373 :type async_req: bool, optional 374 :param _request_timeout: timeout setting for this request. If one 375 number provided, it will be total request 376 timeout. It can also be a pair (tuple) of 377 (connection, read) timeouts. 378 :return: Returns the result object. 379 If the method is called asynchronously, 380 returns the request thread. 381 :rtype: AuthenticationToken 382 """ 383 kwargs['_return_http_data_only'] = True 384 if '_preload_content' in kwargs: 385 raise ValueError("Error! Please call the external_principal_login_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 386 return self.external_principal_login_with_http_info(external_login_information, **kwargs) # noqa: E501 387 388 @validate_arguments 389 def external_principal_login_with_http_info(self, external_login_information : Optional[ExternalLoginInformation] = None, **kwargs) -> ApiResponse: # noqa: E501 390 """perform a login using an external authenticator # noqa: E501 391 392 This method makes a synchronous HTTP request by default. To make an 393 asynchronous HTTP request, please pass async_req=True 394 395 >>> thread = api.external_principal_login_with_http_info(external_login_information, async_req=True) 396 >>> result = thread.get() 397 398 :param external_login_information: 399 :type external_login_information: ExternalLoginInformation 400 :param async_req: Whether to execute the request asynchronously. 401 :type async_req: bool, optional 402 :param _preload_content: if False, the ApiResponse.data will 403 be set to none and raw_data will store the 404 HTTP response body without reading/decoding. 405 Default is True. 406 :type _preload_content: bool, optional 407 :param _return_http_data_only: response data instead of ApiResponse 408 object with status code, headers, etc 409 :type _return_http_data_only: bool, optional 410 :param _request_timeout: timeout setting for this request. If one 411 number provided, it will be total request 412 timeout. It can also be a pair (tuple) of 413 (connection, read) timeouts. 414 :param _request_auth: set to override the auth_settings for an a single 415 request; this effectively ignores the authentication 416 in the spec for a single request. 417 :type _request_auth: dict, optional 418 :type _content_type: string, optional: force content-type for the request 419 :return: Returns the result object. 420 If the method is called asynchronously, 421 returns the request thread. 422 :rtype: tuple(AuthenticationToken, status_code(int), headers(HTTPHeaderDict)) 423 """ 424 425 _params = locals() 426 427 _all_params = [ 428 'external_login_information' 429 ] 430 _all_params.extend( 431 [ 432 'async_req', 433 '_return_http_data_only', 434 '_preload_content', 435 '_request_timeout', 436 '_request_auth', 437 '_content_type', 438 '_headers' 439 ] 440 ) 441 442 # validate the arguments 443 for _key, _val in _params['kwargs'].items(): 444 if _key not in _all_params: 445 raise ApiTypeError( 446 "Got an unexpected keyword argument '%s'" 447 " to method external_principal_login" % _key 448 ) 449 _params[_key] = _val 450 del _params['kwargs'] 451 452 _collection_formats = {} 453 454 # process the path parameters 455 _path_params = {} 456 457 # process the query parameters 458 _query_params = [] 459 # process the header parameters 460 _header_params = dict(_params.get('_headers', {})) 461 # process the form parameters 462 _form_params = [] 463 _files = {} 464 # process the body parameter 465 _body_params = None 466 if _params['external_login_information'] is not None: 467 _body_params = _params['external_login_information'] 468 469 # set the HTTP header `Accept` 470 _header_params['Accept'] = self.api_client.select_header_accept( 471 ['application/json']) # noqa: E501 472 473 # set the HTTP header `Content-Type` 474 _content_types_list = _params.get('_content_type', 475 self.api_client.select_header_content_type( 476 ['application/json'])) 477 if _content_types_list: 478 _header_params['Content-Type'] = _content_types_list 479 480 # authentication setting 481 _auth_settings = [] # noqa: E501 482 483 _response_types_map = { 484 '200': "AuthenticationToken", 485 '400': "Error", 486 '401': "Error", 487 '403': "Error", 488 '404': "Error", 489 '420': None, 490 } 491 492 return self.api_client.call_api( 493 '/auth/external/principal/login', 'POST', 494 _path_params, 495 _query_params, 496 _header_params, 497 body=_body_params, 498 post_params=_form_params, 499 files=_files, 500 response_types_map=_response_types_map, 501 auth_settings=_auth_settings, 502 async_req=_params.get('async_req'), 503 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 504 _preload_content=_params.get('_preload_content', True), 505 _request_timeout=_params.get('_request_timeout'), 506 collection_formats=_collection_formats, 507 _request_auth=_params.get('_request_auth')) 508 509 @validate_arguments 510 def get_external_principal(self, principal_id : StrictStr, **kwargs) -> ExternalPrincipal: # noqa: E501 511 """describe external principal by id # noqa: E501 512 513 This method makes a synchronous HTTP request by default. To make an 514 asynchronous HTTP request, please pass async_req=True 515 516 >>> thread = api.get_external_principal(principal_id, async_req=True) 517 >>> result = thread.get() 518 519 :param principal_id: (required) 520 :type principal_id: str 521 :param async_req: Whether to execute the request asynchronously. 522 :type async_req: bool, optional 523 :param _request_timeout: timeout setting for this request. If one 524 number provided, it will be total request 525 timeout. It can also be a pair (tuple) of 526 (connection, read) timeouts. 527 :return: Returns the result object. 528 If the method is called asynchronously, 529 returns the request thread. 530 :rtype: ExternalPrincipal 531 """ 532 kwargs['_return_http_data_only'] = True 533 if '_preload_content' in kwargs: 534 raise ValueError("Error! Please call the get_external_principal_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 535 return self.get_external_principal_with_http_info(principal_id, **kwargs) # noqa: E501 536 537 @validate_arguments 538 def get_external_principal_with_http_info(self, principal_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 539 """describe external principal by id # noqa: E501 540 541 This method makes a synchronous HTTP request by default. To make an 542 asynchronous HTTP request, please pass async_req=True 543 544 >>> thread = api.get_external_principal_with_http_info(principal_id, async_req=True) 545 >>> result = thread.get() 546 547 :param principal_id: (required) 548 :type principal_id: str 549 :param async_req: Whether to execute the request asynchronously. 550 :type async_req: bool, optional 551 :param _preload_content: if False, the ApiResponse.data will 552 be set to none and raw_data will store the 553 HTTP response body without reading/decoding. 554 Default is True. 555 :type _preload_content: bool, optional 556 :param _return_http_data_only: response data instead of ApiResponse 557 object with status code, headers, etc 558 :type _return_http_data_only: bool, optional 559 :param _request_timeout: timeout setting for this request. If one 560 number provided, it will be total request 561 timeout. It can also be a pair (tuple) of 562 (connection, read) timeouts. 563 :param _request_auth: set to override the auth_settings for an a single 564 request; this effectively ignores the authentication 565 in the spec for a single request. 566 :type _request_auth: dict, optional 567 :type _content_type: string, optional: force content-type for the request 568 :return: Returns the result object. 569 If the method is called asynchronously, 570 returns the request thread. 571 :rtype: tuple(ExternalPrincipal, status_code(int), headers(HTTPHeaderDict)) 572 """ 573 574 _params = locals() 575 576 _all_params = [ 577 'principal_id' 578 ] 579 _all_params.extend( 580 [ 581 'async_req', 582 '_return_http_data_only', 583 '_preload_content', 584 '_request_timeout', 585 '_request_auth', 586 '_content_type', 587 '_headers' 588 ] 589 ) 590 591 # validate the arguments 592 for _key, _val in _params['kwargs'].items(): 593 if _key not in _all_params: 594 raise ApiTypeError( 595 "Got an unexpected keyword argument '%s'" 596 " to method get_external_principal" % _key 597 ) 598 _params[_key] = _val 599 del _params['kwargs'] 600 601 _collection_formats = {} 602 603 # process the path parameters 604 _path_params = {} 605 606 # process the query parameters 607 _query_params = [] 608 if _params.get('principal_id') is not None: # noqa: E501 609 _query_params.append(('principalId', _params['principal_id'])) 610 611 # process the header parameters 612 _header_params = dict(_params.get('_headers', {})) 613 # process the form parameters 614 _form_params = [] 615 _files = {} 616 # process the body parameter 617 _body_params = None 618 # set the HTTP header `Accept` 619 _header_params['Accept'] = self.api_client.select_header_accept( 620 ['application/json']) # noqa: E501 621 622 # authentication setting 623 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 624 625 _response_types_map = { 626 '200': "ExternalPrincipal", 627 '401': "Error", 628 '404': "Error", 629 '420': None, 630 } 631 632 return self.api_client.call_api( 633 '/auth/external/principals', 'GET', 634 _path_params, 635 _query_params, 636 _header_params, 637 body=_body_params, 638 post_params=_form_params, 639 files=_files, 640 response_types_map=_response_types_map, 641 auth_settings=_auth_settings, 642 async_req=_params.get('async_req'), 643 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 644 _preload_content=_params.get('_preload_content', True), 645 _request_timeout=_params.get('_request_timeout'), 646 collection_formats=_collection_formats, 647 _request_auth=_params.get('_request_auth')) 648 649 @validate_arguments 650 def list_user_external_principals(self, user_id : StrictStr, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> ExternalPrincipalList: # noqa: E501 651 """list user external policies attached to a user # noqa: E501 652 653 This method makes a synchronous HTTP request by default. To make an 654 asynchronous HTTP request, please pass async_req=True 655 656 >>> thread = api.list_user_external_principals(user_id, prefix, after, amount, async_req=True) 657 >>> result = thread.get() 658 659 :param user_id: (required) 660 :type user_id: str 661 :param prefix: return items prefixed with this value 662 :type prefix: str 663 :param after: return items after this value 664 :type after: str 665 :param amount: how many items to return 666 :type amount: int 667 :param async_req: Whether to execute the request asynchronously. 668 :type async_req: bool, optional 669 :param _request_timeout: timeout setting for this request. If one 670 number provided, it will be total request 671 timeout. It can also be a pair (tuple) of 672 (connection, read) timeouts. 673 :return: Returns the result object. 674 If the method is called asynchronously, 675 returns the request thread. 676 :rtype: ExternalPrincipalList 677 """ 678 kwargs['_return_http_data_only'] = True 679 if '_preload_content' in kwargs: 680 raise ValueError("Error! Please call the list_user_external_principals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 681 return self.list_user_external_principals_with_http_info(user_id, prefix, after, amount, **kwargs) # noqa: E501 682 683 @validate_arguments 684 def list_user_external_principals_with_http_info(self, user_id : StrictStr, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> ApiResponse: # noqa: E501 685 """list user external policies attached to a user # noqa: E501 686 687 This method makes a synchronous HTTP request by default. To make an 688 asynchronous HTTP request, please pass async_req=True 689 690 >>> thread = api.list_user_external_principals_with_http_info(user_id, prefix, after, amount, async_req=True) 691 >>> result = thread.get() 692 693 :param user_id: (required) 694 :type user_id: str 695 :param prefix: return items prefixed with this value 696 :type prefix: str 697 :param after: return items after this value 698 :type after: str 699 :param amount: how many items to return 700 :type amount: int 701 :param async_req: Whether to execute the request asynchronously. 702 :type async_req: bool, optional 703 :param _preload_content: if False, the ApiResponse.data will 704 be set to none and raw_data will store the 705 HTTP response body without reading/decoding. 706 Default is True. 707 :type _preload_content: bool, optional 708 :param _return_http_data_only: response data instead of ApiResponse 709 object with status code, headers, etc 710 :type _return_http_data_only: bool, optional 711 :param _request_timeout: timeout setting for this request. If one 712 number provided, it will be total request 713 timeout. It can also be a pair (tuple) of 714 (connection, read) timeouts. 715 :param _request_auth: set to override the auth_settings for an a single 716 request; this effectively ignores the authentication 717 in the spec for a single request. 718 :type _request_auth: dict, optional 719 :type _content_type: string, optional: force content-type for the request 720 :return: Returns the result object. 721 If the method is called asynchronously, 722 returns the request thread. 723 :rtype: tuple(ExternalPrincipalList, status_code(int), headers(HTTPHeaderDict)) 724 """ 725 726 _params = locals() 727 728 _all_params = [ 729 'user_id', 730 'prefix', 731 'after', 732 'amount' 733 ] 734 _all_params.extend( 735 [ 736 'async_req', 737 '_return_http_data_only', 738 '_preload_content', 739 '_request_timeout', 740 '_request_auth', 741 '_content_type', 742 '_headers' 743 ] 744 ) 745 746 # validate the arguments 747 for _key, _val in _params['kwargs'].items(): 748 if _key not in _all_params: 749 raise ApiTypeError( 750 "Got an unexpected keyword argument '%s'" 751 " to method list_user_external_principals" % _key 752 ) 753 _params[_key] = _val 754 del _params['kwargs'] 755 756 _collection_formats = {} 757 758 # process the path parameters 759 _path_params = {} 760 if _params['user_id']: 761 _path_params['userId'] = _params['user_id'] 762 763 764 # process the query parameters 765 _query_params = [] 766 if _params.get('prefix') is not None: # noqa: E501 767 _query_params.append(('prefix', _params['prefix'])) 768 769 if _params.get('after') is not None: # noqa: E501 770 _query_params.append(('after', _params['after'])) 771 772 if _params.get('amount') is not None: # noqa: E501 773 _query_params.append(('amount', _params['amount'])) 774 775 # process the header parameters 776 _header_params = dict(_params.get('_headers', {})) 777 # process the form parameters 778 _form_params = [] 779 _files = {} 780 # process the body parameter 781 _body_params = None 782 # set the HTTP header `Accept` 783 _header_params['Accept'] = self.api_client.select_header_accept( 784 ['application/json']) # noqa: E501 785 786 # authentication setting 787 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 788 789 _response_types_map = { 790 '200': "ExternalPrincipalList", 791 '401': "Error", 792 '404': "Error", 793 '420': None, 794 } 795 796 return self.api_client.call_api( 797 '/auth/users/{userId}/external/principals/ls', 'GET', 798 _path_params, 799 _query_params, 800 _header_params, 801 body=_body_params, 802 post_params=_form_params, 803 files=_files, 804 response_types_map=_response_types_map, 805 auth_settings=_auth_settings, 806 async_req=_params.get('async_req'), 807 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 808 _preload_content=_params.get('_preload_content', True), 809 _request_timeout=_params.get('_request_timeout'), 810 collection_formats=_collection_formats, 811 _request_auth=_params.get('_request_auth'))