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,164 @@
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
+ import sys
16
+ from typing import Dict, List, Optional, TypedDict
17
+
18
+ from typing_extensions import NotRequired
19
+
20
+ import os
21
+
22
+
23
+ ServerVariablesT = Dict[str, str]
24
+
25
+
26
+ class HostSettingVariable(TypedDict):
27
+ description: str
28
+ default_value: str
29
+ enum_values: List[str]
30
+
31
+
32
+ class HostSetting(TypedDict):
33
+ url: str
34
+ description: str
35
+ variables: NotRequired[Dict[str, HostSettingVariable]]
36
+
37
+
38
+ class HostConfiguration:
39
+ def __init__(
40
+ self,
41
+ region=None,
42
+ server_index=None,
43
+ server_variables=None,
44
+ server_operation_index=None,
45
+ server_operation_variables=None,
46
+ ignore_operation_servers=False,
47
+ ) -> None:
48
+ print(
49
+ "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
50
+ "as a function argument instead of being set in the client configuration.\n"
51
+ "Once all services have migrated, the methods to specify the region in the client configuration "
52
+ "will be removed.",
53
+ file=sys.stderr,
54
+ )
55
+ """Constructor
56
+ """
57
+ self._base_path = "https://scf.api.stackit.cloud"
58
+ """Default Base url
59
+ """
60
+ self.server_index = 0 if server_index is None else server_index
61
+ self.server_operation_index = server_operation_index or {}
62
+ """Default server index
63
+ """
64
+ self.server_variables = server_variables or {}
65
+ if region:
66
+ self.server_variables["region"] = "{}.".format(region)
67
+ self.server_operation_variables = server_operation_variables or {}
68
+ """Default server variables
69
+ """
70
+ self.ignore_operation_servers = ignore_operation_servers
71
+ """Ignore operation servers
72
+ """
73
+
74
+ def get_host_settings(self) -> List[HostSetting]:
75
+ """Gets an array of host settings
76
+
77
+ :return: An array of host settings
78
+ """
79
+ return [
80
+ {
81
+ "url": "https://scf.api.stackit.cloud",
82
+ "description": "No description provided",
83
+ "variables": {
84
+ "region": {
85
+ "description": "No description provided",
86
+ "default_value": "global",
87
+ }
88
+ },
89
+ }
90
+ ]
91
+
92
+ def get_host_from_settings(
93
+ self,
94
+ index: Optional[int],
95
+ variables: Optional[ServerVariablesT] = None,
96
+ servers: Optional[List[HostSetting]] = None,
97
+ ) -> str:
98
+ """Gets host URL based on the index and variables
99
+ :param index: array index of the host settings
100
+ :param variables: hash of variable and the corresponding value
101
+ :param servers: an array of host settings or None
102
+ :error: if a region is given for a global url
103
+ :return: URL based on host settings
104
+ """
105
+ if index is None:
106
+ return self._base_path
107
+
108
+ variables = {} if variables is None else variables
109
+ servers = self.get_host_settings() if servers is None else servers
110
+
111
+ try:
112
+ server = servers[index]
113
+ except IndexError:
114
+ raise ValueError(
115
+ "Invalid index {0} when selecting the host settings. "
116
+ "Must be less than {1}".format(index, len(servers))
117
+ )
118
+
119
+ url = server["url"]
120
+
121
+ # check if environment variable was provided for region
122
+ # if nothing was set this is None
123
+ region_env = os.environ.get("STACKIT_REGION")
124
+
125
+ # go through variables and replace placeholders
126
+ for variable_name, variable in server.get("variables", {}).items():
127
+ # If a region is provided by the user for a global url
128
+ # return an error (except for providing via environment variable).
129
+ # The region is provided as a function argument instead of being set in the client configuration.
130
+ if (
131
+ variable_name == "region"
132
+ and (variable["default_value"] == "global" or variable["default_value"] == "")
133
+ and region_env is None
134
+ and variables.get(variable_name) is not None
135
+ ):
136
+ raise ValueError(
137
+ "this API does not support setting a region in the client configuration, "
138
+ "please check if the region can be specified as a function parameter"
139
+ )
140
+ used_value = variables.get(variable_name, variable["default_value"])
141
+
142
+ if "enum_values" in variable and used_value not in variable["enum_values"]:
143
+ given_value = variables[variable_name].replace(".", "")
144
+ valid_values = [v.replace(".", "") for v in variable["enum_values"]]
145
+ raise ValueError(
146
+ "The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
147
+ variable_name, given_value, valid_values
148
+ )
149
+ )
150
+
151
+ url = url.replace("{" + variable_name + "}", used_value)
152
+
153
+ return url
154
+
155
+ @property
156
+ def host(self) -> str:
157
+ """Return generated host."""
158
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
159
+
160
+ @host.setter
161
+ def host(self, value: str) -> None:
162
+ """Fix base path."""
163
+ self._base_path = value
164
+ self.server_index = None
@@ -0,0 +1,218 @@
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 typing import Any, Optional
16
+
17
+ from typing_extensions import Self
18
+
19
+
20
+ class OpenApiException(Exception):
21
+ """The base exception class for all OpenAPIExceptions"""
22
+
23
+
24
+ class ApiTypeError(OpenApiException, TypeError):
25
+ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
26
+ """Raises an exception for TypeErrors
27
+
28
+ Args:
29
+ msg (str): the exception message
30
+
31
+ Keyword Args:
32
+ path_to_item (list): a list of keys an indices to get to the
33
+ current_item
34
+ None if unset
35
+ valid_classes (tuple): the primitive classes that current item
36
+ should be an instance of
37
+ None if unset
38
+ key_type (bool): False if our value is a value in a dict
39
+ True if it is a key in a dict
40
+ False if our item is an item in a list
41
+ None if unset
42
+ """
43
+ self.path_to_item = path_to_item
44
+ self.valid_classes = valid_classes
45
+ self.key_type = key_type
46
+ full_msg = msg
47
+ if path_to_item:
48
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
49
+ super(ApiTypeError, self).__init__(full_msg)
50
+
51
+
52
+ class ApiValueError(OpenApiException, ValueError):
53
+ def __init__(self, msg, path_to_item=None) -> None:
54
+ """
55
+ Args:
56
+ msg (str): the exception message
57
+
58
+ Keyword Args:
59
+ path_to_item (list) the path to the exception in the
60
+ received_data dict. None if unset
61
+ """
62
+
63
+ self.path_to_item = path_to_item
64
+ full_msg = msg
65
+ if path_to_item:
66
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
67
+ super(ApiValueError, self).__init__(full_msg)
68
+
69
+
70
+ class ApiAttributeError(OpenApiException, AttributeError):
71
+ def __init__(self, msg, path_to_item=None) -> None:
72
+ """
73
+ Raised when an attribute reference or assignment fails.
74
+
75
+ Args:
76
+ msg (str): the exception message
77
+
78
+ Keyword Args:
79
+ path_to_item (None/list) the path to the exception in the
80
+ received_data dict
81
+ """
82
+ self.path_to_item = path_to_item
83
+ full_msg = msg
84
+ if path_to_item:
85
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
86
+ super(ApiAttributeError, self).__init__(full_msg)
87
+
88
+
89
+ class ApiKeyError(OpenApiException, KeyError):
90
+ def __init__(self, msg, path_to_item=None) -> None:
91
+ """
92
+ Args:
93
+ msg (str): the exception message
94
+
95
+ Keyword Args:
96
+ path_to_item (None/list) the path to the exception in the
97
+ received_data dict
98
+ """
99
+ self.path_to_item = path_to_item
100
+ full_msg = msg
101
+ if path_to_item:
102
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
103
+ super(ApiKeyError, self).__init__(full_msg)
104
+
105
+
106
+ class ApiException(OpenApiException):
107
+
108
+ def __init__(
109
+ self,
110
+ status=None,
111
+ reason=None,
112
+ http_resp=None,
113
+ *,
114
+ body: Optional[str] = None,
115
+ data: Optional[Any] = None,
116
+ ) -> None:
117
+ self.status = status
118
+ self.reason = reason
119
+ self.body = body
120
+ self.data = data
121
+ self.headers = None
122
+
123
+ if http_resp:
124
+ if self.status is None:
125
+ self.status = http_resp.status
126
+ if self.reason is None:
127
+ self.reason = http_resp.reason
128
+ if self.body is None:
129
+ try:
130
+ self.body = http_resp.data.decode("utf-8")
131
+ except Exception: # noqa: S110
132
+ pass
133
+ self.headers = http_resp.getheaders()
134
+
135
+ @classmethod
136
+ def from_response(
137
+ cls,
138
+ *,
139
+ http_resp,
140
+ body: Optional[str],
141
+ data: Optional[Any],
142
+ ) -> Self:
143
+ if http_resp.status == 400:
144
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
145
+
146
+ if http_resp.status == 401:
147
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
148
+
149
+ if http_resp.status == 403:
150
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
151
+
152
+ if http_resp.status == 404:
153
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
154
+
155
+ # Added new conditions for 409 and 422
156
+ if http_resp.status == 409:
157
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
158
+
159
+ if http_resp.status == 422:
160
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
161
+
162
+ if 500 <= http_resp.status <= 599:
163
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
164
+ raise ApiException(http_resp=http_resp, body=body, data=data)
165
+
166
+ def __str__(self):
167
+ """Custom error messages for exception"""
168
+ error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
169
+ if self.headers:
170
+ error_message += "HTTP response headers: {0}\n".format(self.headers)
171
+
172
+ if self.data or self.body:
173
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
174
+
175
+ return error_message
176
+
177
+
178
+ class BadRequestException(ApiException):
179
+ pass
180
+
181
+
182
+ class NotFoundException(ApiException):
183
+ pass
184
+
185
+
186
+ class UnauthorizedException(ApiException):
187
+ pass
188
+
189
+
190
+ class ForbiddenException(ApiException):
191
+ pass
192
+
193
+
194
+ class ServiceException(ApiException):
195
+ pass
196
+
197
+
198
+ class ConflictException(ApiException):
199
+ """Exception for HTTP 409 Conflict."""
200
+
201
+ pass
202
+
203
+
204
+ class UnprocessableEntityException(ApiException):
205
+ """Exception for HTTP 422 Unprocessable Entity."""
206
+
207
+ pass
208
+
209
+
210
+ def render_path(path_to_item):
211
+ """Returns a string representation of a path"""
212
+ result = ""
213
+ for pth in path_to_item:
214
+ if isinstance(pth, int):
215
+ result += "[{0}]".format(pth)
216
+ else:
217
+ result += "['{0}']".format(pth)
218
+ return result
@@ -0,0 +1,56 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ STACKIT Cloud Foundry API
6
+
7
+ API endpoints for managing STACKIT Cloud Foundry
8
+
9
+ The version of the OpenAPI document: 1.0.0
10
+ Contact: support@stackit.cloud
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
+
13
+ Do not edit the class manually.
14
+ """ # noqa: E501
15
+
16
+
17
+ # import models into model package
18
+ from stackit.scf.models.apply_organization_quota_payload import (
19
+ ApplyOrganizationQuotaPayload,
20
+ )
21
+ from stackit.scf.models.create_org_role_payload import CreateOrgRolePayload
22
+ from stackit.scf.models.create_organization_payload import CreateOrganizationPayload
23
+ from stackit.scf.models.create_space_payload import CreateSpacePayload
24
+ from stackit.scf.models.create_space_role_payload import CreateSpaceRolePayload
25
+ from stackit.scf.models.error_response import ErrorResponse
26
+ from stackit.scf.models.org_manager import OrgManager
27
+ from stackit.scf.models.org_manager_delete_response import OrgManagerDeleteResponse
28
+ from stackit.scf.models.org_manager_response import OrgManagerResponse
29
+ from stackit.scf.models.org_role_create_bff_request import OrgRoleCreateBffRequest
30
+ from stackit.scf.models.org_role_response import OrgRoleResponse
31
+ from stackit.scf.models.org_role_type import OrgRoleType
32
+ from stackit.scf.models.organization import Organization
33
+ from stackit.scf.models.organization_create_response import OrganizationCreateResponse
34
+ from stackit.scf.models.organization_delete_response import OrganizationDeleteResponse
35
+ from stackit.scf.models.organization_quota import OrganizationQuota
36
+ from stackit.scf.models.organization_usage_summary import OrganizationUsageSummary
37
+ from stackit.scf.models.organizations_list import OrganizationsList
38
+ from stackit.scf.models.organizations_list_item import OrganizationsListItem
39
+ from stackit.scf.models.pagination import Pagination
40
+ from stackit.scf.models.platform_list import PlatformList
41
+ from stackit.scf.models.platforms import Platforms
42
+ from stackit.scf.models.quota import Quota
43
+ from stackit.scf.models.quota_apps import QuotaApps
44
+ from stackit.scf.models.quota_domains import QuotaDomains
45
+ from stackit.scf.models.quota_routes import QuotaRoutes
46
+ from stackit.scf.models.quota_services import QuotaServices
47
+ from stackit.scf.models.space import Space
48
+ from stackit.scf.models.space_delete_response import SpaceDeleteResponse
49
+ from stackit.scf.models.space_role_create_bff_request import SpaceRoleCreateBffRequest
50
+ from stackit.scf.models.space_role_create_bff_response import SpaceRoleCreateBffResponse
51
+ from stackit.scf.models.space_role_create_response import SpaceRoleCreateResponse
52
+ from stackit.scf.models.space_role_type import SpaceRoleType
53
+ from stackit.scf.models.spaces_list import SpacesList
54
+ from stackit.scf.models.update_organization_payload import UpdateOrganizationPayload
55
+ from stackit.scf.models.update_space_payload import UpdateSpacePayload
56
+ from stackit.scf.models.usage_summary import UsageSummary
@@ -0,0 +1,82 @@
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 ApplyOrganizationQuotaPayload(BaseModel):
26
+ """
27
+ ApplyOrganizationQuotaPayload
28
+ """ # noqa: E501
29
+
30
+ quota_id: StrictStr = Field(alias="quotaId")
31
+ __properties: ClassVar[List[str]] = ["quotaId"]
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 ApplyOrganizationQuotaPayload 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 ApplyOrganizationQuotaPayload 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({"quotaId": obj.get("quotaId")})
82
+ return _obj
@@ -0,0 +1,88 @@
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
+ from stackit.scf.models.org_role_type import OrgRoleType
25
+
26
+
27
+ class CreateOrgRolePayload(BaseModel):
28
+ """
29
+ CreateOrgRolePayload
30
+ """ # noqa: E501
31
+
32
+ type: OrgRoleType
33
+ user_guid: Optional[StrictStr] = Field(default=None, alias="userGuid")
34
+ user_name: Optional[StrictStr] = Field(default=None, alias="userName")
35
+ __properties: ClassVar[List[str]] = ["type", "userGuid", "userName"]
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 CreateOrgRolePayload 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
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of CreateOrgRolePayload from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate(
86
+ {"type": obj.get("type"), "userGuid": obj.get("userGuid"), "userName": obj.get("userName")}
87
+ )
88
+ 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, StrictStr
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class CreateOrganizationPayload(BaseModel):
26
+ """
27
+ CreateOrganizationPayload
28
+ """ # noqa: E501
29
+
30
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=255)]
31
+ platform_id: Optional[StrictStr] = Field(default=None, alias="platformId")
32
+ __properties: ClassVar[List[str]] = ["name", "platformId"]
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 CreateOrganizationPayload 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 CreateOrganizationPayload 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({"name": obj.get("name"), "platformId": obj.get("platformId")})
83
+ return _obj