From 418656a37a8d0ddaaf2404fdce1f67a4e7165bd1 Mon Sep 17 00:00:00 2001 From: pauhull Date: Tue, 31 Oct 2023 09:22:37 +0100 Subject: [PATCH] fix: static resource list commands only return first 50 entries The list commands for datacenters, load balancer types, locations and server types used List() instead of AllWithOpts() to fetch resources. List() only returns a single page of resources at a time (50 entries in this case), while AllWithOpts() returns all of them. This does not make a difference at the moment, but could be a problem in the future. Similar to #574 --- internal/cmd/datacenter/list.go | 2 +- internal/cmd/loadbalancertype/list.go | 2 +- internal/cmd/location/list.go | 2 +- internal/cmd/servertype/list.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cmd/datacenter/list.go b/internal/cmd/datacenter/list.go index aae25e19..4b3bc7ed 100644 --- a/internal/cmd/datacenter/list.go +++ b/internal/cmd/datacenter/list.go @@ -23,7 +23,7 @@ var ListCmd = base.ListCmd{ if len(sorts) > 0 { opts.Sort = sorts } - datacenters, _, err := client.Datacenter().List(ctx, opts) + datacenters, err := client.Datacenter().AllWithOpts(ctx, opts) var resources []interface{} for _, n := range datacenters { resources = append(resources, n) diff --git a/internal/cmd/loadbalancertype/list.go b/internal/cmd/loadbalancertype/list.go index 50ae0e1e..1eaf7dbc 100644 --- a/internal/cmd/loadbalancertype/list.go +++ b/internal/cmd/loadbalancertype/list.go @@ -24,7 +24,7 @@ var ListCmd = base.ListCmd{ if len(sorts) > 0 { opts.Sort = sorts } - loadBalancerTypes, _, err := client.LoadBalancerType().List(ctx, opts) + loadBalancerTypes, err := client.LoadBalancerType().AllWithOpts(ctx, opts) var resources []interface{} for _, r := range loadBalancerTypes { diff --git a/internal/cmd/location/list.go b/internal/cmd/location/list.go index 61c6b508..87369a82 100644 --- a/internal/cmd/location/list.go +++ b/internal/cmd/location/list.go @@ -23,7 +23,7 @@ var ListCmd = base.ListCmd{ if len(sorts) > 0 { opts.Sort = sorts } - locations, _, err := client.Location().List(ctx, opts) + locations, err := client.Location().AllWithOpts(ctx, opts) var resources []interface{} for _, n := range locations { diff --git a/internal/cmd/servertype/list.go b/internal/cmd/servertype/list.go index 862fc4c3..4330660f 100644 --- a/internal/cmd/servertype/list.go +++ b/internal/cmd/servertype/list.go @@ -25,7 +25,7 @@ var ListCmd = base.ListCmd{ if len(sorts) > 0 { opts.Sort = sorts } - servers, _, err := client.ServerType().List(ctx, opts) + servers, err := client.ServerType().AllWithOpts(ctx, opts) var resources []interface{} for _, r := range servers {