stackit-serverupdate 1.1.0__tar.gz → 1.2.0__tar.gz

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 (29) hide show
  1. stackit_serverupdate-1.2.0/.gitignore +267 -0
  2. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/PKG-INFO +14 -12
  3. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/pyproject.toml +49 -37
  4. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/api_client.py +36 -25
  5. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/exceptions.py +1 -1
  6. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/__init__.py +0 -1
  7. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/create_update_payload.py +8 -4
  8. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/create_update_schedule_payload.py +18 -6
  9. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/enable_service_resource_payload.py +7 -5
  10. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/error_response.py +4 -3
  11. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/get_update_policies_response.py +7 -6
  12. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/get_update_schedules_response.py +7 -6
  13. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/get_update_service_response.py +4 -3
  14. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/get_updates_list_response.py +7 -6
  15. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/update.py +4 -3
  16. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/update_policy.py +21 -6
  17. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/update_schedule.py +19 -6
  18. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/update_schedule_create_request.py +18 -6
  19. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/models/update_update_schedule_payload.py +18 -6
  20. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/rest.py +19 -3
  21. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/LICENSE.md +0 -0
  22. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/NOTICE.txt +0 -0
  23. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/README.md +0 -0
  24. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/__init__.py +0 -0
  25. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/api/__init__.py +0 -0
  26. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/api/default_api.py +0 -0
  27. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/api_response.py +0 -0
  28. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/configuration.py +0 -0
  29. {stackit_serverupdate-1.1.0 → stackit_serverupdate-1.2.0}/src/stackit/serverupdate/py.typed +0 -0
@@ -0,0 +1,267 @@
1
+ ### VisualStudioCode template
2
+ .vscode/*
3
+ !.vscode/settings.json
4
+ !.vscode/tasks.json
5
+ !.vscode/launch.json
6
+ !.vscode/extensions.json
7
+ !.vscode/*.code-snippets
8
+
9
+ # Local History for Visual Studio Code
10
+ .history/
11
+
12
+ # Built Visual Studio Code Extensions
13
+ *.vsix
14
+
15
+ ### JetBrains template
16
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
17
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
18
+
19
+ # User-specific stuff
20
+ .idea/**/workspace.xml
21
+ .idea/**/tasks.xml
22
+ .idea/**/usage.statistics.xml
23
+ .idea/**/dictionaries
24
+ .idea/**/shelf
25
+
26
+ # AWS User-specific
27
+ .idea/**/aws.xml
28
+
29
+ # Generated files
30
+ .idea/**/contentModel.xml
31
+
32
+ # Sensitive or high-churn files
33
+ .idea/**/dataSources/
34
+ .idea/**/dataSources.ids
35
+ .idea/**/dataSources.local.xml
36
+ .idea/**/sqlDataSources.xml
37
+ .idea/**/dynamic.xml
38
+ .idea/**/uiDesigner.xml
39
+ .idea/**/dbnavigator.xml
40
+
41
+ # Gradle
42
+ .idea/**/gradle.xml
43
+ .idea/**/libraries
44
+
45
+ # Gradle and Maven with auto-import
46
+ # When using Gradle or Maven with auto-import, you should exclude module files,
47
+ # since they will be recreated, and may cause churn. Uncomment if using
48
+ # auto-import.
49
+ # .idea/artifacts
50
+ # .idea/compiler.xml
51
+ # .idea/jarRepositories.xml
52
+ # .idea/modules.xml
53
+ # .idea/*.iml
54
+ # .idea/modules
55
+ # *.iml
56
+ # *.ipr
57
+
58
+ # CMake
59
+ cmake-build-*/
60
+
61
+ # Mongo Explorer plugin
62
+ .idea/**/mongoSettings.xml
63
+
64
+ # File-based project format
65
+ *.iws
66
+
67
+ # IntelliJ
68
+ out/
69
+
70
+ # mpeltonen/sbt-idea plugin
71
+ .idea_modules/
72
+
73
+ # JIRA plugin
74
+ atlassian-ide-plugin.xml
75
+
76
+ # Cursive Clojure plugin
77
+ .idea/replstate.xml
78
+
79
+ # SonarLint plugin
80
+ .idea/sonarlint/
81
+
82
+ # Crashlytics plugin (for Android Studio and IntelliJ)
83
+ com_crashlytics_export_strings.xml
84
+ crashlytics.properties
85
+ crashlytics-build.properties
86
+ fabric.properties
87
+
88
+ # Editor-based Rest Client
89
+ .idea/httpRequests
90
+
91
+ # Android studio 3.1+ serialized cache file
92
+ .idea/caches/build_file_checksums.ser
93
+
94
+ ### VirtualEnv template
95
+ # Virtualenv
96
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
97
+ .Python
98
+ [Bb]in
99
+ [Ii]nclude
100
+ [Ll]ib
101
+ [Ll]ib64
102
+ [Ll]ocal
103
+ [Ss]cripts
104
+ pyvenv.cfg
105
+ .venv
106
+ pip-selfcheck.json
107
+
108
+ ### Python template
109
+ # Byte-compiled / optimized / DLL files
110
+ __pycache__/
111
+ *.py[cod]
112
+ *$py.class
113
+
114
+ # C extensions
115
+ *.so
116
+
117
+ # Distribution / packaging
118
+ build/
119
+ develop-eggs/
120
+ dist/
121
+ downloads/
122
+ eggs/
123
+ .eggs/
124
+ lib/
125
+ lib64/
126
+ parts/
127
+ sdist/
128
+ var/
129
+ wheels/
130
+ share/python-wheels/
131
+ *.egg-info/
132
+ .installed.cfg
133
+ *.egg
134
+ MANIFEST
135
+
136
+ # PyInstaller
137
+ # Usually these files are written by a python script from a template
138
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
139
+ *.manifest
140
+ *.spec
141
+
142
+ # Installer logs
143
+ pip-log.txt
144
+ pip-delete-this-directory.txt
145
+
146
+ # Unit test / coverage reports
147
+ htmlcov/
148
+ .tox/
149
+ .nox/
150
+ .coverage
151
+ .coverage.*
152
+ .cache
153
+ nosetests.xml
154
+ coverage.xml
155
+ *.cover
156
+ *.py,cover
157
+ .hypothesis/
158
+ .pytest_cache/
159
+ cover/
160
+
161
+ # Translations
162
+ *.mo
163
+ *.pot
164
+
165
+ # Django stuff:
166
+ *.log
167
+ local_settings.py
168
+ db.sqlite3
169
+ db.sqlite3-journal
170
+
171
+ # Flask stuff:
172
+ instance/
173
+ .webassets-cache
174
+
175
+ # Scrapy stuff:
176
+ .scrapy
177
+
178
+ # Sphinx documentation
179
+ docs/_build/
180
+
181
+ # PyBuilder
182
+ .pybuilder/
183
+ target/
184
+
185
+ # Jupyter Notebook
186
+ .ipynb_checkpoints
187
+
188
+ # IPython
189
+ profile_default/
190
+ ipython_config.py
191
+
192
+ # pyenv
193
+ # For a library or package, you might want to ignore these files since the code is
194
+ # intended to run in multiple environments; otherwise, check them in:
195
+ # .python-version
196
+
197
+ # pipenv
198
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
199
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
200
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
201
+ # install all needed dependencies.
202
+ #Pipfile.lock
203
+
204
+ # poetry
205
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
206
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
207
+ # commonly ignored for libraries.
208
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
209
+ #poetry.lock
210
+
211
+ # pdm
212
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
213
+ #pdm.lock
214
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
215
+ # in version control.
216
+ # https://pdm.fming.dev/#use-with-ide
217
+ .pdm.toml
218
+
219
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
220
+ __pypackages__/
221
+
222
+ # Celery stuff
223
+ celerybeat-schedule
224
+ celerybeat.pid
225
+
226
+ # SageMath parsed files
227
+ *.sage.py
228
+
229
+ # Environments
230
+ .env
231
+ env/
232
+ venv/
233
+ ENV/
234
+ env.bak/
235
+ venv.bak/
236
+
237
+ # Spyder project settings
238
+ .spyderproject
239
+ .spyproject
240
+
241
+ # Rope project settings
242
+ .ropeproject
243
+
244
+ # mkdocs documentation
245
+ /site
246
+
247
+ # mypy
248
+ .mypy_cache/
249
+ .dmypy.json
250
+ dmypy.json
251
+
252
+ # Pyre type checker
253
+ .pyre/
254
+
255
+ # pytype static type analyzer
256
+ .pytype/
257
+
258
+ # Cython debug symbols
259
+ cython_debug/
260
+
261
+ # PyCharm
262
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
263
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
264
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
265
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
266
+ .idea/
267
+
@@ -1,10 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: stackit-serverupdate
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: STACKIT Server Update Management API
5
- Author: STACKIT Developer Tools
6
- Author-email: developer-tools@stackit.cloud
7
- Requires-Python: >=3.9,<4.0
5
+ Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
+ Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
7
+ Author-email: STACKIT Developer Tools <developer-tools@stackit.cloud>
8
+ License-File: LICENSE.md
9
+ License-File: NOTICE.txt
8
10
  Classifier: License :: OSI Approved :: Apache Software License
9
11
  Classifier: Operating System :: OS Independent
10
12
  Classifier: Programming Language :: Python :: 3
@@ -13,12 +15,12 @@ Classifier: Programming Language :: Python :: 3.10
13
15
  Classifier: Programming Language :: Python :: 3.11
14
16
  Classifier: Programming Language :: Python :: 3.12
15
17
  Classifier: Programming Language :: Python :: 3.13
16
- Requires-Dist: pydantic (>=2.9.2)
17
- Requires-Dist: python-dateutil (>=2.9.0.post0)
18
- Requires-Dist: requests (>=2.32.3)
19
- Requires-Dist: stackit-core (>=0.0.1a)
20
- Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
21
- Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: <4.0,>=3.9
20
+ Requires-Dist: pydantic>=2.9.2
21
+ Requires-Dist: python-dateutil>=2.9.0.post0
22
+ Requires-Dist: requests>=2.32.3
23
+ Requires-Dist: stackit-core>=0.0.1a
22
24
  Description-Content-Type: text/markdown
23
25
 
24
26
  # stackit.serverupdate
@@ -42,4 +44,4 @@ import stackit.serverupdate
42
44
 
43
45
  ## Getting Started
44
46
 
45
- [Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
47
+ [Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
@@ -1,55 +1,67 @@
1
1
  [project]
2
2
  name = "stackit-serverupdate"
3
-
4
- [tool.poetry]
5
- name = "stackit-serverupdate"
6
- version = "v1.1.0"
7
- authors = [
8
- "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
- ]
3
+ version = "v1.2.0"
10
4
  description = "STACKIT Server Update Management API"
5
+ authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
+ requires-python = ">=3.9,<4.0"
11
7
  readme = "README.md"
12
- #license = "NoLicense"
13
8
  classifiers = [
14
9
  "Programming Language :: Python :: 3",
15
10
  "License :: OSI Approved :: Apache Software License",
16
11
  "Operating System :: OS Independent",
12
+ "Programming Language :: Python :: 3.9",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
17
18
  ]
18
- packages = [
19
- { include = "stackit", from="src" }
19
+ dependencies = [
20
+ "stackit-core>=0.0.1a",
21
+ "requests>=2.32.3",
22
+ "pydantic>=2.9.2",
23
+ "python-dateutil>=2.9.0.post0",
20
24
  ]
21
25
 
22
- [tool.poetry.dependencies]
23
- python = ">=3.9,<4.0"
24
- stackit-core = ">=0.0.1a"
25
- requests = ">=2.32.3"
26
- pydantic = ">=2.9.2"
27
- python-dateutil = ">=2.9.0.post0"
28
-
29
- [tool.poetry.group.dev.dependencies]
30
- black = ">=24.8.0"
31
- pytest = ">=8.3.3"
32
- flake8 = [
33
- { version= ">=5.0.3", python="<3.12"},
34
- { version= ">=6.0.1", python=">=3.12"}
35
- ]
36
- flake8-black = ">=0.3.6"
37
- flake8-pyproject = ">=1.2.3"
38
- autoimport = ">=1.6.1"
39
- flake8-eol = ">=0.0.8"
40
- flake8-eradicate = ">=1.5.0"
41
- flake8-bandit = ">=4.1.1"
42
- flake8-bugbear = ">=23.1.14"
43
- flake8-quotes = ">=3.4.0"
44
- isort = ">=5.13.2"
45
-
46
26
  [project.urls]
47
27
  Homepage = "https://github.com/stackitcloud/stackit-sdk-python"
48
28
  Issues = "https://github.com/stackitcloud/stackit-sdk-python/issues"
49
29
 
30
+ [dependency-groups]
31
+ dev = [
32
+ "black>=24.8.0",
33
+ "pytest>=8.3.3",
34
+ "flake8>=5.0.3 ; python_full_version < '3.12'",
35
+ "flake8>=6.0.1 ; python_full_version >= '3.12'",
36
+ "flake8-black>=0.3.6",
37
+ "flake8-pyproject>=1.2.3",
38
+ "autoimport>=1.6.1",
39
+ "flake8-eol>=0.0.8",
40
+ "flake8-eradicate>=1.5.0",
41
+ "flake8-bandit>=4.1.1",
42
+ "flake8-bugbear>=23.1.14",
43
+ "flake8-quotes>=3.4.0",
44
+ "isort>=5.13.2",
45
+ ]
46
+
47
+ [tool.uv]
48
+ default-groups = "all"
49
+
50
+ [tool.uv.sources]
51
+ stackit-core = { path = "../../core" }
52
+
53
+ [tool.hatch.build.targets.sdist]
54
+ include = ["src/stackit"]
55
+
56
+ [tool.hatch.build.targets.wheel]
57
+ include = ["src/stackit"]
58
+
59
+ [tool.hatch.build.targets.wheel.sources]
60
+ "src/stackit" = "stackit"
61
+
50
62
  [build-system]
51
- requires = ["setuptools", "poetry-core"]
52
- build-backend = "poetry.core.masonry.api"
63
+ requires = ["hatchling"]
64
+ build-backend = "hatchling.build"
53
65
 
54
66
  [tool.pytest.ini_options]
55
67
  pythonpath = [
@@ -105,4 +117,4 @@ per-file-ignores = """
105
117
  # E501: long descriptions/string values might lead to lines that are too long
106
118
  # B028: stacklevel for deprecation warning is irrelevant
107
119
  ./src/stackit/*/api/default_api.py: F841,B028,E501
108
- """
120
+ """
@@ -13,11 +13,13 @@
13
13
  """ # noqa: E501
14
14
 
15
15
  import datetime
16
+ import decimal
16
17
  import json
17
18
  import mimetypes
18
19
  import os
19
20
  import re
20
21
  import tempfile
22
+ import uuid
21
23
  from enum import Enum
22
24
  from typing import Dict, List, Optional, Tuple, Union
23
25
  from urllib.parse import quote
@@ -64,8 +66,11 @@ class ApiClient:
64
66
  "bool": bool,
65
67
  "date": datetime.date,
66
68
  "datetime": datetime.datetime,
69
+ "decimal": decimal.Decimal,
70
+ "UUID": uuid.UUID,
67
71
  "object": object,
68
72
  }
73
+ _pool = None
69
74
 
70
75
  def __init__(self, configuration, header_name=None, header_value=None, cookie=None) -> None:
71
76
  self.config: Configuration = configuration
@@ -262,13 +267,13 @@ class ApiClient:
262
267
  response_text = None
263
268
  return_data = None
264
269
  try:
265
- if response_type == "bytearray":
270
+ if response_type in ("bytearray", "bytes"):
266
271
  return_data = response_data.data
267
272
  elif response_type == "file":
268
273
  return_data = self.__deserialize_file(response_data)
269
274
  elif response_type is not None:
270
275
  match = None
271
- content_type = response_data.getheader("content-type")
276
+ content_type = response_data.headers.get("content-type")
272
277
  if content_type is not None:
273
278
  match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
274
279
  encoding = match.group(1) if match else "utf-8"
@@ -285,7 +290,7 @@ class ApiClient:
285
290
  return ApiResponse(
286
291
  status_code=response_data.status,
287
292
  data=return_data,
288
- headers=response_data.getheaders(),
293
+ headers=response_data.headers,
289
294
  raw_data=response_data.data,
290
295
  )
291
296
 
@@ -297,6 +302,7 @@ class ApiClient:
297
302
  If obj is str, int, long, float, bool, return directly.
298
303
  If obj is datetime.datetime, datetime.date
299
304
  convert to string in iso8601 format.
305
+ If obj is decimal.Decimal return string representation.
300
306
  If obj is list, sanitize each element in the list.
301
307
  If obj is dict, return the dict.
302
308
  If obj is OpenAPI model, return the properties dict.
@@ -312,31 +318,30 @@ class ApiClient:
312
318
  return obj.get_secret_value()
313
319
  elif isinstance(obj, self.PRIMITIVE_TYPES):
314
320
  return obj
321
+ elif isinstance(obj, uuid.UUID):
322
+ return str(obj)
315
323
  elif isinstance(obj, list):
316
324
  return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
317
325
  elif isinstance(obj, tuple):
318
326
  return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
319
327
  elif isinstance(obj, (datetime.datetime, datetime.date)):
320
328
  return obj.isoformat()
321
-
329
+ elif isinstance(obj, decimal.Decimal):
330
+ return str(obj)
322
331
  elif isinstance(obj, dict):
323
- obj_dict = obj
332
+ return {key: self.sanitize_for_serialization(val) for key, val in obj.items()}
333
+
334
+ # Convert model obj to dict except
335
+ # attributes `openapi_types`, `attribute_map`
336
+ # and attributes which value is not None.
337
+ # Convert attribute name to json key in
338
+ # model definition for request.
339
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
340
+ obj_dict = obj.to_dict()
324
341
  else:
325
- # Convert model obj to dict except
326
- # attributes `openapi_types`, `attribute_map`
327
- # and attributes which value is not None.
328
- # Convert attribute name to json key in
329
- # model definition for request.
330
- if hasattr(obj, "to_dict") and callable(obj.to_dict):
331
- obj_dict = obj.to_dict()
332
- else:
333
- obj_dict = obj.__dict__
334
-
335
- if isinstance(obj_dict, list):
336
- # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
337
- return self.sanitize_for_serialization(obj_dict)
342
+ obj_dict = obj.__dict__
338
343
 
339
- return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
344
+ return self.sanitize_for_serialization(obj_dict)
340
345
 
341
346
  def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
342
347
  """Deserializes response into an object.
@@ -355,7 +360,7 @@ class ApiClient:
355
360
  data = json.loads(response_text)
356
361
  except ValueError:
357
362
  data = response_text
358
- elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
363
+ elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
359
364
  if response_text == "":
360
365
  data = ""
361
366
  else:
@@ -401,12 +406,16 @@ class ApiClient:
401
406
 
402
407
  if klass in self.PRIMITIVE_TYPES:
403
408
  return self.__deserialize_primitive(data, klass)
404
- elif klass == object:
409
+ elif klass is object:
405
410
  return self.__deserialize_object(data)
406
- elif klass == datetime.date:
411
+ elif klass is datetime.date:
407
412
  return self.__deserialize_date(data)
408
- elif klass == datetime.datetime:
413
+ elif klass is datetime.datetime:
409
414
  return self.__deserialize_datetime(data)
415
+ elif klass is decimal.Decimal:
416
+ return decimal.Decimal(data)
417
+ elif klass is uuid.UUID:
418
+ return uuid.UUID(data)
410
419
  elif issubclass(klass, Enum):
411
420
  return self.__deserialize_enum(data, klass)
412
421
  else:
@@ -554,12 +563,14 @@ class ApiClient:
554
563
  os.close(fd)
555
564
  os.remove(path)
556
565
 
557
- content_disposition = response.getheader("Content-Disposition")
566
+ content_disposition = response.headers.get("Content-Disposition")
558
567
  if content_disposition:
559
568
  m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
560
569
  if m is None:
561
570
  raise ValueError("Unexpected 'content-disposition' header value")
562
- filename = m.group(1)
571
+ filename = os.path.basename(m.group(1)) # Strip any directory traversal
572
+ if filename in ("", ".", ".."): # fall back to tmp filename
573
+ filename = os.path.basename(path)
563
574
  path = os.path.join(os.path.dirname(path), filename)
564
575
 
565
576
  with open(path, "wb") as f:
@@ -130,7 +130,7 @@ class ApiException(OpenApiException):
130
130
  self.body = http_resp.data.decode("utf-8")
131
131
  except Exception: # noqa: S110
132
132
  pass
133
- self.headers = http_resp.getheaders()
133
+ self.headers = http_resp.headers
134
134
 
135
135
  @classmethod
136
136
  def from_response(
@@ -13,7 +13,6 @@
13
13
  Do not edit the class manually.
14
14
  """ # noqa: E501
15
15
 
16
-
17
16
  # import models into model package
18
17
  from stackit.serverupdate.models.create_update_payload import CreateUpdatePayload
19
18
  from stackit.serverupdate.models.create_update_schedule_payload import (
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictBool
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -28,11 +29,15 @@ class CreateUpdatePayload(BaseModel):
28
29
  """ # noqa: E501
29
30
 
30
31
  backup_before_update: Optional[StrictBool] = Field(default=None, alias="backupBeforeUpdate")
31
- maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
32
+ maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(
33
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
34
+ alias="maintenanceWindow",
35
+ )
32
36
  __properties: ClassVar[List[str]] = ["backupBeforeUpdate", "maintenanceWindow"]
33
37
 
34
38
  model_config = ConfigDict(
35
- populate_by_name=True,
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
36
41
  validate_assignment=True,
37
42
  protected_namespaces=(),
38
43
  )
@@ -43,8 +48,7 @@ class CreateUpdatePayload(BaseModel):
43
48
 
44
49
  def to_json(self) -> str:
45
50
  """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())
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
52
 
49
53
  @classmethod
50
54
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,7 +18,14 @@ import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ )
28
+ from pydantic_core import to_jsonable_python
22
29
  from typing_extensions import Annotated, Self
23
30
 
24
31
 
@@ -28,13 +35,19 @@ class CreateUpdateSchedulePayload(BaseModel):
28
35
  """ # noqa: E501
29
36
 
30
37
  enabled: StrictBool
31
- maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
38
+ maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(
39
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
40
+ alias="maintenanceWindow",
41
+ )
32
42
  name: StrictStr
33
- rrule: StrictStr
43
+ rrule: StrictStr = Field(
44
+ description="An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates"
45
+ )
34
46
  __properties: ClassVar[List[str]] = ["enabled", "maintenanceWindow", "name", "rrule"]
35
47
 
36
48
  model_config = ConfigDict(
37
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
38
51
  validate_assignment=True,
39
52
  protected_namespaces=(),
40
53
  )
@@ -45,8 +58,7 @@ class CreateUpdateSchedulePayload(BaseModel):
45
58
 
46
59
  def to_json(self) -> str:
47
60
  """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())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
62
 
51
63
  @classmethod
52
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -17,8 +17,10 @@ from __future__ import annotations
17
17
  import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
+ from uuid import UUID
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field
23
+ from pydantic_core import to_jsonable_python
22
24
  from typing_extensions import Self
23
25
 
24
26
 
@@ -27,11 +29,12 @@ class EnableServiceResourcePayload(BaseModel):
27
29
  EnableServiceResourcePayload
28
30
  """ # noqa: E501
29
31
 
30
- update_policy_id: Optional[StrictStr] = Field(default=None, alias="updatePolicyId")
32
+ update_policy_id: Optional[UUID] = Field(default=None, alias="updatePolicyId")
31
33
  __properties: ClassVar[List[str]] = ["updatePolicyId"]
32
34
 
33
35
  model_config = ConfigDict(
34
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
35
38
  validate_assignment=True,
36
39
  protected_namespaces=(),
37
40
  )
@@ -42,8 +45,7 @@ class EnableServiceResourcePayload(BaseModel):
42
45
 
43
46
  def to_json(self) -> str:
44
47
  """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())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
47
49
 
48
50
  @classmethod
49
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -34,7 +35,8 @@ class ErrorResponse(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["message", "status"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class ErrorResponse(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.serverupdate.models.update_policy import UpdatePolicy
@@ -33,7 +34,8 @@ class GetUpdatePoliciesResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["items"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -44,8 +46,7 @@ class GetUpdatePoliciesResponse(BaseModel):
44
46
 
45
47
  def to_json(self) -> str:
46
48
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
50
 
50
51
  @classmethod
51
52
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -72,9 +73,9 @@ class GetUpdatePoliciesResponse(BaseModel):
72
73
  # override the default output from pydantic by calling `to_dict()` of each item in items (list)
73
74
  _items = []
74
75
  if self.items:
75
- for _item in self.items:
76
- if _item:
77
- _items.append(_item.to_dict())
76
+ for _item_items in self.items:
77
+ if _item_items:
78
+ _items.append(_item_items.to_dict())
78
79
  _dict["items"] = _items
79
80
  return _dict
80
81
 
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.serverupdate.models.update_schedule import UpdateSchedule
@@ -33,7 +34,8 @@ class GetUpdateSchedulesResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["items"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -44,8 +46,7 @@ class GetUpdateSchedulesResponse(BaseModel):
44
46
 
45
47
  def to_json(self) -> str:
46
48
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
50
 
50
51
  @classmethod
51
52
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -72,9 +73,9 @@ class GetUpdateSchedulesResponse(BaseModel):
72
73
  # override the default output from pydantic by calling `to_dict()` of each item in items (list)
73
74
  _items = []
74
75
  if self.items:
75
- for _item in self.items:
76
- if _item:
77
- _items.append(_item.to_dict())
76
+ for _item_items in self.items:
77
+ if _item_items:
78
+ _items.append(_item_items.to_dict())
78
79
  _dict["items"] = _items
79
80
  return _dict
80
81
 
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, StrictBool
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -31,7 +32,8 @@ class GetUpdateServiceResponse(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["enabled"]
32
33
 
33
34
  model_config = ConfigDict(
34
- populate_by_name=True,
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
35
37
  validate_assignment=True,
36
38
  protected_namespaces=(),
37
39
  )
@@ -42,8 +44,7 @@ class GetUpdateServiceResponse(BaseModel):
42
44
 
43
45
  def to_json(self) -> str:
44
46
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
47
48
 
48
49
  @classmethod
49
50
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.serverupdate.models.update import Update
@@ -33,7 +34,8 @@ class GetUpdatesListResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["items"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -44,8 +46,7 @@ class GetUpdatesListResponse(BaseModel):
44
46
 
45
47
  def to_json(self) -> str:
46
48
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
50
 
50
51
  @classmethod
51
52
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -72,9 +73,9 @@ class GetUpdatesListResponse(BaseModel):
72
73
  # override the default output from pydantic by calling `to_dict()` of each item in items (list)
73
74
  _items = []
74
75
  if self.items:
75
- for _item in self.items:
76
- if _item:
77
- _items.append(_item.to_dict())
76
+ for _item_items in self.items:
77
+ if _item_items:
78
+ _items.append(_item_items.to_dict())
78
79
  _dict["items"] = _items
79
80
  return _dict
80
81
 
@@ -19,6 +19,7 @@ import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -45,7 +46,8 @@ class Update(BaseModel):
45
46
  ]
46
47
 
47
48
  model_config = ConfigDict(
48
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
49
51
  validate_assignment=True,
50
52
  protected_namespaces=(),
51
53
  )
@@ -56,8 +58,7 @@ class Update(BaseModel):
56
58
 
57
59
  def to_json(self) -> str:
58
60
  """Returns the JSON representation of the model using alias"""
59
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
- return json.dumps(self.to_dict())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
61
62
 
62
63
  @classmethod
63
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,7 +18,15 @@ import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictInt,
27
+ StrictStr,
28
+ )
29
+ from pydantic_core import to_jsonable_python
22
30
  from typing_extensions import Self
23
31
 
24
32
 
@@ -31,9 +39,16 @@ class UpdatePolicy(BaseModel):
31
39
  description: Optional[StrictStr] = None
32
40
  enabled: Optional[StrictBool] = None
33
41
  id: Optional[StrictStr] = None
34
- maintenance_window: Optional[StrictInt] = Field(default=None, alias="maintenanceWindow")
42
+ maintenance_window: Optional[StrictInt] = Field(
43
+ default=None,
44
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
45
+ alias="maintenanceWindow",
46
+ )
35
47
  name: Optional[StrictStr] = None
36
- rrule: Optional[StrictStr] = None
48
+ rrule: Optional[StrictStr] = Field(
49
+ default=None,
50
+ description="An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates",
51
+ )
37
52
  __properties: ClassVar[List[str]] = [
38
53
  "default",
39
54
  "description",
@@ -45,7 +60,8 @@ class UpdatePolicy(BaseModel):
45
60
  ]
46
61
 
47
62
  model_config = ConfigDict(
48
- populate_by_name=True,
63
+ validate_by_name=True,
64
+ validate_by_alias=True,
49
65
  validate_assignment=True,
50
66
  protected_namespaces=(),
51
67
  )
@@ -56,8 +72,7 @@ class UpdatePolicy(BaseModel):
56
72
 
57
73
  def to_json(self) -> str:
58
74
  """Returns the JSON representation of the model using alias"""
59
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
- return json.dumps(self.to_dict())
75
+ return json.dumps(to_jsonable_python(self.to_dict()))
61
76
 
62
77
  @classmethod
63
78
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,7 +18,15 @@ import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictInt,
27
+ StrictStr,
28
+ )
29
+ from pydantic_core import to_jsonable_python
22
30
  from typing_extensions import Annotated, Self
23
31
 
24
32
 
@@ -28,14 +36,20 @@ class UpdateSchedule(BaseModel):
28
36
  """ # noqa: E501
29
37
 
30
38
  enabled: StrictBool
31
- maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
39
+ maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(
40
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
41
+ alias="maintenanceWindow",
42
+ )
32
43
  name: StrictStr
33
- rrule: StrictStr
44
+ rrule: StrictStr = Field(
45
+ description="An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates"
46
+ )
34
47
  id: StrictInt
35
48
  __properties: ClassVar[List[str]] = ["enabled", "maintenanceWindow", "name", "rrule", "id"]
36
49
 
37
50
  model_config = ConfigDict(
38
- populate_by_name=True,
51
+ validate_by_name=True,
52
+ validate_by_alias=True,
39
53
  validate_assignment=True,
40
54
  protected_namespaces=(),
41
55
  )
@@ -46,8 +60,7 @@ class UpdateSchedule(BaseModel):
46
60
 
47
61
  def to_json(self) -> str:
48
62
  """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())
63
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
64
 
52
65
  @classmethod
53
66
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,7 +18,14 @@ import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ )
28
+ from pydantic_core import to_jsonable_python
22
29
  from typing_extensions import Annotated, Self
23
30
 
24
31
 
@@ -28,13 +35,19 @@ class UpdateScheduleCreateRequest(BaseModel):
28
35
  """ # noqa: E501
29
36
 
30
37
  enabled: StrictBool
31
- maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
38
+ maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(
39
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
40
+ alias="maintenanceWindow",
41
+ )
32
42
  name: StrictStr
33
- rrule: StrictStr
43
+ rrule: StrictStr = Field(
44
+ description="An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates"
45
+ )
34
46
  __properties: ClassVar[List[str]] = ["enabled", "maintenanceWindow", "name", "rrule"]
35
47
 
36
48
  model_config = ConfigDict(
37
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
38
51
  validate_assignment=True,
39
52
  protected_namespaces=(),
40
53
  )
@@ -45,8 +58,7 @@ class UpdateScheduleCreateRequest(BaseModel):
45
58
 
46
59
  def to_json(self) -> str:
47
60
  """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())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
62
 
51
63
  @classmethod
52
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,7 +18,14 @@ import json
18
18
  import pprint
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ )
28
+ from pydantic_core import to_jsonable_python
22
29
  from typing_extensions import Annotated, Self
23
30
 
24
31
 
@@ -28,13 +35,19 @@ class UpdateUpdateSchedulePayload(BaseModel):
28
35
  """ # noqa: E501
29
36
 
30
37
  enabled: StrictBool
31
- maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
38
+ maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(
39
+ description="Updates start within the defined hourly window. Depending on the updates, the process may exceed this timeframe and require an automatic restart.",
40
+ alias="maintenanceWindow",
41
+ )
32
42
  name: StrictStr
33
- rrule: StrictStr
43
+ rrule: StrictStr = Field(
44
+ description="An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates"
45
+ )
34
46
  __properties: ClassVar[List[str]] = ["enabled", "maintenanceWindow", "name", "rrule"]
35
47
 
36
48
  model_config = ConfigDict(
37
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
38
51
  validate_assignment=True,
39
52
  protected_namespaces=(),
40
53
  )
@@ -45,8 +58,7 @@ class UpdateUpdateSchedulePayload(BaseModel):
45
58
 
46
59
  def to_json(self) -> str:
47
60
  """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())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
62
 
51
63
  @classmethod
52
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -39,12 +39,17 @@ class RESTResponse(io.IOBase):
39
39
  self.data = self.response.content
40
40
  return self.data
41
41
 
42
+ @property
43
+ def headers(self):
44
+ """Returns a dictionary of response headers."""
45
+ return self.response.headers
46
+
42
47
  def getheaders(self):
43
- """Returns a dictionary of the response headers."""
48
+ """Returns a dictionary of the response headers; use ``headers`` instead."""
44
49
  return self.response.headers
45
50
 
46
51
  def getheader(self, name, default=None):
47
- """Returns a given response header."""
52
+ """Returns a given response header; use ``headers.get()`` instead."""
48
53
  return self.response.headers.get(name, default)
49
54
 
50
55
 
@@ -94,6 +99,7 @@ class RESTClientObject:
94
99
  url,
95
100
  data=request_body,
96
101
  headers=headers,
102
+ timeout=_request_timeout,
97
103
  )
98
104
  elif content_type == "application/x-www-form-urlencoded":
99
105
  r = self.session.request(
@@ -101,6 +107,7 @@ class RESTClientObject:
101
107
  url,
102
108
  params=post_params,
103
109
  headers=headers,
110
+ timeout=_request_timeout,
104
111
  )
105
112
  elif content_type == "multipart/form-data":
106
113
  # must del headers['Content-Type'], or the correct
@@ -114,6 +121,7 @@ class RESTClientObject:
114
121
  url,
115
122
  files=post_params,
116
123
  headers=headers,
124
+ timeout=_request_timeout,
117
125
  )
118
126
  # Pass a `string` parameter directly in the body to support
119
127
  # other content types than JSON when `body` argument is
@@ -124,10 +132,17 @@ class RESTClientObject:
124
132
  url,
125
133
  data=body,
126
134
  headers=headers,
135
+ timeout=_request_timeout,
127
136
  )
128
137
  elif headers["Content-Type"].startswith("text/") and isinstance(body, bool):
129
138
  request_body = "true" if body else "false"
130
- r = self.session.request(method, url, data=request_body, headers=headers)
139
+ r = self.session.request(
140
+ method,
141
+ url,
142
+ data=request_body,
143
+ headers=headers,
144
+ timeout=_request_timeout,
145
+ )
131
146
  else:
132
147
  # Cannot generate the request from given parameters
133
148
  msg = """Cannot prepare a request message for provided
@@ -141,6 +156,7 @@ class RESTClientObject:
141
156
  url,
142
157
  params={},
143
158
  headers=headers,
159
+ timeout=_request_timeout,
144
160
  )
145
161
  except requests.exceptions.SSLError as e:
146
162
  msg = "\n".join([type(e).__name__, str(e)])