Skip to content

Commit

Permalink
PQA-1860: get edge hosts using continue token (#110)
Browse files Browse the repository at this point in the history
* get edge hosts using continue token

* Update cluster_edge_native.go
  • Loading branch information
MGamya authored Jun 6, 2024
1 parent 92d0dd2 commit cfbbb09
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions client/cluster_edge_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ func (h *V1Client) GetEdgeHost(edgeHostId string) (*models.V1EdgeHostDevice, err
}

func (h *V1Client) ListEdgeHosts() ([]*models.V1EdgeHostsMetadata, error) {
params := clientV1.NewV1DashboardEdgehostsSearchParamsWithContext(h.ctx)
resp, err := h.Client.V1DashboardEdgehostsSearch(params)
if err != nil {
return nil, err
continueToken := ""
var items []*models.V1EdgeHostsMetadata
for ok := true; ok; ok = (continueToken != "") {
params := clientV1.NewV1DashboardEdgehostsSearchParamsWithContext(h.ctx)
resp, err := h.Client.V1DashboardEdgehostsSearch(params)
if err != nil {
return nil, err
}
continueToken = resp.Payload.Listmeta.Continue
items = append(items, resp.Payload.Items...)
}
return resp.Payload.Items, nil

return items, nil
}

func (h *V1Client) CreateClusterEdgeNative(cluster *models.V1SpectroEdgeNativeClusterEntity) (string, error) {
Expand Down

0 comments on commit cfbbb09

Please sign in to comment.