oracle / oci-go-sdk

Go SDK for Oracle Cloud Infrastructure
https://cloud.oracle.com/cloud-infrastructure
Other
177 stars 82 forks source link

ListExternalContainerDatabases is not returning list of all databases in that region #458

Closed ankurnigam closed 1 year ago

ankurnigam commented 1 year ago

Hi Team,

I need to get list of all external databases but it seems it's not working. Is there is any limit to fetch the databases , if yes, could you please let me know how I can fetch all databases , there are approx 2K external database register.

jyotisaini commented 1 year ago

Hi @ankurnigam this is a paginated API. Not all the records are returned in one go. Plase iterate over the response to fetch next pages.

ankurnigam commented 1 year ago

Thanks Jyoti !!! It worked , here is the sample code for the audience for future :

`for { listResponse, err := dbclient.ListExternalContainerDatabases(ctx, listRequest) if err != nil { log.Errorf("failed to get list of registered DB %s", err) return } for _, db := range listResponse.Items {

        }
    if listResponse.OpcNextPage == nil {
        break
    }

    listRequest.Page = listResponse.OpcNextPage
}`
ankurnigam commented 1 year ago

Worked.