Skip to content

Commit

Permalink
Merge pull request #225 from HewlettPackard/fix_pagination_issue
Browse files Browse the repository at this point in the history
Pagination issue
  • Loading branch information
reubenur-rahman authored Mar 1, 2024
2 parents 33bf3a2 + 101e2b5 commit 628f4fd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions internal/cmp/cloud_folder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package cmp

Expand Down Expand Up @@ -31,7 +31,8 @@ func (f *cloudFolder) Read(ctx context.Context, d *utils.Data, meta interface{})
if err := d.Error(); err != nil {
return err
}
folders, err := f.fClient.GetAllCloudFolders(ctx, cloudID, nil)
param := map[string]string{maxKey: "2000"} // There could be many folders, and max=-1 doesn't return any data
folders, err := f.fClient.GetAllCloudFolders(ctx, cloudID, param)
if err != nil {
return err
}
Expand Down
5 changes: 3 additions & 2 deletions internal/cmp/group.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package cmp

Expand Down Expand Up @@ -30,7 +30,8 @@ func (g *group) Read(ctx context.Context, d *utils.Data, meta interface{}) error
if err := d.Error(); err != nil {
return err
}
groups, err := g.gClient.GetAllGroups(ctx, nil)
param := map[string]string{maxKey: "-1"}
groups, err := g.gClient.GetAllGroups(ctx, param)
if err != nil {
return err
}
Expand Down
5 changes: 3 additions & 2 deletions internal/cmp/network.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package cmp

Expand Down Expand Up @@ -28,7 +28,8 @@ func (n *network) Read(ctx context.Context, d *utils.Data, meta interface{}) err
if err := d.Error(); err != nil {
return err
}
networks, err := n.nClient.GetAllNetworks(ctx, nil)
param := map[string]string{maxKey: "-1"}
networks, err := n.nClient.GetAllNetworks(ctx, param)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmp/resourcePool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package cmp

Expand Down Expand Up @@ -32,7 +32,7 @@ func (n *resourcePool) Read(ctx context.Context, d *utils.Data, meta interface{}

flag := false
resourcePools, err := n.rClient.GetAllCloudResourcePools(ctx, cloudID, map[string]string{
maxKey: "100",
maxKey: "-1",
})
if err != nil {
return err
Expand Down
5 changes: 3 additions & 2 deletions internal/cmp/router_datasource.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package cmp

Expand Down Expand Up @@ -29,7 +29,8 @@ func (n *routerds) Read(ctx context.Context, d *utils.Data, meta interface{}) er
if err := d.Error(); err != nil {
return err
}
routers, err := n.nClient.GetAllRouter(ctx, nil)
param := map[string]string{maxKey: "-1"}
routers, err := n.nClient.GetAllRouter(ctx, param)
if err != nil {
return err
}
Expand Down

0 comments on commit 628f4fd

Please sign in to comment.