Skip to content

python-sdk: Support regions/vpc-availability endpoints#646

Open
mgwoj wants to merge 7 commits intolinode:devfrom
mgwoj:feature/TPT-4109-python-sdk-support-regions-vpc-availability-endpoints
Open

python-sdk: Support regions/vpc-availability endpoints#646
mgwoj wants to merge 7 commits intolinode:devfrom
mgwoj:feature/TPT-4109-python-sdk-support-regions-vpc-availability-endpoints

Conversation

@mgwoj
Copy link
Contributor

@mgwoj mgwoj commented Feb 13, 2026

📝 Description

Added support regions/vpc-availability endpoints:

  • List all vpc availability endpoints
  • Get vpc availability endpoint

Also added support for get availability endpoint

✔️ How to Test

make test-unit

make TEST_SUITE="region" test-int

@mgwoj mgwoj requested a review from a team as a code owner February 13, 2026 14:56
@mgwoj mgwoj requested review from ezilber-akamai and yec-akamai and removed request for a team February 13, 2026 14:56
Copy link
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

This PR adds support for VPC availability endpoints in the Python SDK, enabling users to query which regions support VPC functionality and what IPv6 prefix lengths are available. The PR also adds support for retrieving availability information for a specific region.

Changes:

  • Added vpc_availability() and vpc_availability_get() methods to RegionGroup for listing and retrieving VPC availability data
  • Added availability_get() method to RegionGroup for retrieving availability data for a specific region
  • Added vpc_availability property to Region object for convenient access to VPC availability data
  • Introduced RegionVPCAvailability dataclass to represent VPC availability information

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
linode_api4/groups/region.py Added three new methods: availability_get, vpc_availability, and vpc_availability_get for retrieving region availability data
linode_api4/objects/region.py Added vpc_availability property to Region class and RegionVPCAvailability dataclass
test/unit/groups/region_test.py Added unit tests for new VPC availability and availability_get methods; cleaned up existing test assertions
test/unit/objects/region_test.py Added unit test for Region.vpc_availability property
test/integration/models/region/test_region.py Added comprehensive integration tests covering all three access patterns for VPC availability and the new availability_get method
test/fixtures/regions_vpc-availability.json Added fixture data for VPC availability listing endpoint with pagination support
test/fixtures/regions_us-east_vpc-availability.json Added fixture data for single region VPC availability endpoint

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

{
"region": "us-east",
"available": true,
"available_ipv6_prefix_lengths": [52, 60]
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The available_ipv6_prefix_lengths values for us-east region are inconsistent between the two fixtures. In regions_vpc-availability.json (line 6), it's [52, 48], but in regions_us-east_vpc-availability.json (line 4), it's [52, 60]. These should be the same since they represent the same region. Please verify which values are correct and update one of the fixtures accordingly.

Suggested change
"available_ipv6_prefix_lengths": [52, 60]
"available_ipv6_prefix_lengths": [52, 48]

Copilot uses AI. Check for mistakes.
ezilber-akamai
ezilber-akamai previously approved these changes Feb 20, 2026
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Looks good and tests are passing locally. Nice work!

RegionAvailabilityEntry, *filters, endpoint="/regions/availability"
)

def availability_get(self, region_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's better to move this function under region object too, since it's getting availabilities for a specific region.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed in favour of availability from object

endpoint="/regions/vpc-availability",
)

def vpc_availability_get(self, region_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove this function here, because the endpoint is also implemented under the region object and better just live there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed in favour of vpc_availability from object


return [RegionAvailabilityEntry.from_json(v) for v in result]

def vpc_availability(self, *filters):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: vpc_availabilities. Normally we use plural forms to indicate it's an list endpoints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then it will be inconsistent with the naming of availability method

assert len(avail_entries) > 0

for entry in avail_entries:
assert entry.region is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intended to remove not None checks? It looks the fields are Optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but it is redundant with next check:

                assert len(entry.region) > 0

Copy link
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

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

test/unit/groups/region_test.py:28

  • The assertion for entry.plan is not None was removed, creating an inconsistency with how entry.region is tested. Line 26 checks entry.region is not None before checking its length on line 27, but entry.plan now only has the length check without the None check. Consider adding back assert entry.plan is not None before this line for consistency, or remove the is not None check for entry.region if the length check is sufficient.
                assert len(entry.plan) > 0

linode_api4/objects/region.py:126

  • The existing availability property (lines 115-126) lacks a docstring, while the new vpc_availability property includes comprehensive documentation. For consistency, consider adding a docstring to the availability property following the same format as vpc_availability.
    @property
    def availability(self) -> List["RegionAvailabilityEntry"]:
        result = self._client.get(
            f"{self.api_endpoint}/availability", model=self
        )

        if result is None:
            raise UnexpectedResponseError(
                "Expected availability data, got None."
            )

        return [RegionAvailabilityEntry.from_json(v) for v in result]

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants