Skip to content

TPT-4602: Added support for NAT Service- #1033 - #738

Open
ezilber-akamai wants to merge 4 commits into
linode:proj/nat-service-for-vpcfrom
ezilber-akamai:TPT-4602-support-nat-service
Open

TPT-4602: Added support for NAT Service- #1033#738
ezilber-akamai wants to merge 4 commits into
linode:proj/nat-service-for-vpcfrom
ezilber-akamai:TPT-4602-support-nat-service

Conversation

@ezilber-akamai

@ezilber-akamai ezilber-akamai commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Added support and unit tests for NAT Service for VPC.

✔️ How to Test

make test-unit

@ezilber-akamai
ezilber-akamai requested review from a team as code owners September 8, 2026 15:21
@ezilber-akamai ezilber-akamai added the new-feature for new features in the changelog. label Sep 8, 2026
@ezilber-akamai
ezilber-akamai requested review from jriddle-linode and mawilk90 and removed request for a team September 8, 2026 15:21
@ezilber-akamai ezilber-akamai changed the title Added support for NAT Service- #1033 TPT-4602: Added support for NAT Service- #1033 Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a few correctness/maintainability issues in newly added NAT Gateway typing/fixtures (notably inconsistent NAT Gateway URL vs ID and mismatched NATGatewayType.id typing) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds NAT Gateway (NAT Service) support across VPC-related models and the Networking group in the Linode API v4 Python SDK, along with unit tests and fixtures to validate serialization and parsing of NAT Gateway data.

Changes:

  • Added NAT Gateway models/endpoints under networking (list/create/types/settings + per-gateway address/interface helpers).
  • Extended VPC subnet creation/update and VPC/VPC-IP/Linode-interface response parsing to include NAT Gateway data.
  • Added/updated unit tests and fixtures to cover NAT Gateway serialization and response parsing.
File summaries
File Description
test/unit/objects/vpc_test.py Adds subnet create/update tests for natgateway serialization and parsing assertions.
test/unit/objects/networking_test.py Adds object-level tests for NATGateway methods and nested models.
test/unit/objects/linode_interface_test.py Adds assertions for NAT Gateway data under VPC IPv4 interface config.
test/unit/groups/vpc_test.py Adds group-level test for VPC create with subnet NAT Gateway serialization.
test/unit/groups/networking_test.py Adds group-level tests for NAT Gateway list/create/types/settings.
test/fixtures/vpcs_ips.json Adds natgateway payload under VPC IP fixtures.
test/fixtures/vpcs_123456_subnets.json Adds natgateway payload under subnet list fixture.
test/fixtures/vpcs_123456_subnets_789.json Adds natgateway payload under subnet detail fixture.
test/fixtures/vpcs_123456_ips.json Adds natgateway payload under VPC-specific IP list fixture.
test/fixtures/networking_natgateways.json New NAT Gateways list fixture.
test/fixtures/networking_natgateways_types.json New NAT Gateway types fixture.
test/fixtures/networking_natgateways_settings.json New NAT Gateway settings fixture.
test/fixtures/networking_natgateways_42_interfaces.json New NAT Gateway interfaces fixture.
test/fixtures/networking_natgateways_42_addresses.json New NAT Gateway address-assignments list fixture.
test/fixtures/networking_natgateways_42_addresses_203.0.113.42.json New NAT Gateway address-assignment detail fixture.
test/fixtures/networking_natgateways_42_addresses_203.0.113.42_interfaces.json New per-address interfaces fixture.
test/fixtures/linode_instances_124_upgrade-interfaces.json Adds NAT Gateway data under interface VPC IPv4 fixture.
test/fixtures/linode_instances_124_interfaces.json Adds NAT Gateway data under interfaces list fixture.
test/fixtures/linode_instances_124_interfaces_456.json Adds NAT Gateway data under single interface fixture.
linode_api4/objects/vpc.py Adds VPC subnet NAT Gateway option/response models and subnet create support.
linode_api4/objects/networking.py Adds NAT Gateway-related models and NATGateway object methods.
linode_api4/objects/linode_interfaces.py Adds NAT Gateway parsing under VPC IPv4 interface config.
linode_api4/groups/networking.py Adds Networking group methods for NAT Gateways (list/create/types/settings).
Review details

Suppressed comments (2)

linode_api4/objects/vpc.py:150

  • addresses is typed as List[str] but defaults to None, which is inconsistent and can cause JSONObject._serialize to include "addresses": null. Make it Optional[List[str]] so missing/unknown values are omitted during serialization.
    id: int = 0
    label: str = ""
    addresses: List[str] = None
    portset_assignments: int = 0

linode_api4/objects/vpc.py:154

  • portsets is typed as List[...] but initialized to None (and explicitly documented as sometimes unavailable). Make it Optional[List[...]] = None to align typing with the actual runtime value and JSONObject serialization rules.
    portsets: List[VPCSubnetNATGatewayPortset] = (
        None  # NOTE: This field may not be available to all users.
    )
  • Files reviewed: 23/23 changed files
  • Comments generated: 8
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread linode_api4/objects/networking.py Outdated
Comment thread linode_api4/objects/networking.py Outdated
Comment thread linode_api4/objects/vpc.py Outdated
Comment thread test/fixtures/linode_instances_124_interfaces.json Outdated
Comment thread test/fixtures/linode_instances_124_interfaces_456.json Outdated
Comment thread test/fixtures/linode_instances_124_upgrade-interfaces.json Outdated
Comment thread test/unit/objects/linode_interface_test.py
Comment thread test/unit/objects/vpc_test.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants