Skip to content

Commit 08cb1e8

Browse files
authored
LBAAS-3995: add project ID to nat gateway (#909)
1 parent d8a73dd commit 08cb1e8

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

vpc_nat_gateways.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type VPCNATGatewayRequest struct {
3030
UDPTimeoutSeconds uint32 `json:"udp_timeout_seconds,omitempty"`
3131
ICMPTimeoutSeconds uint32 `json:"icmp_timeout_seconds,omitempty"`
3232
TCPTimeoutSeconds uint32 `json:"tcp_timeout_seconds,omitempty"`
33+
ProjectID string `json:"project_id,omitempty"`
3334
}
3435

3536
// VPCNATGateway represents a DigitalOcean VPC NAT Gateway resource
@@ -47,6 +48,7 @@ type VPCNATGateway struct {
4748
TCPTimeoutSeconds uint32 `json:"tcp_timeout_seconds,omitempty"`
4849
CreatedAt time.Time `json:"created_at"`
4950
UpdatedAt time.Time `json:"updated_at"`
51+
ProjectID string `json:"project_id,omitempty"`
5052
}
5153

5254
// IngressVPC defines the ingress configs supported by a VPC NAT Gateway

vpc_nat_gateways_test.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ var vpcNatGatewayGetJSONResponse = `
3737
"icmp_timeout_seconds": 30,
3838
"tcp_timeout_seconds": 300,
3939
"created_at": "2025-04-28T14:20:00Z",
40-
"updated_at": "2025-04-28T14:20:03Z"
40+
"updated_at": "2025-04-28T14:20:03Z",
41+
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
4142
}
4243
}
4344
`
@@ -69,7 +70,8 @@ var vpcNatGatewayListJSONResponse = `
6970
"icmp_timeout_seconds": 30,
7071
"tcp_timeout_seconds": 300,
7172
"created_at": "2025-04-28T14:20:00Z",
72-
"updated_at": "2025-04-28T14:20:03Z"
73+
"updated_at": "2025-04-28T14:20:03Z",
74+
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
7375
},
7476
{
7577
"id": "8e2fedf5-ce55-4ec3-82ca-e607be36ee08",
@@ -95,7 +97,8 @@ var vpcNatGatewayListJSONResponse = `
9597
"icmp_timeout_seconds": 30,
9698
"tcp_timeout_seconds": 300,
9799
"created_at": "2025-04-28T14:20:29Z",
98-
"updated_at": "2025-04-28T14:20:32Z"
100+
"updated_at": "2025-04-28T14:20:32Z",
101+
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
99102
}
100103
],
101104
"links": {},
@@ -131,7 +134,8 @@ var vpcNatGatewayUpdateJSONResponse = `
131134
"icmp_timeout_seconds": 30,
132135
"tcp_timeout_seconds": 300,
133136
"created_at": "2025-04-28T14:20:00Z",
134-
"updated_at": "2025-04-28T14:20:03Z"
137+
"updated_at": "2025-04-28T14:20:03Z",
138+
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
135139
}
136140
}
137141
`
@@ -151,6 +155,7 @@ func TestVPCNATGateways_Create(t *testing.T) {
151155
UDPTimeoutSeconds: 30,
152156
ICMPTimeoutSeconds: 30,
153157
TCPTimeoutSeconds: 300,
158+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
154159
}
155160

156161
mux.HandleFunc(vpcNatGatewaysBasePath, func(w http.ResponseWriter, r *http.Request) {
@@ -165,12 +170,13 @@ func TestVPCNATGateways_Create(t *testing.T) {
165170
})
166171

167172
expectedGatewayResp := &VPCNATGateway{
168-
ID: "97c46619-1f53-493b-8638-00c899f30152",
169-
Name: "test-egress-gateway-01",
170-
Type: "PUBLIC",
171-
State: "STATE_ACTIVE",
172-
Region: "nyc3",
173-
Size: 1,
173+
ID: "97c46619-1f53-493b-8638-00c899f30152",
174+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
175+
Name: "test-egress-gateway-01",
176+
Type: "PUBLIC",
177+
State: "STATE_ACTIVE",
178+
Region: "nyc3",
179+
Size: 1,
174180
VPCs: []*IngressVPC{
175181
{VpcUUID: "4637280e-3842-4661-a628-a6f0392959d3", GatewayIP: "10.100.0.110"},
176182
},
@@ -220,6 +226,7 @@ func TestVPCNATGateways_Get(t *testing.T) {
220226
UDPTimeoutSeconds: 30,
221227
ICMPTimeoutSeconds: 30,
222228
TCPTimeoutSeconds: 300,
229+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
223230
}
224231

225232
getGatewayResp, _, err := client.VPCNATGateways.Get(ctx, gatewayID)
@@ -273,6 +280,7 @@ func TestVPCNATGateways_List(t *testing.T) {
273280
UDPTimeoutSeconds: 30,
274281
ICMPTimeoutSeconds: 30,
275282
TCPTimeoutSeconds: 300,
283+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
276284
},
277285
{
278286
ID: "8e2fedf5-ce55-4ec3-82ca-e607be36ee08",
@@ -292,6 +300,7 @@ func TestVPCNATGateways_List(t *testing.T) {
292300
UDPTimeoutSeconds: 30,
293301
ICMPTimeoutSeconds: 30,
294302
TCPTimeoutSeconds: 300,
303+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
295304
},
296305
}
297306

@@ -360,6 +369,7 @@ func TestVPCNATGateways_Update(t *testing.T) {
360369
UDPTimeoutSeconds: 30,
361370
ICMPTimeoutSeconds: 30,
362371
TCPTimeoutSeconds: 300,
372+
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
363373
}
364374

365375
updateGatewayResp, _, err := client.VPCNATGateways.Update(ctx, gatewayID, updateReq)

0 commit comments

Comments
 (0)