@@ -2317,6 +2317,21 @@ type HostingAPIListHostingsRequest struct {
23172317 Subdomain * string `json:"-"`
23182318}
23192319
2320+ // HostingAPIMigrateControlPanelRequest: hosting api migrate control panel request.
2321+ type HostingAPIMigrateControlPanelRequest struct {
2322+ // Region: region to target. If none is passed will use default region from the config.
2323+ Region scw.Region `json:"-"`
2324+
2325+ // HostingID: hosting ID to migrate to a new control panel.
2326+ HostingID string `json:"-"`
2327+
2328+ // ControlPanelName: control panel will migrate the hosting to a new server.
2329+ ControlPanelName string `json:"control_panel_name"`
2330+
2331+ // OfferID: migration.
2332+ OfferID string `json:"offer_id"`
2333+ }
2334+
23202335// HostingAPIRemoveCustomDomainRequest: hosting api remove custom domain request.
23212336type HostingAPIRemoveCustomDomainRequest struct {
23222337 // Region: region to target. If none is passed will use default region from the config.
@@ -4409,6 +4424,42 @@ func (s *HostingAPI) RemoveCustomDomain(req *HostingAPIRemoveCustomDomainRequest
44094424 return & resp , nil
44104425}
44114426
4427+ // MigrateControlPanel: Migrate a hosting to a new control panel.
4428+ func (s * HostingAPI ) MigrateControlPanel (req * HostingAPIMigrateControlPanelRequest , opts ... scw.RequestOption ) (* HostingSummary , error ) {
4429+ var err error
4430+
4431+ if req .Region == "" {
4432+ defaultRegion , _ := s .client .GetDefaultRegion ()
4433+ req .Region = defaultRegion
4434+ }
4435+
4436+ if fmt .Sprint (req .Region ) == "" {
4437+ return nil , errors .New ("field Region cannot be empty in request" )
4438+ }
4439+
4440+ if fmt .Sprint (req .HostingID ) == "" {
4441+ return nil , errors .New ("field HostingID cannot be empty in request" )
4442+ }
4443+
4444+ scwReq := & scw.ScalewayRequest {
4445+ Method : "POST" ,
4446+ Path : "/webhosting/v1/regions/" + fmt .Sprint (req .Region ) + "/hostings/" + fmt .Sprint (req .HostingID ) + "/migrate-control-panel" ,
4447+ }
4448+
4449+ err = scwReq .SetBody (req )
4450+ if err != nil {
4451+ return nil , err
4452+ }
4453+
4454+ var resp HostingSummary
4455+
4456+ err = s .client .Do (scwReq , & resp , opts ... )
4457+ if err != nil {
4458+ return nil , err
4459+ }
4460+ return & resp , nil
4461+ }
4462+
44124463// This API allows you to list and check a free domain's validity.
44134464type FreeDomainAPI struct {
44144465 client * scw.Client
0 commit comments