stackit-redis 0.0.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. stackit/redis/__init__.py +68 -0
  2. stackit/redis/api/__init__.py +4 -0
  3. stackit/redis/api/default_api.py +4812 -0
  4. stackit/redis/api_client.py +626 -0
  5. stackit/redis/api_response.py +23 -0
  6. stackit/redis/configuration.py +111 -0
  7. stackit/redis/exceptions.py +198 -0
  8. stackit/redis/models/__init__.py +49 -0
  9. stackit/redis/models/backup.py +95 -0
  10. stackit/redis/models/create_backup_response_item.py +82 -0
  11. stackit/redis/models/create_instance_payload.py +96 -0
  12. stackit/redis/models/create_instance_response.py +81 -0
  13. stackit/redis/models/credentials.py +97 -0
  14. stackit/redis/models/credentials_list_item.py +81 -0
  15. stackit/redis/models/credentials_response.py +94 -0
  16. stackit/redis/models/error.py +82 -0
  17. stackit/redis/models/get_metrics_response.py +153 -0
  18. stackit/redis/models/instance.py +147 -0
  19. stackit/redis/models/instance_last_operation.py +99 -0
  20. stackit/redis/models/instance_parameters.py +242 -0
  21. stackit/redis/models/instance_schema.py +95 -0
  22. stackit/redis/models/list_backups_response.py +98 -0
  23. stackit/redis/models/list_credentials_response.py +98 -0
  24. stackit/redis/models/list_instances_response.py +98 -0
  25. stackit/redis/models/list_offerings_response.py +98 -0
  26. stackit/redis/models/list_restores_response.py +98 -0
  27. stackit/redis/models/model_schema.py +81 -0
  28. stackit/redis/models/offering.py +127 -0
  29. stackit/redis/models/partial_update_instance_payload.py +96 -0
  30. stackit/redis/models/plan.py +93 -0
  31. stackit/redis/models/raw_credentials.py +88 -0
  32. stackit/redis/models/restore.py +93 -0
  33. stackit/redis/models/trigger_restore_response.py +81 -0
  34. stackit/redis/models/update_backups_config_payload.py +81 -0
  35. stackit/redis/models/update_backups_config_response.py +81 -0
  36. stackit/redis/py.typed +0 -0
  37. stackit/redis/rest.py +148 -0
  38. stackit_redis-0.0.1a0.dist-info/METADATA +45 -0
  39. stackit_redis-0.0.1a0.dist-info/RECORD +40 -0
  40. stackit_redis-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,147 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+ from stackit.redis.models.instance_last_operation import InstanceLastOperation
24
+
25
+
26
+ class Instance(BaseModel):
27
+ """
28
+ Instance
29
+ """
30
+
31
+ cf_guid: StrictStr = Field(alias="cfGuid")
32
+ cf_organization_guid: StrictStr = Field(alias="cfOrganizationGuid")
33
+ cf_space_guid: StrictStr = Field(alias="cfSpaceGuid")
34
+ dashboard_url: StrictStr = Field(alias="dashboardUrl")
35
+ image_url: StrictStr = Field(alias="imageUrl")
36
+ instance_id: Optional[StrictStr] = Field(default=None, alias="instanceId")
37
+ last_operation: InstanceLastOperation = Field(alias="lastOperation")
38
+ name: StrictStr
39
+ offering_name: StrictStr = Field(alias="offeringName")
40
+ offering_version: StrictStr = Field(alias="offeringVersion")
41
+ parameters: Dict[str, Any]
42
+ plan_id: StrictStr = Field(alias="planId")
43
+ plan_name: StrictStr = Field(alias="planName")
44
+ status: Optional[StrictStr] = None
45
+ __properties: ClassVar[List[str]] = [
46
+ "cfGuid",
47
+ "cfOrganizationGuid",
48
+ "cfSpaceGuid",
49
+ "dashboardUrl",
50
+ "imageUrl",
51
+ "instanceId",
52
+ "lastOperation",
53
+ "name",
54
+ "offeringName",
55
+ "offeringVersion",
56
+ "parameters",
57
+ "planId",
58
+ "planName",
59
+ "status",
60
+ ]
61
+
62
+ @field_validator("status")
63
+ def status_validate_enum(cls, value):
64
+ """Validates the enum"""
65
+ if value is None:
66
+ return value
67
+
68
+ if value not in set(["active", "failed", "stopped", "creating", "deleting", "updating"]):
69
+ raise ValueError(
70
+ "must be one of enum values ('active', 'failed', 'stopped', 'creating', 'deleting', 'updating')"
71
+ )
72
+ return value
73
+
74
+ model_config = ConfigDict(
75
+ populate_by_name=True,
76
+ validate_assignment=True,
77
+ protected_namespaces=(),
78
+ )
79
+
80
+ def to_str(self) -> str:
81
+ """Returns the string representation of the model using alias"""
82
+ return pprint.pformat(self.model_dump(by_alias=True))
83
+
84
+ def to_json(self) -> str:
85
+ """Returns the JSON representation of the model using alias"""
86
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
+ return json.dumps(self.to_dict())
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of Instance from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ """
104
+ excluded_fields: Set[str] = set([])
105
+
106
+ _dict = self.model_dump(
107
+ by_alias=True,
108
+ exclude=excluded_fields,
109
+ exclude_none=True,
110
+ )
111
+ # override the default output from pydantic by calling `to_dict()` of last_operation
112
+ if self.last_operation:
113
+ _dict["lastOperation"] = self.last_operation.to_dict()
114
+ return _dict
115
+
116
+ @classmethod
117
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
+ """Create an instance of Instance from a dict"""
119
+ if obj is None:
120
+ return None
121
+
122
+ if not isinstance(obj, dict):
123
+ return cls.model_validate(obj)
124
+
125
+ _obj = cls.model_validate(
126
+ {
127
+ "cfGuid": obj.get("cfGuid"),
128
+ "cfOrganizationGuid": obj.get("cfOrganizationGuid"),
129
+ "cfSpaceGuid": obj.get("cfSpaceGuid"),
130
+ "dashboardUrl": obj.get("dashboardUrl"),
131
+ "imageUrl": obj.get("imageUrl"),
132
+ "instanceId": obj.get("instanceId"),
133
+ "lastOperation": (
134
+ InstanceLastOperation.from_dict(obj["lastOperation"])
135
+ if obj.get("lastOperation") is not None
136
+ else None
137
+ ),
138
+ "name": obj.get("name"),
139
+ "offeringName": obj.get("offeringName"),
140
+ "offeringVersion": obj.get("offeringVersion"),
141
+ "parameters": obj.get("parameters"),
142
+ "planId": obj.get("planId"),
143
+ "planName": obj.get("planName"),
144
+ "status": obj.get("status"),
145
+ }
146
+ )
147
+ return _obj
@@ -0,0 +1,99 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+
24
+ class InstanceLastOperation(BaseModel):
25
+ """
26
+ InstanceLastOperation
27
+ """
28
+
29
+ description: StrictStr
30
+ state: StrictStr
31
+ type: StrictStr
32
+ __properties: ClassVar[List[str]] = ["description", "state", "type"]
33
+
34
+ @field_validator("state")
35
+ def state_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(["in progress", "succeeded", "failed"]):
38
+ raise ValueError("must be one of enum values ('in progress', 'succeeded', 'failed')")
39
+ return value
40
+
41
+ @field_validator("type")
42
+ def type_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value not in set(["create", "update", "delete"]):
45
+ raise ValueError("must be one of enum values ('create', 'update', 'delete')")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of InstanceLastOperation from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of InstanceLastOperation from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {"description": obj.get("description"), "state": obj.get("state"), "type": obj.get("type")}
98
+ )
99
+ return _obj
@@ -0,0 +1,242 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictBool,
25
+ StrictInt,
26
+ StrictStr,
27
+ field_validator,
28
+ )
29
+ from typing_extensions import Annotated, Self
30
+
31
+
32
+ class InstanceParameters(BaseModel):
33
+ """
34
+ InstanceParameters
35
+ """
36
+
37
+ down_after_milliseconds: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
38
+ default=10000, description="The unit is milliseconds.", alias="down-after-milliseconds"
39
+ )
40
+ enable_monitoring: Optional[StrictBool] = False
41
+ failover_timeout: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
42
+ default=30000, description="The unit is milliseconds.", alias="failover-timeout"
43
+ )
44
+ graphite: Optional[StrictStr] = Field(
45
+ default=None,
46
+ description="If you want to monitor your service with Graphite, you can set the custom parameter graphite. It expects the host and port where the Graphite metrics should be sent to.",
47
+ )
48
+ lazyfree_lazy_eviction: Optional[StrictStr] = Field(default="no", alias="lazyfree-lazy-eviction")
49
+ lazyfree_lazy_expire: Optional[StrictStr] = Field(default="no", alias="lazyfree-lazy-expire")
50
+ lua_time_limit: Optional[StrictInt] = Field(default=5000, alias="lua-time-limit")
51
+ max_disk_threshold: Optional[StrictInt] = Field(
52
+ default=80,
53
+ description="This component monitors ephemeral and persistent disk usage. If one of these disk usages reaches the default configured threshold of 80%, the a9s Parachute stops all processes on that node.",
54
+ )
55
+ maxclients: Optional[Annotated[int, Field(strict=True, ge=1)]] = 10000
56
+ maxmemory_policy: Optional[StrictStr] = Field(default="volatile-lru", alias="maxmemory-policy")
57
+ maxmemory_samples: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=5, alias="maxmemory-samples")
58
+ metrics_frequency: Optional[StrictInt] = Field(
59
+ default=10, description="Frequency of metrics being emitted in seconds"
60
+ )
61
+ metrics_prefix: Optional[StrictStr] = Field(
62
+ default=None,
63
+ description="Depending on your graphite provider, you might need to prefix the metrics with a certain value, like an API key for example.",
64
+ )
65
+ min_replicas_max_lag: Optional[StrictInt] = Field(default=10, description="The unit is seconds.")
66
+ monitoring_instance_id: Optional[StrictStr] = None
67
+ notify_keyspace_events: Optional[StrictStr] = Field(
68
+ default="",
69
+ description="The allowed value must include the following characters only: [K,E,g,$,l,s,h,z,x,e,A,t]",
70
+ alias="notify-keyspace-events",
71
+ )
72
+ sgw_acl: Optional[StrictStr] = Field(
73
+ default=None,
74
+ description="Comma separated list of IP networks in CIDR notation which are allowed to access this instance.",
75
+ )
76
+ snapshot: Optional[StrictStr] = Field(
77
+ default=None, description="This setting must follow the original Redis configuration for RDB."
78
+ )
79
+ syslog: Optional[List[StrictStr]] = None
80
+ tls_ciphers: Optional[List[StrictStr]] = Field(default=None, alias="tls-ciphers")
81
+ tls_ciphersuites: Optional[StrictStr] = Field(default=None, alias="tls-ciphersuites")
82
+ tls_protocols: Optional[StrictStr] = Field(default=None, alias="tls-protocols")
83
+ __properties: ClassVar[List[str]] = [
84
+ "down-after-milliseconds",
85
+ "enable_monitoring",
86
+ "failover-timeout",
87
+ "graphite",
88
+ "lazyfree-lazy-eviction",
89
+ "lazyfree-lazy-expire",
90
+ "lua-time-limit",
91
+ "max_disk_threshold",
92
+ "maxclients",
93
+ "maxmemory-policy",
94
+ "maxmemory-samples",
95
+ "metrics_frequency",
96
+ "metrics_prefix",
97
+ "min_replicas_max_lag",
98
+ "monitoring_instance_id",
99
+ "notify-keyspace-events",
100
+ "sgw_acl",
101
+ "snapshot",
102
+ "syslog",
103
+ "tls-ciphers",
104
+ "tls-ciphersuites",
105
+ "tls-protocols",
106
+ ]
107
+
108
+ @field_validator("lazyfree_lazy_eviction")
109
+ def lazyfree_lazy_eviction_validate_enum(cls, value):
110
+ """Validates the enum"""
111
+ if value is None:
112
+ return value
113
+
114
+ if value not in set(["yes", "no"]):
115
+ raise ValueError("must be one of enum values ('yes', 'no')")
116
+ return value
117
+
118
+ @field_validator("lazyfree_lazy_expire")
119
+ def lazyfree_lazy_expire_validate_enum(cls, value):
120
+ """Validates the enum"""
121
+ if value is None:
122
+ return value
123
+
124
+ if value not in set(["yes", "no"]):
125
+ raise ValueError("must be one of enum values ('yes', 'no')")
126
+ return value
127
+
128
+ @field_validator("maxmemory_policy")
129
+ def maxmemory_policy_validate_enum(cls, value):
130
+ """Validates the enum"""
131
+ if value is None:
132
+ return value
133
+
134
+ if value not in set(
135
+ ["volatile-lru", "allkeys-lru", "volatile-random", "allkeys-random", "volatile-ttl", "noeviction"]
136
+ ):
137
+ raise ValueError(
138
+ "must be one of enum values ('volatile-lru', 'allkeys-lru', 'volatile-random', 'allkeys-random', 'volatile-ttl', 'noeviction')"
139
+ )
140
+ return value
141
+
142
+ @field_validator("tls_protocols")
143
+ def tls_protocols_validate_enum(cls, value):
144
+ """Validates the enum"""
145
+ if value is None:
146
+ return value
147
+
148
+ if value not in set(["TLSv1.2", "TLSv1.3"]):
149
+ raise ValueError("must be one of enum values ('TLSv1.2', 'TLSv1.3')")
150
+ return value
151
+
152
+ model_config = ConfigDict(
153
+ populate_by_name=True,
154
+ validate_assignment=True,
155
+ protected_namespaces=(),
156
+ )
157
+
158
+ def to_str(self) -> str:
159
+ """Returns the string representation of the model using alias"""
160
+ return pprint.pformat(self.model_dump(by_alias=True))
161
+
162
+ def to_json(self) -> str:
163
+ """Returns the JSON representation of the model using alias"""
164
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
165
+ return json.dumps(self.to_dict())
166
+
167
+ @classmethod
168
+ def from_json(cls, json_str: str) -> Optional[Self]:
169
+ """Create an instance of InstanceParameters from a JSON string"""
170
+ return cls.from_dict(json.loads(json_str))
171
+
172
+ def to_dict(self) -> Dict[str, Any]:
173
+ """Return the dictionary representation of the model using alias.
174
+
175
+ This has the following differences from calling pydantic's
176
+ `self.model_dump(by_alias=True)`:
177
+
178
+ * `None` is only added to the output dict for nullable fields that
179
+ were set at model initialization. Other fields with value `None`
180
+ are ignored.
181
+ """
182
+ excluded_fields: Set[str] = set([])
183
+
184
+ _dict = self.model_dump(
185
+ by_alias=True,
186
+ exclude=excluded_fields,
187
+ exclude_none=True,
188
+ )
189
+ return _dict
190
+
191
+ @classmethod
192
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
193
+ """Create an instance of InstanceParameters from a dict"""
194
+ if obj is None:
195
+ return None
196
+
197
+ if not isinstance(obj, dict):
198
+ return cls.model_validate(obj)
199
+
200
+ _obj = cls.model_validate(
201
+ {
202
+ "down-after-milliseconds": (
203
+ obj.get("down-after-milliseconds") if obj.get("down-after-milliseconds") is not None else 10000
204
+ ),
205
+ "enable_monitoring": (
206
+ obj.get("enable_monitoring") if obj.get("enable_monitoring") is not None else False
207
+ ),
208
+ "failover-timeout": obj.get("failover-timeout") if obj.get("failover-timeout") is not None else 30000,
209
+ "graphite": obj.get("graphite"),
210
+ "lazyfree-lazy-eviction": (
211
+ obj.get("lazyfree-lazy-eviction") if obj.get("lazyfree-lazy-eviction") is not None else "no"
212
+ ),
213
+ "lazyfree-lazy-expire": (
214
+ obj.get("lazyfree-lazy-expire") if obj.get("lazyfree-lazy-expire") is not None else "no"
215
+ ),
216
+ "lua-time-limit": obj.get("lua-time-limit") if obj.get("lua-time-limit") is not None else 5000,
217
+ "max_disk_threshold": (
218
+ obj.get("max_disk_threshold") if obj.get("max_disk_threshold") is not None else 80
219
+ ),
220
+ "maxclients": obj.get("maxclients") if obj.get("maxclients") is not None else 10000,
221
+ "maxmemory-policy": (
222
+ obj.get("maxmemory-policy") if obj.get("maxmemory-policy") is not None else "volatile-lru"
223
+ ),
224
+ "maxmemory-samples": obj.get("maxmemory-samples") if obj.get("maxmemory-samples") is not None else 5,
225
+ "metrics_frequency": obj.get("metrics_frequency") if obj.get("metrics_frequency") is not None else 10,
226
+ "metrics_prefix": obj.get("metrics_prefix"),
227
+ "min_replicas_max_lag": (
228
+ obj.get("min_replicas_max_lag") if obj.get("min_replicas_max_lag") is not None else 10
229
+ ),
230
+ "monitoring_instance_id": obj.get("monitoring_instance_id"),
231
+ "notify-keyspace-events": (
232
+ obj.get("notify-keyspace-events") if obj.get("notify-keyspace-events") is not None else ""
233
+ ),
234
+ "sgw_acl": obj.get("sgw_acl"),
235
+ "snapshot": obj.get("snapshot"),
236
+ "syslog": obj.get("syslog"),
237
+ "tls-ciphers": obj.get("tls-ciphers"),
238
+ "tls-ciphersuites": obj.get("tls-ciphersuites"),
239
+ "tls-protocols": obj.get("tls-protocols"),
240
+ }
241
+ )
242
+ return _obj
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing_extensions import Self
22
+
23
+ from stackit.redis.models.model_schema import ModelSchema
24
+
25
+
26
+ class InstanceSchema(BaseModel):
27
+ """
28
+ InstanceSchema
29
+ """
30
+
31
+ create: ModelSchema
32
+ update: ModelSchema
33
+ __properties: ClassVar[List[str]] = ["create", "update"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of InstanceSchema from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of create
73
+ if self.create:
74
+ _dict["create"] = self.create.to_dict()
75
+ # override the default output from pydantic by calling `to_dict()` of update
76
+ if self.update:
77
+ _dict["update"] = self.update.to_dict()
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of InstanceSchema 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(
90
+ {
91
+ "create": ModelSchema.from_dict(obj["create"]) if obj.get("create") is not None else None,
92
+ "update": ModelSchema.from_dict(obj["update"]) if obj.get("update") is not None else None,
93
+ }
94
+ )
95
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Redis API
5
+
6
+ The STACKIT Redis API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing_extensions import Self
22
+
23
+ from stackit.redis.models.backup import Backup
24
+
25
+
26
+ class ListBackupsResponse(BaseModel):
27
+ """
28
+ ListBackupsResponse
29
+ """
30
+
31
+ instance_backups: List[Backup] = Field(alias="instanceBackups")
32
+ __properties: ClassVar[List[str]] = ["instanceBackups"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of ListBackupsResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ # override the default output from pydantic by calling `to_dict()` of each item in instance_backups (list)
72
+ _items = []
73
+ if self.instance_backups:
74
+ for _item in self.instance_backups:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["instanceBackups"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListBackupsResponse 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(
90
+ {
91
+ "instanceBackups": (
92
+ [Backup.from_dict(_item) for _item in obj["instanceBackups"]]
93
+ if obj.get("instanceBackups") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj