|
49 | 49 | Hosting, |
50 | 50 | HostingApiAddCustomDomainRequest, |
51 | 51 | HostingApiCreateHostingRequest, |
| 52 | + HostingApiMigrateControlPanelRequest, |
52 | 53 | HostingApiRemoveCustomDomainRequest, |
53 | 54 | HostingApiUpdateHostingRequest, |
54 | 55 | HostingSummary, |
|
131 | 132 | marshal_FtpAccountApiCreateFtpAccountRequest, |
132 | 133 | marshal_HostingApiAddCustomDomainRequest, |
133 | 134 | marshal_HostingApiCreateHostingRequest, |
| 135 | + marshal_HostingApiMigrateControlPanelRequest, |
134 | 136 | marshal_HostingApiRemoveCustomDomainRequest, |
135 | 137 | marshal_HostingApiUpdateHostingRequest, |
136 | 138 | marshal_MailAccountApiChangeMailAccountPasswordRequest, |
@@ -2032,6 +2034,54 @@ async def remove_custom_domain( |
2032 | 2034 | self._throw_on_error(res) |
2033 | 2035 | return unmarshal_HostingSummary(res.json()) |
2034 | 2036 |
|
| 2037 | + async def migrate_control_panel( |
| 2038 | + self, |
| 2039 | + *, |
| 2040 | + hosting_id: str, |
| 2041 | + control_panel_name: str, |
| 2042 | + offer_id: str, |
| 2043 | + region: Optional[ScwRegion] = None, |
| 2044 | + ) -> HostingSummary: |
| 2045 | + """ |
| 2046 | + Migrate a hosting to a new control panel. |
| 2047 | + :param hosting_id: Hosting ID to migrate to a new control panel. |
| 2048 | + :param control_panel_name: Control panel will migrate the hosting to a new server. |
| 2049 | + :param offer_id: Migration. |
| 2050 | + :param region: Region to target. If none is passed will use default region from the config. |
| 2051 | + :return: :class:`HostingSummary <HostingSummary>` |
| 2052 | +
|
| 2053 | + Usage: |
| 2054 | + :: |
| 2055 | +
|
| 2056 | + result = await api.migrate_control_panel( |
| 2057 | + hosting_id="example", |
| 2058 | + control_panel_name="example", |
| 2059 | + offer_id="example", |
| 2060 | + ) |
| 2061 | + """ |
| 2062 | + |
| 2063 | + param_region = validate_path_param( |
| 2064 | + "region", region or self.client.default_region |
| 2065 | + ) |
| 2066 | + param_hosting_id = validate_path_param("hosting_id", hosting_id) |
| 2067 | + |
| 2068 | + res = self._request( |
| 2069 | + "POST", |
| 2070 | + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/migrate-control-panel", |
| 2071 | + body=marshal_HostingApiMigrateControlPanelRequest( |
| 2072 | + HostingApiMigrateControlPanelRequest( |
| 2073 | + hosting_id=hosting_id, |
| 2074 | + control_panel_name=control_panel_name, |
| 2075 | + offer_id=offer_id, |
| 2076 | + region=region, |
| 2077 | + ), |
| 2078 | + self.client, |
| 2079 | + ), |
| 2080 | + ) |
| 2081 | + |
| 2082 | + self._throw_on_error(res) |
| 2083 | + return unmarshal_HostingSummary(res.json()) |
| 2084 | + |
2035 | 2085 |
|
2036 | 2086 | class WebhostingV1FreeDomainAPI(API): |
2037 | 2087 | """ |
|
0 commit comments