cloudflare-go icon indicating copy to clipboard operation
cloudflare-go copied to clipboard

No pagination options for ListOriginCertificates

Open Demonsthere opened this issue 1 year ago • 2 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

0.80.0 and 0.86.0

Go environment

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/whoami/Library/Caches/go-build'
GOENV='/Users/whoami/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/whoami/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/whoami/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/opt/go/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/whoami/github/ory/cloud/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/cb/tjw9rzkd0y95s9xwkm4gfwlw0000gq/T/go-build195787705=/tmp/go-build -gno-record-gcc-switches -fno-common'

Expected output

When calling ListOriginCACertificates I would prefer to be able to get a list of all certificates, or be able to go page-by-page.

Actual output

When calling ListOriginCACertificates there is no option to add pagination options, which results in only getting 20 results from the API. The ListParams only supports zoneID

Code demonstrating the issue

# client is a wrapper for cloudflare.API
certs, err := client.API.ListOriginCACertificates(ctx, cloudflare.ListOriginCertificatesParams{ZoneID: client.ZoneID})
if err != nil {
    cmd.PrintErrf("Could not list certificates: %v\n", err)
    return err
}
cmd.Printf("Certs: %d", len(certs))

Steps to reproduce

  1. Create some sample certs (+20)
  2. List them in the API
  3. Only get first 20 results

References

No response

Demonsthere avatar Jan 17 '24 11:01 Demonsthere

Pagination options are also missing for ListCertificatePacks cf: https://github.com/cloudflare/cloudflare-go/blob/a410c28b480f97defd30372eb6ef4f91121170e2/certificate_packs.go#L78

PascalBourdier avatar Oct 11 '24 07:10 PascalBourdier

Bump, as this is stil missing...

Demonsthere avatar Mar 07 '25 12:03 Demonsthere

@Demonsthere Have you verified this on a recent version of the SDK? We're happy to investigate if so. Thanks!

jhutchings1 avatar Apr 28 '25 21:04 jhutchings1

I saw that pagination exists for the v4 version of the library, but not the 0.1xx. Not sure if that by design or mistake :)

Demonsthere avatar May 16 '25 08:05 Demonsthere

@Demonsthere We're not maintaining the 0.x versions of the library anymore. Would encourage you to update to a more recent version of the SDK. 4.5 should be dropping today. Thanks!

jhutchings1 avatar Jun 16 '25 21:06 jhutchings1