stackit-sqlserverflex 1.3.0__py3-none-any.whl → 1.4.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 (87) hide show
  1. stackit/sqlserverflex/__init__.py +128 -88
  2. stackit/sqlserverflex/api/default_api.py +1977 -1535
  3. stackit/sqlserverflex/api_client.py +1 -1
  4. stackit/sqlserverflex/configuration.py +1 -1
  5. stackit/sqlserverflex/exceptions.py +1 -1
  6. stackit/sqlserverflex/models/__init__.py +69 -47
  7. stackit/sqlserverflex/models/{restore_running_restore.py → backup_running_restore.py} +11 -11
  8. stackit/sqlserverflex/models/backup_sort.py +47 -0
  9. stackit/sqlserverflex/models/create_database_payload.py +13 -17
  10. stackit/sqlserverflex/models/create_database_response.py +3 -3
  11. stackit/sqlserverflex/models/create_instance_payload.py +39 -39
  12. stackit/sqlserverflex/models/{instance_documentation_options.py → create_instance_payload_network.py} +17 -13
  13. stackit/sqlserverflex/models/create_instance_response.py +3 -3
  14. stackit/sqlserverflex/models/create_user_payload.py +9 -5
  15. stackit/sqlserverflex/models/create_user_response.py +35 -10
  16. stackit/sqlserverflex/models/{mssql_database_collation.py → database_getcollation.py} +5 -5
  17. stackit/sqlserverflex/models/{mssql_database_compatibility.py → database_getcompatibility.py} +5 -5
  18. stackit/sqlserverflex/models/database_roles.py +84 -0
  19. stackit/sqlserverflex/models/database_sort.py +45 -0
  20. stackit/sqlserverflex/models/{instance_error.py → error.py} +12 -14
  21. stackit/sqlserverflex/models/{list_users_response.py → external_s3.py} +27 -21
  22. stackit/sqlserverflex/models/flavor_sort.py +53 -0
  23. stackit/sqlserverflex/models/{instance_flavor_entry.py → flavor_storage_classes_storage_class.py} +13 -17
  24. stackit/sqlserverflex/models/{storage_range.py → flavor_storage_range.py} +8 -8
  25. stackit/sqlserverflex/models/get_backup_response.py +12 -18
  26. stackit/sqlserverflex/models/get_database_response.py +20 -10
  27. stackit/sqlserverflex/models/get_instance_response.py +85 -10
  28. stackit/sqlserverflex/models/get_user_response.py +19 -10
  29. stackit/sqlserverflex/models/instance_edition.py +38 -0
  30. stackit/sqlserverflex/models/{database_documentation_create_database_request_options.py → instance_encryption.py} +14 -14
  31. stackit/sqlserverflex/models/{single_database.py → instance_network.py} +21 -16
  32. stackit/sqlserverflex/models/instance_network_access_scope.py +37 -0
  33. stackit/sqlserverflex/models/instance_sort.py +45 -0
  34. stackit/sqlserverflex/models/{type.py → instance_version.py} +5 -10
  35. stackit/sqlserverflex/models/instance_version_opt.py +36 -0
  36. stackit/sqlserverflex/models/{backup.py → list_backup.py} +17 -19
  37. stackit/sqlserverflex/models/{backup_list_backups_response_grouped.py → list_backup_response.py} +18 -12
  38. stackit/sqlserverflex/models/list_backups_response.py +17 -17
  39. stackit/sqlserverflex/models/list_collations_response.py +5 -5
  40. stackit/sqlserverflex/models/list_compatibility_response.py +6 -6
  41. stackit/sqlserverflex/models/{list_restore_jobs_response.py → list_current_running_restore_jobs.py} +10 -8
  42. stackit/sqlserverflex/models/{flavor.py → list_database.py} +12 -17
  43. stackit/sqlserverflex/models/list_databases_response.py +13 -7
  44. stackit/sqlserverflex/models/{instance.py → list_flavors.py} +45 -45
  45. stackit/sqlserverflex/models/list_flavors_response.py +13 -7
  46. stackit/sqlserverflex/models/{user_response_user.py → list_instance.py} +22 -18
  47. stackit/sqlserverflex/models/list_instances_response.py +20 -16
  48. stackit/sqlserverflex/models/list_roles_response.py +3 -3
  49. stackit/sqlserverflex/models/list_storages_response.py +23 -7
  50. stackit/sqlserverflex/models/list_user.py +85 -0
  51. stackit/sqlserverflex/models/list_user_response.py +104 -0
  52. stackit/sqlserverflex/models/list_versions_response.py +19 -4
  53. stackit/sqlserverflex/models/{instance_documentation_storage.py → pagination.py} +15 -11
  54. stackit/sqlserverflex/models/partial_update_instance_payload.py +42 -20
  55. stackit/sqlserverflex/models/{database.py → partial_update_instance_payload_network.py} +8 -10
  56. stackit/sqlserverflex/models/replicas.py +37 -0
  57. stackit/sqlserverflex/models/reset_user_response.py +15 -10
  58. stackit/sqlserverflex/models/{host.py → restore_database_from_backup_payload.py} +18 -20
  59. stackit/sqlserverflex/models/restore_database_from_backup_payload_source.py +150 -0
  60. stackit/sqlserverflex/models/s3file_info.py +84 -0
  61. stackit/sqlserverflex/models/source_backup.py +90 -0
  62. stackit/sqlserverflex/models/source_external_s3.py +107 -0
  63. stackit/sqlserverflex/models/state.py +41 -0
  64. stackit/sqlserverflex/models/storage.py +6 -4
  65. stackit/sqlserverflex/models/storage_create.py +84 -0
  66. stackit/sqlserverflex/models/{acl.py → storage_update.py} +9 -9
  67. stackit/sqlserverflex/models/{trigger_database_restore_payload.py → trigger_restore_payload.py} +8 -7
  68. stackit/sqlserverflex/models/update_instance_payload.py +43 -19
  69. stackit/sqlserverflex/models/{instance_documentation_acl.py → update_instance_payload_network.py} +8 -8
  70. stackit/sqlserverflex/models/{instance_list_instance.py → update_instance_protection_payload.py} +9 -11
  71. stackit/sqlserverflex/models/update_instance_protection_response.py +83 -0
  72. stackit/sqlserverflex/models/user_sort.py +43 -0
  73. stackit/sqlserverflex/models/{host_metric.py → validation_error.py} +24 -22
  74. stackit/sqlserverflex/models/{instance_list_user.py → validation_error_validation_inner.py} +10 -10
  75. stackit/sqlserverflex/models/{database_options.py → version.py} +23 -15
  76. stackit/sqlserverflex/rest.py +1 -1
  77. {stackit_sqlserverflex-1.3.0.dist-info → stackit_sqlserverflex-1.4.0.dist-info}/METADATA +1 -1
  78. stackit_sqlserverflex-1.4.0.dist-info/RECORD +84 -0
  79. stackit/sqlserverflex/models/data_point.py +0 -90
  80. stackit/sqlserverflex/models/list_metrics_response.py +0 -94
  81. stackit/sqlserverflex/models/single_user.py +0 -110
  82. stackit/sqlserverflex/models/update_instance_response.py +0 -88
  83. stackit/sqlserverflex/models/user.py +0 -101
  84. stackit_sqlserverflex-1.3.0.dist-info/RECORD +0 -70
  85. {stackit_sqlserverflex-1.3.0.dist-info → stackit_sqlserverflex-1.4.0.dist-info}/WHEEL +0 -0
  86. {stackit_sqlserverflex-1.3.0.dist-info → stackit_sqlserverflex-1.4.0.dist-info}/licenses/LICENSE.md +0 -0
  87. {stackit_sqlserverflex-1.3.0.dist-info → stackit_sqlserverflex-1.4.0.dist-info}/licenses/NOTICE.txt +0 -0
@@ -5,7 +5,7 @@ STACKIT MSSQL Service API
5
5
 
6
6
  This is the documentation for the STACKIT MSSQL service
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 3.0.0
9
9
  Contact: support@stackit.cloud
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -18,13 +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, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
22
  from pydantic_core import to_jsonable_python
23
- from typing_extensions import Self
23
+ from typing_extensions import Annotated, Self
24
24
 
25
- from stackit.sqlserverflex.models.instance_documentation_acl import (
26
- InstanceDocumentationACL,
25
+ from stackit.sqlserverflex.models.instance_version_opt import InstanceVersionOpt
26
+ from stackit.sqlserverflex.models.partial_update_instance_payload_network import (
27
+ PartialUpdateInstancePayloadNetwork,
27
28
  )
29
+ from stackit.sqlserverflex.models.storage_update import StorageUpdate
28
30
 
29
31
 
30
32
  class PartialUpdateInstancePayload(BaseModel):
@@ -32,20 +34,31 @@ class PartialUpdateInstancePayload(BaseModel):
32
34
  PartialUpdateInstancePayload
33
35
  """ # noqa: E501
34
36
 
35
- acl: Optional[InstanceDocumentationACL] = Field(
36
- default=None,
37
- description="ACL is the Access Control List defining the IP ranges allowed to connect to the database",
38
- )
39
37
  backup_schedule: Optional[StrictStr] = Field(
40
38
  default=None,
41
- description="Cronjob for the daily full backup if not provided a job will generated between 00:00 and 04:59",
39
+ description="The schedule on which time the daily backup is being executed. The schedule is written as a cron schedule.",
42
40
  alias="backupSchedule",
43
41
  )
44
- flavor_id: Optional[StrictStr] = Field(default=None, description="Id of the selected flavor", alias="flavorId")
45
- labels: Optional[Dict[str, Any]] = Field(default=None, description="Labels for the instance")
46
- name: Optional[StrictStr] = Field(default=None, description="Name of the instance")
47
- version: Optional[StrictStr] = Field(default="2022", description="Version of the MSSQL Server")
48
- __properties: ClassVar[List[str]] = ["acl", "backupSchedule", "flavorId", "labels", "name", "version"]
42
+ flavor_id: Optional[StrictStr] = Field(default=None, description="The id of the instance flavor.", alias="flavorId")
43
+ labels: Optional[Dict[str, Optional[Annotated[str, Field(strict=True, max_length=63)]]]] = Field(
44
+ default=None,
45
+ description="A dictionary of user-defined key-value pairs used to categorize or organize the resource. **Rules for Keys:** * Must be between 1 and 63 characters long. * Must begin and end with an alphanumeric character (`[a-z0-9A-Z]`). * May contain dashes (`-`), underscores (`_`), and dots (`.`). * **Regex:** `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$` * **Restriction:** The prefix `stackit-` is strictly reserved and cannot be used. **Rules for Values:** * Must be between 0 (empty string) and 63 characters long. * If not empty, must begin and end with an alphanumeric character. * May contain dashes (`-`), underscores (`_`), and dots (`.`). * **Regex:** `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$` ",
46
+ )
47
+ name: Optional[StrictStr] = Field(default=None, description="The name of the instance.")
48
+ network: Optional[PartialUpdateInstancePayloadNetwork] = None
49
+ retention_days: Optional[StrictInt] = Field(default=None, alias="retentionDays")
50
+ storage: Optional[StorageUpdate] = None
51
+ version: Optional[InstanceVersionOpt] = None
52
+ __properties: ClassVar[List[str]] = [
53
+ "backupSchedule",
54
+ "flavorId",
55
+ "labels",
56
+ "name",
57
+ "network",
58
+ "retentionDays",
59
+ "storage",
60
+ "version",
61
+ ]
49
62
 
50
63
  model_config = ConfigDict(
51
64
  validate_by_name=True,
@@ -84,9 +97,12 @@ class PartialUpdateInstancePayload(BaseModel):
84
97
  exclude=excluded_fields,
85
98
  exclude_none=True,
86
99
  )
87
- # override the default output from pydantic by calling `to_dict()` of acl
88
- if self.acl:
89
- _dict["acl"] = self.acl.to_dict()
100
+ # override the default output from pydantic by calling `to_dict()` of network
101
+ if self.network:
102
+ _dict["network"] = self.network.to_dict()
103
+ # override the default output from pydantic by calling `to_dict()` of storage
104
+ if self.storage:
105
+ _dict["storage"] = self.storage.to_dict()
90
106
  return _dict
91
107
 
92
108
  @classmethod
@@ -100,12 +116,18 @@ class PartialUpdateInstancePayload(BaseModel):
100
116
 
101
117
  _obj = cls.model_validate(
102
118
  {
103
- "acl": InstanceDocumentationACL.from_dict(obj["acl"]) if obj.get("acl") is not None else None,
104
119
  "backupSchedule": obj.get("backupSchedule"),
105
120
  "flavorId": obj.get("flavorId"),
106
121
  "labels": obj.get("labels"),
107
122
  "name": obj.get("name"),
108
- "version": obj.get("version") if obj.get("version") is not None else "2022",
123
+ "network": (
124
+ PartialUpdateInstancePayloadNetwork.from_dict(obj["network"])
125
+ if obj.get("network") is not None
126
+ else None
127
+ ),
128
+ "retentionDays": obj.get("retentionDays"),
129
+ "storage": StorageUpdate.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
130
+ "version": obj.get("version"),
109
131
  }
110
132
  )
111
133
  return _obj
@@ -5,7 +5,7 @@ STACKIT MSSQL Service API
5
5
 
6
6
  This is the documentation for the STACKIT MSSQL service
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 3.0.0
9
9
  Contact: support@stackit.cloud
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -23,15 +23,13 @@ from pydantic_core import to_jsonable_python
23
23
  from typing_extensions import Self
24
24
 
25
25
 
26
- class Database(BaseModel):
26
+ class PartialUpdateInstancePayloadNetwork(BaseModel):
27
27
  """
28
- Database
28
+ the network configuration of the instance.
29
29
  """ # noqa: E501
30
30
 
31
- id: Optional[StrictStr] = None
32
- name: Optional[StrictStr] = None
33
- options: Optional[Dict[str, Any]] = Field(default=None, description="Database specific options")
34
- __properties: ClassVar[List[str]] = ["id", "name", "options"]
31
+ acl: Optional[List[StrictStr]] = Field(default=None, description="List of IPV4 cidr.")
32
+ __properties: ClassVar[List[str]] = ["acl"]
35
33
 
36
34
  model_config = ConfigDict(
37
35
  validate_by_name=True,
@@ -50,7 +48,7 @@ class Database(BaseModel):
50
48
 
51
49
  @classmethod
52
50
  def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of Database from a JSON string"""
51
+ """Create an instance of PartialUpdateInstancePayloadNetwork from a JSON string"""
54
52
  return cls.from_dict(json.loads(json_str))
55
53
 
56
54
  def to_dict(self) -> Dict[str, Any]:
@@ -74,12 +72,12 @@ class Database(BaseModel):
74
72
 
75
73
  @classmethod
76
74
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
- """Create an instance of Database from a dict"""
75
+ """Create an instance of PartialUpdateInstancePayloadNetwork from a dict"""
78
76
  if obj is None:
79
77
  return None
80
78
 
81
79
  if not isinstance(obj, dict):
82
80
  return cls.model_validate(obj)
83
81
 
84
- _obj = cls.model_validate({"id": obj.get("id"), "name": obj.get("name"), "options": obj.get("options")})
82
+ _obj = cls.model_validate({"acl": obj.get("acl")})
85
83
  return _obj
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 3.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
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ from enum import Enum
19
+
20
+ from typing_extensions import Self
21
+
22
+
23
+ class Replicas(int, Enum):
24
+ """
25
+ How many replicas the instance should have.
26
+ """
27
+
28
+ """
29
+ allowed enum values
30
+ """
31
+ NUMBER_1 = 1
32
+ NUMBER_3 = 3
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of Replicas from a JSON string"""
37
+ return cls(json.loads(json_str))
@@ -5,7 +5,7 @@ STACKIT MSSQL Service API
5
5
 
6
6
  This is the documentation for the STACKIT MSSQL service
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 3.0.0
9
9
  Contact: support@stackit.cloud
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -18,20 +18,21 @@ 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
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
22
  from pydantic_core import to_jsonable_python
23
23
  from typing_extensions import Self
24
24
 
25
- from stackit.sqlserverflex.models.single_user import SingleUser
26
-
27
25
 
28
26
  class ResetUserResponse(BaseModel):
29
27
  """
30
28
  ResetUserResponse
31
29
  """ # noqa: E501
32
30
 
33
- item: Optional[SingleUser] = None
34
- __properties: ClassVar[List[str]] = ["item"]
31
+ password: StrictStr = Field(description="The password for the user.")
32
+ status: StrictStr = Field(description="The current status of the user.")
33
+ uri: StrictStr = Field(description="The connection string for the user to the instance.")
34
+ username: StrictStr = Field(description="The name of the user.")
35
+ __properties: ClassVar[List[str]] = ["password", "status", "uri", "username"]
35
36
 
36
37
  model_config = ConfigDict(
37
38
  validate_by_name=True,
@@ -70,9 +71,6 @@ class ResetUserResponse(BaseModel):
70
71
  exclude=excluded_fields,
71
72
  exclude_none=True,
72
73
  )
73
- # override the default output from pydantic by calling `to_dict()` of item
74
- if self.item:
75
- _dict["item"] = self.item.to_dict()
76
74
  return _dict
77
75
 
78
76
  @classmethod
@@ -84,5 +82,12 @@ class ResetUserResponse(BaseModel):
84
82
  if not isinstance(obj, dict):
85
83
  return cls.model_validate(obj)
86
84
 
87
- _obj = cls.model_validate({"item": SingleUser.from_dict(obj["item"]) if obj.get("item") is not None else None})
85
+ _obj = cls.model_validate(
86
+ {
87
+ "password": obj.get("password"),
88
+ "status": obj.get("status"),
89
+ "uri": obj.get("uri"),
90
+ "username": obj.get("username"),
91
+ }
92
+ )
88
93
  return _obj
@@ -5,7 +5,7 @@ STACKIT MSSQL Service API
5
5
 
6
6
  This is the documentation for the STACKIT MSSQL service
7
7
 
8
- The version of the OpenAPI document: 2.0.0
8
+ The version of the OpenAPI document: 3.0.0
9
9
  Contact: support@stackit.cloud
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -22,17 +22,19 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
22
  from pydantic_core import to_jsonable_python
23
23
  from typing_extensions import Self
24
24
 
25
- from stackit.sqlserverflex.models.host_metric import HostMetric
25
+ from stackit.sqlserverflex.models.restore_database_from_backup_payload_source import (
26
+ RestoreDatabaseFromBackupPayloadSource,
27
+ )
26
28
 
27
29
 
28
- class Host(BaseModel):
30
+ class RestoreDatabaseFromBackupPayload(BaseModel):
29
31
  """
30
- Host
32
+ Request to restore a database.
31
33
  """ # noqa: E501
32
34
 
33
- host_metrics: Optional[List[HostMetric]] = Field(default=None, alias="hostMetrics")
34
- id: Optional[StrictStr] = None
35
- __properties: ClassVar[List[str]] = ["hostMetrics", "id"]
35
+ database_name: StrictStr = Field(description="The name of the database on the instance to be restore.")
36
+ source: RestoreDatabaseFromBackupPayloadSource
37
+ __properties: ClassVar[List[str]] = ["database_name", "source"]
36
38
 
37
39
  model_config = ConfigDict(
38
40
  validate_by_name=True,
@@ -51,7 +53,7 @@ class Host(BaseModel):
51
53
 
52
54
  @classmethod
53
55
  def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of Host from a JSON string"""
56
+ """Create an instance of RestoreDatabaseFromBackupPayload from a JSON string"""
55
57
  return cls.from_dict(json.loads(json_str))
56
58
 
57
59
  def to_dict(self) -> Dict[str, Any]:
@@ -71,18 +73,14 @@ class Host(BaseModel):
71
73
  exclude=excluded_fields,
72
74
  exclude_none=True,
73
75
  )
74
- # override the default output from pydantic by calling `to_dict()` of each item in host_metrics (list)
75
- _items = []
76
- if self.host_metrics:
77
- for _item_host_metrics in self.host_metrics:
78
- if _item_host_metrics:
79
- _items.append(_item_host_metrics.to_dict())
80
- _dict["hostMetrics"] = _items
76
+ # override the default output from pydantic by calling `to_dict()` of source
77
+ if self.source:
78
+ _dict["source"] = self.source.to_dict()
81
79
  return _dict
82
80
 
83
81
  @classmethod
84
82
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
- """Create an instance of Host from a dict"""
83
+ """Create an instance of RestoreDatabaseFromBackupPayload from a dict"""
86
84
  if obj is None:
87
85
  return None
88
86
 
@@ -91,12 +89,12 @@ class Host(BaseModel):
91
89
 
92
90
  _obj = cls.model_validate(
93
91
  {
94
- "hostMetrics": (
95
- [HostMetric.from_dict(_item) for _item in obj["hostMetrics"]]
96
- if obj.get("hostMetrics") is not None
92
+ "database_name": obj.get("database_name"),
93
+ "source": (
94
+ RestoreDatabaseFromBackupPayloadSource.from_dict(obj["source"])
95
+ if obj.get("source") is not None
97
96
  else None
98
97
  ),
99
- "id": obj.get("id"),
100
98
  }
101
99
  )
102
100
  return _obj
@@ -0,0 +1,150 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 3.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
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, Dict, Optional, Set, Union
20
+
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ ValidationError,
25
+ field_validator,
26
+ )
27
+ from typing_extensions import Self
28
+
29
+ from stackit.sqlserverflex.models.source_backup import SourceBackup
30
+ from stackit.sqlserverflex.models.source_external_s3 import SourceExternalS3
31
+
32
+ RESTOREDATABASEFROMBACKUPPAYLOADSOURCE_ONE_OF_SCHEMAS = ["SourceBackup", "SourceExternalS3"]
33
+
34
+
35
+ class RestoreDatabaseFromBackupPayloadSource(BaseModel):
36
+ """
37
+ The source of the restore.
38
+ """
39
+
40
+ # data type: SourceBackup
41
+ oneof_schema_1_validator: Optional[SourceBackup] = None
42
+ # data type: SourceExternalS3
43
+ oneof_schema_2_validator: Optional[SourceExternalS3] = None
44
+ actual_instance: Optional[Union[SourceBackup, SourceExternalS3]] = None
45
+ one_of_schemas: Set[str] = {"SourceBackup", "SourceExternalS3"}
46
+
47
+ model_config = ConfigDict(
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ discriminator_value_class_map: Dict[str, str] = {}
53
+
54
+ def __init__(self, *args, **kwargs) -> None:
55
+ if args:
56
+ if len(args) > 1:
57
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
58
+ if kwargs:
59
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
60
+ super().__init__(actual_instance=args[0])
61
+ else:
62
+ super().__init__(**kwargs)
63
+
64
+ @field_validator("actual_instance")
65
+ def actual_instance_must_validate_oneof(cls, v):
66
+ instance = RestoreDatabaseFromBackupPayloadSource.model_construct()
67
+ error_messages = []
68
+ match = 0
69
+ # validate data type: SourceBackup
70
+ if not isinstance(v, SourceBackup):
71
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SourceBackup`")
72
+ else:
73
+ match += 1
74
+ # validate data type: SourceExternalS3
75
+ if not isinstance(v, SourceExternalS3):
76
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SourceExternalS3`")
77
+ else:
78
+ match += 1
79
+ if match == 0:
80
+ # no match
81
+ raise ValueError(
82
+ "No match found when setting `actual_instance` in RestoreDatabaseFromBackupPayloadSource with oneOf schemas: SourceBackup, SourceExternalS3. Details: "
83
+ + ", ".join(error_messages)
84
+ )
85
+ else:
86
+ return v
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
90
+ return cls.from_json(json.dumps(obj))
91
+
92
+ @classmethod
93
+ def from_json(cls, json_str: str) -> Self:
94
+ """Returns the object represented by the json string"""
95
+ instance = cls.model_construct()
96
+ error_messages = []
97
+ match = 0
98
+
99
+ # deserialize data into SourceBackup
100
+ try:
101
+ instance.actual_instance = SourceBackup.from_json(json_str)
102
+ match += 1
103
+ except (ValidationError, ValueError) as e:
104
+ error_messages.append(str(e))
105
+ # deserialize data into SourceExternalS3
106
+ try:
107
+ instance.actual_instance = SourceExternalS3.from_json(json_str)
108
+ match += 1
109
+ except (ValidationError, ValueError) as e:
110
+ error_messages.append(str(e))
111
+
112
+ if match > 1:
113
+ # more than 1 match
114
+ raise ValueError(
115
+ "Multiple matches found when deserializing the JSON string into RestoreDatabaseFromBackupPayloadSource with oneOf schemas: SourceBackup, SourceExternalS3. Details: "
116
+ + ", ".join(error_messages)
117
+ )
118
+ elif match == 0:
119
+ # no match
120
+ raise ValueError(
121
+ "No match found when deserializing the JSON string into RestoreDatabaseFromBackupPayloadSource with oneOf schemas: SourceBackup, SourceExternalS3. Details: "
122
+ + ", ".join(error_messages)
123
+ )
124
+ else:
125
+ return instance
126
+
127
+ def to_json(self) -> str:
128
+ """Returns the JSON representation of the actual instance"""
129
+ if self.actual_instance is None:
130
+ return "null"
131
+
132
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
133
+ return self.actual_instance.to_json()
134
+ else:
135
+ return json.dumps(self.actual_instance)
136
+
137
+ def to_dict(self) -> Optional[Union[Dict[str, Any], SourceBackup, SourceExternalS3]]:
138
+ """Returns the dict representation of the actual instance"""
139
+ if self.actual_instance is None:
140
+ return None
141
+
142
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
143
+ return self.actual_instance.to_dict()
144
+ else:
145
+ # primitive type
146
+ return self.actual_instance
147
+
148
+ def to_str(self) -> str:
149
+ """Returns the string representation of the actual instance"""
150
+ return pprint.pformat(self.model_dump())
@@ -0,0 +1,84 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 3.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
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class S3fileInfo(BaseModel):
27
+ """
28
+ S3fileInfo
29
+ """ # noqa: E501
30
+
31
+ file_number: Optional[StrictInt] = Field(default=None, description="The sequence number of the file")
32
+ file_path: Optional[StrictStr] = Field(default=None, description="The path to the file on the S3 bucket")
33
+ __properties: ClassVar[List[str]] = ["file_number", "file_path"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of S3fileInfo from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of S3fileInfo from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({"file_number": obj.get("file_number"), "file_path": obj.get("file_path")})
84
+ return _obj
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 3.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
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, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class SourceBackup(BaseModel):
27
+ """
28
+ Restore from an existing managed backup.
29
+ """ # noqa: E501
30
+
31
+ type: StrictStr
32
+ __properties: ClassVar[List[str]] = ["type"]
33
+
34
+ @field_validator("type")
35
+ def type_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(["BACKUP"]):
38
+ raise ValueError("must be one of enum values ('BACKUP')")
39
+ return value
40
+
41
+ model_config = ConfigDict(
42
+ validate_by_name=True,
43
+ validate_by_alias=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of SourceBackup from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of SourceBackup from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({"type": obj.get("type")})
90
+ return _obj