|
51 | 51 | UpdateClusterRequest, |
52 | 52 | UpgradeClusterRequest, |
53 | 53 | SetClusterTypeRequest, |
| 54 | + MigrateToPrivateNetworkClusterRequest, |
54 | 55 | CreatePoolRequest, |
55 | 56 | UpgradePoolRequest, |
56 | 57 | UpdatePoolRequest, |
|
63 | 64 | from .marshalling import ( |
64 | 65 | marshal_CreateClusterRequest, |
65 | 66 | marshal_CreatePoolRequest, |
| 67 | + marshal_MigrateToPrivateNetworkClusterRequest, |
66 | 68 | marshal_SetClusterTypeRequest, |
67 | 69 | marshal_UpdateClusterRequest, |
68 | 70 | marshal_UpdatePoolRequest, |
@@ -665,6 +667,51 @@ async def reset_cluster_admin_token( |
665 | 667 | self._throw_on_error(res) |
666 | 668 | return None |
667 | 669 |
|
| 670 | + async def migrate_to_private_network_cluster( |
| 671 | + self, |
| 672 | + *, |
| 673 | + cluster_id: str, |
| 674 | + private_network_id: str, |
| 675 | + region: Optional[Region] = None, |
| 676 | + ) -> Cluster: |
| 677 | + """ |
| 678 | + Migrate an existing cluster to a Private Network cluster. |
| 679 | + Migrate a cluster that was created before the release of Private Network clusters to a new one with a Private Network. |
| 680 | + :param region: Region to target. If none is passed will use default region from the config. |
| 681 | + :param cluster_id: ID of the cluster to migrate. |
| 682 | + :param private_network_id: ID of the Private Network to link to the cluster. |
| 683 | + :return: :class:`Cluster <Cluster>` |
| 684 | +
|
| 685 | + Usage: |
| 686 | + :: |
| 687 | +
|
| 688 | + result = await api.migrate_to_private_network_cluster( |
| 689 | + cluster_id="example", |
| 690 | + private_network_id="example", |
| 691 | + ) |
| 692 | + """ |
| 693 | + |
| 694 | + param_region = validate_path_param( |
| 695 | + "region", region or self.client.default_region |
| 696 | + ) |
| 697 | + param_cluster_id = validate_path_param("cluster_id", cluster_id) |
| 698 | + |
| 699 | + res = self._request( |
| 700 | + "POST", |
| 701 | + f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-private-network", |
| 702 | + body=marshal_MigrateToPrivateNetworkClusterRequest( |
| 703 | + MigrateToPrivateNetworkClusterRequest( |
| 704 | + cluster_id=cluster_id, |
| 705 | + private_network_id=private_network_id, |
| 706 | + region=region, |
| 707 | + ), |
| 708 | + self.client, |
| 709 | + ), |
| 710 | + ) |
| 711 | + |
| 712 | + self._throw_on_error(res) |
| 713 | + return unmarshal_Cluster(res.json()) |
| 714 | + |
668 | 715 | async def list_pools( |
669 | 716 | self, |
670 | 717 | *, |
|
0 commit comments