aboutsummaryrefslogtreecommitdiff
path: root/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'container.go')
-rw-r--r--container.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/container.go b/container.go
index f075d15..1e30eff 100644
--- a/container.go
+++ b/container.go
@@ -175,3 +175,25 @@ func (c *Container) EnsureExists() (*Container, error) {
}.Do(c.a.client)
return c, err
}
+
+//Objects returns an ObjectIterator that lists the objects in this
+//container. The most common use case is:
+//
+// objects, err := container.Objects().Collect()
+//
+//You can extend this by configuring the iterator before collecting the results:
+//
+// iter := container.Objects()
+// iter.Prefix = "test-"
+// objects, err := iter.Collect()
+//
+//Or you can use a different iteration method:
+//
+// err := container.Objects().ForeachDetailed(func (info ObjectInfo) error {
+// log.Printf("object %s is %d bytes large!\n",
+// info.Object.Name(), info.SizeBytes)
+// })
+//
+func (c *Container) Objects() *ObjectIterator {
+ return &ObjectIterator{Container: c}
+}