Skip to content

Commit 0a4eb3b

Browse files
authored
feat(pgw): ipam config for native vpc integration (#846)
1 parent 7ab7db7 commit 0a4eb3b

File tree

3 files changed

+62
-15
lines changed

3 files changed

+62
-15
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type {
3030
GetIPRequest,
3131
GetPATRuleRequest,
3232
IP,
33+
IpamConfig,
3334
ListDHCPEntriesRequest,
3435
ListDHCPEntriesRequestOrderBy,
3536
ListDHCPEntriesResponse,

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type {
2121
GatewayNetwork,
2222
GatewayType,
2323
IP,
24+
IpamConfig,
2425
ListDHCPEntriesResponse,
2526
ListDHCPsResponse,
2627
ListGatewayNetworksResponse,
@@ -340,6 +341,13 @@ export const marshalCreateDHCPRequest = (
340341
valid_lifetime: request.validLifetime,
341342
})
342343

344+
const marshalIpamConfig = (
345+
request: IpamConfig,
346+
defaults: DefaultValues,
347+
): Record<string, unknown> => ({
348+
push_default_route: request.pushDefaultRoute,
349+
})
350+
343351
const marshalSetDHCPEntriesRequestEntry = (
344352
request: SetDHCPEntriesRequestEntry,
345353
defaults: DefaultValues,
@@ -390,6 +398,12 @@ export const marshalCreateGatewayNetworkRequest = (
390398
param: 'address',
391399
value: request.address,
392400
},
401+
{
402+
param: 'ipam_config',
403+
value: request.ipamConfig
404+
? marshalIpamConfig(request.ipamConfig, defaults)
405+
: undefined,
406+
},
393407
]),
394408
})
395409

@@ -481,7 +495,7 @@ export const marshalUpdateGatewayNetworkRequest = (
481495
): Record<string, unknown> => ({
482496
enable_dhcp: request.enableDhcp,
483497
enable_masquerade: request.enableMasquerade,
484-
...resolveOneOf([
498+
...resolveOneOf<unknown>([
485499
{
486500
param: 'dhcp_id',
487501
value: request.dhcpId,
@@ -490,6 +504,12 @@ export const marshalUpdateGatewayNetworkRequest = (
490504
param: 'address',
491505
value: request.address,
492506
},
507+
{
508+
param: 'ipam_config',
509+
value: request.ipamConfig
510+
? marshalIpamConfig(request.ipamConfig, defaults)
511+
: undefined,
512+
},
493513
]),
494514
})
495515

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

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ export interface IP {
284284
zone: Zone
285285
}
286286

287+
/** Ipam config. */
288+
export interface IpamConfig {
289+
/** Defines whether the default route is enabled on that Gateway Network. */
290+
pushDefaultRoute: boolean
291+
}
292+
287293
/** List dhcp entries response. */
288294
export interface ListDHCPEntriesResponse {
289295
/** DHCP entries in this page. */
@@ -541,33 +547,44 @@ export type CreateGatewayNetworkRequest = {
541547
privateNetworkId: string
542548
/** Defines whether to enable masquerade (dynamic NAT) on this network. */
543549
enableMasquerade: boolean
550+
/**
551+
* Defines whether to enable DHCP on this Private Network. Defaults to `true`
552+
* if either `dhcp_id` or `dhcp` are present. If set to `true`, either
553+
* `dhcp_id` or `dhcp` must be present.
554+
*/
555+
enableDhcp?: boolean
544556
/**
545557
* ID of an existing DHCP configuration object to use for this GatewayNetwork.
546558
*
547-
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address' could be
548-
* set.
559+
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address',
560+
* 'ipamConfig' could be set.
549561
*/
550562
dhcpId?: string
551563
/**
552564
* New DHCP configuration object to use for this GatewayNetwork.
553565
*
554-
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address' could be
555-
* set.
566+
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address',
567+
* 'ipamConfig' could be set.
556568
*/
557569
dhcp?: CreateDHCPRequest
558570
/**
559571
* Static IP address in CIDR format to to use without DHCP.
560572
*
561-
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address' could be
562-
* set.
573+
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address',
574+
* 'ipamConfig' could be set.
563575
*/
564576
address?: string
565577
/**
566-
* Defines whether to enable DHCP on this Private Network. Defaults to `true`
567-
* if either `dhcp_id` or `dhcp` are present. If set to `true`, either
568-
* `dhcp_id` or `dhcp` must be present.
578+
* Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address
579+
* management service). Note: all or none of the GatewayNetworks for a single
580+
* gateway can use the IPAM. DHCP and IPAM configurations cannot be mixed.
581+
* Some products may require that the Public Gateway uses the IPAM, to ensure
582+
* correct functionality.
583+
*
584+
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address',
585+
* 'ipamConfig' could be set.
569586
*/
570-
enableDhcp?: boolean
587+
ipamConfig?: IpamConfig
571588
}
572589

573590
export type UpdateGatewayNetworkRequest = {
@@ -577,20 +594,29 @@ export type UpdateGatewayNetworkRequest = {
577594
gatewayNetworkId: string
578595
/** Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. */
579596
enableMasquerade?: boolean
597+
/** Defines whether to enable DHCP on the connected Private Network. */
598+
enableDhcp?: boolean
580599
/**
581600
* ID of the new DHCP configuration object to use with this GatewayNetwork.
582601
*
583-
* One-of ('ipConfig'): at most one of 'dhcpId', 'address' could be set.
602+
* One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could
603+
* be set.
584604
*/
585605
dhcpId?: string
586-
/** Defines whether to enable DHCP on the connected Private Network. */
587-
enableDhcp?: boolean
588606
/**
589607
* New static IP address.
590608
*
591-
* One-of ('ipConfig'): at most one of 'dhcpId', 'address' could be set.
609+
* One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could
610+
* be set.
592611
*/
593612
address?: string
613+
/**
614+
* New IPAM configuration to use for this GatewayNetwork.
615+
*
616+
* One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could
617+
* be set.
618+
*/
619+
ipamConfig?: IpamConfig
594620
}
595621

596622
export type DeleteGatewayNetworkRequest = {

0 commit comments

Comments
 (0)