Skip to content

Commit

Permalink
fix pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
pavansokkenagaraj committed Oct 19, 2024
1 parent 6925f4d commit 69441d4
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,25 @@ func (h *V1Client) SearchClusterSummaries(filter *models.V1SearchFilterSpec, sor
Filter: filter,
Sort: sort,
})
resp, err := h.Client.V1SpectroClustersSearchFilterSummary(params)
if apiutil.Is404(err) {
return nil, nil
} else if err != nil {
return nil, err

var clusters []*models.V1SpectroClusterSummary
for {
resp, err := h.Client.V1SpectroClustersSearchFilterSummary(params)
if apiutil.Is404(err) {
return nil, nil
} else if err != nil {
return nil, err
}

clusters = append(clusters, resp.Payload.Items...)
if resp.Payload.Listmeta.Continue == "" {
break
}

params = params.WithContinue(&resp.Payload.Listmeta.Continue)
}
return resp.Payload.Items, nil

return clusters, nil
}

// GetClusterKubeConfig retrieves a cluster's kubeconfig.
Expand Down

0 comments on commit 69441d4

Please sign in to comment.