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.
- stackit/authorization/__init__.py +57 -0
- stackit/authorization/api/__init__.py +4 -0
- stackit/authorization/api/default_api.py +1894 -0
- stackit/authorization/api_client.py +626 -0
- stackit/authorization/api_response.py +23 -0
- stackit/authorization/configuration.py +110 -0
- stackit/authorization/exceptions.py +198 -0
- stackit/authorization/models/__init__.py +38 -0
- stackit/authorization/models/add_members_payload.py +106 -0
- stackit/authorization/models/error_response.py +94 -0
- stackit/authorization/models/existing_permission.py +90 -0
- stackit/authorization/models/list_members_response.py +115 -0
- stackit/authorization/models/list_permissions_response.py +98 -0
- stackit/authorization/models/list_user_memberships_response.py +98 -0
- stackit/authorization/models/list_user_permissions_response.py +98 -0
- stackit/authorization/models/member.py +90 -0
- stackit/authorization/models/members_response.py +121 -0
- stackit/authorization/models/permission.py +90 -0
- stackit/authorization/models/remove_members_payload.py +108 -0
- stackit/authorization/models/role.py +122 -0
- stackit/authorization/models/roles_response.py +113 -0
- stackit/authorization/models/user_membership.py +113 -0
- stackit/authorization/models/user_permission.py +117 -0
- stackit/authorization/models/zookie.py +81 -0
- stackit/authorization/py.typed +0 -0
- stackit/authorization/rest.py +148 -0
- stackit_authorization-0.0.1a0.dist-info/METADATA +44 -0
- stackit_authorization-0.0.1a0.dist-info/RECORD +29 -0
- stackit_authorization-0.0.1a0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,115 @@
|
|
|
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 __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re
|
|
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.member import Member
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ListMembersResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ListMembersResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
members: List[Member]
|
|
33
|
+
resource_id: Annotated[str, Field(strict=True)] = Field(alias="resourceId")
|
|
34
|
+
resource_type: Annotated[str, Field(strict=True)] = Field(alias="resourceType")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["members", "resourceId", "resourceType"]
|
|
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 ListMembersResponse 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 members (list)
|
|
89
|
+
_items = []
|
|
90
|
+
if self.members:
|
|
91
|
+
for _item in self.members:
|
|
92
|
+
if _item:
|
|
93
|
+
_items.append(_item.to_dict())
|
|
94
|
+
_dict["members"] = _items
|
|
95
|
+
return _dict
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
99
|
+
"""Create an instance of ListMembersResponse 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
|
+
"members": (
|
|
109
|
+
[Member.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None
|
|
110
|
+
),
|
|
111
|
+
"resourceId": obj.get("resourceId"),
|
|
112
|
+
"resourceType": obj.get("resourceType"),
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
return _obj
|
|
@@ -0,0 +1,98 @@
|
|
|
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 __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
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
from stackit.authorization.models.permission import Permission
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ListPermissionsResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListPermissionsResponse
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
permissions: List[Permission]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["permissions"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of ListPermissionsResponse from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
# override the default output from pydantic by calling `to_dict()` of each item in permissions (list)
|
|
72
|
+
_items = []
|
|
73
|
+
if self.permissions:
|
|
74
|
+
for _item in self.permissions:
|
|
75
|
+
if _item:
|
|
76
|
+
_items.append(_item.to_dict())
|
|
77
|
+
_dict["permissions"] = _items
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of ListPermissionsResponse from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate(
|
|
90
|
+
{
|
|
91
|
+
"permissions": (
|
|
92
|
+
[Permission.from_dict(_item) for _item in obj["permissions"]]
|
|
93
|
+
if obj.get("permissions") is not None
|
|
94
|
+
else None
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
return _obj
|
|
@@ -0,0 +1,98 @@
|
|
|
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 __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
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
from stackit.authorization.models.user_membership import UserMembership
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ListUserMembershipsResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListUserMembershipsResponse
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
items: List[UserMembership]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of ListUserMembershipsResponse from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
72
|
+
_items = []
|
|
73
|
+
if self.items:
|
|
74
|
+
for _item in self.items:
|
|
75
|
+
if _item:
|
|
76
|
+
_items.append(_item.to_dict())
|
|
77
|
+
_dict["items"] = _items
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of ListUserMembershipsResponse from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate(
|
|
90
|
+
{
|
|
91
|
+
"items": (
|
|
92
|
+
[UserMembership.from_dict(_item) for _item in obj["items"]]
|
|
93
|
+
if obj.get("items") is not None
|
|
94
|
+
else None
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
return _obj
|
|
@@ -0,0 +1,98 @@
|
|
|
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 __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
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
from stackit.authorization.models.user_permission import UserPermission
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ListUserPermissionsResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListUserPermissionsResponse
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
items: List[UserPermission]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of ListUserPermissionsResponse from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
72
|
+
_items = []
|
|
73
|
+
if self.items:
|
|
74
|
+
for _item in self.items:
|
|
75
|
+
if _item:
|
|
76
|
+
_items.append(_item.to_dict())
|
|
77
|
+
_dict["items"] = _items
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of ListUserPermissionsResponse from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate(
|
|
90
|
+
{
|
|
91
|
+
"items": (
|
|
92
|
+
[UserPermission.from_dict(_item) for _item in obj["items"]]
|
|
93
|
+
if obj.get("items") is not None
|
|
94
|
+
else None
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
return _obj
|
|
@@ -0,0 +1,90 @@
|
|
|
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 __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re
|
|
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
|
+
|
|
25
|
+
class Member(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Member
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
role: Annotated[str, Field(strict=True)]
|
|
31
|
+
subject: Annotated[str, Field(min_length=1, strict=True, max_length=255)]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["role", "subject"]
|
|
33
|
+
|
|
34
|
+
@field_validator("role")
|
|
35
|
+
def role_validate_regular_expression(cls, value):
|
|
36
|
+
"""Validates the regular expression"""
|
|
37
|
+
if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value):
|
|
38
|
+
raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of Member from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of Member from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({"role": obj.get("role"), "subject": obj.get("subject")})
|
|
90
|
+
return _obj
|
|
@@ -0,0 +1,121 @@
|
|
|
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 __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re
|
|
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.member import Member
|
|
25
|
+
from stackit.authorization.models.zookie import Zookie
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class MembersResponse(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
MembersResponse
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
members: List[Member]
|
|
34
|
+
resource_id: Annotated[str, Field(strict=True)] = Field(alias="resourceId")
|
|
35
|
+
resource_type: Annotated[str, Field(strict=True)] = Field(alias="resourceType")
|
|
36
|
+
written_at: Optional[Zookie] = Field(default=None, alias="writtenAt")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["members", "resourceId", "resourceType", "writtenAt"]
|
|
38
|
+
|
|
39
|
+
@field_validator("resource_id")
|
|
40
|
+
def resource_id_validate_regular_expression(cls, value):
|
|
41
|
+
"""Validates the regular expression"""
|
|
42
|
+
if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
|
|
43
|
+
raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
@field_validator("resource_type")
|
|
47
|
+
def resource_type_validate_regular_expression(cls, value):
|
|
48
|
+
"""Validates the regular expression"""
|
|
49
|
+
if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
|
|
50
|
+
raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
|
+
return json.dumps(self.to_dict())
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of MembersResponse from a JSON string"""
|
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
|
75
|
+
|
|
76
|
+
This has the following differences from calling pydantic's
|
|
77
|
+
`self.model_dump(by_alias=True)`:
|
|
78
|
+
|
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
|
80
|
+
were set at model initialization. Other fields with value `None`
|
|
81
|
+
are ignored.
|
|
82
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of each item in members (list)
|
|
91
|
+
_items = []
|
|
92
|
+
if self.members:
|
|
93
|
+
for _item in self.members:
|
|
94
|
+
if _item:
|
|
95
|
+
_items.append(_item.to_dict())
|
|
96
|
+
_dict["members"] = _items
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of written_at
|
|
98
|
+
if self.written_at:
|
|
99
|
+
_dict["writtenAt"] = self.written_at.to_dict()
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of MembersResponse from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj)
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate(
|
|
112
|
+
{
|
|
113
|
+
"members": (
|
|
114
|
+
[Member.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None
|
|
115
|
+
),
|
|
116
|
+
"resourceId": obj.get("resourceId"),
|
|
117
|
+
"resourceType": obj.get("resourceType"),
|
|
118
|
+
"writtenAt": Zookie.from_dict(obj["writtenAt"]) if obj.get("writtenAt") is not None else None,
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
return _obj
|