diff --git a/packages/clients/src/api/k8s/v1/api.gen.ts b/packages/clients/src/api/k8s/v1/api.gen.ts index f9360e1e8..d02a52ef2 100644 --- a/packages/clients/src/api/k8s/v1/api.gen.ts +++ b/packages/clients/src/api/k8s/v1/api.gen.ts @@ -16,6 +16,7 @@ import { import { marshalCreateClusterRequest, marshalCreatePoolRequest, + marshalMigrateToPrivateNetworkClusterRequest, marshalSetClusterTypeRequest, marshalUpdateClusterRequest, marshalUpdatePoolRequest, @@ -55,6 +56,7 @@ import type { ListPoolsResponse, ListVersionsRequest, ListVersionsResponse, + MigrateToPrivateNetworkClusterRequest, Node, Pool, RebootNodeRequest, @@ -338,6 +340,38 @@ export class API extends ParentAPI { )}/reset-admin-token`, }) + /** + * Migrate an existing cluster to a Private Network cluster. Migrate a cluster + * that was created before the release of Private Network clusters to a new + * one with a Private Network. + * + * @param request - The request {@link MigrateToPrivateNetworkClusterRequest} + * @returns A Promise of Cluster + */ + migrateToPrivateNetworkCluster = ( + request: Readonly, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalMigrateToPrivateNetworkClusterRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/k8s/v1/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/clusters/${validatePathParam( + 'clusterId', + request.clusterId, + )}/migrate-to-private-network`, + }, + unmarshalCluster, + ) + protected pageOfListPools = (request: Readonly) => this.client.fetch( { diff --git a/packages/clients/src/api/k8s/v1/index.gen.ts b/packages/clients/src/api/k8s/v1/index.gen.ts index 6e1f077bb..b71213f13 100644 --- a/packages/clients/src/api/k8s/v1/index.gen.ts +++ b/packages/clients/src/api/k8s/v1/index.gen.ts @@ -44,6 +44,7 @@ export type { ListVersionsResponse, MaintenanceWindow, MaintenanceWindowDayOfTheWeek, + MigrateToPrivateNetworkClusterRequest, Node, NodeStatus, Pool, diff --git a/packages/clients/src/api/k8s/v1/marshalling.gen.ts b/packages/clients/src/api/k8s/v1/marshalling.gen.ts index ea3a53a02..55d69ff3f 100644 --- a/packages/clients/src/api/k8s/v1/marshalling.gen.ts +++ b/packages/clients/src/api/k8s/v1/marshalling.gen.ts @@ -28,6 +28,7 @@ import type { ListPoolsResponse, ListVersionsResponse, MaintenanceWindow, + MigrateToPrivateNetworkClusterRequest, Node, Pool, PoolUpgradePolicy, @@ -534,6 +535,13 @@ export const marshalCreatePoolRequest = ( zone: request.zone ?? defaults.defaultZone, }) +export const marshalMigrateToPrivateNetworkClusterRequest = ( + request: MigrateToPrivateNetworkClusterRequest, + defaults: DefaultValues, +): Record => ({ + private_network_id: request.privateNetworkId, +}) + export const marshalSetClusterTypeRequest = ( request: SetClusterTypeRequest, defaults: DefaultValues, diff --git a/packages/clients/src/api/k8s/v1/types.gen.ts b/packages/clients/src/api/k8s/v1/types.gen.ts index cacdfffa9..2f3c54f13 100644 --- a/packages/clients/src/api/k8s/v1/types.gen.ts +++ b/packages/clients/src/api/k8s/v1/types.gen.ts @@ -928,6 +928,18 @@ export type ResetClusterAdminTokenRequest = { clusterId: string } +export type MigrateToPrivateNetworkClusterRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** ID of the cluster to migrate. */ + clusterId: string + /** ID of the Private Network to link to the cluster. */ + privateNetworkId: string +} + export type ListPoolsRequest = { /** * Region to target. If none is passed will use default region from the