Skip to content

Commit 984c469

Browse files
authored
feat(rdb): add volume_type for snapshots (#396)
1 parent 633fdf6 commit 984c469

File tree

6 files changed

+74
-0
lines changed

6 files changed

+74
-0
lines changed

scaleway-async/scaleway_async/rdb/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from .types import SetInstanceACLRulesResponse
7474
from .types import SetInstanceSettingsResponse
7575
from .types import Snapshot
76+
from .types import SnapshotVolumeType
7677
from .types import UpgradableVersion
7778
from .types import UpgradeInstanceRequestMajorUpgradeWorkflow
7879
from .types import User
@@ -159,6 +160,7 @@
159160
"SetInstanceACLRulesResponse",
160161
"SetInstanceSettingsResponse",
161162
"Snapshot",
163+
"SnapshotVolumeType",
162164
"UpgradableVersion",
163165
"UpgradeInstanceRequestMajorUpgradeWorkflow",
164166
"User",

scaleway-async/scaleway_async/rdb/v1/marshalling.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
SetInstanceACLRulesResponse,
6767
SetInstanceSettingsResponse,
6868
Snapshot,
69+
SnapshotVolumeType,
6970
UpgradableVersion,
7071
UpgradeInstanceRequestMajorUpgradeWorkflow,
7172
User,
@@ -419,6 +420,23 @@ def unmarshal_ReadReplica(data: Any) -> ReadReplica:
419420
return ReadReplica(**args)
420421

421422

423+
def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType:
424+
if type(data) is not dict:
425+
raise TypeError(
426+
f"Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary."
427+
)
428+
429+
args: Dict[str, Any] = {}
430+
431+
field = data.get("class", None)
432+
args["class_"] = field
433+
434+
field = data.get("type", None)
435+
args["type_"] = field
436+
437+
return SnapshotVolumeType(**args)
438+
439+
422440
def unmarshal_UpgradableVersion(data: Any) -> UpgradableVersion:
423441
if type(data) is not dict:
424442
raise TypeError(
@@ -854,6 +872,11 @@ def unmarshal_Snapshot(data: Any) -> Snapshot:
854872
field = data.get("updated_at", None)
855873
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
856874

875+
field = data.get("volume_type", None)
876+
args["volume_type"] = (
877+
unmarshal_SnapshotVolumeType(field) if field is not None else None
878+
)
879+
857880
return Snapshot(**args)
858881

859882

scaleway-async/scaleway_async/rdb/v1/types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,12 +1491,24 @@ class Snapshot:
14911491
Source node type.
14921492
"""
14931493

1494+
volume_type: Optional[SnapshotVolumeType]
1495+
"""
1496+
Type of volume where data is stored (lssd, bssd or sbs).
1497+
"""
1498+
14941499
region: Region
14951500
"""
14961501
Region of this snapshot.
14971502
"""
14981503

14991504

1505+
@dataclass
1506+
class SnapshotVolumeType:
1507+
type_: VolumeType
1508+
1509+
class_: StorageClass
1510+
1511+
15001512
@dataclass
15011513
class UpgradableVersion:
15021514
id: str

scaleway/scaleway/rdb/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from .types import SetInstanceACLRulesResponse
7474
from .types import SetInstanceSettingsResponse
7575
from .types import Snapshot
76+
from .types import SnapshotVolumeType
7677
from .types import UpgradableVersion
7778
from .types import UpgradeInstanceRequestMajorUpgradeWorkflow
7879
from .types import User
@@ -159,6 +160,7 @@
159160
"SetInstanceACLRulesResponse",
160161
"SetInstanceSettingsResponse",
161162
"Snapshot",
163+
"SnapshotVolumeType",
162164
"UpgradableVersion",
163165
"UpgradeInstanceRequestMajorUpgradeWorkflow",
164166
"User",

scaleway/scaleway/rdb/v1/marshalling.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
SetInstanceACLRulesResponse,
6767
SetInstanceSettingsResponse,
6868
Snapshot,
69+
SnapshotVolumeType,
6970
UpgradableVersion,
7071
UpgradeInstanceRequestMajorUpgradeWorkflow,
7172
User,
@@ -419,6 +420,23 @@ def unmarshal_ReadReplica(data: Any) -> ReadReplica:
419420
return ReadReplica(**args)
420421

421422

423+
def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType:
424+
if type(data) is not dict:
425+
raise TypeError(
426+
f"Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary."
427+
)
428+
429+
args: Dict[str, Any] = {}
430+
431+
field = data.get("class", None)
432+
args["class_"] = field
433+
434+
field = data.get("type", None)
435+
args["type_"] = field
436+
437+
return SnapshotVolumeType(**args)
438+
439+
422440
def unmarshal_UpgradableVersion(data: Any) -> UpgradableVersion:
423441
if type(data) is not dict:
424442
raise TypeError(
@@ -854,6 +872,11 @@ def unmarshal_Snapshot(data: Any) -> Snapshot:
854872
field = data.get("updated_at", None)
855873
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
856874

875+
field = data.get("volume_type", None)
876+
args["volume_type"] = (
877+
unmarshal_SnapshotVolumeType(field) if field is not None else None
878+
)
879+
857880
return Snapshot(**args)
858881

859882

scaleway/scaleway/rdb/v1/types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,12 +1491,24 @@ class Snapshot:
14911491
Source node type.
14921492
"""
14931493

1494+
volume_type: Optional[SnapshotVolumeType]
1495+
"""
1496+
Type of volume where data is stored (lssd, bssd or sbs).
1497+
"""
1498+
14941499
region: Region
14951500
"""
14961501
Region of this snapshot.
14971502
"""
14981503

14991504

1505+
@dataclass
1506+
class SnapshotVolumeType:
1507+
type_: VolumeType
1508+
1509+
class_: StorageClass
1510+
1511+
15001512
@dataclass
15011513
class UpgradableVersion:
15021514
id: str

0 commit comments

Comments
 (0)