stackit-postgresflex 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 (67) hide show
  1. stackit/postgresflex/__init__.py +120 -0
  2. stackit/postgresflex/api/__init__.py +4 -0
  3. stackit/postgresflex/api/default_api.py +7275 -0
  4. stackit/postgresflex/api_client.py +627 -0
  5. stackit/postgresflex/api_response.py +23 -0
  6. stackit/postgresflex/configuration.py +112 -0
  7. stackit/postgresflex/exceptions.py +199 -0
  8. stackit/postgresflex/models/__init__.py +101 -0
  9. stackit/postgresflex/models/acl.py +82 -0
  10. stackit/postgresflex/models/api_configuration.py +83 -0
  11. stackit/postgresflex/models/api_extension_config_load_response.py +101 -0
  12. stackit/postgresflex/models/api_extension_configure_response.py +101 -0
  13. stackit/postgresflex/models/api_extension_delete_response.py +82 -0
  14. stackit/postgresflex/models/api_extension_list.py +84 -0
  15. stackit/postgresflex/models/api_extension_load_response.py +89 -0
  16. stackit/postgresflex/models/api_install_response.py +89 -0
  17. stackit/postgresflex/models/api_installed_list_response.py +99 -0
  18. stackit/postgresflex/models/backup.py +100 -0
  19. stackit/postgresflex/models/clone_instance_payload.py +89 -0
  20. stackit/postgresflex/models/clone_instance_response.py +82 -0
  21. stackit/postgresflex/models/create_database_payload.py +83 -0
  22. stackit/postgresflex/models/create_instance_payload.py +121 -0
  23. stackit/postgresflex/models/create_instance_response.py +82 -0
  24. stackit/postgresflex/models/create_user_payload.py +83 -0
  25. stackit/postgresflex/models/create_user_response.py +87 -0
  26. stackit/postgresflex/models/error.py +92 -0
  27. stackit/postgresflex/models/extensions_configuration.py +83 -0
  28. stackit/postgresflex/models/extensions_extension_list_response.py +99 -0
  29. stackit/postgresflex/models/extensions_new_config.py +99 -0
  30. stackit/postgresflex/models/flavor.py +92 -0
  31. stackit/postgresflex/models/get_backup_response.py +87 -0
  32. stackit/postgresflex/models/get_user_response.py +89 -0
  33. stackit/postgresflex/models/instance.py +128 -0
  34. stackit/postgresflex/models/instance_create_database_response.py +82 -0
  35. stackit/postgresflex/models/instance_data_point.py +83 -0
  36. stackit/postgresflex/models/instance_database.py +84 -0
  37. stackit/postgresflex/models/instance_host.py +101 -0
  38. stackit/postgresflex/models/instance_host_metric.py +103 -0
  39. stackit/postgresflex/models/instance_list_databases_response.py +99 -0
  40. stackit/postgresflex/models/instance_list_instance.py +84 -0
  41. stackit/postgresflex/models/instance_metrics_response.py +97 -0
  42. stackit/postgresflex/models/instance_response.py +87 -0
  43. stackit/postgresflex/models/list_backups_response.py +97 -0
  44. stackit/postgresflex/models/list_flavors_response.py +97 -0
  45. stackit/postgresflex/models/list_instances_response.py +101 -0
  46. stackit/postgresflex/models/list_storages_response.py +95 -0
  47. stackit/postgresflex/models/list_users_response.py +101 -0
  48. stackit/postgresflex/models/list_users_response_item.py +83 -0
  49. stackit/postgresflex/models/list_versions_response.py +82 -0
  50. stackit/postgresflex/models/partial_update_instance_payload.py +121 -0
  51. stackit/postgresflex/models/partial_update_instance_response.py +87 -0
  52. stackit/postgresflex/models/partial_update_user_payload.py +83 -0
  53. stackit/postgresflex/models/postgres_database_parameter.py +137 -0
  54. stackit/postgresflex/models/postgres_database_parameter_response.py +101 -0
  55. stackit/postgresflex/models/reset_user_response.py +87 -0
  56. stackit/postgresflex/models/storage.py +83 -0
  57. stackit/postgresflex/models/storage_range.py +83 -0
  58. stackit/postgresflex/models/update_backup_schedule_payload.py +82 -0
  59. stackit/postgresflex/models/update_instance_payload.py +121 -0
  60. stackit/postgresflex/models/update_user_payload.py +83 -0
  61. stackit/postgresflex/models/user.py +100 -0
  62. stackit/postgresflex/models/user_response.py +94 -0
  63. stackit/postgresflex/py.typed +0 -0
  64. stackit/postgresflex/rest.py +149 -0
  65. stackit_postgresflex-0.0.1a0.dist-info/METADATA +45 -0
  66. stackit_postgresflex-0.0.1a0.dist-info/RECORD +67 -0
  67. stackit_postgresflex-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT PostgreSQL Flex API
5
+
6
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
14
+
15
+
16
+ class HostConfiguration:
17
+ def __init__(
18
+ self,
19
+ region=None,
20
+ server_index=None,
21
+ server_variables=None,
22
+ server_operation_index=None,
23
+ server_operation_variables=None,
24
+ ignore_operation_servers=False,
25
+ ) -> None:
26
+ """Constructor"""
27
+ self._base_path = "https://postgres-flex-service.api.eu01.stackit.cloud"
28
+ """Default Base url
29
+ """
30
+ self.server_index = 0 if server_index is None else server_index
31
+ self.server_operation_index = server_operation_index or {}
32
+ """Default server index
33
+ """
34
+ self.server_variables = server_variables or {}
35
+ if region:
36
+ self.server_variables["region"] = "{}.".format(region)
37
+ self.server_operation_variables = server_operation_variables or {}
38
+ """Default server variables
39
+ """
40
+ self.ignore_operation_servers = ignore_operation_servers
41
+ """Ignore operation servers
42
+ """
43
+
44
+ def get_host_settings(self):
45
+ """Gets an array of host settings
46
+
47
+ :return: An array of host settings
48
+ """
49
+ return [
50
+ {
51
+ "url": "https://postgres-flex-service.api.{region}stackit.cloud",
52
+ "description": "No description provided",
53
+ "variables": {
54
+ "region": {
55
+ "description": "No description provided",
56
+ "default_value": "eu01.",
57
+ "enum_values": ["eu01."],
58
+ }
59
+ },
60
+ }
61
+ ]
62
+
63
+ def get_host_from_settings(self, index, variables=None, servers=None):
64
+ """Gets host URL based on the index and variables
65
+ :param index: array index of the host settings
66
+ :param variables: hash of variable and the corresponding value
67
+ :param servers: an array of host settings or None
68
+ :return: URL based on host settings
69
+ """
70
+ if index is None:
71
+ return self._base_path
72
+
73
+ variables = {} if variables is None else variables
74
+ servers = self.get_host_settings() if servers is None else servers
75
+
76
+ try:
77
+ server = servers[index]
78
+ except IndexError:
79
+ raise ValueError(
80
+ "Invalid index {0} when selecting the host settings. "
81
+ "Must be less than {1}".format(index, len(servers))
82
+ )
83
+
84
+ url = server["url"]
85
+
86
+ # go through variables and replace placeholders
87
+ for variable_name, variable in server.get("variables", {}).items():
88
+ used_value = variables.get(variable_name, variable["default_value"])
89
+
90
+ if "enum_values" in variable and used_value not in variable["enum_values"]:
91
+ given_value = variables[variable_name].replace(".", "")
92
+ valid_values = [v.replace(".", "") for v in variable["enum_values"]]
93
+ raise ValueError(
94
+ "The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
95
+ variable_name, given_value, valid_values
96
+ )
97
+ )
98
+
99
+ url = url.replace("{" + variable_name + "}", used_value)
100
+
101
+ return url
102
+
103
+ @property
104
+ def host(self):
105
+ """Return generated host."""
106
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
107
+
108
+ @host.setter
109
+ def host(self, value):
110
+ """Fix base path."""
111
+ self._base_path = value
112
+ self.server_index = None
@@ -0,0 +1,199 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT PostgreSQL Flex API
5
+
6
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
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
+ if 500 <= http_resp.status <= 599:
156
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
157
+ raise ApiException(http_resp=http_resp, body=body, data=data)
158
+
159
+ def __str__(self):
160
+ """Custom error messages for exception"""
161
+ error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
162
+ if self.headers:
163
+ error_message += "HTTP response headers: {0}\n".format(self.headers)
164
+
165
+ if self.data or self.body:
166
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
167
+
168
+ return error_message
169
+
170
+
171
+ class BadRequestException(ApiException):
172
+ pass
173
+
174
+
175
+ class NotFoundException(ApiException):
176
+ pass
177
+
178
+
179
+ class UnauthorizedException(ApiException):
180
+ pass
181
+
182
+
183
+ class ForbiddenException(ApiException):
184
+ pass
185
+
186
+
187
+ class ServiceException(ApiException):
188
+ pass
189
+
190
+
191
+ def render_path(path_to_item):
192
+ """Returns a string representation of a path"""
193
+ result = ""
194
+ for pth in path_to_item:
195
+ if isinstance(pth, int):
196
+ result += "[{0}]".format(pth)
197
+ else:
198
+ result += "['{0}']".format(pth)
199
+ return result
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ STACKIT PostgreSQL Flex API
6
+
7
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
15
+
16
+
17
+ # import models into model package
18
+ from stackit.postgresflex.models.acl import ACL
19
+ from stackit.postgresflex.models.api_configuration import ApiConfiguration
20
+ from stackit.postgresflex.models.api_extension_config_load_response import (
21
+ ApiExtensionConfigLoadResponse,
22
+ )
23
+ from stackit.postgresflex.models.api_extension_configure_response import (
24
+ ApiExtensionConfigureResponse,
25
+ )
26
+ from stackit.postgresflex.models.api_extension_delete_response import (
27
+ ApiExtensionDeleteResponse,
28
+ )
29
+ from stackit.postgresflex.models.api_extension_list import ApiExtensionList
30
+ from stackit.postgresflex.models.api_extension_load_response import (
31
+ ApiExtensionLoadResponse,
32
+ )
33
+ from stackit.postgresflex.models.api_install_response import ApiInstallResponse
34
+ from stackit.postgresflex.models.api_installed_list_response import (
35
+ ApiInstalledListResponse,
36
+ )
37
+ from stackit.postgresflex.models.backup import Backup
38
+ from stackit.postgresflex.models.clone_instance_payload import CloneInstancePayload
39
+ from stackit.postgresflex.models.clone_instance_response import CloneInstanceResponse
40
+ from stackit.postgresflex.models.create_database_payload import CreateDatabasePayload
41
+ from stackit.postgresflex.models.create_instance_payload import CreateInstancePayload
42
+ from stackit.postgresflex.models.create_instance_response import CreateInstanceResponse
43
+ from stackit.postgresflex.models.create_user_payload import CreateUserPayload
44
+ from stackit.postgresflex.models.create_user_response import CreateUserResponse
45
+ from stackit.postgresflex.models.error import Error
46
+ from stackit.postgresflex.models.extensions_configuration import ExtensionsConfiguration
47
+ from stackit.postgresflex.models.extensions_extension_list_response import (
48
+ ExtensionsExtensionListResponse,
49
+ )
50
+ from stackit.postgresflex.models.extensions_new_config import ExtensionsNewConfig
51
+ from stackit.postgresflex.models.flavor import Flavor
52
+ from stackit.postgresflex.models.get_backup_response import GetBackupResponse
53
+ from stackit.postgresflex.models.get_user_response import GetUserResponse
54
+ from stackit.postgresflex.models.instance import Instance
55
+ from stackit.postgresflex.models.instance_create_database_response import (
56
+ InstanceCreateDatabaseResponse,
57
+ )
58
+ from stackit.postgresflex.models.instance_data_point import InstanceDataPoint
59
+ from stackit.postgresflex.models.instance_database import InstanceDatabase
60
+ from stackit.postgresflex.models.instance_host import InstanceHost
61
+ from stackit.postgresflex.models.instance_host_metric import InstanceHostMetric
62
+ from stackit.postgresflex.models.instance_list_databases_response import (
63
+ InstanceListDatabasesResponse,
64
+ )
65
+ from stackit.postgresflex.models.instance_list_instance import InstanceListInstance
66
+ from stackit.postgresflex.models.instance_metrics_response import (
67
+ InstanceMetricsResponse,
68
+ )
69
+ from stackit.postgresflex.models.instance_response import InstanceResponse
70
+ from stackit.postgresflex.models.list_backups_response import ListBackupsResponse
71
+ from stackit.postgresflex.models.list_flavors_response import ListFlavorsResponse
72
+ from stackit.postgresflex.models.list_instances_response import ListInstancesResponse
73
+ from stackit.postgresflex.models.list_storages_response import ListStoragesResponse
74
+ from stackit.postgresflex.models.list_users_response import ListUsersResponse
75
+ from stackit.postgresflex.models.list_users_response_item import ListUsersResponseItem
76
+ from stackit.postgresflex.models.list_versions_response import ListVersionsResponse
77
+ from stackit.postgresflex.models.partial_update_instance_payload import (
78
+ PartialUpdateInstancePayload,
79
+ )
80
+ from stackit.postgresflex.models.partial_update_instance_response import (
81
+ PartialUpdateInstanceResponse,
82
+ )
83
+ from stackit.postgresflex.models.partial_update_user_payload import (
84
+ PartialUpdateUserPayload,
85
+ )
86
+ from stackit.postgresflex.models.postgres_database_parameter import (
87
+ PostgresDatabaseParameter,
88
+ )
89
+ from stackit.postgresflex.models.postgres_database_parameter_response import (
90
+ PostgresDatabaseParameterResponse,
91
+ )
92
+ from stackit.postgresflex.models.reset_user_response import ResetUserResponse
93
+ from stackit.postgresflex.models.storage import Storage
94
+ from stackit.postgresflex.models.storage_range import StorageRange
95
+ from stackit.postgresflex.models.update_backup_schedule_payload import (
96
+ UpdateBackupSchedulePayload,
97
+ )
98
+ from stackit.postgresflex.models.update_instance_payload import UpdateInstancePayload
99
+ from stackit.postgresflex.models.update_user_payload import UpdateUserPayload
100
+ from stackit.postgresflex.models.user import User
101
+ from stackit.postgresflex.models.user_response import UserResponse
@@ -0,0 +1,82 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT PostgreSQL Flex API
5
+
6
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class ACL(BaseModel):
26
+ """
27
+ ACL
28
+ """
29
+
30
+ items: Optional[List[StrictStr]] = None
31
+ __properties: ClassVar[List[str]] = ["items"]
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 ACL 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 ACL 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({"items": obj.get("items")})
82
+ return _obj
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT PostgreSQL Flex API
5
+
6
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class ApiConfiguration(BaseModel):
26
+ """
27
+ ApiConfiguration
28
+ """
29
+
30
+ name: Optional[StrictStr] = None
31
+ setting: Optional[StrictStr] = None
32
+ __properties: ClassVar[List[str]] = ["name", "setting"]
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 ApiConfiguration 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 ApiConfiguration 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"), "setting": obj.get("setting")})
83
+ return _obj
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT PostgreSQL Flex API
5
+
6
+ This is the documentation for the STACKIT postgres service
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 docstring might be too long
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 Self
23
+
24
+ from stackit.postgresflex.models.api_configuration import ApiConfiguration
25
+
26
+
27
+ class ApiExtensionConfigLoadResponse(BaseModel):
28
+ """
29
+ ApiExtensionConfigLoadResponse
30
+ """
31
+
32
+ configuration: Optional[List[ApiConfiguration]] = Field(
33
+ default=None, description="Returns marshalled JSON of the new configuration of whatever extension is called"
34
+ )
35
+ __properties: ClassVar[List[str]] = ["configuration"]
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 ApiExtensionConfigLoadResponse 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 each item in configuration (list)
75
+ _items = []
76
+ if self.configuration:
77
+ for _item in self.configuration:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict["configuration"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of ApiExtensionConfigLoadResponse from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "configuration": (
95
+ [ApiConfiguration.from_dict(_item) for _item in obj["configuration"]]
96
+ if obj.get("configuration") is not None
97
+ else None
98
+ )
99
+ }
100
+ )
101
+ return _obj