diff options
author | Nick White <git@njw.name> | 2020-12-14 17:08:14 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-12-14 17:08:14 +0000 |
commit | 9147e57a3a634ad303e8f1e7c456988996d5c75b (patch) | |
tree | 026e914ecce14c8cfdb7539eb71c36388b77cd03 /aws.go | |
parent | 452d3d2b6023eb245cb0586954a5fb510df567e1 (diff) |
Add rmbook tool
Diffstat (limited to 'aws.go')
-rw-r--r-- | aws.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -379,6 +379,23 @@ func (a *AwsConn) ListObjectPrefixes(bucket string) ([]string, error) { return prefixes, err } +// Deletes a list of objects +func (a *AwsConn) DeleteObjects(bucket string, keys []string) error { + objs := []*s3.ObjectIdentifier{} + for _, v := range keys { + o := s3.ObjectIdentifier{Key: aws.String(v)} + objs = append(objs, &o) + } + _, err := a.s3svc.DeleteObjects(&s3.DeleteObjectsInput{ + Bucket: aws.String(bucket), + Delete: &s3.Delete{ + Objects: objs, + Quiet: aws.Bool(true), + }, + }) + return err +} + // CreateBucket creates a new S3 bucket func (a *AwsConn) CreateBucket(name string) error { _, err := a.s3svc.CreateBucket(&s3.CreateBucketInput{ |