Skip to content

Commit

Permalink
Handle pagination for IoTCertificates (#844)
Browse files Browse the repository at this point in the history
Closes #831
  • Loading branch information
ccatterina committed Sep 5, 2022
1 parent fe7fb59 commit c4685d3
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 c4685d3

Please sign in to comment.