Would be nice to have a NS1.listZones() and/or Zone.list()
something akin to
return zones.Zone(self.config, None)._rest.list()
Perhaps Zone itself can have a list() method that just extracts a list of bare zone['zone']s
huh, definitely fair to want easier access to list, seems like an oversight.
I don't think I'd want it on Zone objects, as it's higher scope, but I think a listZones method on the client is appropriate. I'll see if i can whip up a PR.
this code more or less works for me (from an api client, not an api patch)
data = zones.Zone(api.config, None)._rest.list()
print("known zones:")
for z in data:
print(z["zone"])
yep, that works, but it's not really the way we envisioned its use. usually we access this via the "rest layer"
zones = client.zones()
zones.list()
for the "high-level" interface, I still believe that a listZones function is appropriate - my suspicion is that it hasn't been implemented as it should return Zone objects, and loading all of those zones would take N API calls. I would not want that happening if i had thousands of zones in my list!
what I'd like to do, and proposed, is to make listZones return a list of mostly empty Zone objects, and you would have to make a call to "load" the ones you want. That would need a bit of docs/comments explaining it, and i worry a bit if it would be more confusing than useful, but I'm inclined to add it. it's definitely on the radar!
Hi @nyetwurk @rupa, thanks for this report We already created a ticket about this.