Skip to content

Commit f3a9ec1

Browse files
authored
feat(k8s): expose MigrateClusterToSBSCSI (#647)
1 parent e2132a7 commit f3a9ec1

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
from .types import ListVersionsRequest
7070
from .types import ListVersionsResponse
7171
from .types import MigrateClusterToRoutedIPsRequest
72+
from .types import MigrateClusterToSBSCSIRequest
7273
from .types import NodeMetadata
7374
from .types import RebootNodeRequest
7475
from .types import ReplaceNodeRequest
@@ -150,6 +151,7 @@
150151
"ListVersionsRequest",
151152
"ListVersionsResponse",
152153
"MigrateClusterToRoutedIPsRequest",
154+
"MigrateClusterToSBSCSIRequest",
153155
"NodeMetadata",
154156
"RebootNodeRequest",
155157
"ReplaceNodeRequest",

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,41 @@ async def migrate_cluster_to_routed_i_ps(
749749
self._throw_on_error(res)
750750
return unmarshal_Cluster(res.json())
751751

752+
async def migrate_cluster_to_sbscsi(
753+
self,
754+
*,
755+
cluster_id: str,
756+
region: Optional[Region] = None,
757+
) -> Cluster:
758+
"""
759+
Migrate a cluster to SBS CSI.
760+
Enable the latest CSI compatible with Scaleway Block Storage (SBS) and migrate all existing PersistentVolumes/VolumeSnapshotContents to SBS.
761+
:param cluster_id: Cluster ID for which the latest CSI compatible with Scaleway Block Storage will be enabled.
762+
:param region: Region to target. If none is passed will use default region from the config.
763+
:return: :class:`Cluster <Cluster>`
764+
765+
Usage:
766+
::
767+
768+
result = await api.migrate_cluster_to_sbscsi(
769+
cluster_id="example",
770+
)
771+
"""
772+
773+
param_region = validate_path_param(
774+
"region", region or self.client.default_region
775+
)
776+
param_cluster_id = validate_path_param("cluster_id", cluster_id)
777+
778+
res = self._request(
779+
"POST",
780+
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-sbs-csi",
781+
body={},
782+
)
783+
784+
self._throw_on_error(res)
785+
return unmarshal_Cluster(res.json())
786+
752787
async def list_pools(
753788
self,
754789
*,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,19 @@ class MigrateClusterToRoutedIPsRequest:
17071707
"""
17081708

17091709

1710+
@dataclass
1711+
class MigrateClusterToSBSCSIRequest:
1712+
cluster_id: str
1713+
"""
1714+
Cluster ID for which the latest CSI compatible with Scaleway Block Storage will be enabled.
1715+
"""
1716+
1717+
region: Optional[Region]
1718+
"""
1719+
Region to target. If none is passed will use default region from the config.
1720+
"""
1721+
1722+
17101723
@dataclass
17111724
class NodeMetadata:
17121725
id: str

scaleway/scaleway/k8s/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
from .types import ListVersionsRequest
7070
from .types import ListVersionsResponse
7171
from .types import MigrateClusterToRoutedIPsRequest
72+
from .types import MigrateClusterToSBSCSIRequest
7273
from .types import NodeMetadata
7374
from .types import RebootNodeRequest
7475
from .types import ReplaceNodeRequest
@@ -150,6 +151,7 @@
150151
"ListVersionsRequest",
151152
"ListVersionsResponse",
152153
"MigrateClusterToRoutedIPsRequest",
154+
"MigrateClusterToSBSCSIRequest",
153155
"NodeMetadata",
154156
"RebootNodeRequest",
155157
"ReplaceNodeRequest",

scaleway/scaleway/k8s/v1/api.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,41 @@ def migrate_cluster_to_routed_i_ps(
749749
self._throw_on_error(res)
750750
return unmarshal_Cluster(res.json())
751751

752+
def migrate_cluster_to_sbscsi(
753+
self,
754+
*,
755+
cluster_id: str,
756+
region: Optional[Region] = None,
757+
) -> Cluster:
758+
"""
759+
Migrate a cluster to SBS CSI.
760+
Enable the latest CSI compatible with Scaleway Block Storage (SBS) and migrate all existing PersistentVolumes/VolumeSnapshotContents to SBS.
761+
:param cluster_id: Cluster ID for which the latest CSI compatible with Scaleway Block Storage will be enabled.
762+
:param region: Region to target. If none is passed will use default region from the config.
763+
:return: :class:`Cluster <Cluster>`
764+
765+
Usage:
766+
::
767+
768+
result = api.migrate_cluster_to_sbscsi(
769+
cluster_id="example",
770+
)
771+
"""
772+
773+
param_region = validate_path_param(
774+
"region", region or self.client.default_region
775+
)
776+
param_cluster_id = validate_path_param("cluster_id", cluster_id)
777+
778+
res = self._request(
779+
"POST",
780+
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-sbs-csi",
781+
body={},
782+
)
783+
784+
self._throw_on_error(res)
785+
return unmarshal_Cluster(res.json())
786+
752787
def list_pools(
753788
self,
754789
*,

scaleway/scaleway/k8s/v1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,19 @@ class MigrateClusterToRoutedIPsRequest:
17071707
"""
17081708

17091709

1710+
@dataclass
1711+
class MigrateClusterToSBSCSIRequest:
1712+
cluster_id: str
1713+
"""
1714+
Cluster ID for which the latest CSI compatible with Scaleway Block Storage will be enabled.
1715+
"""
1716+
1717+
region: Optional[Region]
1718+
"""
1719+
Region to target. If none is passed will use default region from the config.
1720+
"""
1721+
1722+
17101723
@dataclass
17111724
class NodeMetadata:
17121725
id: str

0 commit comments

Comments
 (0)