stackit-sqlserverflex 1.1.1__py3-none-any.whl → 1.2.0__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/sqlserverflex/api_client.py +36 -25
  2. stackit/sqlserverflex/exceptions.py +1 -1
  3. stackit/sqlserverflex/models/__init__.py +0 -1
  4. stackit/sqlserverflex/models/acl.py +4 -3
  5. stackit/sqlserverflex/models/backup.py +4 -3
  6. stackit/sqlserverflex/models/backup_list_backups_response_grouped.py +7 -6
  7. stackit/sqlserverflex/models/create_database_payload.py +4 -3
  8. stackit/sqlserverflex/models/create_database_response.py +4 -3
  9. stackit/sqlserverflex/models/create_instance_payload.py +4 -3
  10. stackit/sqlserverflex/models/create_instance_response.py +4 -3
  11. stackit/sqlserverflex/models/create_user_payload.py +4 -3
  12. stackit/sqlserverflex/models/create_user_response.py +4 -3
  13. stackit/sqlserverflex/models/data_point.py +4 -3
  14. stackit/sqlserverflex/models/database.py +4 -3
  15. stackit/sqlserverflex/models/database_documentation_create_database_request_options.py +4 -3
  16. stackit/sqlserverflex/models/database_options.py +4 -3
  17. stackit/sqlserverflex/models/flavor.py +4 -3
  18. stackit/sqlserverflex/models/get_backup_response.py +4 -3
  19. stackit/sqlserverflex/models/get_database_response.py +4 -3
  20. stackit/sqlserverflex/models/get_instance_response.py +4 -3
  21. stackit/sqlserverflex/models/get_user_response.py +4 -3
  22. stackit/sqlserverflex/models/host.py +7 -6
  23. stackit/sqlserverflex/models/host_metric.py +7 -6
  24. stackit/sqlserverflex/models/instance.py +4 -3
  25. stackit/sqlserverflex/models/instance_documentation_acl.py +4 -3
  26. stackit/sqlserverflex/models/instance_documentation_options.py +4 -3
  27. stackit/sqlserverflex/models/instance_documentation_storage.py +4 -3
  28. stackit/sqlserverflex/models/instance_error.py +4 -3
  29. stackit/sqlserverflex/models/instance_flavor_entry.py +4 -3
  30. stackit/sqlserverflex/models/instance_list_instance.py +4 -3
  31. stackit/sqlserverflex/models/instance_list_user.py +4 -3
  32. stackit/sqlserverflex/models/list_backups_response.py +7 -6
  33. stackit/sqlserverflex/models/list_collations_response.py +7 -6
  34. stackit/sqlserverflex/models/list_compatibility_response.py +7 -6
  35. stackit/sqlserverflex/models/list_databases_response.py +7 -6
  36. stackit/sqlserverflex/models/list_flavors_response.py +7 -6
  37. stackit/sqlserverflex/models/list_instances_response.py +7 -6
  38. stackit/sqlserverflex/models/list_metrics_response.py +7 -6
  39. stackit/sqlserverflex/models/list_restore_jobs_response.py +7 -6
  40. stackit/sqlserverflex/models/list_roles_response.py +4 -3
  41. stackit/sqlserverflex/models/list_storages_response.py +4 -3
  42. stackit/sqlserverflex/models/list_users_response.py +7 -6
  43. stackit/sqlserverflex/models/list_versions_response.py +4 -3
  44. stackit/sqlserverflex/models/mssql_database_collation.py +4 -3
  45. stackit/sqlserverflex/models/mssql_database_compatibility.py +4 -3
  46. stackit/sqlserverflex/models/partial_update_instance_payload.py +4 -3
  47. stackit/sqlserverflex/models/reset_user_response.py +4 -3
  48. stackit/sqlserverflex/models/restore_running_restore.py +4 -3
  49. stackit/sqlserverflex/models/single_database.py +4 -3
  50. stackit/sqlserverflex/models/single_user.py +4 -3
  51. stackit/sqlserverflex/models/storage.py +4 -3
  52. stackit/sqlserverflex/models/storage_range.py +4 -3
  53. stackit/sqlserverflex/models/trigger_database_restore_payload.py +4 -3
  54. stackit/sqlserverflex/models/update_instance_payload.py +4 -3
  55. stackit/sqlserverflex/models/update_instance_response.py +4 -3
  56. stackit/sqlserverflex/models/user.py +4 -3
  57. stackit/sqlserverflex/models/user_response_user.py +4 -3
  58. stackit/sqlserverflex/rest.py +19 -3
  59. {stackit_sqlserverflex-1.1.1.dist-info → stackit_sqlserverflex-1.2.0.dist-info}/METADATA +10 -11
  60. stackit_sqlserverflex-1.2.0.dist-info/RECORD +70 -0
  61. {stackit_sqlserverflex-1.1.1.dist-info → stackit_sqlserverflex-1.2.0.dist-info}/WHEEL +1 -1
  62. stackit_sqlserverflex-1.1.1.dist-info/RECORD +0 -70
  63. {stackit_sqlserverflex-1.1.1.dist-info → stackit_sqlserverflex-1.2.0.dist-info}/licenses/LICENSE.md +0 -0
  64. {stackit_sqlserverflex-1.1.1.dist-info → stackit_sqlserverflex-1.2.0.dist-info}/licenses/NOTICE.txt +0 -0
@@ -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.sqlserverflex.models.acl import ACL
19
18
  from stackit.sqlserverflex.models.backup import Backup
@@ -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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -31,7 +32,8 @@ class ACL(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["items"]
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 ACL(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, Field, StrictInt, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -38,7 +39,8 @@ class Backup(BaseModel):
38
39
  __properties: ClassVar[List[str]] = ["endTime", "error", "id", "labels", "name", "options", "size", "startTime"]
39
40
 
40
41
  model_config = ConfigDict(
41
- populate_by_name=True,
42
+ validate_by_name=True,
43
+ validate_by_alias=True,
42
44
  validate_assignment=True,
43
45
  protected_namespaces=(),
44
46
  )
@@ -49,8 +51,7 @@ class Backup(BaseModel):
49
51
 
50
52
  def to_json(self) -> str:
51
53
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
55
 
55
56
  @classmethod
56
57
  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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.sqlserverflex.models.backup import Backup
@@ -34,7 +35,8 @@ class BackupListBackupsResponseGrouped(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["backups", "name"]
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 BackupListBackupsResponseGrouped(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]:
@@ -73,9 +74,9 @@ class BackupListBackupsResponseGrouped(BaseModel):
73
74
  # override the default output from pydantic by calling `to_dict()` of each item in backups (list)
74
75
  _items = []
75
76
  if self.backups:
76
- for _item in self.backups:
77
- if _item:
78
- _items.append(_item.to_dict())
77
+ for _item_backups in self.backups:
78
+ if _item_backups:
79
+ _items.append(_item_backups.to_dict())
79
80
  _dict["backups"] = _items
80
81
  return _dict
81
82
 
@@ -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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.sqlserverflex.models.database_documentation_create_database_request_options import (
@@ -36,7 +37,8 @@ class CreateDatabasePayload(BaseModel):
36
37
  __properties: ClassVar[List[str]] = ["name", "options"]
37
38
 
38
39
  model_config = ConfigDict(
39
- populate_by_name=True,
40
+ validate_by_name=True,
41
+ validate_by_alias=True,
40
42
  validate_assignment=True,
41
43
  protected_namespaces=(),
42
44
  )
@@ -47,8 +49,7 @@ class CreateDatabasePayload(BaseModel):
47
49
 
48
50
  def to_json(self) -> str:
49
51
  """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
53
 
53
54
  @classmethod
54
55
  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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -31,7 +32,8 @@ class CreateDatabaseResponse(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["id"]
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 CreateDatabaseResponse(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, Field, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.sqlserverflex.models.instance_documentation_acl import (
@@ -66,7 +67,8 @@ class CreateInstancePayload(BaseModel):
66
67
  ]
67
68
 
68
69
  model_config = ConfigDict(
69
- populate_by_name=True,
70
+ validate_by_name=True,
71
+ validate_by_alias=True,
70
72
  validate_assignment=True,
71
73
  protected_namespaces=(),
72
74
  )
@@ -77,8 +79,7 @@ class CreateInstancePayload(BaseModel):
77
79
 
78
80
  def to_json(self) -> str:
79
81
  """Returns the JSON representation of the model using alias"""
80
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
81
- return json.dumps(self.to_dict())
82
+ return json.dumps(to_jsonable_python(self.to_dict()))
82
83
 
83
84
  @classmethod
84
85
  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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -31,7 +32,8 @@ class CreateInstanceResponse(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["id"]
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 CreateInstanceResponse(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, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -33,7 +34,8 @@ class CreateUserPayload(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["default_database", "roles", "username"]
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 CreateUserPayload(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]:
@@ -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.sqlserverflex.models.single_user import SingleUser
@@ -33,7 +34,8 @@ class CreateUserResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["item"]
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 CreateUserResponse(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]:
@@ -25,6 +25,7 @@ from pydantic import (
25
25
  StrictInt,
26
26
  StrictStr,
27
27
  )
28
+ from pydantic_core import to_jsonable_python
28
29
  from typing_extensions import Self
29
30
 
30
31
 
@@ -38,7 +39,8 @@ class DataPoint(BaseModel):
38
39
  __properties: ClassVar[List[str]] = ["timestamp", "value"]
39
40
 
40
41
  model_config = ConfigDict(
41
- populate_by_name=True,
42
+ validate_by_name=True,
43
+ validate_by_alias=True,
42
44
  validate_assignment=True,
43
45
  protected_namespaces=(),
44
46
  )
@@ -49,8 +51,7 @@ class DataPoint(BaseModel):
49
51
 
50
52
  def to_json(self) -> str:
51
53
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
55
 
55
56
  @classmethod
56
57
  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
 
@@ -33,7 +34,8 @@ class Database(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["id", "name", "options"]
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 Database(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]:
@@ -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
 
@@ -35,7 +36,8 @@ class DatabaseDocumentationCreateDatabaseRequestOptions(BaseModel):
35
36
  __properties: ClassVar[List[str]] = ["collation", "compatibilityLevel", "owner"]
36
37
 
37
38
  model_config = ConfigDict(
38
- populate_by_name=True,
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
39
41
  validate_assignment=True,
40
42
  protected_namespaces=(),
41
43
  )
@@ -46,8 +48,7 @@ class DatabaseDocumentationCreateDatabaseRequestOptions(BaseModel):
46
48
 
47
49
  def to_json(self) -> str:
48
50
  """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
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
52
 
52
53
  @classmethod
53
54
  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, StrictInt, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -37,7 +38,8 @@ class DatabaseOptions(BaseModel):
37
38
  __properties: ClassVar[List[str]] = ["collationName", "compatibilityLevel", "owner"]
38
39
 
39
40
  model_config = ConfigDict(
40
- populate_by_name=True,
41
+ validate_by_name=True,
42
+ validate_by_alias=True,
41
43
  validate_assignment=True,
42
44
  protected_namespaces=(),
43
45
  )
@@ -48,8 +50,7 @@ class DatabaseOptions(BaseModel):
48
50
 
49
51
  def to_json(self) -> str:
50
52
  """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
+ return json.dumps(to_jsonable_python(self.to_dict()))
53
54
 
54
55
  @classmethod
55
56
  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, StrictInt, 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 Flavor(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["cpu", "description", "id", "memory"]
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 Flavor(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, Field, StrictInt, StrictStr
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -42,7 +43,8 @@ class GetBackupResponse(BaseModel):
42
43
  __properties: ClassVar[List[str]] = ["endTime", "error", "id", "labels", "name", "options", "size", "startTime"]
43
44
 
44
45
  model_config = ConfigDict(
45
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
46
48
  validate_assignment=True,
47
49
  protected_namespaces=(),
48
50
  )
@@ -53,8 +55,7 @@ class GetBackupResponse(BaseModel):
53
55
 
54
56
  def to_json(self) -> str:
55
57
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
59
 
59
60
  @classmethod
60
61
  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.sqlserverflex.models.single_database import SingleDatabase
@@ -33,7 +34,8 @@ class GetDatabaseResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["database"]
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 GetDatabaseResponse(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]:
@@ -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.sqlserverflex.models.instance import Instance
@@ -33,7 +34,8 @@ class GetInstanceResponse(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["item"]
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 GetInstanceResponse(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]: