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,128 @@
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, StrictInt, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.postgresflex.models.acl import ACL
25
+ from stackit.postgresflex.models.flavor import Flavor
26
+ from stackit.postgresflex.models.storage import Storage
27
+
28
+
29
+ class Instance(BaseModel):
30
+ """
31
+ Instance
32
+ """
33
+
34
+ acl: Optional[ACL] = None
35
+ backup_schedule: Optional[StrictStr] = Field(default=None, alias="backupSchedule")
36
+ flavor: Optional[Flavor] = None
37
+ id: Optional[StrictStr] = None
38
+ name: Optional[StrictStr] = None
39
+ options: Optional[Dict[str, StrictStr]] = None
40
+ replicas: Optional[StrictInt] = None
41
+ status: Optional[StrictStr] = None
42
+ storage: Optional[Storage] = None
43
+ version: Optional[StrictStr] = None
44
+ __properties: ClassVar[List[str]] = [
45
+ "acl",
46
+ "backupSchedule",
47
+ "flavor",
48
+ "id",
49
+ "name",
50
+ "options",
51
+ "replicas",
52
+ "status",
53
+ "storage",
54
+ "version",
55
+ ]
56
+
57
+ model_config = ConfigDict(
58
+ populate_by_name=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of Instance from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ # override the default output from pydantic by calling `to_dict()` of acl
95
+ if self.acl:
96
+ _dict["acl"] = self.acl.to_dict()
97
+ # override the default output from pydantic by calling `to_dict()` of flavor
98
+ if self.flavor:
99
+ _dict["flavor"] = self.flavor.to_dict()
100
+ # override the default output from pydantic by calling `to_dict()` of storage
101
+ if self.storage:
102
+ _dict["storage"] = self.storage.to_dict()
103
+ return _dict
104
+
105
+ @classmethod
106
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
107
+ """Create an instance of Instance from a dict"""
108
+ if obj is None:
109
+ return None
110
+
111
+ if not isinstance(obj, dict):
112
+ return cls.model_validate(obj)
113
+
114
+ _obj = cls.model_validate(
115
+ {
116
+ "acl": ACL.from_dict(obj["acl"]) if obj.get("acl") is not None else None,
117
+ "backupSchedule": obj.get("backupSchedule"),
118
+ "flavor": Flavor.from_dict(obj["flavor"]) if obj.get("flavor") is not None else None,
119
+ "id": obj.get("id"),
120
+ "name": obj.get("name"),
121
+ "options": obj.get("options"),
122
+ "replicas": obj.get("replicas"),
123
+ "status": obj.get("status"),
124
+ "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
125
+ "version": obj.get("version"),
126
+ }
127
+ )
128
+ return _obj
@@ -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 InstanceCreateDatabaseResponse(BaseModel):
26
+ """
27
+ InstanceCreateDatabaseResponse
28
+ """
29
+
30
+ id: Optional[StrictStr] = None
31
+ __properties: ClassVar[List[str]] = ["id"]
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 InstanceCreateDatabaseResponse 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 InstanceCreateDatabaseResponse 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")})
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, Union
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class InstanceDataPoint(BaseModel):
26
+ """
27
+ InstanceDataPoint
28
+ """
29
+
30
+ timestamp: Optional[StrictStr] = None
31
+ value: Optional[Union[StrictFloat, StrictInt]] = None
32
+ __properties: ClassVar[List[str]] = ["timestamp", "value"]
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 InstanceDataPoint 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 InstanceDataPoint 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({"timestamp": obj.get("timestamp"), "value": obj.get("value")})
83
+ return _obj
@@ -0,0 +1,84 @@
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class InstanceDatabase(BaseModel):
26
+ """
27
+ InstanceDatabase
28
+ """
29
+
30
+ id: Optional[StrictStr] = None
31
+ name: Optional[StrictStr] = None
32
+ options: Optional[Dict[str, Any]] = Field(default=None, description="Database specific options")
33
+ __properties: ClassVar[List[str]] = ["id", "name", "options"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of InstanceDatabase from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of InstanceDatabase from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({"id": obj.get("id"), "name": obj.get("name"), "options": obj.get("options")})
84
+ 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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.postgresflex.models.instance_host_metric import InstanceHostMetric
25
+
26
+
27
+ class InstanceHost(BaseModel):
28
+ """
29
+ InstanceHost
30
+ """
31
+
32
+ host_metrics: Optional[List[InstanceHostMetric]] = Field(default=None, alias="hostMetrics")
33
+ id: Optional[StrictStr] = None
34
+ __properties: ClassVar[List[str]] = ["hostMetrics", "id"]
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 InstanceHost 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 each item in host_metrics (list)
74
+ _items = []
75
+ if self.host_metrics:
76
+ for _item in self.host_metrics:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["hostMetrics"] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of InstanceHost from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "hostMetrics": (
94
+ [InstanceHostMetric.from_dict(_item) for _item in obj["hostMetrics"]]
95
+ if obj.get("hostMetrics") is not None
96
+ else None
97
+ ),
98
+ "id": obj.get("id"),
99
+ }
100
+ )
101
+ return _obj
@@ -0,0 +1,103 @@
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
+ from stackit.postgresflex.models.instance_data_point import InstanceDataPoint
25
+
26
+
27
+ class InstanceHostMetric(BaseModel):
28
+ """
29
+ InstanceHostMetric
30
+ """
31
+
32
+ datapoints: Optional[List[InstanceDataPoint]] = None
33
+ name: Optional[StrictStr] = None
34
+ units: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["datapoints", "name", "units"]
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 InstanceHostMetric 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 datapoints (list)
75
+ _items = []
76
+ if self.datapoints:
77
+ for _item in self.datapoints:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict["datapoints"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of InstanceHostMetric 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
+ "datapoints": (
95
+ [InstanceDataPoint.from_dict(_item) for _item in obj["datapoints"]]
96
+ if obj.get("datapoints") is not None
97
+ else None
98
+ ),
99
+ "name": obj.get("name"),
100
+ "units": obj.get("units"),
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,99 @@
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
22
+ from typing_extensions import Self
23
+
24
+ from stackit.postgresflex.models.instance_database import InstanceDatabase
25
+
26
+
27
+ class InstanceListDatabasesResponse(BaseModel):
28
+ """
29
+ InstanceListDatabasesResponse
30
+ """
31
+
32
+ databases: Optional[List[InstanceDatabase]] = None
33
+ __properties: ClassVar[List[str]] = ["databases"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of InstanceListDatabasesResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in databases (list)
73
+ _items = []
74
+ if self.databases:
75
+ for _item in self.databases:
76
+ if _item:
77
+ _items.append(_item.to_dict())
78
+ _dict["databases"] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of InstanceListDatabasesResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate(
91
+ {
92
+ "databases": (
93
+ [InstanceDatabase.from_dict(_item) for _item in obj["databases"]]
94
+ if obj.get("databases") is not None
95
+ else None
96
+ )
97
+ }
98
+ )
99
+ return _obj