linode_api4-python icon indicating copy to clipboard operation
linode_api4-python copied to clipboard

node balancer filter on label

Open muradm opened this issue 4 years ago • 2 comments

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 avatar Dec 27 '20 12:12 muradm

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.

muradm avatar Dec 27 '20 13:12 muradm

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.

Dorthu avatar Jan 04 '21 17:01 Dorthu

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

lgarber-akamai avatar Sep 11 '23 19:09 lgarber-akamai