stackit-scf 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. stackit/scf/__init__.py +158 -0
  2. stackit/scf/api/__init__.py +4 -0
  3. stackit/scf/api/default_api.py +6710 -0
  4. stackit/scf/api_client.py +640 -0
  5. stackit/scf/api_response.py +23 -0
  6. stackit/scf/configuration.py +164 -0
  7. stackit/scf/exceptions.py +218 -0
  8. stackit/scf/models/__init__.py +56 -0
  9. stackit/scf/models/apply_organization_quota_payload.py +82 -0
  10. stackit/scf/models/create_org_role_payload.py +88 -0
  11. stackit/scf/models/create_organization_payload.py +83 -0
  12. stackit/scf/models/create_space_payload.py +82 -0
  13. stackit/scf/models/create_space_role_payload.py +88 -0
  14. stackit/scf/models/error_response.py +83 -0
  15. stackit/scf/models/org_manager.py +107 -0
  16. stackit/scf/models/org_manager_delete_response.py +90 -0
  17. stackit/scf/models/org_manager_response.py +113 -0
  18. stackit/scf/models/org_role_create_bff_request.py +84 -0
  19. stackit/scf/models/org_role_response.py +98 -0
  20. stackit/scf/models/org_role_type.py +39 -0
  21. stackit/scf/models/organization.py +118 -0
  22. stackit/scf/models/organization_create_response.py +92 -0
  23. stackit/scf/models/organization_delete_response.py +92 -0
  24. stackit/scf/models/organization_quota.py +94 -0
  25. stackit/scf/models/organization_usage_summary.py +101 -0
  26. stackit/scf/models/organizations_list.py +105 -0
  27. stackit/scf/models/organizations_list_item.py +118 -0
  28. stackit/scf/models/pagination.py +83 -0
  29. stackit/scf/models/platform_list.py +105 -0
  30. stackit/scf/models/platforms.py +96 -0
  31. stackit/scf/models/quota.py +139 -0
  32. stackit/scf/models/quota_apps.py +138 -0
  33. stackit/scf/models/quota_domains.py +89 -0
  34. stackit/scf/models/quota_routes.py +99 -0
  35. stackit/scf/models/quota_services.py +104 -0
  36. stackit/scf/models/space.py +110 -0
  37. stackit/scf/models/space_delete_response.py +90 -0
  38. stackit/scf/models/space_role_create_bff_request.py +84 -0
  39. stackit/scf/models/space_role_create_bff_response.py +99 -0
  40. stackit/scf/models/space_role_create_response.py +100 -0
  41. stackit/scf/models/space_role_type.py +39 -0
  42. stackit/scf/models/spaces_list.py +103 -0
  43. stackit/scf/models/update_organization_payload.py +85 -0
  44. stackit/scf/models/update_space_payload.py +82 -0
  45. stackit/scf/models/usage_summary.py +109 -0
  46. stackit/scf/py.typed +0 -0
  47. stackit/scf/rest.py +149 -0
  48. stackit_scf-0.1.0.dist-info/LICENSE.md +201 -0
  49. stackit_scf-0.1.0.dist-info/METADATA +46 -0
  50. stackit_scf-0.1.0.dist-info/NOTICE.txt +2 -0
  51. stackit_scf-0.1.0.dist-info/RECORD +52 -0
  52. stackit_scf-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing_extensions import Self
23
+
24
+ from stackit.scf.models.organizations_list_item import OrganizationsListItem
25
+ from stackit.scf.models.pagination import Pagination
26
+
27
+
28
+ class OrganizationsList(BaseModel):
29
+ """
30
+ OrganizationsList
31
+ """ # noqa: E501
32
+
33
+ pagination: Pagination
34
+ resources: List[OrganizationsListItem]
35
+ __properties: ClassVar[List[str]] = ["pagination", "resources"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of OrganizationsList from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of pagination
75
+ if self.pagination:
76
+ _dict["pagination"] = self.pagination.to_dict()
77
+ # override the default output from pydantic by calling `to_dict()` of each item in resources (list)
78
+ _items = []
79
+ if self.resources:
80
+ for _item in self.resources:
81
+ if _item:
82
+ _items.append(_item.to_dict())
83
+ _dict["resources"] = _items
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of OrganizationsList from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate(
96
+ {
97
+ "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None,
98
+ "resources": (
99
+ [OrganizationsListItem.from_dict(_item) for _item in obj["resources"]]
100
+ if obj.get("resources") is not None
101
+ else None
102
+ ),
103
+ }
104
+ )
105
+ return _obj
@@ -0,0 +1,118 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from datetime import datetime
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
23
+ from typing_extensions import Self
24
+
25
+
26
+ class OrganizationsListItem(BaseModel):
27
+ """
28
+ OrganizationsListItem
29
+ """ # noqa: E501
30
+
31
+ created_at: Optional[datetime] = Field(default=None, alias="createdAt")
32
+ guid: StrictStr
33
+ name: Optional[StrictStr] = None
34
+ platform_id: StrictStr = Field(alias="platformId")
35
+ project_id: StrictStr = Field(alias="projectId")
36
+ quota_id: Optional[StrictStr] = Field(default=None, alias="quotaId")
37
+ region: StrictStr
38
+ status: StrictStr = Field(
39
+ description="The organization's status. The status value starts with `deleting` when a deleting request is in progress. The status value starts with `delete_failed` when the deletion failed. The status value can be different from `deleting` and `delete_failed`. Additional details can be provided in the future. "
40
+ )
41
+ suspended: Optional[StrictBool] = None
42
+ updated_at: Optional[datetime] = Field(default=None, alias="updatedAt")
43
+ __properties: ClassVar[List[str]] = [
44
+ "createdAt",
45
+ "guid",
46
+ "name",
47
+ "platformId",
48
+ "projectId",
49
+ "quotaId",
50
+ "region",
51
+ "status",
52
+ "suspended",
53
+ "updatedAt",
54
+ ]
55
+
56
+ model_config = ConfigDict(
57
+ populate_by_name=True,
58
+ validate_assignment=True,
59
+ protected_namespaces=(),
60
+ )
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict())
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of OrganizationsListItem from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of OrganizationsListItem from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate(
105
+ {
106
+ "createdAt": obj.get("createdAt"),
107
+ "guid": obj.get("guid"),
108
+ "name": obj.get("name"),
109
+ "platformId": obj.get("platformId"),
110
+ "projectId": obj.get("projectId"),
111
+ "quotaId": obj.get("quotaId"),
112
+ "region": obj.get("region"),
113
+ "status": obj.get("status"),
114
+ "suspended": obj.get("suspended"),
115
+ "updatedAt": obj.get("updatedAt"),
116
+ }
117
+ )
118
+ return _obj
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class Pagination(BaseModel):
26
+ """
27
+ Pagination
28
+ """ # noqa: E501
29
+
30
+ total_pages: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="totalPages")
31
+ total_results: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, alias="totalResults")
32
+ __properties: ClassVar[List[str]] = ["totalPages", "totalResults"]
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 Pagination 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
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of Pagination from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({"totalPages": obj.get("totalPages"), "totalResults": obj.get("totalResults")})
83
+ return _obj
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing_extensions import Self
23
+
24
+ from stackit.scf.models.pagination import Pagination
25
+ from stackit.scf.models.platforms import Platforms
26
+
27
+
28
+ class PlatformList(BaseModel):
29
+ """
30
+ PlatformList
31
+ """ # noqa: E501
32
+
33
+ pagination: Pagination
34
+ resources: List[Platforms]
35
+ __properties: ClassVar[List[str]] = ["pagination", "resources"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of PlatformList from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of pagination
75
+ if self.pagination:
76
+ _dict["pagination"] = self.pagination.to_dict()
77
+ # override the default output from pydantic by calling `to_dict()` of each item in resources (list)
78
+ _items = []
79
+ if self.resources:
80
+ for _item in self.resources:
81
+ if _item:
82
+ _items.append(_item.to_dict())
83
+ _dict["resources"] = _items
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of PlatformList from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate(
96
+ {
97
+ "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None,
98
+ "resources": (
99
+ [Platforms.from_dict(_item) for _item in obj["resources"]]
100
+ if obj.get("resources") is not None
101
+ else None
102
+ ),
103
+ }
104
+ )
105
+ return _obj
@@ -0,0 +1,96 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class Platforms(BaseModel):
26
+ """
27
+ Platforms
28
+ """ # noqa: E501
29
+
30
+ api_url: StrictStr = Field(alias="apiUrl")
31
+ console_url: Optional[StrictStr] = Field(default=None, alias="consoleUrl")
32
+ display_name: StrictStr = Field(alias="displayName")
33
+ guid: StrictStr
34
+ region: StrictStr
35
+ system_id: StrictStr = Field(alias="systemId")
36
+ __properties: ClassVar[List[str]] = ["apiUrl", "consoleUrl", "displayName", "guid", "region", "systemId"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of Platforms from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of Platforms from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate(
87
+ {
88
+ "apiUrl": obj.get("apiUrl"),
89
+ "consoleUrl": obj.get("consoleUrl"),
90
+ "displayName": obj.get("displayName"),
91
+ "guid": obj.get("guid"),
92
+ "region": obj.get("region"),
93
+ "systemId": obj.get("systemId"),
94
+ }
95
+ )
96
+ return _obj
@@ -0,0 +1,139 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Cloud Foundry API
5
+
6
+ API endpoints for managing STACKIT Cloud Foundry
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from datetime import datetime
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
+ from typing_extensions import Self
24
+
25
+ from stackit.scf.models.quota_apps import QuotaApps
26
+ from stackit.scf.models.quota_domains import QuotaDomains
27
+ from stackit.scf.models.quota_routes import QuotaRoutes
28
+ from stackit.scf.models.quota_services import QuotaServices
29
+
30
+
31
+ class Quota(BaseModel):
32
+ """
33
+ Quota
34
+ """ # noqa: E501
35
+
36
+ apps: QuotaApps
37
+ created_at: datetime = Field(alias="createdAt")
38
+ domains: QuotaDomains
39
+ guid: StrictStr
40
+ name: StrictStr
41
+ org_id: Optional[StrictStr] = Field(default=None, alias="orgId")
42
+ platform_id: StrictStr = Field(alias="platformId")
43
+ project_id: StrictStr = Field(alias="projectId")
44
+ region: StrictStr
45
+ routes: QuotaRoutes
46
+ services: QuotaServices
47
+ updated_at: datetime = Field(alias="updatedAt")
48
+ __properties: ClassVar[List[str]] = [
49
+ "apps",
50
+ "createdAt",
51
+ "domains",
52
+ "guid",
53
+ "name",
54
+ "orgId",
55
+ "platformId",
56
+ "projectId",
57
+ "region",
58
+ "routes",
59
+ "services",
60
+ "updatedAt",
61
+ ]
62
+
63
+ model_config = ConfigDict(
64
+ populate_by_name=True,
65
+ validate_assignment=True,
66
+ protected_namespaces=(),
67
+ )
68
+
69
+ def to_str(self) -> str:
70
+ """Returns the string representation of the model using alias"""
71
+ return pprint.pformat(self.model_dump(by_alias=True))
72
+
73
+ def to_json(self) -> str:
74
+ """Returns the JSON representation of the model using alias"""
75
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> Optional[Self]:
80
+ """Create an instance of Quota from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self) -> Dict[str, Any]:
84
+ """Return the dictionary representation of the model using alias.
85
+
86
+ This has the following differences from calling pydantic's
87
+ `self.model_dump(by_alias=True)`:
88
+
89
+ * `None` is only added to the output dict for nullable fields that
90
+ were set at model initialization. Other fields with value `None`
91
+ are ignored.
92
+ """
93
+ excluded_fields: Set[str] = set([])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # override the default output from pydantic by calling `to_dict()` of apps
101
+ if self.apps:
102
+ _dict["apps"] = self.apps.to_dict()
103
+ # override the default output from pydantic by calling `to_dict()` of domains
104
+ if self.domains:
105
+ _dict["domains"] = self.domains.to_dict()
106
+ # override the default output from pydantic by calling `to_dict()` of routes
107
+ if self.routes:
108
+ _dict["routes"] = self.routes.to_dict()
109
+ # override the default output from pydantic by calling `to_dict()` of services
110
+ if self.services:
111
+ _dict["services"] = self.services.to_dict()
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of Quota from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate(
124
+ {
125
+ "apps": QuotaApps.from_dict(obj["apps"]) if obj.get("apps") is not None else None,
126
+ "createdAt": obj.get("createdAt"),
127
+ "domains": QuotaDomains.from_dict(obj["domains"]) if obj.get("domains") is not None else None,
128
+ "guid": obj.get("guid"),
129
+ "name": obj.get("name"),
130
+ "orgId": obj.get("orgId"),
131
+ "platformId": obj.get("platformId"),
132
+ "projectId": obj.get("projectId"),
133
+ "region": obj.get("region"),
134
+ "routes": QuotaRoutes.from_dict(obj["routes"]) if obj.get("routes") is not None else None,
135
+ "services": QuotaServices.from_dict(obj["services"]) if obj.get("services") is not None else None,
136
+ "updatedAt": obj.get("updatedAt"),
137
+ }
138
+ )
139
+ return _obj