Skip to content

Conversation

@zliang-akamai
Copy link
Member

📝 Description

  1. Rename interfaces property of a Linode instance object to linode_interfaces to avoid confusion with legacy config interfaces.
  2. Avoid API error by returning None from the property getter function when the Linode is with legacy interfaces.

✔️ How to Test

import os
from linode_api4 import LinodeClient, Instance
from linode_api4.objects.linode_interfaces import LinodeInterfacePublicOptions


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

created_linode = linode_client.linode.instance_create(
    ltype="g6-nanode-1",
    region="us-mia",
    interface_generation="legacy_config"
)

linode = linode_client.load(Instance, created_linode.id)
print(linode.linode_interfaces) # expecting None
linode.delete()

created_linode2 = linode_client.linode.instance_create(
    ltype="g6-nanode-1",
    region="us-mia",
    interface_generation="linode"
)
created_linode2.interface_create(
    firewall=12345, # replace with your non-prod firewall here
    public=LinodeInterfacePublicOptions(),
)

linode2 = linode_client.load(Instance, created_linode2.id)
print(linode2.linode_interfaces) # expecting a list with one LinodeInterface object
linode2.delete()

@zliang-akamai zliang-akamai requested a review from a team as a code owner September 29, 2025 21:24
@zliang-akamai zliang-akamai requested review from lgarber-akamai and yec-akamai and removed request for a team September 29, 2025 21:24
Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

LGTM

@zliang-akamai zliang-akamai merged commit 08ffe71 into linode:dev Sep 30, 2025
12 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/fix-interfaces-property branch September 30, 2025 17:01
@zliang-akamai zliang-akamai added the bugfix for any bug fixes in the changelog. label Oct 2, 2025
srbhaakamai pushed a commit to srbhaakamai/linode_api4-python that referenced this pull request Oct 3, 2025
* Rename `interfaces` property to `linode_interfaces`

* Return `None` when interface generation is not `linode`

* Update docstring

* Fix test

* Use enum
srbhaakamai added a commit to srbhaakamai/linode_api4-python that referenced this pull request Oct 3, 2025
yec-akamai added a commit that referenced this pull request Dec 2, 2025
* DI-26927 Python SDK code for GET Alert Definitions

* DI-26927 Python SDK code modified for client code

* DI-26927 Added Unit test cases and missing classes

* DI-26927 made corrections to keep code consistent

* DI-26927 Updated Unit and Integratoion Tests

* [dev 51950af] DI-26927 Updated Unit and Integratoion Tests

* Revert "DI-26927 Updated Unit and Integratoion Tests"

This reverts commit 51950af.

* Revert "[dev 51950af] DI-26927 Updated Unit and Integratoion Tests"

This reverts commit 6ca6a5a.

* DI-26927 Updated Unit and Integratoion Tests

* Remove .venv from repo and add to .gitignore

* DI-26927 reverted git ignore

* DI-26927 reverted conftest,py

* DI-26927  added accidentlly deleted file

* DI-26927 Corrected Integration and Unit Test cases for Alerting APIs

* DI-26927 Reverted conftest.py and check integration without those changes

* DI-26927 fixed integration test for firewall and added time for alert update before deletion

* DI-26927 fixed changing monitor.py as per review comments

* DI-26927 fixed changing monitor.py as per review comments

* DI-26927 fixed changing monitor.py as per review comments

* DI-26927 Intermediate change to address internal review comments

* DI-26927 CLosed review comments

* DI-26927 CLosed review comments

* DI-27156 closed review comments from Ketan

* DI-27156 closed review comments from Ketan

* DI-27156 fixed unit test cases post review comments fixes

* DI-27156 Updated docstring and make unit test cases changes

* DI-27156 Added unit test cases post review comments fixes

* DI-27156 Added unit test cases post review comments fixes

* tests(monitor): add MonitorAlertDefinitionsTest and update fixtures for alert-definitions

* DI-27156 Added unit test cases post review comments fixes

* DI-27156 Updated docstring

* DI-27156 Updated unit test errors

* removed unwanted files

* added missing doxcstring

* added missing doxcstring

* added missing doxcstring

* rmoved test files

* closed final review comments

* fixing integration test issues

* Corrected Integration Test Case

* DI-26927 Corrected json to object modifications issues

* DI-26927 Corrected json to object modifications issues

* DI-26927 Unit test corrections for mofied functions name

* Delete test/fixtures/monitor/services/dbaas/alert-definitions.json

Not Required

* Delete test.py

Not Required here required for local testing only

* Delete test/fixtures/monitor/alert-definitions.json

Not required here

* DI-26927 reverted fixtures.py as its not necesary to change

* DI-26927 reverted fixtures.py as its not necesary to change

* DI-26927 reverted fixtures.py as its not necesary to change

* DI-26927 fixed linting error

* DI-26927 fixed linting error

* DI-26927 fixed lint error caught in CI

* Update test/unit/groups/monitor_api_test.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update linode_api4/objects/monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* DI-26927 fixed copilot comments

* fixed review comments from APIv4 team

* fixed review comments from APIv4 team

* fixed review comments from APIv4 team

* fixed review comments from APIv4 team

* DI-26927 fixed review comments from API v4 team

* fixed review comments from APIv4 team

* fixed lint errors

* Update linode_api4/groups/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* Update linode_api4/groups/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* fixed review  errors

* fixed unittest

* fixed unittest

* fixed unittest

* fixed unittest

* fixed unittest

* fixed unittest

* added update use case to integration test

* Update linode_api4/objects/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* Update linode_api4/objects/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* Update linode_api4/objects/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* Update linode_api4/objects/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* fixed further review comments

* Updated  integration test

* Updated  integration test with more assert statements

* Fix Linode interfaces property (#604)

* Fix test for interfaces (#605)

* Fix test

* changed as per github-advanced-security comments

* fixed formatting errors using python black

* Migrate test fixtures discovery to be with pathlib (#599)

* Migrate test fixtures discovery to be with pathlib

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update linode_api4/objects/monitor.py

Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>

* Fixed Copilot comments on unit and integration tests

* corrected unit test assert statement

* Added comment as per copilot suggestion for save() and delete()

* resolved comments from copilot commented whereever not applicable

* Test: verify automatic GPG signing is working

* Incorporated copilot comments

* Removed serialisabel file from commit

* Fix Lint errors

* fixed review comments fo mutable

* fixed review comments  to keep it in line with SDK guidelines

* Addressed review comments on AlertDefinition class

* Comprehensive monitor API improvements and code quality fixes

- Removed unused imports and optimized import order
- Updated test cases for monitor integration
- Enhanced monitor objects with proper type annotations
- Improved monitor groups with better error handling
- Applied code review feedback and best practices

* Applied review comments across

* Comprehensive monitor API fixes and improvements

- Fixed json_object parameter issues in AlertDefinition properties
- Corrected list type annotations for AlertChannelEnvelope
- Updated integration tests with proper status handling for alert definitions
- Applied review comments for better code quality
- Enhanced type annotations and import organization
- Improved error handling in monitor group methods

* change entity id type as per review comments

* reverted copilot comments as per the suggestion unit and integration test passed after the changes

* removed unused imports

* removed unused imports

* Refactored integration test

* changed _class to alert_class as per review suggestions

* changed alert_class to service_class as per review suggestions

* Update linode_api4/objects/monitor.py

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update linode_api4/groups/monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/integration/models/monitor/test_monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update linode_api4/groups/monitor.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/fixtures/monitor_alert-definitions.json

* Apply suggestion from @zliang-akamai

* Apply suggestion from @zliang-akamai

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Co-authored-by: Zhiwei Liang <zliang@akamai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants