@@ -1625,6 +1625,14 @@ type ListVersionsResponse struct {
16251625 Versions []* Version `json:"versions"`
16261626}
16271627
1628+ // MigrateClusterToRoutedIPsRequest: migrate cluster to routed i ps request.
1629+ type MigrateClusterToRoutedIPsRequest struct {
1630+ // Region: region to target. If none is passed will use default region from the config.
1631+ Region scw.Region `json:"-"`
1632+
1633+ ClusterID string `json:"-"`
1634+ }
1635+
16281636// MigrateToPrivateNetworkClusterRequest: migrate to private network cluster request.
16291637type MigrateToPrivateNetworkClusterRequest struct {
16301638 // Region: region to target. If none is passed will use default region from the config.
@@ -2219,6 +2227,42 @@ func (s *API) MigrateToPrivateNetworkCluster(req *MigrateToPrivateNetworkCluster
22192227 return & resp , nil
22202228}
22212229
2230+ // MigrateClusterToRoutedIPs: Migrate the nodes of an existing cluster to Routed IPs and enable Routed IPs for all future nodes.
2231+ func (s * API ) MigrateClusterToRoutedIPs (req * MigrateClusterToRoutedIPsRequest , opts ... scw.RequestOption ) (* Cluster , error ) {
2232+ var err error
2233+
2234+ if req .Region == "" {
2235+ defaultRegion , _ := s .client .GetDefaultRegion ()
2236+ req .Region = defaultRegion
2237+ }
2238+
2239+ if fmt .Sprint (req .Region ) == "" {
2240+ return nil , errors .New ("field Region cannot be empty in request" )
2241+ }
2242+
2243+ if fmt .Sprint (req .ClusterID ) == "" {
2244+ return nil , errors .New ("field ClusterID cannot be empty in request" )
2245+ }
2246+
2247+ scwReq := & scw.ScalewayRequest {
2248+ Method : "POST" ,
2249+ Path : "/k8s/v1/regions/" + fmt .Sprint (req .Region ) + "/clusters/" + fmt .Sprint (req .ClusterID ) + "/migrate-to-routed-ips" ,
2250+ }
2251+
2252+ err = scwReq .SetBody (req )
2253+ if err != nil {
2254+ return nil , err
2255+ }
2256+
2257+ var resp Cluster
2258+
2259+ err = s .client .Do (scwReq , & resp , opts ... )
2260+ if err != nil {
2261+ return nil , err
2262+ }
2263+ return & resp , nil
2264+ }
2265+
22222266// ListPools: List all the existing pools for a specific Kubernetes cluster.
22232267func (s * API ) ListPools (req * ListPoolsRequest , opts ... scw.RequestOption ) (* ListPoolsResponse , error ) {
22242268 var err error
0 commit comments