Skip to content

Would be nice to have a NS1.listZones() and/or Zone.list() #68

Open

Description

@nyetwurk

something akin to

    return zones.Zone(self.config, None)._rest.list()

Activity

  1. nyetwurk commented on Jul 22, 2020

    @nyetwurk
    Author

    Perhaps Zone itself can have a list() method that just extracts a list of bare zone['zone']s

  2. changed the title [-]Would be nice to have a api.listZones()[/-] [+]Would be nice to have a NS1.listZones() and/or Zone.list()[/+] on Jul 22, 2020
  3. rupa commented on Jul 23, 2020

    @rupa
    Contributor

    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.

  4. nyetwurk commented on Jul 29, 2020

    @nyetwurk
    Author

    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"])
  5. rupa commented on Jul 30, 2020

    @rupa
    Contributor

    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!

  6. ThiagoYU commented on Oct 6, 2021

    @ThiagoYU
    Contributor

    Hi @nyetwurk @rupa, thanks for this report
    We already created a ticket about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions