Skip to content

TPT-4278: python-sdk: Implement support for Reserved IP for IPv4#672

Open
mgwoj wants to merge 1 commit intolinode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4278-python-sdk-implement-support-for-reserved-ip-for-ipv4
Open

TPT-4278: python-sdk: Implement support for Reserved IP for IPv4#672
mgwoj wants to merge 1 commit intolinode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4278-python-sdk-implement-support-for-reserved-ip-for-ipv4

Conversation

@mgwoj
Copy link
Copy Markdown
Contributor

@mgwoj mgwoj commented Mar 26, 2026

📝 Description

Add full Reserved IP support to the Python SDK (linode_api4-python). Currently there is no reserved IP support in the SDK. This story covers new object classes, networking group methods, and updates to existing objects.

✔️ How to Test

make test-unit

@mgwoj mgwoj requested a review from Copilot March 26, 2026 13:09
@mgwoj mgwoj requested a review from a team as a code owner March 26, 2026 13:09
@mgwoj mgwoj requested review from yec-akamai and zliang-akamai and removed request for a team March 26, 2026 13:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Reserved IPv4 (Reserved IP) support across the SDK, including new networking objects, networking group endpoints, and integration with existing tagging and allocation flows.

Changes:

  • Introduces Reserved IP models (ReservedIPAddress, ReservedIPType, ReservedIPAssignedEntity) and exposes reserved/tags/assigned_entity on IPAddress.
  • Adds networking group methods for listing/creating reserved IPs and fetching reserved IP types/pricing.
  • Extends tagging and allocation APIs/tests to support reserved IPv4 assignment (Instance/NodeBalancer/Tag flows), plus new fixtures and pytest config.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/unit/objects/tag_test.py Adds unit coverage for tagged reserved IPv4 objects and tag creation with reserved IPv4s.
test/unit/objects/networking_test.py Adds unit coverage for Reserved IP fields, save/delete flows, and Instance IP allocation with explicit address.
test/unit/groups/networking_test.py Adds unit coverage for networking group reserved IP list/create/types and reserved-vs-ephemeral allocation behavior.
test/fixtures/networking_reserved_ips.json Fixture data for listing reserved IPs.
test/fixtures/networking_reserved_ips_types.json Fixture data for reserved IP type pricing.
pytest.ini Adds pytest discovery defaults and marker declarations.
conftest.py Ensures repo root is importable for pytest runs from arbitrary working dirs.
linode_api4/objects/tag.py Enables tagged object resolution for reserved_ipv4_address and supports non-id identifiers via id_attribute.
linode_api4/objects/networking.py Adds Reserved IP object models and new/updated IP-related properties.
linode_api4/objects/linode.py Extends Instance.ip_allocate to optionally assign a reserved IPv4 address.
linode_api4/groups/tag.py Adds reserved_ipv4_addresses support to tag creation.
linode_api4/groups/nodebalancer.py Adds optional ipv4 param to assign a reserved IPv4 at NodeBalancer creation.
linode_api4/groups/networking.py Extends ip_allocate for reserved IP allocation and adds reserved IP list/create/types group methods.
linode_api4/groups/linode.py Adds ipv4 parameter for assigning reserved IPv4s at instance creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +362 to +366
data = {
"type": "ipv4",
"public": public,
}

Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

ip_allocate's docstring describes required arguments (linode required when reserved=False; region or linode required when reserved=True), but the implementation never validates these combinations. This allows requests to be sent without linode_id/region (or with region while reserved is False), which will fail at the API with a less actionable error. Add explicit argument validation (raise ValueError) to enforce the documented contract before building/sending the request body.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to 37
entities=[],
):
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

entities uses a mutable default ([]). Even though this method currently only iterates it, mutable defaults are easy to misuse later and are discouraged because they can create cross-call shared state if mutated. Prefer entities=None and then set entities = entities or [] inside the function.

Copilot uses AI. Check for mistakes.
@mgwoj mgwoj added the new-feature for new features in the changelog. label Mar 26, 2026
@mgwoj mgwoj changed the title TPT-4278 python-sdk: Implement support for Reserved IP for IPv4 TPT-4278: python-sdk: Implement support for Reserved IP for IPv4 Mar 26, 2026
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