Skip to content

Commit

Permalink
feat(vpc_gw): add field to help clients known which pwg is legacy xor…
Browse files Browse the repository at this point in the history
… ipam (scaleway#936)
  • Loading branch information
scaleway-bot authored Oct 17, 2023
1 parent 75461bb commit a8334bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/clients/src/api/vpcgw/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ export const unmarshalDHCP = (data: unknown) => {
} as DHCP
}

const unmarshalIpamConfig = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
`Unmarshalling the type 'IpamConfig' failed as data isn't a dictionary.`,
)
}

return { pushDefaultRoute: data.push_default_route } as IpamConfig
}

export const unmarshalGatewayNetwork = (data: unknown) => {
if (!isJSONObject(data)) {
throw new TypeError(
Expand All @@ -89,6 +99,9 @@ export const unmarshalGatewayNetwork = (data: unknown) => {
enableMasquerade: data.enable_masquerade,
gatewayId: data.gateway_id,
id: data.id,
ipamConfig: data.ipam_config
? unmarshalIpamConfig(data.ipam_config)
: undefined,
macAddress: data.mac_address,
privateNetworkId: data.private_network_id,
status: data.status,
Expand Down Expand Up @@ -170,6 +183,7 @@ export const unmarshalGateway = (data: unknown) => {
),
id: data.id,
ip: data.ip ? unmarshalIP(data.ip) : undefined,
isLegacy: data.is_legacy,
name: data.name,
organizationId: data.organization_id,
projectId: data.project_id,
Expand Down
4 changes: 4 additions & 0 deletions packages/clients/src/api/vpcgw/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ export interface Gateway {
bastionPort: number
/** Defines whether SMTP traffic is allowed to pass through the gateway. */
smtpEnabled: boolean
/** Whether this uses non-IPAM IP configurations. */
isLegacy: boolean
/** Zone of the gateway. */
zone: Zone
}
Expand Down Expand Up @@ -242,6 +244,8 @@ export interface GatewayNetwork {
enableDhcp: boolean
/** Address of the Gateway (in CIDR form) to use when DHCP is not used. */
address?: string
/** IPAM IP configuration used. */
ipamConfig?: IpamConfig
/** Zone of the GatewayNetwork connection. */
zone: Zone
}
Expand Down

0 comments on commit a8334bc

Please sign in to comment.