Skip to content

Commit

Permalink
fix: static resource list commands only return first 50 entries (#592)
Browse files Browse the repository at this point in the history
The list commands for datacenters, load balancer types, locations and
server types uses ``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
  • Loading branch information
phm07 committed Oct 31, 2023
1 parent 0e0eaa8 commit 7e511d9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/datacenter/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/loadbalancertype/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/location/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/servertype/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7e511d9

Please sign in to comment.