Skip to content

Commit 9d3bd03

Browse files
authored
feat(rdb): add seemless major upgrade (#349)
1 parent 07eb706 commit 9d3bd03

File tree

8 files changed

+140
-20
lines changed

8 files changed

+140
-20
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
from .types import SetInstanceSettingsResponse
7575
from .types import Snapshot
7676
from .types import UpgradableVersion
77+
from .types import UpgradeInstanceRequestMajorUpgradeWorkflow
7778
from .types import User
7879
from .types import Volume
7980
from .content import DATABASE_BACKUP_TRANSIENT_STATUSES
@@ -159,6 +160,7 @@
159160
"SetInstanceSettingsResponse",
160161
"Snapshot",
161162
"UpgradableVersion",
163+
"UpgradeInstanceRequestMajorUpgradeWorkflow",
162164
"User",
163165
"Volume",
164166
"DATABASE_BACKUP_TRANSIENT_STATUSES",

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
SetInstanceACLRulesResponse,
6363
SetInstanceSettingsResponse,
6464
Snapshot,
65+
UpgradeInstanceRequestMajorUpgradeWorkflow,
6566
User,
6667
CreateDatabaseBackupRequest,
6768
UpdateDatabaseBackupRequest,
@@ -716,6 +717,9 @@ async def upgrade_instance(
716717
volume_size: Optional[int] = None,
717718
volume_type: Optional[VolumeType] = None,
718719
upgradable_version_id: Optional[str] = None,
720+
major_upgrade_workflow: Optional[
721+
UpgradeInstanceRequestMajorUpgradeWorkflow
722+
] = None,
719723
) -> Instance:
720724
"""
721725
Upgrade a Database Instance.
@@ -724,20 +728,23 @@ async def upgrade_instance(
724728
:param instance_id: UUID of the Database Instance you want to upgrade.
725729
:param node_type: Node type of the Database Instance you want to upgrade to.
726730
727-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
731+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
728732
:param enable_ha: Defines whether or not high availability should be enabled on the Database Instance.
729733
730-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
734+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
731735
:param volume_size: Increase your block storage volume size.
732736
733-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
737+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
734738
:param volume_type: Change your Database Instance storage type.
735739
736-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
740+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
737741
:param upgradable_version_id: Update your database engine to a newer version.
738742
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
739743
740-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
744+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
745+
:param major_upgrade_workflow: Upgrade your database engine to a new major version including instance endpoints.
746+
747+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
741748
:return: :class:`Instance <Instance>`
742749
743750
Usage:
@@ -763,6 +770,7 @@ async def upgrade_instance(
763770
volume_size=volume_size,
764771
volume_type=volume_type,
765772
upgradable_version_id=upgradable_version_id,
773+
major_upgrade_workflow=major_upgrade_workflow,
766774
),
767775
self.client,
768776
),

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
SetInstanceSettingsResponse,
6868
Snapshot,
6969
UpgradableVersion,
70+
UpgradeInstanceRequestMajorUpgradeWorkflow,
7071
User,
7172
Volume,
7273
CreateDatabaseBackupRequest,
@@ -1403,6 +1404,21 @@ def marshal_ReadReplicaEndpointSpec(
14031404
return output
14041405

14051406

1407+
def marshal_UpgradeInstanceRequestMajorUpgradeWorkflow(
1408+
request: UpgradeInstanceRequestMajorUpgradeWorkflow,
1409+
defaults: ProfileDefaults,
1410+
) -> Dict[str, Any]:
1411+
output: Dict[str, Any] = {}
1412+
1413+
if request.upgradable_version_id is not None:
1414+
output["upgradable_version_id"] = request.upgradable_version_id
1415+
1416+
if request.with_endpoints is not None:
1417+
output["with_endpoints"] = request.with_endpoints
1418+
1419+
return output
1420+
1421+
14061422
def marshal_AddInstanceACLRulesRequest(
14071423
request: AddInstanceACLRulesRequest,
14081424
defaults: ProfileDefaults,
@@ -1878,6 +1894,14 @@ def marshal_UpgradeInstanceRequest(
18781894
if request.upgradable_version_id is not None
18791895
else None,
18801896
),
1897+
OneOfPossibility(
1898+
"major_upgrade_workflow",
1899+
marshal_UpgradeInstanceRequestMajorUpgradeWorkflow(
1900+
request.major_upgrade_workflow, defaults
1901+
)
1902+
if request.major_upgrade_workflow is not None
1903+
else None,
1904+
),
18811905
]
18821906
),
18831907
)

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

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,25 @@ class UpgradableVersion:
15081508
minor_version: str
15091509

15101510

1511+
@dataclass
1512+
class UpgradeInstanceRequestMajorUpgradeWorkflow:
1513+
"""
1514+
Upgrade instance request. major upgrade workflow.
1515+
"""
1516+
1517+
upgradable_version_id: str
1518+
"""
1519+
Update your database engine to a newer version.
1520+
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
1521+
"""
1522+
1523+
with_endpoints: bool
1524+
"""
1525+
Include endpoint during the migration.
1526+
At the end of the migration procedure this option let you migrate all your database endpoint to the upgraded instance.
1527+
"""
1528+
1529+
15111530
@dataclass
15121531
class User:
15131532
"""
@@ -1739,36 +1758,43 @@ class UpgradeInstanceRequest:
17391758
"""
17401759
Node type of the Database Instance you want to upgrade to.
17411760
1742-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1761+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17431762
"""
17441763

17451764
enable_ha: Optional[bool]
17461765
"""
17471766
Defines whether or not high availability should be enabled on the Database Instance.
17481767
1749-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1768+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17501769
"""
17511770

17521771
volume_size: Optional[int]
17531772
"""
17541773
Increase your block storage volume size.
17551774
1756-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1775+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17571776
"""
17581777

17591778
volume_type: Optional[VolumeType]
17601779
"""
17611780
Change your Database Instance storage type.
17621781
1763-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1782+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17641783
"""
17651784

17661785
upgradable_version_id: Optional[str]
17671786
"""
17681787
Update your database engine to a newer version.
17691788
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
17701789
1771-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1790+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
1791+
"""
1792+
1793+
major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow]
1794+
"""
1795+
Upgrade your database engine to a new major version including instance endpoints.
1796+
1797+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17721798
"""
17731799

17741800

scaleway/scaleway/rdb/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
from .types import SetInstanceSettingsResponse
7575
from .types import Snapshot
7676
from .types import UpgradableVersion
77+
from .types import UpgradeInstanceRequestMajorUpgradeWorkflow
7778
from .types import User
7879
from .types import Volume
7980
from .content import DATABASE_BACKUP_TRANSIENT_STATUSES
@@ -159,6 +160,7 @@
159160
"SetInstanceSettingsResponse",
160161
"Snapshot",
161162
"UpgradableVersion",
163+
"UpgradeInstanceRequestMajorUpgradeWorkflow",
162164
"User",
163165
"Volume",
164166
"DATABASE_BACKUP_TRANSIENT_STATUSES",

scaleway/scaleway/rdb/v1/api.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
SetInstanceACLRulesResponse,
6363
SetInstanceSettingsResponse,
6464
Snapshot,
65+
UpgradeInstanceRequestMajorUpgradeWorkflow,
6566
User,
6667
CreateDatabaseBackupRequest,
6768
UpdateDatabaseBackupRequest,
@@ -714,6 +715,9 @@ def upgrade_instance(
714715
volume_size: Optional[int] = None,
715716
volume_type: Optional[VolumeType] = None,
716717
upgradable_version_id: Optional[str] = None,
718+
major_upgrade_workflow: Optional[
719+
UpgradeInstanceRequestMajorUpgradeWorkflow
720+
] = None,
717721
) -> Instance:
718722
"""
719723
Upgrade a Database Instance.
@@ -722,20 +726,23 @@ def upgrade_instance(
722726
:param instance_id: UUID of the Database Instance you want to upgrade.
723727
:param node_type: Node type of the Database Instance you want to upgrade to.
724728
725-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
729+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
726730
:param enable_ha: Defines whether or not high availability should be enabled on the Database Instance.
727731
728-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
732+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
729733
:param volume_size: Increase your block storage volume size.
730734
731-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
735+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
732736
:param volume_type: Change your Database Instance storage type.
733737
734-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
738+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
735739
:param upgradable_version_id: Update your database engine to a newer version.
736740
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
737741
738-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
742+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
743+
:param major_upgrade_workflow: Upgrade your database engine to a new major version including instance endpoints.
744+
745+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
739746
:return: :class:`Instance <Instance>`
740747
741748
Usage:
@@ -761,6 +768,7 @@ def upgrade_instance(
761768
volume_size=volume_size,
762769
volume_type=volume_type,
763770
upgradable_version_id=upgradable_version_id,
771+
major_upgrade_workflow=major_upgrade_workflow,
764772
),
765773
self.client,
766774
),

scaleway/scaleway/rdb/v1/marshalling.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
SetInstanceSettingsResponse,
6868
Snapshot,
6969
UpgradableVersion,
70+
UpgradeInstanceRequestMajorUpgradeWorkflow,
7071
User,
7172
Volume,
7273
CreateDatabaseBackupRequest,
@@ -1403,6 +1404,21 @@ def marshal_ReadReplicaEndpointSpec(
14031404
return output
14041405

14051406

1407+
def marshal_UpgradeInstanceRequestMajorUpgradeWorkflow(
1408+
request: UpgradeInstanceRequestMajorUpgradeWorkflow,
1409+
defaults: ProfileDefaults,
1410+
) -> Dict[str, Any]:
1411+
output: Dict[str, Any] = {}
1412+
1413+
if request.upgradable_version_id is not None:
1414+
output["upgradable_version_id"] = request.upgradable_version_id
1415+
1416+
if request.with_endpoints is not None:
1417+
output["with_endpoints"] = request.with_endpoints
1418+
1419+
return output
1420+
1421+
14061422
def marshal_AddInstanceACLRulesRequest(
14071423
request: AddInstanceACLRulesRequest,
14081424
defaults: ProfileDefaults,
@@ -1878,6 +1894,14 @@ def marshal_UpgradeInstanceRequest(
18781894
if request.upgradable_version_id is not None
18791895
else None,
18801896
),
1897+
OneOfPossibility(
1898+
"major_upgrade_workflow",
1899+
marshal_UpgradeInstanceRequestMajorUpgradeWorkflow(
1900+
request.major_upgrade_workflow, defaults
1901+
)
1902+
if request.major_upgrade_workflow is not None
1903+
else None,
1904+
),
18811905
]
18821906
),
18831907
)

scaleway/scaleway/rdb/v1/types.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,25 @@ class UpgradableVersion:
15081508
minor_version: str
15091509

15101510

1511+
@dataclass
1512+
class UpgradeInstanceRequestMajorUpgradeWorkflow:
1513+
"""
1514+
Upgrade instance request. major upgrade workflow.
1515+
"""
1516+
1517+
upgradable_version_id: str
1518+
"""
1519+
Update your database engine to a newer version.
1520+
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
1521+
"""
1522+
1523+
with_endpoints: bool
1524+
"""
1525+
Include endpoint during the migration.
1526+
At the end of the migration procedure this option let you migrate all your database endpoint to the upgraded instance.
1527+
"""
1528+
1529+
15111530
@dataclass
15121531
class User:
15131532
"""
@@ -1739,36 +1758,43 @@ class UpgradeInstanceRequest:
17391758
"""
17401759
Node type of the Database Instance you want to upgrade to.
17411760
1742-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1761+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17431762
"""
17441763

17451764
enable_ha: Optional[bool]
17461765
"""
17471766
Defines whether or not high availability should be enabled on the Database Instance.
17481767
1749-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1768+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17501769
"""
17511770

17521771
volume_size: Optional[int]
17531772
"""
17541773
Increase your block storage volume size.
17551774
1756-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1775+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17571776
"""
17581777

17591778
volume_type: Optional[VolumeType]
17601779
"""
17611780
Change your Database Instance storage type.
17621781
1763-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1782+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17641783
"""
17651784

17661785
upgradable_version_id: Optional[str]
17671786
"""
17681787
Update your database engine to a newer version.
17691788
This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade.
17701789
1771-
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id' could be set.
1790+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
1791+
"""
1792+
1793+
major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow]
1794+
"""
1795+
Upgrade your database engine to a new major version including instance endpoints.
1796+
1797+
One-of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set.
17721798
"""
17731799

17741800

0 commit comments

Comments
 (0)