stackit-mongodbflex 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 (64) hide show
  1. stackit/mongodbflex/__init__.py +103 -0
  2. stackit/mongodbflex/api/__init__.py +4 -0
  3. stackit/mongodbflex/api/default_api.py +6867 -0
  4. stackit/mongodbflex/api_client.py +627 -0
  5. stackit/mongodbflex/api_response.py +23 -0
  6. stackit/mongodbflex/configuration.py +112 -0
  7. stackit/mongodbflex/exceptions.py +199 -0
  8. stackit/mongodbflex/models/__init__.py +84 -0
  9. stackit/mongodbflex/models/acl.py +82 -0
  10. stackit/mongodbflex/models/backup.py +100 -0
  11. stackit/mongodbflex/models/backup_schedule.py +103 -0
  12. stackit/mongodbflex/models/clone_instance_payload.py +83 -0
  13. stackit/mongodbflex/models/clone_instance_response.py +82 -0
  14. stackit/mongodbflex/models/create_instance_payload.py +121 -0
  15. stackit/mongodbflex/models/create_instance_response.py +82 -0
  16. stackit/mongodbflex/models/create_user_payload.py +86 -0
  17. stackit/mongodbflex/models/create_user_response.py +87 -0
  18. stackit/mongodbflex/models/data_point.py +83 -0
  19. stackit/mongodbflex/models/error.py +92 -0
  20. stackit/mongodbflex/models/flavor.py +92 -0
  21. stackit/mongodbflex/models/get_backup_response.py +87 -0
  22. stackit/mongodbflex/models/get_instance_response.py +87 -0
  23. stackit/mongodbflex/models/get_user_response.py +89 -0
  24. stackit/mongodbflex/models/handlers_infra_flavor.py +94 -0
  25. stackit/mongodbflex/models/handlers_infra_get_flavors_response.py +99 -0
  26. stackit/mongodbflex/models/handlers_instances_get_instance_response.py +87 -0
  27. stackit/mongodbflex/models/handlers_instances_slow_queries_response.py +103 -0
  28. stackit/mongodbflex/models/handlers_instances_suggested_indexes_response.py +118 -0
  29. stackit/mongodbflex/models/host.py +101 -0
  30. stackit/mongodbflex/models/host_metric.py +103 -0
  31. stackit/mongodbflex/models/instance.py +128 -0
  32. stackit/mongodbflex/models/instance_list_instance.py +84 -0
  33. stackit/mongodbflex/models/instance_response_user.py +96 -0
  34. stackit/mongodbflex/models/list_backups_response.py +97 -0
  35. stackit/mongodbflex/models/list_flavors_response.py +99 -0
  36. stackit/mongodbflex/models/list_instances_response.py +101 -0
  37. stackit/mongodbflex/models/list_metrics_response.py +93 -0
  38. stackit/mongodbflex/models/list_restore_jobs_response.py +99 -0
  39. stackit/mongodbflex/models/list_storages_response.py +95 -0
  40. stackit/mongodbflex/models/list_user.py +83 -0
  41. stackit/mongodbflex/models/list_users_response.py +99 -0
  42. stackit/mongodbflex/models/list_versions_response.py +82 -0
  43. stackit/mongodbflex/models/mongodbatlas_operation.py +97 -0
  44. stackit/mongodbflex/models/mongodbatlas_stats.py +98 -0
  45. stackit/mongodbflex/models/partial_update_instance_payload.py +121 -0
  46. stackit/mongodbflex/models/partial_update_user_payload.py +83 -0
  47. stackit/mongodbflex/models/restore_instance_payload.py +83 -0
  48. stackit/mongodbflex/models/restore_instance_response.py +89 -0
  49. stackit/mongodbflex/models/restore_instance_status.py +94 -0
  50. stackit/mongodbflex/models/shape.py +122 -0
  51. stackit/mongodbflex/models/slow_query.py +83 -0
  52. stackit/mongodbflex/models/storage.py +83 -0
  53. stackit/mongodbflex/models/storage_range.py +83 -0
  54. stackit/mongodbflex/models/suggested_index.py +102 -0
  55. stackit/mongodbflex/models/update_backup_schedule_payload.py +103 -0
  56. stackit/mongodbflex/models/update_instance_payload.py +121 -0
  57. stackit/mongodbflex/models/update_instance_response.py +87 -0
  58. stackit/mongodbflex/models/update_user_payload.py +83 -0
  59. stackit/mongodbflex/models/user.py +100 -0
  60. stackit/mongodbflex/py.typed +0 -0
  61. stackit/mongodbflex/rest.py +149 -0
  62. stackit_mongodbflex-0.0.1a0.dist-info/METADATA +45 -0
  63. stackit_mongodbflex-0.0.1a0.dist-info/RECORD +64 -0
  64. stackit_mongodbflex-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
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://mongodb-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://mongodb-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 MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
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,84 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ STACKIT MongoDB Service API
6
+
7
+ This is the documentation for the STACKIT MongoDB Flex Service API
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.mongodbflex.models.acl import ACL
19
+ from stackit.mongodbflex.models.backup import Backup
20
+ from stackit.mongodbflex.models.backup_schedule import BackupSchedule
21
+ from stackit.mongodbflex.models.clone_instance_payload import CloneInstancePayload
22
+ from stackit.mongodbflex.models.clone_instance_response import CloneInstanceResponse
23
+ from stackit.mongodbflex.models.create_instance_payload import CreateInstancePayload
24
+ from stackit.mongodbflex.models.create_instance_response import CreateInstanceResponse
25
+ from stackit.mongodbflex.models.create_user_payload import CreateUserPayload
26
+ from stackit.mongodbflex.models.create_user_response import CreateUserResponse
27
+ from stackit.mongodbflex.models.data_point import DataPoint
28
+ from stackit.mongodbflex.models.error import Error
29
+ from stackit.mongodbflex.models.flavor import Flavor
30
+ from stackit.mongodbflex.models.get_backup_response import GetBackupResponse
31
+ from stackit.mongodbflex.models.get_instance_response import GetInstanceResponse
32
+ from stackit.mongodbflex.models.get_user_response import GetUserResponse
33
+ from stackit.mongodbflex.models.handlers_infra_flavor import HandlersInfraFlavor
34
+ from stackit.mongodbflex.models.handlers_infra_get_flavors_response import (
35
+ HandlersInfraGetFlavorsResponse,
36
+ )
37
+ from stackit.mongodbflex.models.handlers_instances_get_instance_response import (
38
+ HandlersInstancesGetInstanceResponse,
39
+ )
40
+ from stackit.mongodbflex.models.handlers_instances_slow_queries_response import (
41
+ HandlersInstancesSlowQueriesResponse,
42
+ )
43
+ from stackit.mongodbflex.models.handlers_instances_suggested_indexes_response import (
44
+ HandlersInstancesSuggestedIndexesResponse,
45
+ )
46
+ from stackit.mongodbflex.models.host import Host
47
+ from stackit.mongodbflex.models.host_metric import HostMetric
48
+ from stackit.mongodbflex.models.instance import Instance
49
+ from stackit.mongodbflex.models.instance_list_instance import InstanceListInstance
50
+ from stackit.mongodbflex.models.instance_response_user import InstanceResponseUser
51
+ from stackit.mongodbflex.models.list_backups_response import ListBackupsResponse
52
+ from stackit.mongodbflex.models.list_flavors_response import ListFlavorsResponse
53
+ from stackit.mongodbflex.models.list_instances_response import ListInstancesResponse
54
+ from stackit.mongodbflex.models.list_metrics_response import ListMetricsResponse
55
+ from stackit.mongodbflex.models.list_restore_jobs_response import (
56
+ ListRestoreJobsResponse,
57
+ )
58
+ from stackit.mongodbflex.models.list_storages_response import ListStoragesResponse
59
+ from stackit.mongodbflex.models.list_user import ListUser
60
+ from stackit.mongodbflex.models.list_users_response import ListUsersResponse
61
+ from stackit.mongodbflex.models.list_versions_response import ListVersionsResponse
62
+ from stackit.mongodbflex.models.mongodbatlas_operation import MongodbatlasOperation
63
+ from stackit.mongodbflex.models.mongodbatlas_stats import MongodbatlasStats
64
+ from stackit.mongodbflex.models.partial_update_instance_payload import (
65
+ PartialUpdateInstancePayload,
66
+ )
67
+ from stackit.mongodbflex.models.partial_update_user_payload import (
68
+ PartialUpdateUserPayload,
69
+ )
70
+ from stackit.mongodbflex.models.restore_instance_payload import RestoreInstancePayload
71
+ from stackit.mongodbflex.models.restore_instance_response import RestoreInstanceResponse
72
+ from stackit.mongodbflex.models.restore_instance_status import RestoreInstanceStatus
73
+ from stackit.mongodbflex.models.shape import Shape
74
+ from stackit.mongodbflex.models.slow_query import SlowQuery
75
+ from stackit.mongodbflex.models.storage import Storage
76
+ from stackit.mongodbflex.models.storage_range import StorageRange
77
+ from stackit.mongodbflex.models.suggested_index import SuggestedIndex
78
+ from stackit.mongodbflex.models.update_backup_schedule_payload import (
79
+ UpdateBackupSchedulePayload,
80
+ )
81
+ from stackit.mongodbflex.models.update_instance_payload import UpdateInstancePayload
82
+ from stackit.mongodbflex.models.update_instance_response import UpdateInstanceResponse
83
+ from stackit.mongodbflex.models.update_user_payload import UpdateUserPayload
84
+ from stackit.mongodbflex.models.user import User
@@ -0,0 +1,82 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
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,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
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
+
25
+ class Backup(BaseModel):
26
+ """
27
+ Backup
28
+ """
29
+
30
+ end_time: Optional[StrictStr] = Field(default=None, alias="endTime")
31
+ error: Optional[StrictStr] = None
32
+ id: Optional[StrictStr] = None
33
+ labels: Optional[List[StrictStr]] = None
34
+ name: Optional[StrictStr] = None
35
+ options: Optional[Dict[str, StrictStr]] = None
36
+ size: Optional[StrictInt] = None
37
+ start_time: Optional[StrictStr] = Field(default=None, alias="startTime")
38
+ __properties: ClassVar[List[str]] = ["endTime", "error", "id", "labels", "name", "options", "size", "startTime"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of Backup from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of Backup from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "endTime": obj.get("endTime"),
91
+ "error": obj.get("error"),
92
+ "id": obj.get("id"),
93
+ "labels": obj.get("labels"),
94
+ "name": obj.get("name"),
95
+ "options": obj.get("options"),
96
+ "size": obj.get("size"),
97
+ "startTime": obj.get("startTime"),
98
+ }
99
+ )
100
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
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
+
25
+ class BackupSchedule(BaseModel):
26
+ """
27
+ BackupSchedule
28
+ """
29
+
30
+ backup_schedule: Optional[StrictStr] = Field(default=None, alias="backupSchedule")
31
+ daily_snapshot_retention_days: Optional[StrictInt] = Field(default=None, alias="dailySnapshotRetentionDays")
32
+ monthly_snapshot_retention_months: Optional[StrictInt] = Field(default=None, alias="monthlySnapshotRetentionMonths")
33
+ point_in_time_window_hours: Optional[StrictInt] = Field(default=None, alias="pointInTimeWindowHours")
34
+ snapshot_retention_days: Optional[StrictInt] = Field(default=None, alias="snapshotRetentionDays")
35
+ weekly_snapshot_retention_weeks: Optional[StrictInt] = Field(default=None, alias="weeklySnapshotRetentionWeeks")
36
+ __properties: ClassVar[List[str]] = [
37
+ "backupSchedule",
38
+ "dailySnapshotRetentionDays",
39
+ "monthlySnapshotRetentionMonths",
40
+ "pointInTimeWindowHours",
41
+ "snapshotRetentionDays",
42
+ "weeklySnapshotRetentionWeeks",
43
+ ]
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
+ return json.dumps(self.to_dict())
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of BackupSchedule from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of BackupSchedule from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate(
94
+ {
95
+ "backupSchedule": obj.get("backupSchedule"),
96
+ "dailySnapshotRetentionDays": obj.get("dailySnapshotRetentionDays"),
97
+ "monthlySnapshotRetentionMonths": obj.get("monthlySnapshotRetentionMonths"),
98
+ "pointInTimeWindowHours": obj.get("pointInTimeWindowHours"),
99
+ "snapshotRetentionDays": obj.get("snapshotRetentionDays"),
100
+ "weeklySnapshotRetentionWeeks": obj.get("weeklySnapshotRetentionWeeks"),
101
+ }
102
+ )
103
+ return _obj