Skip to content

Commit

Permalink
Handle pagination for IoTCertificates
Browse files Browse the repository at this point in the history
fix #831
  • Loading branch information
ccatterina committed Aug 27, 2022
1 parent fe7fb59 commit 18b226f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions resources/iot-certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,23 @@ func ListIoTCertificates(sess *session.Session) ([]Resource, error) {

params := &iot.ListCertificatesInput{}

output, err := svc.ListCertificates(params)
if err != nil {
return nil, err
}
for {
output, err := svc.ListCertificates(params)
if err != nil {
return nil, err
}

for _, certificate := range output.Certificates {
resources = append(resources, &IoTCertificate{
svc: svc,
ID: certificate.CertificateId,
})
}
if output.NextMarker == nil {
break
}

for _, certificate := range output.Certificates {
resources = append(resources, &IoTCertificate{
svc: svc,
ID: certificate.CertificateId,
})
params.Marker = output.NextMarker
}

return resources, nil
Expand Down

0 comments on commit 18b226f

Please sign in to comment.