Skip to content

Commit 91d5d6f

Browse files
authored
feat(instance): use the new 'IP Mobility' network stack (#709)
1 parent a28d914 commit 91d5d6f

File tree

6 files changed

+91
-5
lines changed

6 files changed

+91
-5
lines changed

packages/clients/src/api/instance/v1/api.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ export class API extends ParentAPI {
439439
* keep the slot on the hypervisor. `reboot`: Stop the instance and restart
440440
* it. `backup`: Create an image with all the volumes of an Instance.
441441
* `terminate`: Delete the Instance along with all attached volumes.
442+
* `enable_routed_ip`: Migrate the Instance to the new network stack.
442443
*
443444
* Keep in mind that terminating an Instance will result in the deletion of
444445
* all attached volumes, including local and block storage. If you want to

packages/clients/src/api/instance/v1/content.gen.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
import type {
44
ImageState,
5+
IpState,
56
PrivateNICState,
67
SecurityGroupState,
78
ServerState,
@@ -14,6 +15,9 @@ import type {
1415
/** Lists transient statutes of the enum {@link ImageState}. */
1516
export const IMAGE_TRANSIENT_STATUSES: ImageState[] = ['creating']
1617

18+
/** Lists transient statutes of the enum {@link IpState}. */
19+
export const IP_TRANSIENT_STATUSES: IpState[] = ['pending']
20+
1721
/** Lists transient statutes of the enum {@link PrivateNICState}. */
1822
export const PRIVATE_NIC_TRANSIENT_STATUSES: PrivateNICState[] = ['syncing']
1923

packages/clients/src/api/instance/v1/index.gen.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export type {
6666
Image,
6767
ImageState,
6868
Ip,
69+
IpState,
70+
IpType,
6971
ListBootscriptsRequest,
7072
ListBootscriptsResponse,
7173
ListDefaultSecurityGroupRulesRequest,
@@ -117,6 +119,8 @@ export type {
117119
ServerActionRequestVolumeBackupTemplate,
118120
ServerActionResponse,
119121
ServerIp,
122+
ServerIpIpFamily,
123+
ServerIpProvisioningMode,
120124
ServerIpv6,
121125
ServerLocation,
122126
ServerMaintenance,

packages/clients/src/api/instance/v1/marshalling.gen.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ const unmarshalServerIp = (data: unknown) => {
312312
return {
313313
address: data.address,
314314
dynamic: data.dynamic,
315+
family: data.family,
316+
gateway: data.gateway,
315317
id: data.id,
318+
netmask: data.netmask,
319+
provisioningMode: data.provisioning_mode,
316320
} as ServerIp
317321
}
318322

@@ -506,10 +510,13 @@ const unmarshalIp = (data: unknown) => {
506510
address: data.address,
507511
id: data.id,
508512
organization: data.organization,
513+
prefix: data.prefix,
509514
project: data.project,
510515
reverse: data.reverse,
511516
server: data.server ? unmarshalServerSummary(data.server) : undefined,
517+
state: data.state,
512518
tags: data.tags,
519+
type: data.type,
513520
zone: data.zone,
514521
} as Ip
515522
}
@@ -602,6 +609,7 @@ const unmarshalServer = (data: unknown) => {
602609
location: data.location
603610
? unmarshalServerLocation(data.location)
604611
: undefined,
612+
macAddress: data.mac_address,
605613
maintenances: unmarshalArrayOfObject(
606614
data.maintenances,
607615
unmarshalServerMaintenance,
@@ -617,6 +625,8 @@ const unmarshalServer = (data: unknown) => {
617625
project: data.project,
618626
protected: data.protected,
619627
publicIp: data.public_ip ? unmarshalServerIp(data.public_ip) : undefined,
628+
publicIps: unmarshalArrayOfObject(data.public_ips, unmarshalServerIp),
629+
routedIpEnabled: data.routed_ip_enabled,
620630
securityGroup: data.security_group
621631
? unmarshalSecurityGroupSummary(data.security_group)
622632
: undefined,
@@ -1521,7 +1531,11 @@ const marshalServerIp = (
15211531
): Record<string, unknown> => ({
15221532
address: request.address,
15231533
dynamic: request.dynamic,
1534+
family: request.family,
1535+
gateway: request.gateway,
15241536
id: request.id,
1537+
netmask: request.netmask,
1538+
provisioning_mode: request.provisioningMode,
15251539
})
15261540

15271541
const marshalServerIpv6 = (
@@ -1648,6 +1662,7 @@ export const marshalCreateIpRequest = (
16481662
): Record<string, unknown> => ({
16491663
server: request.server,
16501664
tags: request.tags,
1665+
type: request.type ?? 'unknown_iptype',
16511666
...resolveOneOf([
16521667
{
16531668
default: defaults.defaultProjectId,
@@ -1754,6 +1769,8 @@ export const marshalCreateServerRequest = (
17541769
name: request.name || randomName('srv'),
17551770
placement_group: request.placementGroup,
17561771
public_ip: request.publicIp,
1772+
public_ips: request.publicIps,
1773+
routed_ip_enabled: request.routedIpEnabled,
17571774
security_group: request.securityGroup,
17581775
tags: request.tags,
17591776
volumes: request.volumes
@@ -2003,6 +2020,10 @@ export const marshalSetServerRequest = (
20032020
public_ip: request.publicIp
20042021
? marshalServerIp(request.publicIp, defaults)
20052022
: undefined,
2023+
public_ips: request.publicIps
2024+
? request.publicIps.map(elt => marshalServerIp(elt, defaults))
2025+
: undefined,
2026+
routed_ip_enabled: request.routedIpEnabled,
20062027
security_group: request.securityGroup
20072028
? marshalSecurityGroupSummary(request.securityGroup, defaults)
20082029
: undefined,
@@ -2046,6 +2067,7 @@ export const marshalUpdateIpRequest = (
20462067
reverse: request.reverse,
20472068
server: request.server,
20482069
tags: request.tags,
2070+
type: request.type ?? 'unknown_iptype',
20492071
})
20502072

20512073
export const marshalUpdatePlacementGroupRequest = (
@@ -2086,6 +2108,10 @@ export const marshalUpdateServerRequest = (
20862108
? request.privateNics.map(elt => marshalPrivateNIC(elt, defaults))
20872109
: undefined,
20882110
protected: request.protected,
2111+
public_ips: request.publicIps
2112+
? request.publicIps.map(elt => marshalServerIp(elt, defaults))
2113+
: undefined,
2114+
routed_ip_enabled: request.routedIpEnabled,
20892115
security_group: request.securityGroup
20902116
? marshalSecurityGroupTemplate(request.securityGroup, defaults)
20912117
: undefined,

packages/clients/src/api/instance/v1/types.gen.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ export type BootType = 'local' | 'bootscript' | 'rescue'
88

99
export type ImageState = 'available' | 'creating' | 'error'
1010

11+
export type IpState =
12+
| 'unknown_state'
13+
| 'detached'
14+
| 'attached'
15+
| 'pending'
16+
| 'error'
17+
18+
export type IpType = 'unknown_iptype' | 'nat' | 'routed_ipv4' | 'routed_ipv6'
19+
1120
export type ListServersRequestOrder =
1221
| 'creation_date_desc'
1322
| 'creation_date_asc'
@@ -38,6 +47,10 @@ export type ServerAction =
3847
| 'terminate'
3948
| 'reboot'
4049

50+
export type ServerIpIpFamily = 'inet' | 'inet6'
51+
52+
export type ServerIpProvisioningMode = 'manual' | 'dhcp' | 'slaac'
53+
4154
export type ServerState =
4255
| 'running'
4356
| 'stopped'
@@ -267,6 +280,9 @@ export interface Ip {
267280
organization: string
268281
tags: string[]
269282
project: string
283+
type: IpType
284+
state: IpState
285+
prefix: string
270286
zone: Zone
271287
}
272288

@@ -510,8 +526,10 @@ export interface Server {
510526
commercialType: string
511527
/** Instance creation date. */
512528
creationDate?: Date
513-
/** True if a dynamic IP is required. */
529+
/** True if a dynamic IPv4 is required. */
514530
dynamicIpRequired: boolean
531+
/** True to configure the instance so it uses the new routed IP mode. */
532+
routedIpEnabled: boolean
515533
/** True if IPv6 is enabled. */
516534
enableIpv6: boolean
517535
/** Instance host name. */
@@ -524,6 +542,10 @@ export interface Server {
524542
privateIp?: string
525543
/** Information about the public IP. */
526544
publicIp?: ServerIp
545+
/** Information about all the public IPs attached to the server. */
546+
publicIps: ServerIp[]
547+
/** The server's MAC address. */
548+
macAddress: string
527549
/** Instance modification date. */
528550
modificationDate?: Date
529551
/** Instance state. */
@@ -572,10 +594,18 @@ export interface ServerActionResponse {
572594
export interface ServerIp {
573595
/** Unique ID of the IP address. */
574596
id: string
575-
/** Instance public IPv4 IP-Address. */
597+
/** Instance's public IP-Address. */
576598
address: string
599+
/** Gateway's IP address. */
600+
gateway: string
601+
/** CIDR netmask. */
602+
netmask: string
603+
/** IP address family (inet or inet6). */
604+
family: ServerIpIpFamily
577605
/** True if the IP address is dynamic. */
578606
dynamic: boolean
607+
/** Information about this address provisioning mode. */
608+
provisioningMode: ServerIpProvisioningMode
579609
}
580610

581611
/** Server. ipv6. */
@@ -1591,6 +1621,8 @@ export type CreateIpRequest = {
15911621
tags?: string[]
15921622
/** UUID of the Instance you want to attach the IP to. */
15931623
server?: string
1624+
/** IP type to reserve (either 'nat', 'routed_ipv4' or 'routed_ipv6'). */
1625+
type?: IpType
15941626
}
15951627

15961628
export type GetIpRequest = {
@@ -1607,6 +1639,8 @@ export type UpdateIpRequest = {
16071639
ip: string
16081640
/** Reverse domain name. */
16091641
reverse?: string | null
1642+
/** Convert a 'nat' IP to a 'routed_ipv4'. */
1643+
type?: IpType
16101644
/** An array of keywords you want to tag this IP with. */
16111645
tags?: string[]
16121646
server?: string | null

packages/clients/src/api/instance/v1/types.private.gen.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ export type CreateServerRequest = {
6363
zone?: Zone
6464
/** Instance name. */
6565
name?: string
66-
/** Define if a dynamic IP is required for the Instance. */
66+
/** Define if a dynamic IPv4 is required for the Instance. */
6767
dynamicIpRequired?: boolean
68+
/** If true, configure the Instance so it uses the new routed IP mode. */
69+
routedIpEnabled?: boolean
6870
/** Define the Instance commercial type (i.e. GP1-S). */
6971
commercialType: string
7072
/** Instance image ID or label. */
@@ -73,8 +75,10 @@ export type CreateServerRequest = {
7375
volumes?: Record<string, VolumeServerTemplate>
7476
/** True if IPv6 is enabled on the server. */
7577
enableIpv6: boolean
76-
/** ID of the reserved IP to attach to the server. */
78+
/** ID of the reserved IP to attach to the Instance. */
7779
publicIp?: string
80+
/** A list of reserved IP IDs to attach to the Instance. */
81+
publicIps?: string[]
7882
/** Boot type to use. */
7983
bootType?: BootType
8084
/** @deprecated Bootscript ID to use when `boot_type` is set to `bootscript`. */
@@ -120,8 +124,13 @@ export type SetServerRequest = {
120124
commercialType: string
121125
/** Instance creation date. */
122126
creationDate?: Date
123-
/** True if a dynamic IP is required. */
127+
/** True if a dynamic IPv4 is required. */
124128
dynamicIpRequired: boolean
129+
/**
130+
* True to configure the instance so it uses the new routed IP mode (once this
131+
* is set to True you cannot set it back to False).
132+
*/
133+
routedIpEnabled?: boolean
125134
/** True if IPv6 is enabled. */
126135
enableIpv6: boolean
127136
/** Instance host name. */
@@ -134,6 +143,8 @@ export type SetServerRequest = {
134143
privateIp?: string
135144
/** Information about the public IP. */
136145
publicIp?: ServerIp
146+
/** Information about all the public IPs attached to the server. */
147+
publicIps?: ServerIp[]
137148
/** Instance modification date. */
138149
modificationDate?: Date
139150
/** Instance state. */
@@ -179,6 +190,12 @@ export type UpdateServerRequest = {
179190
/** @deprecated */
180191
bootscript?: string
181192
dynamicIpRequired?: boolean
193+
/**
194+
* True to configure the instance so it uses the new routed IP mode (once this
195+
* is set to True you cannot set it back to False).
196+
*/
197+
routedIpEnabled?: boolean
198+
publicIps?: ServerIp[]
182199
enableIpv6?: boolean
183200
protected?: boolean
184201
securityGroup?: SecurityGroupTemplate

0 commit comments

Comments
 (0)