TUN-5361: Commands for managing virtual networks

This commit is contained in:
Nuno Diegues
2021-11-26 12:37:54 +00:00
parent 6cc7d99e32
commit eec6b87eea
12 changed files with 664 additions and 9 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"net"
"net/url"
"strconv"
"time"
"github.com/google/uuid"
@@ -86,6 +87,10 @@ func NewFromCLI(c *cli.Context) (*Filter, error) {
f.tunnelID(u)
}
if maxFetch := c.Int("max-fetch-size"); maxFetch > 0 {
f.MaxFetchSize(uint(maxFetch))
}
return f, nil
}
@@ -133,6 +138,10 @@ func (f *Filter) tunnelID(id uuid.UUID) {
f.queryParams.Set("tunnel_id", id.String())
}
func (f *Filter) MaxFetchSize(max uint) {
f.queryParams.Set("per_page", strconv.Itoa(int(max)))
}
func (f Filter) Encode() string {
return f.queryParams.Encode()
}