Skip to content

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Oct 3, 2025

📝 Description

This pull request adds support for the databases field returned for VPC subnets with attached Managed Databases.

✔️ How to Test

The following test steps assume you have pulled down this PR locally and run make install.

Unit Testing

make test-unit

Manual Testing

  1. In a linode_api4-python sandbox environment (e.g. dx-devenv), run the following:
import os

from linode_api4 import (
    LinodeClient,
    DatabasePrivateNetwork,
)

linode_client = LinodeClient(
    os.getenv("LINODE_TOKEN"), base_url="https://api.linode.com/v4beta"
)

vpc = linode_client.vpcs.create(label="python-sdk-test", region="us-mia")

subnet = vpc.subnet_create(label="python-sdk-test", ipv4="10.0.0.0/24")

db = linode_client.database.mysql_create(
    label="python-sdk-test",
    ltype="g6-nanode-1",
    region="us-mia",
    engine="mysql/8",
    private_network=DatabasePrivateNetwork(
        vpc_id=vpc.id, subnet_id=subnet.id, public_access=False
    ),
)

subnet.invalidate()

print(subnet.databases)
  1. Ensure the output looks similar to the following:
[VPCSubnetDatabase(id=365862, ipv4_range='10.0.0.16/28', ipv6_range=None)]

@lgarber-akamai lgarber-akamai added the new-feature for new features in the changelog. label Oct 3, 2025
@lgarber-akamai lgarber-akamai marked this pull request as ready for review October 3, 2025 18:06
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner October 3, 2025 18:06
@lgarber-akamai lgarber-akamai requested review from zliang-akamai and yec-akamai and removed request for a team October 3, 2025 18:06
Copy link
Member

@zliang-akamai zliang-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 works well!

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Works well on my end!

@zliang-akamai zliang-akamai requested a review from Copilot October 6, 2025 17:41
Copy link
Contributor

@Copilot 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 the databases field in VPC subnets to handle Managed Databases attached to VPC subnets. The implementation includes a new VPCSubnetDatabase class and corresponding property mapping.

  • Adds VPCSubnetDatabase data class to represent database information within VPC subnets
  • Updates VPCSubnet class to include the databases property
  • Adds comprehensive test coverage including fixtures and validation

Reviewed Changes

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

File Description
linode_api4/objects/vpc.py Adds VPCSubnetDatabase class and databases property to VPCSubnet
test/unit/objects/vpc_test.py Adds test validation for databases field functionality
test/fixtures/vpcs_123456_subnets_789.json Adds test fixture data for single subnet with database
test/fixtures/vpcs_123456_subnets.json Adds test fixture data for subnet list with database

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lgarber-akamai lgarber-akamai merged commit 9f43566 into linode:proj/dbaas-vpc Oct 6, 2025
12 checks passed
lgarber-akamai added a commit that referenced this pull request Oct 7, 2025
* Added support for VPC DBaaS Integration (#560)

* Implemented support for VPC DBaaS Integration

* Added unit tests

* Add support for VPCSubnet.databases field (#607)

* Add support for VPCSubnet.databases field

* ipv6_range -> ipv6_ranges

* ipv6_range -> ipv6_ranges (list)

---------

Co-authored-by: Erik Zilber <ezilber@akamai.com>
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.

3 participants