TPT-4603: Added support for NAT Service - #1033
Open
ezilber-akamai wants to merge 2 commits into
Open
Conversation
ezilber-akamai
requested review from
lgarber-akamai and
psnoch-akamai
and removed request for
a team
August 28, 2026 13:22
Contributor
There was a problem hiding this comment.
Pull request overview
Adds VPC NAT Gateway support to the client and related resource models.
Changes:
- Adds NAT Gateway models and client operations.
- Exposes NAT Gateway data on subnets, interfaces, IPs, and regions.
- Adds fixture-backed unit coverage.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
nat_gateways.go |
Adds NAT Gateway API support. |
regions.go |
Adds the regional capability. |
vpc_subnet.go |
Adds subnet NAT Gateway fields and options. |
interfaces.go |
Adds interface NAT Gateway data. |
instance_ips.go |
Adds VPC IP NAT Gateway data. |
test/unit/nat_gateways_test.go |
Tests NAT Gateway operations. |
test/unit/vpc_test.go |
Tests NAT Gateway subnet creation. |
test/unit/vpc_subnets_test.go |
Tests subnet NAT Gateway responses. |
test/unit/vpc_ips_test.go |
Tests VPC IP NAT Gateway data. |
test/unit/interface_test.go |
Tests interface NAT Gateway data. |
test/unit/fixtures/vpc_subnets_list.json |
Adds list response data. |
test/unit/fixtures/vpc_subnet_update.json |
Adds update response data. |
test/unit/fixtures/vpc_subnet_get.json |
Adds get response data. |
test/unit/fixtures/vpc_subnet_create.json |
Adds create response data. |
test/unit/fixtures/vpc_specific_ips_list.json |
Adds scoped IP response data. |
test/unit/fixtures/vpc_ips_list.json |
Adds IP list response data. |
test/unit/fixtures/nat_gateways_update.json |
Adds update fixture. |
test/unit/fixtures/nat_gateways_list.json |
Adds list fixture. |
test/unit/fixtures/nat_gateways_list_interfaces.json |
Adds interface list fixture. |
test/unit/fixtures/nat_gateways_list_addresses.json |
Adds address list fixture. |
test/unit/fixtures/nat_gateways_list_address_interfaces.json |
Adds address-interface fixture. |
test/unit/fixtures/nat_gateways_get.json |
Adds get fixture. |
test/unit/fixtures/nat_gateways_get_types.json |
Adds type fixture. |
test/unit/fixtures/nat_gateways_get_settings.json |
Adds settings fixture. |
test/unit/fixtures/nat_gateways_get_address.json |
Adds address fixture. |
test/unit/fixtures/nat_gateways_create.json |
Adds create fixture. |
test/unit/fixtures/nat_gateways_add_address.json |
Adds address creation fixture. |
test/unit/fixtures/interface_list.json |
Adds interface association data. |
Suppressed comments (5)
vpc_subnet.go:68
GetCreateOptionswas not updated for this newly writable field, so converting a returned subnet back to create options silently drops its NAT gateway ID. Populate the option from the response model and extend the conversion assertion to cover it.
NATGateway *VPCSubnetCreateOptionsNATGateway `json:"natgateway,omitzero"`
nat_gateways.go:49
- Repository guidance requires optional create/update fields to use
omitzero(AGENTS.md:40). Keep this new options type consistent; for a pointer this retains the same omission behavior while using the required tag.
Label *string `json:"label,omitempty"`
nat_gateways.go:122
- This exported update signature reverses the established ID-before-options order used by
UpdateVPCSubnet,UpdateVolume, and other ID-scoped updates. Define it as(ctx, id, opts)now; correcting the ordering after release would require a breaking API change.
func (c *Client) UpdateNATGateway(ctx context.Context, opts NATGatewayUpdateOptions, id int) (*NATGateway, error) {
nat_gateways.go:134
- The subordinate public methods switch from the file's verb-first naming (
ListNATGateways,GetNATGateway) toNATGateway<Action>, and place options before the gateway ID. Rename this family consistently—for example,AddNATGatewayAddress(ctx, id, opts),ListNATGatewayAddresses(ctx, id, opts), andGetNATGatewaySettings—before the API is released.
func (c *Client) NATGatewayAddAddress(ctx context.Context, opts NATGatewayAddAddressOptions, id int) (*NATGatewayAddressObject, error) {
nat_gateways.go:133
- Correct the typo in the exported method documentation.
// NATGatewayAddAddress adds an addresd to the NAT Gateway with the specified id
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Databases []VPCSubnetDatabase `json:"databases"` | ||
| Nodebalancers []VPCSubnetNodebalancers `json:"nodebalancers"` | ||
|
|
||
| NATGateway VPCSubnetNATGateway `json:"natgateway"` |
| Ranges []VPCInterfaceIPv4Range `json:"ranges"` | ||
| Addresses []VPCInterfaceIPv4Address `json:"addresses"` | ||
| Ranges []VPCInterfaceIPv4Range `json:"ranges"` | ||
| NATGateway VPCInterfaceIPv4NATGateway `json:"natgateway"` |
| // The type of this field will be made a pointer in the next major release of linodego. | ||
| ConfigID int `json:"config_id"` | ||
| ConfigID int `json:"config_id"` | ||
| NATGateway VPCIPNATGateway `json:"natgateway"` |
Comment on lines
+18
to
+19
| Created *time.Time `json:"-"` | ||
| Updated *time.Time `json:"-"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Added support and unit tests for NAT Service for VPC.
✔️ How to Test
make test-unit