Skip to content

Commit

Permalink
account for an s3 folder when listing objects (#3807) (#3812)
Browse files Browse the repository at this point in the history
* account for an s3 folder when listing objects
  • Loading branch information
briandowns authored Aug 10, 2021
1 parent 12ec437 commit 18bc38d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,15 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]Snapsho
return nil, err
}

objects := e.s3.client.ListObjects(ctx, e.config.EtcdS3BucketName, minio.ListObjectsOptions{})
var loo minio.ListObjectsOptions
if e.config.EtcdS3Folder != "" {
loo = minio.ListObjectsOptions{
Prefix: e.config.EtcdS3Folder,
Recursive: true,
}
}

objects := e.s3.client.ListObjects(ctx, e.config.EtcdS3BucketName, loo)

for obj := range objects {
if obj.Err != nil {
Expand Down

0 comments on commit 18bc38d

Please sign in to comment.