Skip to content

Commit a05a723

Browse files
chore(rdb): handle deprecated_optional fields (#1688)
Co-authored-by: Mia-Cross <lmarabese@scaleway.com>
1 parent 874717c commit a05a723

File tree

4 files changed

+38
-38
lines changed

4 files changed

+38
-38
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def unmarshal_ACLRule(data: Any) -> ACLRule:
10451045
if field is not None:
10461046
args["port"] = field
10471047
else:
1048-
args["port"] = 0
1048+
args["port"] = None
10491049

10501050
return ACLRule(**args)
10511051

@@ -1625,18 +1625,6 @@ def unmarshal_NodeType(data: Any) -> NodeType:
16251625
else:
16261626
args["memory"] = 0
16271627

1628-
field = data.get("volume_constraint", None)
1629-
if field is not None:
1630-
args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field)
1631-
else:
1632-
args["volume_constraint"] = None
1633-
1634-
field = data.get("is_bssd_compatible", None)
1635-
if field is not None:
1636-
args["is_bssd_compatible"] = field
1637-
else:
1638-
args["is_bssd_compatible"] = False
1639-
16401628
field = data.get("disabled", None)
16411629
if field is not None:
16421630
args["disabled"] = field
@@ -1649,6 +1637,18 @@ def unmarshal_NodeType(data: Any) -> NodeType:
16491637
else:
16501638
args["beta"] = False
16511639

1640+
field = data.get("volume_constraint", None)
1641+
if field is not None:
1642+
args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field)
1643+
else:
1644+
args["volume_constraint"] = None
1645+
1646+
field = data.get("is_bssd_compatible", None)
1647+
if field is not None:
1648+
args["is_bssd_compatible"] = field
1649+
else:
1650+
args["is_bssd_compatible"] = None
1651+
16521652
field = data.get("available_volume_types", None)
16531653
if field is not None:
16541654
args["available_volume_types"] = (

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class ACLRule:
667667
direction: ACLRuleDirection
668668
action: ACLRuleAction
669669
description: str
670-
port: int
670+
port: Optional[int] = None
671671

672672

673673
@dataclass
@@ -992,11 +992,6 @@ class NodeType:
992992
Quantity of RAM.
993993
"""
994994

995-
is_bssd_compatible: bool
996-
"""
997-
The Node Type is compliant with Block Storage.
998-
"""
999-
1000995
disabled: bool
1001996
"""
1002997
The Node Type is currently disabled.
@@ -1037,6 +1032,11 @@ class NodeType:
10371032
[deprecated] Node Type volume constraints.
10381033
"""
10391034

1035+
is_bssd_compatible: Optional[bool] = None
1036+
"""
1037+
The Node Type is compliant with Block Storage.
1038+
"""
1039+
10401040

10411041
@dataclass
10421042
class Privilege:

scaleway/scaleway/rdb/v1/marshalling.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def unmarshal_ACLRule(data: Any) -> ACLRule:
10451045
if field is not None:
10461046
args["port"] = field
10471047
else:
1048-
args["port"] = 0
1048+
args["port"] = None
10491049

10501050
return ACLRule(**args)
10511051

@@ -1625,18 +1625,6 @@ def unmarshal_NodeType(data: Any) -> NodeType:
16251625
else:
16261626
args["memory"] = 0
16271627

1628-
field = data.get("volume_constraint", None)
1629-
if field is not None:
1630-
args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field)
1631-
else:
1632-
args["volume_constraint"] = None
1633-
1634-
field = data.get("is_bssd_compatible", None)
1635-
if field is not None:
1636-
args["is_bssd_compatible"] = field
1637-
else:
1638-
args["is_bssd_compatible"] = False
1639-
16401628
field = data.get("disabled", None)
16411629
if field is not None:
16421630
args["disabled"] = field
@@ -1649,6 +1637,18 @@ def unmarshal_NodeType(data: Any) -> NodeType:
16491637
else:
16501638
args["beta"] = False
16511639

1640+
field = data.get("volume_constraint", None)
1641+
if field is not None:
1642+
args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field)
1643+
else:
1644+
args["volume_constraint"] = None
1645+
1646+
field = data.get("is_bssd_compatible", None)
1647+
if field is not None:
1648+
args["is_bssd_compatible"] = field
1649+
else:
1650+
args["is_bssd_compatible"] = None
1651+
16521652
field = data.get("available_volume_types", None)
16531653
if field is not None:
16541654
args["available_volume_types"] = (

scaleway/scaleway/rdb/v1/types.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class ACLRule:
667667
direction: ACLRuleDirection
668668
action: ACLRuleAction
669669
description: str
670-
port: int
670+
port: Optional[int] = None
671671

672672

673673
@dataclass
@@ -992,11 +992,6 @@ class NodeType:
992992
Quantity of RAM.
993993
"""
994994

995-
is_bssd_compatible: bool
996-
"""
997-
The Node Type is compliant with Block Storage.
998-
"""
999-
1000995
disabled: bool
1001996
"""
1002997
The Node Type is currently disabled.
@@ -1037,6 +1032,11 @@ class NodeType:
10371032
[deprecated] Node Type volume constraints.
10381033
"""
10391034

1035+
is_bssd_compatible: Optional[bool] = None
1036+
"""
1037+
The Node Type is compliant with Block Storage.
1038+
"""
1039+
10401040

10411041
@dataclass
10421042
class Privilege:

0 commit comments

Comments
 (0)