-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
Description
The current resources and data sources that fetch a list of entities currently use a large page size and sometimes have a note like this:
// TODO: It would be preferable to us the client.Images.ListAllPages method instead.
// Unfortunately, currently that method has a bug where it returns twice as many results
// as there are in reality. For now I'll use the List method with a limit of 1,000,000,000 results.
// Seems unlikely anyone will have more than one billion images.
Testing the SDK, I found that this bug was fixed on commit https://github.com/oxidecomputer/oxide.go/tree/e5aaa35f6fb3d2d3dc46a336f12b9dd62fc9ffb3, so we should now able to use the ListAllPages methods instead of requesting a single page with Limit set to oxide.NewPointer(1000000000).
Examples of where this pattern is found:
terraform-provider-oxide/internal/provider/resource_instance.go
Lines 920 to 923 in 536e0dd
| params := oxide.InstanceDiskListParams{ | |
| Limit: oxide.NewPointer(1000000000), | |
| Instance: oxide.NameOrId(instanceID), | |
| } |
terraform-provider-oxide/internal/provider/data_source_images.go
Lines 161 to 169 in 536e0dd
| // TODO: It would be preferable to us the client.Images.ListAllPages method instead. | |
| // Unfortunately, currently that method has a bug where it returns twice as many results | |
| // as there are in reality. For now I'll use the List method with a limit of 1,000,000,000 results. | |
| // Seems unlikely anyone will have more than one billion images. | |
| params := oxide.ImageListParams{ | |
| Project: oxide.NameOrId(state.ProjectID.ValueString()), | |
| Limit: oxide.NewPointer(1000000000), | |
| SortBy: oxide.NameOrIdSortModeIdAscending, | |
| } |
Reactions are currently unavailable