|
20 | 20 | from stackit.authorization.api_client import ApiClient, RequestSerialized |
21 | 21 | from stackit.authorization.api_response import ApiResponse |
22 | 22 | from stackit.authorization.models.add_members_payload import AddMembersPayload |
| 23 | +from stackit.authorization.models.list_assignable_subjects_response import ( |
| 24 | + ListAssignableSubjectsResponse, |
| 25 | +) |
23 | 26 | from stackit.authorization.models.list_members_response import ListMembersResponse |
24 | 27 | from stackit.authorization.models.list_permissions_response import ( |
25 | 28 | ListPermissionsResponse, |
@@ -307,6 +310,273 @@ def _add_members_serialize( |
307 | 310 | _request_auth=_request_auth, |
308 | 311 | ) |
309 | 312 |
|
| 313 | + @validate_call |
| 314 | + def get_assignable_subjects( |
| 315 | + self, |
| 316 | + resource_type: StrictStr, |
| 317 | + resource_id: StrictStr, |
| 318 | + subject: Optional[StrictStr] = None, |
| 319 | + _request_timeout: Union[ |
| 320 | + None, |
| 321 | + Annotated[StrictFloat, Field(gt=0)], |
| 322 | + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], |
| 323 | + ] = None, |
| 324 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 325 | + _content_type: Optional[StrictStr] = None, |
| 326 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 327 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 328 | + ) -> ListAssignableSubjectsResponse: |
| 329 | + """Get subjects assignable to a resource |
| 330 | +
|
| 331 | + BFF endpoint for portal. List subjects assignable to a given resource. |
| 332 | +
|
| 333 | + :param resource_type: (required) |
| 334 | + :type resource_type: str |
| 335 | + :param resource_id: (required) |
| 336 | + :type resource_id: str |
| 337 | + :param subject: |
| 338 | + :type subject: str |
| 339 | + :param _request_timeout: timeout setting for this request. If one |
| 340 | + number provided, it will be total request |
| 341 | + timeout. It can also be a pair (tuple) of |
| 342 | + (connection, read) timeouts. |
| 343 | + :type _request_timeout: int, tuple(int, int), optional |
| 344 | + :param _request_auth: set to override the auth_settings for an a single |
| 345 | + request; this effectively ignores the |
| 346 | + authentication in the spec for a single request. |
| 347 | + :type _request_auth: dict, optional |
| 348 | + :param _content_type: force content-type for the request. |
| 349 | + :type _content_type: str, Optional |
| 350 | + :param _headers: set to override the headers for a single |
| 351 | + request; this effectively ignores the headers |
| 352 | + in the spec for a single request. |
| 353 | + :type _headers: dict, optional |
| 354 | + :param _host_index: set to override the host_index for a single |
| 355 | + request; this effectively ignores the host_index |
| 356 | + in the spec for a single request. |
| 357 | + :type _host_index: int, optional |
| 358 | + :return: Returns the result object. |
| 359 | + """ # noqa: E501 |
| 360 | + |
| 361 | + _param = self._get_assignable_subjects_serialize( |
| 362 | + resource_type=resource_type, |
| 363 | + resource_id=resource_id, |
| 364 | + subject=subject, |
| 365 | + _request_auth=_request_auth, |
| 366 | + _content_type=_content_type, |
| 367 | + _headers=_headers, |
| 368 | + _host_index=_host_index, |
| 369 | + ) |
| 370 | + |
| 371 | + _response_types_map: Dict[str, Optional[str]] = { |
| 372 | + "200": "ListAssignableSubjectsResponse", |
| 373 | + "400": "ErrorResponse", |
| 374 | + "401": "ErrorResponse", |
| 375 | + "403": "ErrorResponse", |
| 376 | + } |
| 377 | + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) |
| 378 | + response_data.read() |
| 379 | + return self.api_client.response_deserialize( |
| 380 | + response_data=response_data, |
| 381 | + response_types_map=_response_types_map, |
| 382 | + ).data |
| 383 | + |
| 384 | + @validate_call |
| 385 | + def get_assignable_subjects_with_http_info( |
| 386 | + self, |
| 387 | + resource_type: StrictStr, |
| 388 | + resource_id: StrictStr, |
| 389 | + subject: Optional[StrictStr] = None, |
| 390 | + _request_timeout: Union[ |
| 391 | + None, |
| 392 | + Annotated[StrictFloat, Field(gt=0)], |
| 393 | + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], |
| 394 | + ] = None, |
| 395 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 396 | + _content_type: Optional[StrictStr] = None, |
| 397 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 398 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 399 | + ) -> ApiResponse[ListAssignableSubjectsResponse]: |
| 400 | + """Get subjects assignable to a resource |
| 401 | +
|
| 402 | + BFF endpoint for portal. List subjects assignable to a given resource. |
| 403 | +
|
| 404 | + :param resource_type: (required) |
| 405 | + :type resource_type: str |
| 406 | + :param resource_id: (required) |
| 407 | + :type resource_id: str |
| 408 | + :param subject: |
| 409 | + :type subject: str |
| 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 | + :type _request_timeout: int, tuple(int, int), optional |
| 415 | + :param _request_auth: set to override the auth_settings for an a single |
| 416 | + request; this effectively ignores the |
| 417 | + authentication in the spec for a single request. |
| 418 | + :type _request_auth: dict, optional |
| 419 | + :param _content_type: force content-type for the request. |
| 420 | + :type _content_type: str, Optional |
| 421 | + :param _headers: set to override the headers for a single |
| 422 | + request; this effectively ignores the headers |
| 423 | + in the spec for a single request. |
| 424 | + :type _headers: dict, optional |
| 425 | + :param _host_index: set to override the host_index for a single |
| 426 | + request; this effectively ignores the host_index |
| 427 | + in the spec for a single request. |
| 428 | + :type _host_index: int, optional |
| 429 | + :return: Returns the result object. |
| 430 | + """ # noqa: E501 |
| 431 | + |
| 432 | + _param = self._get_assignable_subjects_serialize( |
| 433 | + resource_type=resource_type, |
| 434 | + resource_id=resource_id, |
| 435 | + subject=subject, |
| 436 | + _request_auth=_request_auth, |
| 437 | + _content_type=_content_type, |
| 438 | + _headers=_headers, |
| 439 | + _host_index=_host_index, |
| 440 | + ) |
| 441 | + |
| 442 | + _response_types_map: Dict[str, Optional[str]] = { |
| 443 | + "200": "ListAssignableSubjectsResponse", |
| 444 | + "400": "ErrorResponse", |
| 445 | + "401": "ErrorResponse", |
| 446 | + "403": "ErrorResponse", |
| 447 | + } |
| 448 | + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) |
| 449 | + response_data.read() |
| 450 | + return self.api_client.response_deserialize( |
| 451 | + response_data=response_data, |
| 452 | + response_types_map=_response_types_map, |
| 453 | + ) |
| 454 | + |
| 455 | + @validate_call |
| 456 | + def get_assignable_subjects_without_preload_content( |
| 457 | + self, |
| 458 | + resource_type: StrictStr, |
| 459 | + resource_id: StrictStr, |
| 460 | + subject: Optional[StrictStr] = None, |
| 461 | + _request_timeout: Union[ |
| 462 | + None, |
| 463 | + Annotated[StrictFloat, Field(gt=0)], |
| 464 | + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], |
| 465 | + ] = None, |
| 466 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 467 | + _content_type: Optional[StrictStr] = None, |
| 468 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 469 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 470 | + ) -> RESTResponseType: |
| 471 | + """Get subjects assignable to a resource |
| 472 | +
|
| 473 | + BFF endpoint for portal. List subjects assignable to a given resource. |
| 474 | +
|
| 475 | + :param resource_type: (required) |
| 476 | + :type resource_type: str |
| 477 | + :param resource_id: (required) |
| 478 | + :type resource_id: str |
| 479 | + :param subject: |
| 480 | + :type subject: str |
| 481 | + :param _request_timeout: timeout setting for this request. If one |
| 482 | + number provided, it will be total request |
| 483 | + timeout. It can also be a pair (tuple) of |
| 484 | + (connection, read) timeouts. |
| 485 | + :type _request_timeout: int, tuple(int, int), optional |
| 486 | + :param _request_auth: set to override the auth_settings for an a single |
| 487 | + request; this effectively ignores the |
| 488 | + authentication in the spec for a single request. |
| 489 | + :type _request_auth: dict, optional |
| 490 | + :param _content_type: force content-type for the request. |
| 491 | + :type _content_type: str, Optional |
| 492 | + :param _headers: set to override the headers for a single |
| 493 | + request; this effectively ignores the headers |
| 494 | + in the spec for a single request. |
| 495 | + :type _headers: dict, optional |
| 496 | + :param _host_index: set to override the host_index for a single |
| 497 | + request; this effectively ignores the host_index |
| 498 | + in the spec for a single request. |
| 499 | + :type _host_index: int, optional |
| 500 | + :return: Returns the result object. |
| 501 | + """ # noqa: E501 |
| 502 | + |
| 503 | + _param = self._get_assignable_subjects_serialize( |
| 504 | + resource_type=resource_type, |
| 505 | + resource_id=resource_id, |
| 506 | + subject=subject, |
| 507 | + _request_auth=_request_auth, |
| 508 | + _content_type=_content_type, |
| 509 | + _headers=_headers, |
| 510 | + _host_index=_host_index, |
| 511 | + ) |
| 512 | + |
| 513 | + _response_types_map: Dict[str, Optional[str]] = { |
| 514 | + "200": "ListAssignableSubjectsResponse", |
| 515 | + "400": "ErrorResponse", |
| 516 | + "401": "ErrorResponse", |
| 517 | + "403": "ErrorResponse", |
| 518 | + } |
| 519 | + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) |
| 520 | + return response_data.response |
| 521 | + |
| 522 | + def _get_assignable_subjects_serialize( |
| 523 | + self, |
| 524 | + resource_type, |
| 525 | + resource_id, |
| 526 | + subject, |
| 527 | + _request_auth, |
| 528 | + _content_type, |
| 529 | + _headers, |
| 530 | + _host_index, |
| 531 | + ) -> RequestSerialized: |
| 532 | + |
| 533 | + _host = None |
| 534 | + |
| 535 | + _collection_formats: Dict[str, str] = {} |
| 536 | + |
| 537 | + _path_params: Dict[str, str] = {} |
| 538 | + _query_params: List[Tuple[str, str]] = [] |
| 539 | + _header_params: Dict[str, Optional[str]] = _headers or {} |
| 540 | + _form_params: List[Tuple[str, str]] = [] |
| 541 | + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} |
| 542 | + _body_params: Optional[bytes] = None |
| 543 | + |
| 544 | + # process the path parameters |
| 545 | + if resource_type is not None: |
| 546 | + _path_params["resourceType"] = resource_type |
| 547 | + if resource_id is not None: |
| 548 | + _path_params["resourceId"] = resource_id |
| 549 | + # process the query parameters |
| 550 | + if subject is not None: |
| 551 | + |
| 552 | + _query_params.append(("subject", subject)) |
| 553 | + |
| 554 | + # process the header parameters |
| 555 | + # process the form parameters |
| 556 | + # process the body parameter |
| 557 | + |
| 558 | + # set the HTTP header `Accept` |
| 559 | + if "Accept" not in _header_params: |
| 560 | + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) |
| 561 | + |
| 562 | + # authentication setting |
| 563 | + _auth_settings: List[str] = [] |
| 564 | + |
| 565 | + return self.api_client.param_serialize( |
| 566 | + method="GET", |
| 567 | + resource_path="/v2/bff/{resourceType}/{resourceId}/assignableSubjects", |
| 568 | + path_params=_path_params, |
| 569 | + query_params=_query_params, |
| 570 | + header_params=_header_params, |
| 571 | + body=_body_params, |
| 572 | + post_params=_form_params, |
| 573 | + files=_files, |
| 574 | + auth_settings=_auth_settings, |
| 575 | + collection_formats=_collection_formats, |
| 576 | + _host=_host, |
| 577 | + _request_auth=_request_auth, |
| 578 | + ) |
| 579 | + |
310 | 580 | @validate_call |
311 | 581 | def list_members( |
312 | 582 | self, |
|
0 commit comments