Skip to content

feat(vpc_gw): support passing IPAM IP IDs #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023
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
2 changes: 2 additions & 0 deletions packages/clients/src/api/vpcgw/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type {
CreateDHCPEntryRequest,
CreateDHCPRequest,
CreateGatewayNetworkRequest,
CreateGatewayNetworkRequestIpamConfig,
CreateGatewayRequest,
CreateIPRequest,
CreatePATRuleRequest,
Expand Down Expand Up @@ -63,6 +64,7 @@ export type {
UpdateDHCPEntryRequest,
UpdateDHCPRequest,
UpdateGatewayNetworkRequest,
UpdateGatewayNetworkRequestIpamConfig,
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
Expand Down
30 changes: 25 additions & 5 deletions packages/clients/src/api/vpcgw/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
CreateDHCPEntryRequest,
CreateDHCPRequest,
CreateGatewayNetworkRequest,
CreateGatewayNetworkRequestIpamConfig,
CreateGatewayRequest,
CreateIPRequest,
CreatePATRuleRequest,
Expand Down Expand Up @@ -39,6 +40,7 @@ import type {
UpdateDHCPEntryRequest,
UpdateDHCPRequest,
UpdateGatewayNetworkRequest,
UpdateGatewayNetworkRequestIpamConfig,
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
Expand Down Expand Up @@ -81,7 +83,10 @@ const unmarshalIpamConfig = (data: unknown) => {
)
}

return { pushDefaultRoute: data.push_default_route } as IpamConfig
return {
ipamIpId: data.ipam_ip_id,
pushDefaultRoute: data.push_default_route,
} as IpamConfig
}

export const unmarshalGatewayNetwork = (data: unknown) => {
Expand Down Expand Up @@ -355,10 +360,11 @@ export const marshalCreateDHCPRequest = (
valid_lifetime: request.validLifetime,
})

const marshalIpamConfig = (
request: IpamConfig,
const marshalCreateGatewayNetworkRequestIpamConfig = (
request: CreateGatewayNetworkRequestIpamConfig,
defaults: DefaultValues,
): Record<string, unknown> => ({
ipam_ip_id: request.ipamIpId,
push_default_route: request.pushDefaultRoute,
})

Expand All @@ -380,6 +386,14 @@ const marshalSetPATRulesRequestRule = (
public_port: request.publicPort,
})

const marshalUpdateGatewayNetworkRequestIpamConfig = (
request: UpdateGatewayNetworkRequestIpamConfig,
defaults: DefaultValues,
): Record<string, unknown> => ({
ipam_ip_id: request.ipamIpId,
push_default_route: request.pushDefaultRoute,
})

export const marshalCreateDHCPEntryRequest = (
request: CreateDHCPEntryRequest,
defaults: DefaultValues,
Expand Down Expand Up @@ -415,7 +429,10 @@ export const marshalCreateGatewayNetworkRequest = (
{
param: 'ipam_config',
value: request.ipamConfig
? marshalIpamConfig(request.ipamConfig, defaults)
? marshalCreateGatewayNetworkRequestIpamConfig(
request.ipamConfig,
defaults,
)
: undefined,
},
]),
Expand Down Expand Up @@ -521,7 +538,10 @@ export const marshalUpdateGatewayNetworkRequest = (
{
param: 'ipam_config',
value: request.ipamConfig
? marshalIpamConfig(request.ipamConfig, defaults)
? marshalUpdateGatewayNetworkRequestIpamConfig(
request.ipamConfig,
defaults,
)
: undefined,
},
]),
Expand Down
22 changes: 20 additions & 2 deletions packages/clients/src/api/vpcgw/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export type ListPATRulesRequestOrderBy =

export type PATRuleProtocol = 'unknown' | 'both' | 'tcp' | 'udp'

/** Create gateway network request. ipam config. */
export interface CreateGatewayNetworkRequestIpamConfig {
/** Enabling the default route also enables masquerading. */
pushDefaultRoute: boolean
/** Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. */
ipamIpId?: string
}

/** Dhcp. */
export interface DHCP {
/** ID of the DHCP config. */
Expand Down Expand Up @@ -292,6 +300,8 @@ export interface IP {
export interface IpamConfig {
/** Defines whether the default route is enabled on that Gateway Network. */
pushDefaultRoute: boolean
/** IPAM-booked IP ID as the Gateway's IP in this Private Network. */
ipamIpId: string
}

/** List dhcp entries response. */
Expand Down Expand Up @@ -409,6 +419,14 @@ export interface SetPATRulesResponse {
patRules: PATRule[]
}

/** Update gateway network request. ipam config. */
export interface UpdateGatewayNetworkRequestIpamConfig {
/** Enabling the default route also enables masquerading. */
pushDefaultRoute?: boolean
/** Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. */
ipamIpId?: string
}

export type ListGatewaysRequest = {
/** Zone to target. If none is passed will use default zone from the config. */
zone?: Zone
Expand Down Expand Up @@ -592,7 +610,7 @@ export type CreateGatewayNetworkRequest = {
* One-of ('ipConfig'): at most one of 'dhcpId', 'dhcp', 'address',
* 'ipamConfig' could be set.
*/
ipamConfig?: IpamConfig
ipamConfig?: CreateGatewayNetworkRequestIpamConfig
}

export type UpdateGatewayNetworkRequest = {
Expand Down Expand Up @@ -635,7 +653,7 @@ export type UpdateGatewayNetworkRequest = {
* One-of ('ipConfig'): at most one of 'dhcpId', 'address', 'ipamConfig' could
* be set.
*/
ipamConfig?: IpamConfig
ipamConfig?: UpdateGatewayNetworkRequestIpamConfig
}

export type DeleteGatewayNetworkRequest = {
Expand Down