stackit-authorization 0.6.0__tar.gz → 0.7.0__tar.gz

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 (40) hide show
  1. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/PKG-INFO +1 -1
  2. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/pyproject.toml +1 -1
  3. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/__init__.py +0 -8
  4. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/api/default_api.py +0 -270
  5. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/__init__.py +0 -4
  6. stackit_authorization-0.6.0/src/stackit/authorization/models/assignable_subject.py +0 -82
  7. stackit_authorization-0.6.0/src/stackit/authorization/models/list_assignable_subjects_response.py +0 -117
  8. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/LICENSE.md +0 -0
  9. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/NOTICE.txt +0 -0
  10. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/README.md +0 -0
  11. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/api/__init__.py +0 -0
  12. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/api_client.py +0 -0
  13. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/api_response.py +0 -0
  14. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/configuration.py +0 -0
  15. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/exceptions.py +0 -0
  16. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/add_custom_role_response.py +0 -0
  17. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/add_members_payload.py +0 -0
  18. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/add_role_payload.py +0 -0
  19. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/delete_role_response.py +0 -0
  20. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/error_response.py +0 -0
  21. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/existing_permission.py +0 -0
  22. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/get_role_response.py +0 -0
  23. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/list_members_response.py +0 -0
  24. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/list_permissions_response.py +0 -0
  25. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/list_user_memberships_response.py +0 -0
  26. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/list_user_permissions_response.py +0 -0
  27. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/member.py +0 -0
  28. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/members_response.py +0 -0
  29. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/permission.py +0 -0
  30. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/permission_request.py +0 -0
  31. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/remove_members_payload.py +0 -0
  32. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/role.py +0 -0
  33. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/roles_response.py +0 -0
  34. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/update_role_payload.py +0 -0
  35. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/update_role_response.py +0 -0
  36. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/user_membership.py +0 -0
  37. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/user_permission.py +0 -0
  38. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/models/zookie.py +0 -0
  39. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/py.typed +0 -0
  40. {stackit_authorization-0.6.0 → stackit_authorization-0.7.0}/src/stackit/authorization/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-authorization
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: STACKIT Membership API
5
5
  License-File: LICENSE.md
6
6
  License-File: NOTICE.txt
@@ -3,7 +3,7 @@ name = "stackit-authorization"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "stackit-authorization"
6
- version = "v0.6.0"
6
+ version = "v0.7.0"
7
7
  authors = [
8
8
  "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
9
  ]
@@ -31,12 +31,10 @@ __all__ = [
31
31
  "AddCustomRoleResponse",
32
32
  "AddMembersPayload",
33
33
  "AddRolePayload",
34
- "AssignableSubject",
35
34
  "DeleteRoleResponse",
36
35
  "ErrorResponse",
37
36
  "ExistingPermission",
38
37
  "GetRoleResponse",
39
- "ListAssignableSubjectsResponse",
40
38
  "ListMembersResponse",
41
39
  "ListPermissionsResponse",
42
40
  "ListUserMembershipsResponse",
@@ -79,9 +77,6 @@ from stackit.authorization.models.add_members_payload import (
79
77
  from stackit.authorization.models.add_role_payload import (
80
78
  AddRolePayload as AddRolePayload,
81
79
  )
82
- from stackit.authorization.models.assignable_subject import (
83
- AssignableSubject as AssignableSubject,
84
- )
85
80
  from stackit.authorization.models.delete_role_response import (
86
81
  DeleteRoleResponse as DeleteRoleResponse,
87
82
  )
@@ -92,9 +87,6 @@ from stackit.authorization.models.existing_permission import (
92
87
  from stackit.authorization.models.get_role_response import (
93
88
  GetRoleResponse as GetRoleResponse,
94
89
  )
95
- from stackit.authorization.models.list_assignable_subjects_response import (
96
- ListAssignableSubjectsResponse as ListAssignableSubjectsResponse,
97
- )
98
90
  from stackit.authorization.models.list_members_response import (
99
91
  ListMembersResponse as ListMembersResponse,
100
92
  )
@@ -24,9 +24,6 @@ from stackit.authorization.models.add_members_payload import AddMembersPayload
24
24
  from stackit.authorization.models.add_role_payload import AddRolePayload
25
25
  from stackit.authorization.models.delete_role_response import DeleteRoleResponse
26
26
  from stackit.authorization.models.get_role_response import GetRoleResponse
27
- from stackit.authorization.models.list_assignable_subjects_response import (
28
- ListAssignableSubjectsResponse,
29
- )
30
27
  from stackit.authorization.models.list_members_response import ListMembersResponse
31
28
  from stackit.authorization.models.list_permissions_response import (
32
29
  ListPermissionsResponse,
@@ -871,273 +868,6 @@ class DefaultApi:
871
868
  _request_auth=_request_auth,
872
869
  )
873
870
 
874
- @validate_call
875
- def get_assignable_subjects(
876
- self,
877
- resource_type: StrictStr,
878
- resource_id: StrictStr,
879
- subject: Optional[StrictStr] = None,
880
- _request_timeout: Union[
881
- None,
882
- Annotated[StrictFloat, Field(gt=0)],
883
- Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
884
- ] = None,
885
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
886
- _content_type: Optional[StrictStr] = None,
887
- _headers: Optional[Dict[StrictStr, Any]] = None,
888
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
889
- ) -> ListAssignableSubjectsResponse:
890
- """Get subjects assignable to a resource
891
-
892
- BFF endpoint for portal. List subjects assignable to a given resource.
893
-
894
- :param resource_type: (required)
895
- :type resource_type: str
896
- :param resource_id: (required)
897
- :type resource_id: str
898
- :param subject:
899
- :type subject: str
900
- :param _request_timeout: timeout setting for this request. If one
901
- number provided, it will be total request
902
- timeout. It can also be a pair (tuple) of
903
- (connection, read) timeouts.
904
- :type _request_timeout: int, tuple(int, int), optional
905
- :param _request_auth: set to override the auth_settings for an a single
906
- request; this effectively ignores the
907
- authentication in the spec for a single request.
908
- :type _request_auth: dict, optional
909
- :param _content_type: force content-type for the request.
910
- :type _content_type: str, Optional
911
- :param _headers: set to override the headers for a single
912
- request; this effectively ignores the headers
913
- in the spec for a single request.
914
- :type _headers: dict, optional
915
- :param _host_index: set to override the host_index for a single
916
- request; this effectively ignores the host_index
917
- in the spec for a single request.
918
- :type _host_index: int, optional
919
- :return: Returns the result object.
920
- """ # noqa: E501
921
-
922
- _param = self._get_assignable_subjects_serialize(
923
- resource_type=resource_type,
924
- resource_id=resource_id,
925
- subject=subject,
926
- _request_auth=_request_auth,
927
- _content_type=_content_type,
928
- _headers=_headers,
929
- _host_index=_host_index,
930
- )
931
-
932
- _response_types_map: Dict[str, Optional[str]] = {
933
- "200": "ListAssignableSubjectsResponse",
934
- "400": "ErrorResponse",
935
- "401": "ErrorResponse",
936
- "403": "ErrorResponse",
937
- }
938
- response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
939
- response_data.read()
940
- return self.api_client.response_deserialize(
941
- response_data=response_data,
942
- response_types_map=_response_types_map,
943
- ).data
944
-
945
- @validate_call
946
- def get_assignable_subjects_with_http_info(
947
- self,
948
- resource_type: StrictStr,
949
- resource_id: StrictStr,
950
- subject: Optional[StrictStr] = None,
951
- _request_timeout: Union[
952
- None,
953
- Annotated[StrictFloat, Field(gt=0)],
954
- Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
955
- ] = None,
956
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
957
- _content_type: Optional[StrictStr] = None,
958
- _headers: Optional[Dict[StrictStr, Any]] = None,
959
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
960
- ) -> ApiResponse[ListAssignableSubjectsResponse]:
961
- """Get subjects assignable to a resource
962
-
963
- BFF endpoint for portal. List subjects assignable to a given resource.
964
-
965
- :param resource_type: (required)
966
- :type resource_type: str
967
- :param resource_id: (required)
968
- :type resource_id: str
969
- :param subject:
970
- :type subject: 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
992
-
993
- _param = self._get_assignable_subjects_serialize(
994
- resource_type=resource_type,
995
- resource_id=resource_id,
996
- subject=subject,
997
- _request_auth=_request_auth,
998
- _content_type=_content_type,
999
- _headers=_headers,
1000
- _host_index=_host_index,
1001
- )
1002
-
1003
- _response_types_map: Dict[str, Optional[str]] = {
1004
- "200": "ListAssignableSubjectsResponse",
1005
- "400": "ErrorResponse",
1006
- "401": "ErrorResponse",
1007
- "403": "ErrorResponse",
1008
- }
1009
- response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1010
- response_data.read()
1011
- return self.api_client.response_deserialize(
1012
- response_data=response_data,
1013
- response_types_map=_response_types_map,
1014
- )
1015
-
1016
- @validate_call
1017
- def get_assignable_subjects_without_preload_content(
1018
- self,
1019
- resource_type: StrictStr,
1020
- resource_id: StrictStr,
1021
- subject: Optional[StrictStr] = None,
1022
- _request_timeout: Union[
1023
- None,
1024
- Annotated[StrictFloat, Field(gt=0)],
1025
- Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1026
- ] = None,
1027
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
1028
- _content_type: Optional[StrictStr] = None,
1029
- _headers: Optional[Dict[StrictStr, Any]] = None,
1030
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1031
- ) -> RESTResponseType:
1032
- """Get subjects assignable to a resource
1033
-
1034
- BFF endpoint for portal. List subjects assignable to a given resource.
1035
-
1036
- :param resource_type: (required)
1037
- :type resource_type: str
1038
- :param resource_id: (required)
1039
- :type resource_id: str
1040
- :param subject:
1041
- :type subject: str
1042
- :param _request_timeout: timeout setting for this request. If one
1043
- number provided, it will be total request
1044
- timeout. It can also be a pair (tuple) of
1045
- (connection, read) timeouts.
1046
- :type _request_timeout: int, tuple(int, int), optional
1047
- :param _request_auth: set to override the auth_settings for an a single
1048
- request; this effectively ignores the
1049
- authentication in the spec for a single request.
1050
- :type _request_auth: dict, optional
1051
- :param _content_type: force content-type for the request.
1052
- :type _content_type: str, Optional
1053
- :param _headers: set to override the headers for a single
1054
- request; this effectively ignores the headers
1055
- in the spec for a single request.
1056
- :type _headers: dict, optional
1057
- :param _host_index: set to override the host_index for a single
1058
- request; this effectively ignores the host_index
1059
- in the spec for a single request.
1060
- :type _host_index: int, optional
1061
- :return: Returns the result object.
1062
- """ # noqa: E501
1063
-
1064
- _param = self._get_assignable_subjects_serialize(
1065
- resource_type=resource_type,
1066
- resource_id=resource_id,
1067
- subject=subject,
1068
- _request_auth=_request_auth,
1069
- _content_type=_content_type,
1070
- _headers=_headers,
1071
- _host_index=_host_index,
1072
- )
1073
-
1074
- _response_types_map: Dict[str, Optional[str]] = {
1075
- "200": "ListAssignableSubjectsResponse",
1076
- "400": "ErrorResponse",
1077
- "401": "ErrorResponse",
1078
- "403": "ErrorResponse",
1079
- }
1080
- response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1081
- return response_data.response
1082
-
1083
- def _get_assignable_subjects_serialize(
1084
- self,
1085
- resource_type,
1086
- resource_id,
1087
- subject,
1088
- _request_auth,
1089
- _content_type,
1090
- _headers,
1091
- _host_index,
1092
- ) -> RequestSerialized:
1093
-
1094
- _host = None
1095
-
1096
- _collection_formats: Dict[str, str] = {}
1097
-
1098
- _path_params: Dict[str, str] = {}
1099
- _query_params: List[Tuple[str, str]] = []
1100
- _header_params: Dict[str, Optional[str]] = _headers or {}
1101
- _form_params: List[Tuple[str, str]] = []
1102
- _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1103
- _body_params: Optional[bytes] = None
1104
-
1105
- # process the path parameters
1106
- if resource_type is not None:
1107
- _path_params["resourceType"] = resource_type
1108
- if resource_id is not None:
1109
- _path_params["resourceId"] = resource_id
1110
- # process the query parameters
1111
- if subject is not None:
1112
-
1113
- _query_params.append(("subject", subject))
1114
-
1115
- # process the header parameters
1116
- # process the form parameters
1117
- # process the body parameter
1118
-
1119
- # set the HTTP header `Accept`
1120
- if "Accept" not in _header_params:
1121
- _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1122
-
1123
- # authentication setting
1124
- _auth_settings: List[str] = []
1125
-
1126
- return self.api_client.param_serialize(
1127
- method="GET",
1128
- resource_path="/v2/bff/{resourceType}/{resourceId}/assignableSubjects",
1129
- path_params=_path_params,
1130
- query_params=_query_params,
1131
- header_params=_header_params,
1132
- body=_body_params,
1133
- post_params=_form_params,
1134
- files=_files,
1135
- auth_settings=_auth_settings,
1136
- collection_formats=_collection_formats,
1137
- _host=_host,
1138
- _request_auth=_request_auth,
1139
- )
1140
-
1141
871
  @validate_call
1142
872
  def get_role(
1143
873
  self,
@@ -17,14 +17,10 @@
17
17
  from stackit.authorization.models.add_custom_role_response import AddCustomRoleResponse
18
18
  from stackit.authorization.models.add_members_payload import AddMembersPayload
19
19
  from stackit.authorization.models.add_role_payload import AddRolePayload
20
- from stackit.authorization.models.assignable_subject import AssignableSubject
21
20
  from stackit.authorization.models.delete_role_response import DeleteRoleResponse
22
21
  from stackit.authorization.models.error_response import ErrorResponse
23
22
  from stackit.authorization.models.existing_permission import ExistingPermission
24
23
  from stackit.authorization.models.get_role_response import GetRoleResponse
25
- from stackit.authorization.models.list_assignable_subjects_response import (
26
- ListAssignableSubjectsResponse,
27
- )
28
24
  from stackit.authorization.models.list_members_response import ListMembersResponse
29
25
  from stackit.authorization.models.list_permissions_response import (
30
26
  ListPermissionsResponse,
@@ -1,82 +0,0 @@
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
13
-
14
- from __future__ import annotations
15
-
16
- import json
17
- import pprint
18
- from typing import Any, ClassVar, Dict, List, Optional, Set
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing_extensions import Annotated, Self
22
-
23
-
24
- class AssignableSubject(BaseModel):
25
- """
26
- AssignableSubject
27
- """ # noqa: E501
28
-
29
- display_name: Optional[StrictStr] = Field(default=None, alias="displayName")
30
- subject: Annotated[str, Field(min_length=1, strict=True, max_length=255)]
31
- __properties: ClassVar[List[str]] = ["displayName", "subject"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
- def to_str(self) -> str:
40
- """Returns the string representation of the model using alias"""
41
- return pprint.pformat(self.model_dump(by_alias=True))
42
-
43
- def to_json(self) -> str:
44
- """Returns the JSON representation of the model using alias"""
45
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
- return json.dumps(self.to_dict())
47
-
48
- @classmethod
49
- def from_json(cls, json_str: str) -> Optional[Self]:
50
- """Create an instance of AssignableSubject from a JSON string"""
51
- return cls.from_dict(json.loads(json_str))
52
-
53
- def to_dict(self) -> Dict[str, Any]:
54
- """Return the dictionary representation of the model using alias.
55
-
56
- This has the following differences from calling pydantic's
57
- `self.model_dump(by_alias=True)`:
58
-
59
- * `None` is only added to the output dict for nullable fields that
60
- were set at model initialization. Other fields with value `None`
61
- are ignored.
62
- """
63
- excluded_fields: Set[str] = set([])
64
-
65
- _dict = self.model_dump(
66
- by_alias=True,
67
- exclude=excluded_fields,
68
- exclude_none=True,
69
- )
70
- return _dict
71
-
72
- @classmethod
73
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
- """Create an instance of AssignableSubject from a dict"""
75
- if obj is None:
76
- return None
77
-
78
- if not isinstance(obj, dict):
79
- return cls.model_validate(obj)
80
-
81
- _obj = cls.model_validate({"displayName": obj.get("displayName"), "subject": obj.get("subject")})
82
- return _obj
@@ -1,117 +0,0 @@
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
13
-
14
- from __future__ import annotations
15
-
16
- import json
17
- import pprint
18
- import re # noqa: F401
19
- from typing import Any, ClassVar, Dict, List, Optional, Set
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, field_validator
22
- from typing_extensions import Annotated, Self
23
-
24
- from stackit.authorization.models.assignable_subject import AssignableSubject
25
-
26
-
27
- class ListAssignableSubjectsResponse(BaseModel):
28
- """
29
- ListAssignableSubjectsResponse
30
- """ # noqa: E501
31
-
32
- resource_id: Annotated[str, Field(strict=True)] = Field(alias="resourceId")
33
- resource_type: Annotated[str, Field(strict=True)] = Field(alias="resourceType")
34
- subjects: List[AssignableSubject]
35
- __properties: ClassVar[List[str]] = ["resourceId", "resourceType", "subjects"]
36
-
37
- @field_validator("resource_id")
38
- def resource_id_validate_regular_expression(cls, value):
39
- """Validates the regular expression"""
40
- if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
- raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
- return value
43
-
44
- @field_validator("resource_type")
45
- def resource_type_validate_regular_expression(cls, value):
46
- """Validates the regular expression"""
47
- if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
- raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
- return value
50
-
51
- model_config = ConfigDict(
52
- populate_by_name=True,
53
- validate_assignment=True,
54
- protected_namespaces=(),
55
- )
56
-
57
- def to_str(self) -> str:
58
- """Returns the string representation of the model using alias"""
59
- return pprint.pformat(self.model_dump(by_alias=True))
60
-
61
- def to_json(self) -> str:
62
- """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
65
-
66
- @classmethod
67
- def from_json(cls, json_str: str) -> Optional[Self]:
68
- """Create an instance of ListAssignableSubjectsResponse from a JSON string"""
69
- return cls.from_dict(json.loads(json_str))
70
-
71
- def to_dict(self) -> Dict[str, Any]:
72
- """Return the dictionary representation of the model using alias.
73
-
74
- This has the following differences from calling pydantic's
75
- `self.model_dump(by_alias=True)`:
76
-
77
- * `None` is only added to the output dict for nullable fields that
78
- were set at model initialization. Other fields with value `None`
79
- are ignored.
80
- """
81
- excluded_fields: Set[str] = set([])
82
-
83
- _dict = self.model_dump(
84
- by_alias=True,
85
- exclude=excluded_fields,
86
- exclude_none=True,
87
- )
88
- # override the default output from pydantic by calling `to_dict()` of each item in subjects (list)
89
- _items = []
90
- if self.subjects:
91
- for _item in self.subjects:
92
- if _item:
93
- _items.append(_item.to_dict())
94
- _dict["subjects"] = _items
95
- return _dict
96
-
97
- @classmethod
98
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
- """Create an instance of ListAssignableSubjectsResponse from a dict"""
100
- if obj is None:
101
- return None
102
-
103
- if not isinstance(obj, dict):
104
- return cls.model_validate(obj)
105
-
106
- _obj = cls.model_validate(
107
- {
108
- "resourceId": obj.get("resourceId"),
109
- "resourceType": obj.get("resourceType"),
110
- "subjects": (
111
- [AssignableSubject.from_dict(_item) for _item in obj["subjects"]]
112
- if obj.get("subjects") is not None
113
- else None
114
- ),
115
- }
116
- )
117
- return _obj