@@ -228,21 +228,23 @@ func (me *CbsService) DescribeSnapshotById(ctx context.Context, snapshotId strin
228228}
229229
230230func (me * CbsService ) DescribeSnapshotByIds (ctx context.Context , snapshotIdsParam []* string ) (snapshots []* cbs.Snapshot , errRet error ) {
231- logId := getLogId (ctx )
232- request := cbs .NewDescribeSnapshotsRequest ()
233231 if len (snapshotIdsParam ) == 0 {
234232 return
235233 }
234+
235+ var (
236+ logId = getLogId (ctx )
237+ request = cbs .NewDescribeSnapshotsRequest ()
238+ err error
239+ response * cbs.DescribeSnapshotsResponse
240+ offset , pageSize uint64 = 0 , 100
241+ )
236242 request .SnapshotIds = snapshotIdsParam
237243
238- offset := 0
239- pageSize := 100
240244 for {
241- request .Offset = helper . IntUint64 ( offset )
242- request .Limit = helper . IntUint64 ( pageSize )
245+ request .Offset = & offset
246+ request .Limit = & pageSize
243247
244- var err error
245- var response * cbs.DescribeSnapshotsResponse
246248 err = resource .Retry (readRetryTimeout , func () * resource.RetryError {
247249 ratelimit .Check (request .GetAction ())
248250 response , err = me .client .UseCbsClient ().DescribeSnapshots (request )
@@ -263,7 +265,7 @@ func (me *CbsService) DescribeSnapshotByIds(ctx context.Context, snapshotIdsPara
263265 }
264266
265267 snapshots = append (snapshots , response .Response .SnapshotSet ... )
266- if len (response .Response .SnapshotSet ) < pageSize {
268+ if len (response .Response .SnapshotSet ) < int ( pageSize ) {
267269 break
268270 }
269271 offset += pageSize
0 commit comments