Closed Praveen005 closed 3 weeks ago
Hi @uzaxirr
Following changes are needed to solve the issue civo/cli-#451
I have updated the url like below:
I have a question, in FindObjectStoreCredential
, when querying paginated responses, is it better to retrieve all pages in a loop like this:
var creds []ObjectStoreCredential
page := 1
perPage := 100
for {
paginatedCreds, err := c.ListObjectStoreCredentials(page, perPage)
if err != nil {
return nil, decodeError(err)
}
creds = append(creds, paginatedCreds.Items...)
if page >= paginatedCreds.Pages {
break
}
page++
}
Or should I simply use a large perPage
value to fetch the complete result in one request, like this:
ListObjectStoreCredentials(1, 1000)
I noticed a similar case being handled like this:
instances, err := c.ListInstances(1, 99999999)
I am inclined toward the first approach, I feel having a large perPage
value can potentially hog the server.
hii @Praveen005 i would prefer you to use the second approach which is ListObjectStoreCredentials(1, 1000)
looping is not which i ideally want here.
Or a much much better option would be if we can allow sending page number and page size in the SDK function call itself. and the same can be sent via CLI as well.
Description
Currently, the
ListObjectStoreCredentials
method incivogo
retrieves only the first page of bucket credentials due to the request URL not including a configurable page number. This restricts users to only the first 20 credentials (defaultperPage
value) without an option to access additional pages.