equinix / equinix-sdk-go

Golang client for Equinix APIs
https://deploy.equinix.com/labs/equinix-sdk-go
MIT License
2 stars 6 forks source link

[Metal] pagination should offer early escape criteria #13

Open displague opened 9 months ago

displague commented 9 months ago

When using client-side filtering against a paginated resource list, the pagination helpers could accept criteria functions to determine if pagination can be concluded early.

If there are 1000 devices that I need to sift through to find the one with a particular set of tags (https://github.com/kubernetes-sigs/cluster-api-provider-packet/issues/630), I should be able to take advantage of pagination helpers and not request 100 pages of data if my single desired matching result was found on page 1.

See related packngo issue https://github.com/packethost/packngo/issues/206

ctreatma commented 9 months ago

In the event that a user doesn't want the automatic pagination provided by ExecuteWithPagination, they always have the option of using the Execute method instead and navigating the pages as they see fit.