Skip to content
Open
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: 2 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
from .types import HostingApiGetHostingRequest
from .types import HostingApiGetResourceSummaryRequest
from .types import HostingApiListHostingsRequest
from .types import HostingApiMigrateControlPanelRequest
from .types import HostingApiRemoveCustomDomainRequest
from .types import HostingApiResetHostingPasswordRequest
from .types import HostingApiUpdateHostingRequest
Expand Down Expand Up @@ -242,6 +243,7 @@
"HostingApiGetHostingRequest",
"HostingApiGetResourceSummaryRequest",
"HostingApiListHostingsRequest",
"HostingApiMigrateControlPanelRequest",
"HostingApiRemoveCustomDomainRequest",
"HostingApiResetHostingPasswordRequest",
"HostingApiUpdateHostingRequest",
Expand Down
50 changes: 50 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
Hosting,
HostingApiAddCustomDomainRequest,
HostingApiCreateHostingRequest,
HostingApiMigrateControlPanelRequest,
HostingApiRemoveCustomDomainRequest,
HostingApiUpdateHostingRequest,
HostingSummary,
Expand Down Expand Up @@ -131,6 +132,7 @@
marshal_FtpAccountApiCreateFtpAccountRequest,
marshal_HostingApiAddCustomDomainRequest,
marshal_HostingApiCreateHostingRequest,
marshal_HostingApiMigrateControlPanelRequest,
marshal_HostingApiRemoveCustomDomainRequest,
marshal_HostingApiUpdateHostingRequest,
marshal_MailAccountApiChangeMailAccountPasswordRequest,
Expand Down Expand Up @@ -2032,6 +2034,54 @@ async def remove_custom_domain(
self._throw_on_error(res)
return unmarshal_HostingSummary(res.json())

async def migrate_control_panel(
self,
*,
hosting_id: str,
control_panel_name: str,
offer_id: str,
region: Optional[ScwRegion] = None,
) -> HostingSummary:
"""
Migrate a hosting to a new control panel.
:param hosting_id: Hosting ID to migrate to a new control panel.
:param control_panel_name: Control panel will migrate the hosting to a new server.
:param offer_id: Migration.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`HostingSummary <HostingSummary>`

Usage:
::

result = await api.migrate_control_panel(
hosting_id="example",
control_panel_name="example",
offer_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_hosting_id = validate_path_param("hosting_id", hosting_id)

res = self._request(
"POST",
f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/migrate-control-panel",
body=marshal_HostingApiMigrateControlPanelRequest(
HostingApiMigrateControlPanelRequest(
hosting_id=hosting_id,
control_panel_name=control_panel_name,
offer_id=offer_id,
region=region,
),
self.client,
),
)

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


class WebhostingV1FreeDomainAPI(API):
"""
Expand Down
16 changes: 16 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
CreateHostingRequestDomainConfiguration,
OfferOptionRequest,
HostingApiCreateHostingRequest,
HostingApiMigrateControlPanelRequest,
HostingApiRemoveCustomDomainRequest,
HostingApiUpdateHostingRequest,
MailAccountApiChangeMailAccountPasswordRequest,
Expand Down Expand Up @@ -2074,6 +2075,21 @@ def marshal_HostingApiCreateHostingRequest(
return output


def marshal_HostingApiMigrateControlPanelRequest(
request: HostingApiMigrateControlPanelRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

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

return output


def marshal_HostingApiRemoveCustomDomainRequest(
request: HostingApiRemoveCustomDomainRequest,
defaults: ProfileDefaults,
Expand Down
23 changes: 23 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,29 @@ class HostingApiListHostingsRequest:
"""


@dataclass
class HostingApiMigrateControlPanelRequest:
hosting_id: str
"""
Hosting ID to migrate to a new control panel.
"""

control_panel_name: str
"""
Control panel will migrate the hosting to a new server.
"""

offer_id: str
"""
Migration.
"""

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


@dataclass
class HostingApiRemoveCustomDomainRequest:
hosting_id: str
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/webhosting/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
from .types import HostingApiGetHostingRequest
from .types import HostingApiGetResourceSummaryRequest
from .types import HostingApiListHostingsRequest
from .types import HostingApiMigrateControlPanelRequest
from .types import HostingApiRemoveCustomDomainRequest
from .types import HostingApiResetHostingPasswordRequest
from .types import HostingApiUpdateHostingRequest
Expand Down Expand Up @@ -242,6 +243,7 @@
"HostingApiGetHostingRequest",
"HostingApiGetResourceSummaryRequest",
"HostingApiListHostingsRequest",
"HostingApiMigrateControlPanelRequest",
"HostingApiRemoveCustomDomainRequest",
"HostingApiResetHostingPasswordRequest",
"HostingApiUpdateHostingRequest",
Expand Down
50 changes: 50 additions & 0 deletions scaleway/scaleway/webhosting/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
Hosting,
HostingApiAddCustomDomainRequest,
HostingApiCreateHostingRequest,
HostingApiMigrateControlPanelRequest,
HostingApiRemoveCustomDomainRequest,
HostingApiUpdateHostingRequest,
HostingSummary,
Expand Down Expand Up @@ -131,6 +132,7 @@
marshal_FtpAccountApiCreateFtpAccountRequest,
marshal_HostingApiAddCustomDomainRequest,
marshal_HostingApiCreateHostingRequest,
marshal_HostingApiMigrateControlPanelRequest,
marshal_HostingApiRemoveCustomDomainRequest,
marshal_HostingApiUpdateHostingRequest,
marshal_MailAccountApiChangeMailAccountPasswordRequest,
Expand Down Expand Up @@ -2032,6 +2034,54 @@ def remove_custom_domain(
self._throw_on_error(res)
return unmarshal_HostingSummary(res.json())

def migrate_control_panel(
self,
*,
hosting_id: str,
control_panel_name: str,
offer_id: str,
region: Optional[ScwRegion] = None,
) -> HostingSummary:
"""
Migrate a hosting to a new control panel.
:param hosting_id: Hosting ID to migrate to a new control panel.
:param control_panel_name: Control panel will migrate the hosting to a new server.
:param offer_id: Migration.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`HostingSummary <HostingSummary>`

Usage:
::

result = api.migrate_control_panel(
hosting_id="example",
control_panel_name="example",
offer_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_hosting_id = validate_path_param("hosting_id", hosting_id)

res = self._request(
"POST",
f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/migrate-control-panel",
body=marshal_HostingApiMigrateControlPanelRequest(
HostingApiMigrateControlPanelRequest(
hosting_id=hosting_id,
control_panel_name=control_panel_name,
offer_id=offer_id,
region=region,
),
self.client,
),
)

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


class WebhostingV1FreeDomainAPI(API):
"""
Expand Down
16 changes: 16 additions & 0 deletions scaleway/scaleway/webhosting/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
CreateHostingRequestDomainConfiguration,
OfferOptionRequest,
HostingApiCreateHostingRequest,
HostingApiMigrateControlPanelRequest,
HostingApiRemoveCustomDomainRequest,
HostingApiUpdateHostingRequest,
MailAccountApiChangeMailAccountPasswordRequest,
Expand Down Expand Up @@ -2074,6 +2075,21 @@ def marshal_HostingApiCreateHostingRequest(
return output


def marshal_HostingApiMigrateControlPanelRequest(
request: HostingApiMigrateControlPanelRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

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

return output


def marshal_HostingApiRemoveCustomDomainRequest(
request: HostingApiRemoveCustomDomainRequest,
defaults: ProfileDefaults,
Expand Down
23 changes: 23 additions & 0 deletions scaleway/scaleway/webhosting/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,29 @@ class HostingApiListHostingsRequest:
"""


@dataclass
class HostingApiMigrateControlPanelRequest:
hosting_id: str
"""
Hosting ID to migrate to a new control panel.
"""

control_panel_name: str
"""
Control panel will migrate the hosting to a new server.
"""

offer_id: str
"""
Migration.
"""

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


@dataclass
class HostingApiRemoveCustomDomainRequest:
hosting_id: str
Expand Down