Skip to content

Commit ccd7d61

Browse files
authored
[CLI-3542] Fix infinite page token loop for confluent kafka quota list (#3083)
1 parent d2facf6 commit ccd7d61

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/ccloudv2/kafka_quotas.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ func (c *Client) ListKafkaQuotas(clusterId, envId string) ([]kafkaquotasv1.Kafka
2929
done := false
3030
pageToken := ""
3131
for !done {
32-
page, httpResp, err := c.listQuotas(clusterId, envId, pageToken)
32+
page, httpResp, err := c.executeListQuotas(clusterId, envId, pageToken)
3333
if err != nil {
3434
return nil, errors.CatchCCloudV2Error(err, httpResp)
3535
}
3636
list = append(list, page.GetData()...)
3737

38-
// nextPageUrlStringNullable is nil for the last page
3938
pageToken, done, err = extractNextPageToken(page.GetMetadata().Next)
4039
if err != nil {
4140
return nil, err
@@ -44,10 +43,10 @@ func (c *Client) ListKafkaQuotas(clusterId, envId string) ([]kafkaquotasv1.Kafka
4443
return list, nil
4544
}
4645

47-
func (c *Client) listQuotas(clusterId, envId, pageToken string) (kafkaquotasv1.KafkaQuotasV1ClientQuotaList, *http.Response, error) {
46+
func (c *Client) executeListQuotas(clusterId, envId, pageToken string) (kafkaquotasv1.KafkaQuotasV1ClientQuotaList, *http.Response, error) {
4847
req := c.KafkaQuotasClient.ClientQuotasKafkaQuotasV1Api.ListKafkaQuotasV1ClientQuotas(c.kafkaQuotasContext()).PageSize(ccloudV2ListPageSize).SpecCluster(clusterId).Environment(envId)
4948
if pageToken != "" {
50-
req.PageToken(pageToken)
49+
req = req.PageToken(pageToken)
5150
}
5251
return req.Execute()
5352
}

0 commit comments

Comments
 (0)