Struct: s3.ListBucketsPaginator

import "../ibm-cos-sdk-go-v2/service/s3"

Overview

ListBucketsPaginator is a paginator for ListBuckets

Implemented Interfaces

types.AnalyticsFilter, v4.HTTPPresigner, s3.HTTPPresignerV4, types.MetricsFilter, s3.PresignPost, arn.S3ObjectLambdaARN, types.SelectObjectContentEventStream

Method Summary collapse

Method Details

func (p *ListBucketsPaginator) HasMorePages() bool

HasMorePages returns a boolean indicating whether more pages are available



282
283
284
// File 'service/s3/api_op_ListBuckets.go', line 282

func (p *ListBucketsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) }

func (p *ListBucketsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListBucketsOutput, error)

NextPage retrieves the next ListBuckets page.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
// File 'service/s3/api_op_ListBuckets.go', line 287

func (p *ListBucketsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListBucketsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.ContinuationToken = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxBuckets = limit optFns = append([]func(*Options){ addIsPaginatorUserAgent, }, optFns...) result, err := p.client.ListBuckets(ctx, ¶ms, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.ContinuationToken if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil }