Skip to content

feat(k8s): remove MigrateToPrivateNetwork rpc #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions scaleway-async/scaleway_async/k8s/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
from .types import ListVersionsRequest
from .types import ListVersionsResponse
from .types import MigrateClusterToRoutedIPsRequest
from .types import MigrateToPrivateNetworkClusterRequest
from .types import RebootNodeRequest
from .types import ReplaceNodeRequest
from .types import ResetClusterAdminTokenRequest
Expand Down Expand Up @@ -142,7 +141,6 @@
"ListVersionsRequest",
"ListVersionsResponse",
"MigrateClusterToRoutedIPsRequest",
"MigrateToPrivateNetworkClusterRequest",
"RebootNodeRequest",
"ReplaceNodeRequest",
"ResetClusterAdminTokenRequest",
Expand Down
47 changes: 0 additions & 47 deletions scaleway-async/scaleway_async/k8s/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
ListNodesResponse,
ListPoolsResponse,
ListVersionsResponse,
MigrateToPrivateNetworkClusterRequest,
Node,
Pool,
SetClusterTypeRequest,
Expand Down Expand Up @@ -78,7 +77,6 @@
unmarshal_ListVersionsResponse,
marshal_CreateClusterRequest,
marshal_CreatePoolRequest,
marshal_MigrateToPrivateNetworkClusterRequest,
marshal_SetClusterTypeRequest,
marshal_UpdateClusterRequest,
marshal_UpdatePoolRequest,
Expand Down Expand Up @@ -712,51 +710,6 @@ async def reset_cluster_admin_token(

self._throw_on_error(res)

async def migrate_to_private_network_cluster(
self,
*,
cluster_id: str,
private_network_id: str,
region: Optional[Region] = None,
) -> Cluster:
"""
Migrate an existing cluster to a Private Network cluster.
Migrate a cluster that was created before the release of Private Network clusters to a new one with a Private Network.
:param cluster_id: ID of the cluster to migrate.
:param private_network_id: ID of the Private Network to link to the cluster.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Cluster <Cluster>`

Usage:
::

result = await api.migrate_to_private_network_cluster(
cluster_id="example",
private_network_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_cluster_id = validate_path_param("cluster_id", cluster_id)

res = self._request(
"POST",
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-private-network",
body=marshal_MigrateToPrivateNetworkClusterRequest(
MigrateToPrivateNetworkClusterRequest(
cluster_id=cluster_id,
private_network_id=private_network_id,
region=region,
),
self.client,
),
)

self._throw_on_error(res)
return unmarshal_Cluster(res.json())

async def migrate_cluster_to_routed_i_ps(
self,
*,
Expand Down
13 changes: 0 additions & 13 deletions scaleway-async/scaleway_async/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
CreateClusterRequest,
CreatePoolRequestUpgradePolicy,
CreatePoolRequest,
MigrateToPrivateNetworkClusterRequest,
SetClusterTypeRequest,
UpdateClusterRequestAutoUpgrade,
UpdateClusterRequestAutoscalerConfig,
Expand Down Expand Up @@ -1178,18 +1177,6 @@ def marshal_CreatePoolRequest(
return output


def marshal_MigrateToPrivateNetworkClusterRequest(
request: MigrateToPrivateNetworkClusterRequest,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


def marshal_SetClusterTypeRequest(
request: SetClusterTypeRequest,
defaults: ProfileDefaults,
Expand Down
18 changes: 0 additions & 18 deletions scaleway-async/scaleway_async/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1657,24 +1657,6 @@ class MigrateClusterToRoutedIPsRequest:
"""


@dataclass
class MigrateToPrivateNetworkClusterRequest:
cluster_id: str
"""
ID of the cluster to migrate.
"""

private_network_id: str
"""
ID of the Private Network to link to the cluster.
"""

region: Optional[Region]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class RebootNodeRequest:
node_id: str
Expand Down
2 changes: 0 additions & 2 deletions scaleway/scaleway/k8s/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
from .types import ListVersionsRequest
from .types import ListVersionsResponse
from .types import MigrateClusterToRoutedIPsRequest
from .types import MigrateToPrivateNetworkClusterRequest
from .types import RebootNodeRequest
from .types import ReplaceNodeRequest
from .types import ResetClusterAdminTokenRequest
Expand Down Expand Up @@ -142,7 +141,6 @@
"ListVersionsRequest",
"ListVersionsResponse",
"MigrateClusterToRoutedIPsRequest",
"MigrateToPrivateNetworkClusterRequest",
"RebootNodeRequest",
"ReplaceNodeRequest",
"ResetClusterAdminTokenRequest",
Expand Down
47 changes: 0 additions & 47 deletions scaleway/scaleway/k8s/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
ListNodesResponse,
ListPoolsResponse,
ListVersionsResponse,
MigrateToPrivateNetworkClusterRequest,
Node,
Pool,
SetClusterTypeRequest,
Expand Down Expand Up @@ -78,7 +77,6 @@
unmarshal_ListVersionsResponse,
marshal_CreateClusterRequest,
marshal_CreatePoolRequest,
marshal_MigrateToPrivateNetworkClusterRequest,
marshal_SetClusterTypeRequest,
marshal_UpdateClusterRequest,
marshal_UpdatePoolRequest,
Expand Down Expand Up @@ -712,51 +710,6 @@ def reset_cluster_admin_token(

self._throw_on_error(res)

def migrate_to_private_network_cluster(
self,
*,
cluster_id: str,
private_network_id: str,
region: Optional[Region] = None,
) -> Cluster:
"""
Migrate an existing cluster to a Private Network cluster.
Migrate a cluster that was created before the release of Private Network clusters to a new one with a Private Network.
:param cluster_id: ID of the cluster to migrate.
:param private_network_id: ID of the Private Network to link to the cluster.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Cluster <Cluster>`

Usage:
::

result = api.migrate_to_private_network_cluster(
cluster_id="example",
private_network_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_cluster_id = validate_path_param("cluster_id", cluster_id)

res = self._request(
"POST",
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-private-network",
body=marshal_MigrateToPrivateNetworkClusterRequest(
MigrateToPrivateNetworkClusterRequest(
cluster_id=cluster_id,
private_network_id=private_network_id,
region=region,
),
self.client,
),
)

self._throw_on_error(res)
return unmarshal_Cluster(res.json())

def migrate_cluster_to_routed_i_ps(
self,
*,
Expand Down
13 changes: 0 additions & 13 deletions scaleway/scaleway/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
CreateClusterRequest,
CreatePoolRequestUpgradePolicy,
CreatePoolRequest,
MigrateToPrivateNetworkClusterRequest,
SetClusterTypeRequest,
UpdateClusterRequestAutoUpgrade,
UpdateClusterRequestAutoscalerConfig,
Expand Down Expand Up @@ -1178,18 +1177,6 @@ def marshal_CreatePoolRequest(
return output


def marshal_MigrateToPrivateNetworkClusterRequest(
request: MigrateToPrivateNetworkClusterRequest,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.private_network_id is not None:
output["private_network_id"] = request.private_network_id

return output


def marshal_SetClusterTypeRequest(
request: SetClusterTypeRequest,
defaults: ProfileDefaults,
Expand Down
18 changes: 0 additions & 18 deletions scaleway/scaleway/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1657,24 +1657,6 @@ class MigrateClusterToRoutedIPsRequest:
"""


@dataclass
class MigrateToPrivateNetworkClusterRequest:
cluster_id: str
"""
ID of the cluster to migrate.
"""

private_network_id: str
"""
ID of the Private Network to link to the cluster.
"""

region: Optional[Region]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class RebootNodeRequest:
node_id: str
Expand Down