TUN-8281: Run cloudflared query list tunnels/routes endpoint in a paginated way

Before this commit the commands that listed tunnels and tunnel routes would be limited to 1000 results by the server.

Now, the commands will call the endpoints until the result set is exhausted. This can take a long time if there are
thousands of pages available, since each request is executed synchronously.
From a user's perspective, nothing changes.
This commit is contained in:
GoncaloGarcia
2024-03-14 19:51:46 +00:00
parent da6fac4133
commit 86476e6248
6 changed files with 106 additions and 89 deletions

View File

@@ -50,6 +50,10 @@ func (f *TunnelFilter) MaxFetchSize(max uint) {
f.queryParams.Set("per_page", strconv.Itoa(int(max)))
}
func (f *TunnelFilter) Page(page int) {
f.queryParams.Set("page", strconv.Itoa(page))
}
func (f TunnelFilter) encode() string {
return f.queryParams.Encode()
}