Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions packages/clients/src/api/k8s/v1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import {
marshalCreateClusterRequest,
marshalCreatePoolRequest,
marshalMigrateToPrivateNetworkClusterRequest,
marshalSetClusterTypeRequest,
marshalUpdateClusterRequest,
marshalUpdatePoolRequest,
Expand Down Expand Up @@ -55,6 +56,7 @@ import type {
ListPoolsResponse,
ListVersionsRequest,
ListVersionsResponse,
MigrateToPrivateNetworkClusterRequest,
Node,
Pool,
RebootNodeRequest,
Expand Down Expand Up @@ -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<MigrateToPrivateNetworkClusterRequest>,
) =>
this.client.fetch<Cluster>(
{
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<ListPoolsRequest>) =>
this.client.fetch<ListPoolsResponse>(
{
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/k8s/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type {
ListVersionsResponse,
MaintenanceWindow,
MaintenanceWindowDayOfTheWeek,
MigrateToPrivateNetworkClusterRequest,
Node,
NodeStatus,
Pool,
Expand Down
8 changes: 8 additions & 0 deletions packages/clients/src/api/k8s/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {
ListPoolsResponse,
ListVersionsResponse,
MaintenanceWindow,
MigrateToPrivateNetworkClusterRequest,
Node,
Pool,
PoolUpgradePolicy,
Expand Down Expand Up @@ -534,6 +535,13 @@ export const marshalCreatePoolRequest = (
zone: request.zone ?? defaults.defaultZone,
})

export const marshalMigrateToPrivateNetworkClusterRequest = (
request: MigrateToPrivateNetworkClusterRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
private_network_id: request.privateNetworkId,
})

export const marshalSetClusterTypeRequest = (
request: SetClusterTypeRequest,
defaults: DefaultValues,
Expand Down
12 changes: 12 additions & 0 deletions packages/clients/src/api/k8s/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down