stackit-redis 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.
Files changed (40) hide show
  1. stackit/redis/__init__.py +68 -0
  2. stackit/redis/api/__init__.py +4 -0
  3. stackit/redis/api/default_api.py +4812 -0
  4. stackit/redis/api_client.py +626 -0
  5. stackit/redis/api_response.py +23 -0
  6. stackit/redis/configuration.py +111 -0
  7. stackit/redis/exceptions.py +198 -0
  8. stackit/redis/models/__init__.py +49 -0
  9. stackit/redis/models/backup.py +95 -0
  10. stackit/redis/models/create_backup_response_item.py +82 -0
  11. stackit/redis/models/create_instance_payload.py +96 -0
  12. stackit/redis/models/create_instance_response.py +81 -0
  13. stackit/redis/models/credentials.py +97 -0
  14. stackit/redis/models/credentials_list_item.py +81 -0
  15. stackit/redis/models/credentials_response.py +94 -0
  16. stackit/redis/models/error.py +82 -0
  17. stackit/redis/models/get_metrics_response.py +153 -0
  18. stackit/redis/models/instance.py +147 -0
  19. stackit/redis/models/instance_last_operation.py +99 -0
  20. stackit/redis/models/instance_parameters.py +242 -0
  21. stackit/redis/models/instance_schema.py +95 -0
  22. stackit/redis/models/list_backups_response.py +98 -0
  23. stackit/redis/models/list_credentials_response.py +98 -0
  24. stackit/redis/models/list_instances_response.py +98 -0
  25. stackit/redis/models/list_offerings_response.py +98 -0
  26. stackit/redis/models/list_restores_response.py +98 -0
  27. stackit/redis/models/model_schema.py +81 -0
  28. stackit/redis/models/offering.py +127 -0
  29. stackit/redis/models/partial_update_instance_payload.py +96 -0
  30. stackit/redis/models/plan.py +93 -0
  31. stackit/redis/models/raw_credentials.py +88 -0
  32. stackit/redis/models/restore.py +93 -0
  33. stackit/redis/models/trigger_restore_response.py +81 -0
  34. stackit/redis/models/update_backups_config_payload.py +81 -0
  35. stackit/redis/models/update_backups_config_response.py +81 -0
  36. stackit/redis/py.typed +0 -0
  37. stackit/redis/rest.py +148 -0
  38. stackit_redis-0.0.1a0.dist-info/METADATA +45 -0
  39. stackit_redis-0.0.1a0.dist-info/RECORD +40 -0
  40. stackit_redis-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,111 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.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
+
15
+ class HostConfiguration:
16
+ def __init__(
17
+ self,
18
+ region=None,
19
+ server_index=None,
20
+ server_variables=None,
21
+ server_operation_index=None,
22
+ server_operation_variables=None,
23
+ ignore_operation_servers=False,
24
+ ) -> None:
25
+ """Constructor"""
26
+ self._base_path = "https://redis.api.eu01.stackit.cloud"
27
+ """Default Base url
28
+ """
29
+ self.server_index = 0 if server_index is None else server_index
30
+ self.server_operation_index = server_operation_index or {}
31
+ """Default server index
32
+ """
33
+ self.server_variables = server_variables or {}
34
+ if region:
35
+ self.server_variables["region"] = "{}.".format(region)
36
+ self.server_operation_variables = server_operation_variables or {}
37
+ """Default server variables
38
+ """
39
+ self.ignore_operation_servers = ignore_operation_servers
40
+ """Ignore operation servers
41
+ """
42
+
43
+ def get_host_settings(self):
44
+ """Gets an array of host settings
45
+
46
+ :return: An array of host settings
47
+ """
48
+ return [
49
+ {
50
+ "url": "https://redis.api.{region}stackit.cloud",
51
+ "description": "No description provided",
52
+ "variables": {
53
+ "region": {
54
+ "description": "No description provided",
55
+ "default_value": "eu01.",
56
+ "enum_values": ["eu01."],
57
+ }
58
+ },
59
+ }
60
+ ]
61
+
62
+ def get_host_from_settings(self, index, variables=None, servers=None):
63
+ """Gets host URL based on the index and variables
64
+ :param index: array index of the host settings
65
+ :param variables: hash of variable and the corresponding value
66
+ :param servers: an array of host settings or None
67
+ :return: URL based on host settings
68
+ """
69
+ if index is None:
70
+ return self._base_path
71
+
72
+ variables = {} if variables is None else variables
73
+ servers = self.get_host_settings() if servers is None else servers
74
+
75
+ try:
76
+ server = servers[index]
77
+ except IndexError:
78
+ raise ValueError(
79
+ "Invalid index {0} when selecting the host settings. "
80
+ "Must be less than {1}".format(index, len(servers))
81
+ )
82
+
83
+ url = server["url"]
84
+
85
+ # go through variables and replace placeholders
86
+ for variable_name, variable in server.get("variables", {}).items():
87
+ used_value = variables.get(variable_name, variable["default_value"])
88
+
89
+ if "enum_values" in variable and used_value not in variable["enum_values"]:
90
+ given_value = variables[variable_name].replace(".", "")
91
+ valid_values = [v.replace(".", "") for v in variable["enum_values"]]
92
+ raise ValueError(
93
+ "The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
94
+ variable_name, given_value, valid_values
95
+ )
96
+ )
97
+
98
+ url = url.replace("{" + variable_name + "}", used_value)
99
+
100
+ return url
101
+
102
+ @property
103
+ def host(self):
104
+ """Return generated host."""
105
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
106
+
107
+ @host.setter
108
+ def host(self, value):
109
+ """Fix base path."""
110
+ self._base_path = value
111
+ self.server_index = None
@@ -0,0 +1,198 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.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 typing import Any, Optional
15
+
16
+ from typing_extensions import Self
17
+
18
+
19
+ class OpenApiException(Exception):
20
+ """The base exception class for all OpenAPIExceptions"""
21
+
22
+
23
+ class ApiTypeError(OpenApiException, TypeError):
24
+ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
25
+ """Raises an exception for TypeErrors
26
+
27
+ Args:
28
+ msg (str): the exception message
29
+
30
+ Keyword Args:
31
+ path_to_item (list): a list of keys an indices to get to the
32
+ current_item
33
+ None if unset
34
+ valid_classes (tuple): the primitive classes that current item
35
+ should be an instance of
36
+ None if unset
37
+ key_type (bool): False if our value is a value in a dict
38
+ True if it is a key in a dict
39
+ False if our item is an item in a list
40
+ None if unset
41
+ """
42
+ self.path_to_item = path_to_item
43
+ self.valid_classes = valid_classes
44
+ self.key_type = key_type
45
+ full_msg = msg
46
+ if path_to_item:
47
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
48
+ super(ApiTypeError, self).__init__(full_msg)
49
+
50
+
51
+ class ApiValueError(OpenApiException, ValueError):
52
+ def __init__(self, msg, path_to_item=None) -> None:
53
+ """
54
+ Args:
55
+ msg (str): the exception message
56
+
57
+ Keyword Args:
58
+ path_to_item (list) the path to the exception in the
59
+ received_data dict. None if unset
60
+ """
61
+
62
+ self.path_to_item = path_to_item
63
+ full_msg = msg
64
+ if path_to_item:
65
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
66
+ super(ApiValueError, self).__init__(full_msg)
67
+
68
+
69
+ class ApiAttributeError(OpenApiException, AttributeError):
70
+ def __init__(self, msg, path_to_item=None) -> None:
71
+ """
72
+ Raised when an attribute reference or assignment fails.
73
+
74
+ Args:
75
+ msg (str): the exception message
76
+
77
+ Keyword Args:
78
+ path_to_item (None/list) the path to the exception in the
79
+ received_data dict
80
+ """
81
+ self.path_to_item = path_to_item
82
+ full_msg = msg
83
+ if path_to_item:
84
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
85
+ super(ApiAttributeError, self).__init__(full_msg)
86
+
87
+
88
+ class ApiKeyError(OpenApiException, KeyError):
89
+ def __init__(self, msg, path_to_item=None) -> None:
90
+ """
91
+ Args:
92
+ msg (str): the exception message
93
+
94
+ Keyword Args:
95
+ path_to_item (None/list) the path to the exception in the
96
+ received_data dict
97
+ """
98
+ self.path_to_item = path_to_item
99
+ full_msg = msg
100
+ if path_to_item:
101
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
102
+ super(ApiKeyError, self).__init__(full_msg)
103
+
104
+
105
+ class ApiException(OpenApiException):
106
+
107
+ def __init__(
108
+ self,
109
+ status=None,
110
+ reason=None,
111
+ http_resp=None,
112
+ *,
113
+ body: Optional[str] = None,
114
+ data: Optional[Any] = None,
115
+ ) -> None:
116
+ self.status = status
117
+ self.reason = reason
118
+ self.body = body
119
+ self.data = data
120
+ self.headers = None
121
+
122
+ if http_resp:
123
+ if self.status is None:
124
+ self.status = http_resp.status
125
+ if self.reason is None:
126
+ self.reason = http_resp.reason
127
+ if self.body is None:
128
+ try:
129
+ self.body = http_resp.data.decode("utf-8")
130
+ except Exception: # noqa: S110
131
+ pass
132
+ self.headers = http_resp.getheaders()
133
+
134
+ @classmethod
135
+ def from_response(
136
+ cls,
137
+ *,
138
+ http_resp,
139
+ body: Optional[str],
140
+ data: Optional[Any],
141
+ ) -> Self:
142
+ if http_resp.status == 400:
143
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
144
+
145
+ if http_resp.status == 401:
146
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
147
+
148
+ if http_resp.status == 403:
149
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
150
+
151
+ if http_resp.status == 404:
152
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
153
+
154
+ if 500 <= http_resp.status <= 599:
155
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
156
+ raise ApiException(http_resp=http_resp, body=body, data=data)
157
+
158
+ def __str__(self):
159
+ """Custom error messages for exception"""
160
+ error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
161
+ if self.headers:
162
+ error_message += "HTTP response headers: {0}\n".format(self.headers)
163
+
164
+ if self.data or self.body:
165
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
166
+
167
+ return error_message
168
+
169
+
170
+ class BadRequestException(ApiException):
171
+ pass
172
+
173
+
174
+ class NotFoundException(ApiException):
175
+ pass
176
+
177
+
178
+ class UnauthorizedException(ApiException):
179
+ pass
180
+
181
+
182
+ class ForbiddenException(ApiException):
183
+ pass
184
+
185
+
186
+ class ServiceException(ApiException):
187
+ pass
188
+
189
+
190
+ def render_path(path_to_item):
191
+ """Returns a string representation of a path"""
192
+ result = ""
193
+ for pth in path_to_item:
194
+ if isinstance(pth, int):
195
+ result += "[{0}]".format(pth)
196
+ else:
197
+ result += "['{0}']".format(pth)
198
+ return result
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ STACKIT Redis API
6
+
7
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
8
+
9
+ The version of the OpenAPI document: 1.1.0
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+
16
+ # import models into model package
17
+ from stackit.redis.models.backup import Backup
18
+ from stackit.redis.models.create_backup_response_item import CreateBackupResponseItem
19
+ from stackit.redis.models.create_instance_payload import CreateInstancePayload
20
+ from stackit.redis.models.create_instance_response import CreateInstanceResponse
21
+ from stackit.redis.models.credentials import Credentials
22
+ from stackit.redis.models.credentials_list_item import CredentialsListItem
23
+ from stackit.redis.models.credentials_response import CredentialsResponse
24
+ from stackit.redis.models.error import Error
25
+ from stackit.redis.models.get_metrics_response import GetMetricsResponse
26
+ from stackit.redis.models.instance import Instance
27
+ from stackit.redis.models.instance_last_operation import InstanceLastOperation
28
+ from stackit.redis.models.instance_parameters import InstanceParameters
29
+ from stackit.redis.models.instance_schema import InstanceSchema
30
+ from stackit.redis.models.list_backups_response import ListBackupsResponse
31
+ from stackit.redis.models.list_credentials_response import ListCredentialsResponse
32
+ from stackit.redis.models.list_instances_response import ListInstancesResponse
33
+ from stackit.redis.models.list_offerings_response import ListOfferingsResponse
34
+ from stackit.redis.models.list_restores_response import ListRestoresResponse
35
+ from stackit.redis.models.model_schema import ModelSchema
36
+ from stackit.redis.models.offering import Offering
37
+ from stackit.redis.models.partial_update_instance_payload import (
38
+ PartialUpdateInstancePayload,
39
+ )
40
+ from stackit.redis.models.plan import Plan
41
+ from stackit.redis.models.raw_credentials import RawCredentials
42
+ from stackit.redis.models.restore import Restore
43
+ from stackit.redis.models.trigger_restore_response import TriggerRestoreResponse
44
+ from stackit.redis.models.update_backups_config_payload import (
45
+ UpdateBackupsConfigPayload,
46
+ )
47
+ from stackit.redis.models.update_backups_config_response import (
48
+ UpdateBackupsConfigResponse,
49
+ )
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.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, StrictBool, StrictInt, StrictStr
21
+ from typing_extensions import Self
22
+
23
+
24
+ class Backup(BaseModel):
25
+ """
26
+ Backup
27
+ """
28
+
29
+ downloadable: Optional[StrictBool] = None
30
+ finished_at: StrictStr
31
+ id: StrictInt
32
+ size: Optional[StrictInt] = None
33
+ status: StrictStr
34
+ triggered_at: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["downloadable", "finished_at", "id", "size", "status", "triggered_at"]
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 Backup 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 Backup 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
+ {
87
+ "downloadable": obj.get("downloadable"),
88
+ "finished_at": obj.get("finished_at"),
89
+ "id": obj.get("id"),
90
+ "size": obj.get("size"),
91
+ "status": obj.get("status"),
92
+ "triggered_at": obj.get("triggered_at"),
93
+ }
94
+ )
95
+ return _obj
@@ -0,0 +1,82 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.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, StrictInt, StrictStr
21
+ from typing_extensions import Self
22
+
23
+
24
+ class CreateBackupResponseItem(BaseModel):
25
+ """
26
+ CreateBackupResponseItem
27
+ """
28
+
29
+ id: StrictInt
30
+ message: StrictStr
31
+ __properties: ClassVar[List[str]] = ["id", "message"]
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 CreateBackupResponseItem 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 CreateBackupResponseItem 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({"id": obj.get("id"), "message": obj.get("message")})
82
+ return _obj
@@ -0,0 +1,96 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.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, Field, StrictStr
21
+ from typing_extensions import Self
22
+
23
+ from stackit.redis.models.instance_parameters import InstanceParameters
24
+
25
+
26
+ class CreateInstancePayload(BaseModel):
27
+ """
28
+ CreateInstancePayload
29
+ """
30
+
31
+ instance_name: StrictStr = Field(alias="instanceName")
32
+ parameters: Optional[InstanceParameters] = None
33
+ plan_id: StrictStr = Field(alias="planId")
34
+ __properties: ClassVar[List[str]] = ["instanceName", "parameters", "planId"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of CreateInstancePayload from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of parameters
74
+ if self.parameters:
75
+ _dict["parameters"] = self.parameters.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of CreateInstancePayload from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate(
88
+ {
89
+ "instanceName": obj.get("instanceName"),
90
+ "parameters": (
91
+ InstanceParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None
92
+ ),
93
+ "planId": obj.get("planId"),
94
+ }
95
+ )
96
+ return _obj