Struct: s3manager.DeleteListIterator

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

Overview

DeleteListIterator is an alternative iterator for the BatchDelete client. This will iterate through a list of objects and delete the objects.

Example:

iter := &s3manager.DeleteListIterator{ Client: svc, Input: &s3.ListObjectsInput{ Bucket: aws.String("bucket"), MaxKeys: aws.Int64(5), }, Paginator: request.Pagination{ NewRequest: func() (*request.Request, error) { var inCpy *ListObjectsInput if input != nil { tmp := *input inCpy = &tmp } req, _ := c.ListObjectsRequest(inCpy) return req, nil }, }, } batcher := s3manager.NewBatchDeleteWithClient(svc) if err := batcher.Delete(aws.BackgroundContext(), iter); err != nil { return err }

Implemented Interfaces

s3manager.BatchDeleteIterator, s3crypto.Cipher, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Structure Field Summary collapse

Method Summary collapse

Structure Field Details

Bucket *string

Paginator request.Pagination

Method Details

func (iter *DeleteListIterator) DeleteObject() BatchDeleteObject

DeleteObject will return the current object to be deleted.



186
187
188
189
190
191
192
193
// File 'service/s3/s3manager/batch.go', line 186

func (iter *DeleteListIterator) DeleteObject() BatchDeleteObject { return BatchDeleteObject{ Object: &s3.DeleteObjectInput{ Bucket: iter.Bucket, Key: iter.objects[0].Key, }, } }

func (iter *DeleteListIterator) Err() error

Err will return the last known error from Next.



181
182
183
// File 'service/s3/s3manager/batch.go', line 181

func (iter *DeleteListIterator) Err() error { return iter.Paginator.Err() }

func (iter *DeleteListIterator) Next() bool

Next will use the S3API client to iterate through a list of objects.



168
169
170
171
172
173
174
175
176
177
178
// File 'service/s3/s3manager/batch.go', line 168

func (iter *DeleteListIterator) Next() bool { if len(iter.objects) > 0 { iter.objects = iter.objects[1:] } if len(iter.objects) == 0 && iter.Paginator.Next() { iter.objects = iter.Paginator.Page().(*s3.ListObjectsOutput).Contents } return len(iter.objects) > 0 }