summaryrefslogtreecommitdiff
path: root/aws.go
diff options
context:
space:
mode:
Diffstat (limited to 'aws.go')
-rw-r--r--aws.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/aws.go b/aws.go
index f5ac338..6f7d385 100644
--- a/aws.go
+++ b/aws.go
@@ -274,6 +274,21 @@ func (a *AwsConn) ListObjectsWithMeta(bucket string, prefix string) ([]ObjMeta,
return objs, err
}
+func (a *AwsConn) ListObjectPrefixes(bucket string) ([]string, error) {
+ var prefixes []string
+ err := a.s3svc.ListObjectsV2Pages(&s3.ListObjectsV2Input{
+ Bucket: aws.String(bucket),
+ Delimiter: aws.String("/"),
+ MaxKeys: aws.Int64(1),
+ }, func(page *s3.ListObjectsV2Output, last bool) bool {
+ for _, r := range page.CommonPrefixes {
+ prefixes = append(prefixes, *r.Prefix)
+ }
+ return true
+ })
+ return prefixes, err
+}
+
func (a *AwsConn) AddToQueue(url string, msg string) error {
_, err := a.sqssvc.SendMessage(&sqs.SendMessageInput{
MessageBody: &msg,