linode / linode_api4-python

Official Python bindings for the Linode API
https://linode-api4.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
136 stars 74 forks source link

node balancer filter on label #186

Closed muradm closed 1 year ago

muradm commented 3 years ago

Please, add filtering of NodeBalancers based on label. All objects are findable using label:

client = ...
instance = client.linode.instances(Instance.label = 'some-label')

However, NodeBalancer does not, it has only filterable property region. For them, either its id should be known in advance or this should be done:

client = ...
for balancer in client.nodebalancers():
    if balancer.label == label:
        return balancer
muradm commented 3 years ago

Actually it works, although NodeBalancer does not declare it as filterable: https://github.com/linode/linode_api4-python/blob/d83e5c6774e2cccd6a46d802081ac55842f583eb/linode_api4/objects/nodebalancer.py#L131 Until it works its ok for me :) issue can be closed, or tracked if above line is actually issue.

Dorthu commented 3 years ago

This library allows you to filter by any attribute; if you attempt to do so with an attribute that isn't filterable, the API will return an error that this library will wrap. Declaring specific fields as filterable is deprecated, and I should really remove it from everything to avoid confusion. I'm going to use this issue to track that effort.

lgarber-akamai commented 1 year ago

Closing this issue since it appears to be resolved. Feel free to @ me if this issue is still relevant 🙂